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

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

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 475 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 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
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

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

          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.

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