Matrix Identity



  • On 18/06/2014 at 14:42, xxxxxxxx wrote:

    In Blender I can do the following to check if an object has been transformed:

    ident_matrix = Matrix.Identity(4)
    obj_moved = obj.matrix_world != ident_matrix
    

    I don't see any matrix identity functions in C4D.
    Am I missing something?

    If there isn't, what is the best way to check if an object has been transformed?

    Thanks,

    Chris



  • On 21/06/2014 at 13:32, xxxxxxxx wrote:

    Couldn't find anything, so I guess you have to roll your own:

    def CheckIdentity(op) :
        matrix = op.GetMg()
        
        if matrix.off == c4d.Vector(0,0,0) and \n       matrix.v1 == c4d.Vector(1,0,0) and \n       matrix.v2 == c4d.Vector(0,1,0) and \n       matrix.v3 == c4d.Vector(0,0,1) :
           
            return True
      
        else:
            return False
    

    This does the trick.



  • On 21/06/2014 at 15:52, xxxxxxxx wrote:

    This does what I wanted, and is the simplest answer:

    obj.GetMg() == Matrix()
    

    The function above could be used to check for a particular transformation, but it is overkill for this.


Log in to reply