3
$\begingroup$

I am a very basic blender user, I need to know if there is a add-on or a built in function that could export selected objects model transformation matrix (the matrix that contains the models scaling, rotation and translation information).

Thanks!

$\endgroup$
  • $\begingroup$ What do you mean by export? To where or in what format? This would be a pretty easy thing to do using a python script, but you need to be more specific about how you need the matrix to be represented and exported. $\endgroup$ – TLousky Sep 28 '15 at 20:38
  • $\begingroup$ For example a text file, any format would be fine. $\endgroup$ – VOid Sep 28 '15 at 20:48
1
$\begingroup$

Alrighty, then this script creates a text file with the transform matrix [see answer here to understand blender's transform matrix format] of the active object as it is represented in blender. Just copy and paste it into a text editor window in Blender, save your blendfile where you want your text file to be created, and run the script:

import bpy
from os.path import dirname, join

if bpy.context.object and bpy.data.filepath:
    fname = bpy.context.object.name + ".matrix"
    fpath = join( dirname( bpy.data.filepath ),  fname )

    f = open( fpath, "w" )
    f.write( str( bpy.context.object.matrix_world ) )
    f.close()

Example:

For this transformed cube with the following transform values: Example

You get this result in the generated textfile:

<Matrix 4x4 ( 0.6416, 0.2411,  0.7263, -0.8912)
            (-0.8174, 0.1801, -1.0416, -2.1409)
            (-0.8864, 0.0084,  1.4863,  3.1665)
            ( 0.0000, 0.0000,  0.0000,  1.0000)>
$\endgroup$
0
$\begingroup$

There is this Blender add-on, that allows you to extract transformation matrices from objects and write them on disc.

It also allows you to apply transformation matrices to object - for instance by loading them from disc.

Here is a screen shot of the GUI elements added by the add-on. enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.