Plugin doesn't work if child has tag(tex,dynamics,



  • On 17/12/2017 at 15:25, xxxxxxxx wrote:

    I have a test plugin that simply extrudes all polygons from its child object. 
    It's working without any problems when the child object has a phong tag or most of the other tags, but seems like certain tags can't be used with it. For example, if I attempt to assign dynamics tag, texture tag, Compositing tag ... it stops working.
    I can't see any error messages in the console.

    Which part of this code should I change in order to bypass this issue?

    Thanks. :)

    1. def GetVirtualObjects(self, op, hh) :
    2. #Check child Object
    3. child = op.GetDown()
    4. if not child: return None
    5. #Create clone
    6. cloneGenerator = op.GetAndCheckHierarchyClone(hh, child, c4d.HIERARCHYCLONEFLAGS_ASPOLY, False)
    7. dirty = cloneGenerator["dirty"]
    8. clone = cloneGenerator["clone"]
    9. children = clone.GetChildren()
    10. if not dirty:
    11. return clone
    12. #Crete Connect Generator
    13. connect = c4d.BaseObject(1011010)
    14. connect[c4d.CONNECTOBJECT_WELD] = False
    15. clone.InsertUnder(connect)
    16. #Make Editable
    17. res1 = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,
    18. list     = [connect],
    19. doc      = child.GetDocument())[0]
    20. #Extrude all polygons
    21. settings = c4d.BaseContainer()
    22. settings[c4d.MDATA_EXTRUDE_OFFSET] = op[10000]
    23. res = c4d.utils.SendModelingCommand (command = c4d.ID_MODELING_EXTRUDE_TOOL,
    24. list    = [res1],
    25. mode    = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,
    26. bc      = settings,
    27. doc     = child.GetDocument())
    28. #Return Result
    29. return res1


  • On 19/12/2017 at 08:17, xxxxxxxx wrote:

    I had similar issues running the CURRENTSTATETOOBJECT-command.
    If I remember correctly, depending on the tags it returns a null-object with the converted object underneath. So you'll need to check if res1 is a null-object and if so if "res1.GetDown()" returns a polygonal object.

    Phil



  • On 19/12/2017 at 09:13, xxxxxxxx wrote:

    Hi,

    I confirm the behavior outlined by Phil.
    Current State to Object command keeps objects with hierarchical tags and inserts these under a null object that is returned, instead of just a polygon object.


Log in to reply