Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Matrix Identity

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 321 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post