Inverse matrix

(klopes) #1

Hi all!, I’m Klópes, an old user of Blender but new on the forum. I’m not a guru in python, but i move a little… copy&paste is great! :wink: Now, it’s my question: How can I see (is there any way…?) a list of all the objects which contains another one? I.e., if “ob” is an object of “Object” type, I can write ob.loc, ob.rot, ob.size, and so on… How many more?

My particular problem is getting the transformation inverse matrix of an object, I remember there’s something like ob.matrix, but returning the inverse. Isn’t it?

Thank you

(jms) #2
print dir(ob)

With module Blender, there is an “ob.inverse” but it seems that it is just a name in the list, not a “real” object.


(aayers) #3


Here are the available option for ob if you’re using Blender 2.23

>>>print dir(ob)
[‘EffX’, ‘EffY’, ‘EffZ’, ‘Layer’, ‘LocX’, ‘LocY’, ‘LocZ’, ‘RotX’, ‘RotY’, ‘RotZ’, ‘SizeX’, ‘SizeY’, ‘SizeZ’, ‘clone’, ‘dLocX’, ‘dLocY’, ‘dLocZ’, ‘dRotX’, ‘dRotY’, ‘dRotZ’, ‘dSizeX’, ‘dSizeY’, ‘dSizeZ’, ‘data’, ‘dloc’, ‘drot’, ‘dsize’, ‘inverse’, ‘ipo’, ‘loc’, ‘makeParent’, ‘mat’, ‘matrix’, ‘parent’, ‘rot’, ‘size’, ‘track’]

I don’t believe ob.matrix returns an inverse matrix. It’s 4x4 matrix brokendown as such,

[ [3x3 rotation matrix], [3x1 position matrix] ;
[1x3 scale matrix], [1] ]

I think this is right.


(eeshlo) #4

If you use Blender2.23 or earlier you can still use the Blender210 module, which does have the inverse matrix:

import Blender210

ob = Blender210.getObject(object_name)
inverse_matrix = ob.inverseMatrix


import Blender

ob = Blender.Object.get(object_name)
inverse_matrix = ob.getInversematrix()

(klopes) #5

For some reason, I couldn’t use the ‘dir’ function with an entity like ‘ob’… Maybe I wrote it bad, or I might be drunk… :o

Well, I mean the inverse object. I remember having red somewhere about inverse returned the inverse matrix, but, as JMSoler said, never ran. It’s time to work handly… buf! :x

Thanks everyone.

(klopes) #6

Wow, eeshlo, I’ve just post my messge and your one appears! I’ve tested the two ways and the fist one runs ok! under 2.23

But getInversematrix() isn’t recognised, indeed it’s not appear in the attribute list of such ob. :frowning:

Thanks again

(eeshlo) #7

That is because that function is in Publisher only, that is, Blender version’s 2.24 or 2.25