resolve an instance object [SOLVED]



  • 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



  • 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)
    


  • 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



  • 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



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

    Thanks a lot.
    It solved my Problem.
    Ronald


Log in to reply