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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to Determine if an Object Supports Effectors?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 272 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 01/08/2016 at 11:37, xxxxxxxx wrote:

      Hi,

      What is the best practice to check to see if an object is a MoGraph object and supports effectors? I'm currently manually building a list of object ID's and checking against that.

        
      def is_cloner(obj) :   
          CLONER_IDS = [   
              1018544, # Cloner   
              1018545, # Matrix   
              1018791, # Fracture   
              1018957, # MoInstance   
              1019268, # MoText   
              1018655, # Tracer   
              440000054 # MoSpline   
          ]   
             
          if obj.GetType() in CLONER_IDS:   
              return True   
             
          return False   
      

      This works fine until a new cloner object is introduced (like the new Voronoi Fracture), at which point my plugin doesn't behave as expected and I have to add the new ID and push out an update to all users. Is there a method in the mograph module for checking this?
      Thanks,

      Donovan

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

        On 02/08/2016 at 02:26, xxxxxxxx wrote:

        Hi Donovan,

        all these objects are an instance of Obasemogen. Just note, this is also true for the PolyFX, but as it takes effectors as well, it's probably even a desired side effect.

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

          On 02/08/2016 at 14:38, xxxxxxxx wrote:

          Perfect. Thank you!

            
          """Is it a MoGraph Generator?   
          """   
            
          import c4d   
          from c4d import gui   
          #Welcome to the world of Python   
            
            
          def main() :   
              if not op:   
                  return   
                 
              if op.IsInstanceOf(c4d.Obasemogen) :   
                  print op.GetName() + " is a MoGraph Generator!"   
              else:   
                  print op.GetName() + "is not a MoGraph Generator."   
            
          if __name__=='__main__':   
              main()   
          

          It seems like "Obasemogen" isn't documented in the Python SDK, so I'd suggest adding it.
          Thanks!

          Donovan

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