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

    resolve an instance object [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 459 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 19/02/2015 at 13:43, xxxxxxxx wrote:

      Hi all,

      I try to apply the command "current state to object" to an Instance so that it is a new polygon-object.
      But something is going wrong :-(((

      Can anybody give me an advice how to convert an Instance please.

        
        
      def resolve_all_Instance_Objects(doc) :   
          doc.SetActiveObject(None)   
          obj = doc.GetFirstObject()   
          instance_list = []   
          while obj:   
              if obj.CheckType(c4d.Oinstance) :   
                  print 'Instanobjekt gefunden'   
                  instance_list.append(obj)   
                
              obj = walk(obj)   
             
          print instance_list   
             
          for obj in instance_list:   
              settings = c4d.BaseContainer()   
              settings.SetBool(c4d.MDATA_CURRENTSTATETOOBJECT_INHERITANCE, True)   
              settings.SetBool(c4d.MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION, True)   
              settings.SetBool(c4d.MDATA_CURRENTSTATETOOBJECT_NOGENERATE, True)   
              new_object = c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [obj.GetClone()], bc=settings, doc=doc)   
              #obj.remove()   
              doc.InsertObject(new_object[0])   
              print 'new_object'   
        
      

      thanks a lot to all

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

        On 19/02/2015 at 15:07, xxxxxxxx wrote:

        Hi,

        the no generator flag needs to be set to False. 
        Best wishes
        Martin

        settings.SetBool(c4d.MDATA_CURRENTSTATETOOBJECT_NOGENERATE, False)
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 20/02/2015 at 01:13, xxxxxxxx wrote:

          Thanks to you.
          It works.

          But another problem grows up.

          The instances are set as c4d.INSTANCEOBJECT_RENDERINSTANCE=True
          But I have to set them to c4d.INSTANCEOBJECT_RENDERINSTANCE=False

          I did a look to the SDK but didn't find anything about INSTANCEOBJECT_RENDERINSTANCE.

          So I think it is a general thing who to set a Value in BaseObject !?!

          So Question: Whow can I set the value to False?
          Thanks a lot

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

            On 20/02/2015 at 02:03, xxxxxxxx wrote:

            I´m glad I could help.
            The next problem....
            like almost every attribute an object has.

              
              obj[c4d.INSTANCEOBJECT_RENDERINSTANCE] = False  
            

            or the other way like

              
              data = op.GetDataInstance()  
              data.SetBool(c4d.INSTANCEOBJECT_RENDERINSTANCE, False)  
            

            Best wishes
            Maritn

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

              On 20/02/2015 at 03:47, xxxxxxxx wrote:

              Thanks a lot.
              It solved my Problem.
              Ronald

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