Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Behaviour of MCOMMAND_JOIN diffrnt in R18 [SOLVED]

    PYTHON Development
    0
    3
    773
    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
      Helper
      last edited by

      On 21/06/2017 at 06:19, xxxxxxxx wrote:

      Hi! The scene that you can download below contains a Null object with a bunch of polygon objects under it.
      I want to merge them into a single polygon object using MCOMMAND_JOIN, which works fine in R17, in
      R18 however, the result contains only the very first object instead of all objects.

      import c4d
        
      def join_objects(objs, doc) :
          print 'Joining', len(objs), 'objects'
          settings = c4d.BaseContainer()
          settings[c4d.MDATA_JOIN_MERGE_SELTAGS] = True
          result = c4d.utils.SendModelingCommand(
              c4d.MCOMMAND_JOIN, objs,
              c4d.MODELINGCOMMANDMODE_ALL, settings, doc)
          if not result:
              return None
          return result[0]
        
      obj = join_objects(op.GetChildren(), doc)
      doc.InsertObject(obj)
      c4d.EventAdd()
      

      Download 2017-06-21-plugincafe-jointest.c4d.

      Any idea what's going wrong in R18?

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

        On 21/06/2017 at 08:38, xxxxxxxx wrote:

        Hi!
        In R18 MCOMMAND_JOIN works in a different manner than pre-R18.

        For more details see:
        https://developers.maxon.net/forum/topic/9836/13246_python-sendmodelingcommand&KW=&PID=52423#52423

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

          On 21/06/2017 at 10:46, xxxxxxxx wrote:

          Thank you, no photo. Should've used the forum search first 🙂

          Here's the updated join_objects() function

          def join_objects(root, doc) :
              children = root.GetChildren()
              set_status("Joining %d objects ..." % len(children), 50)
              # Pre-R18 we need to pass the list of objects to join.
              if c4d.GetC4DVersion() < 18000:
                  source = children
              else:
                  source = [root]
            
              settings = c4d.BaseContainer()
              settings[c4d.MDATA_JOIN_MERGE_SELTAGS] = True
              result = c4d.utils.SendModelingCommand(
                  c4d.MCOMMAND_JOIN, source,
                  c4d.MODELINGCOMMANDMODE_ALL, settings, doc)
              if not result:
                  return None
              return result[0]
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post