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
    • Register
    • Login

    Mesh Emitter CallCommand works in Script Manager, no-op from plugin

    Scheduled Pinned Locked Moved Cinema 4D SDK
    python2026
    3 Posts 2 Posters 37 Views 1 Watching
    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.
    • A Offline
      atg
      last edited by atg

      I'm trying to create a Mesh Emitter with the selected object as Geometry, same as Simulate > Mesh Emitter when geo is already selected.

      Script Manager (works):

      import c4d
      doc = c4d.documents.GetActiveDocument()
      geo = doc.GetActiveObject()
      doc.SetActiveObject(geo, c4d.SELECTION_NEW)
      c4d.CallCommand(1062577, 1067510)  # Mesh Emitter
      c4d.EventAdd()
      

      From an ObjectData plugin (doesn't): Create button builds a polygon object (100 pts). I don't call CallCommand from MSG_DESCRIPTION_COMMAND; the handler queues work and calls SpecialEventAdd, and a MessageData plugin runs the Mesh Emitter command in CoreMessage. Also tried having MessageData invoke a CommandData that runs the same CallCommand.

      Same result either way: active stays on the grid, no new emitter in the scene.

      So it's not selection or empty mesh. The command does nothing from plugin code but works in Script Manager.

      Does CallCommand(1062577, 1067510) only work in certain contexts? What's the supported way to create a Mesh Emitter from a description button without BaseObject(Ofpmeshemitter) + manual SetLink (Geometry grey out in the AM)?

      Ofpmeshemitter = 1062577. Script Log records CallCommand(1062577, 1067510) when using the menu.

      AnlvA 1 Reply Last reply Reply Quote 0
      • AnlvA Offline
        Anlv @atg
        last edited by Anlv

        Hi, @atg Simply remove the invalid child IDs after the commands recorded in the script log, for example:

        c4d.CallCommand(1062577, 1067510) → c4d.CallCommand(1062577)
        

        I remember encountering the same issue before, but I can’t quite recall the details. I need to look it up.

        import c4d
        
        doc: c4d.documents.BaseDocument  # The currently active document.
        op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
        
        def main() -> None:
            """Called by Cinema 4D when the script is being executed.
            """
            c4d.CallCommand(1062577)  # Mesh Emitter
        
        if __name__ == '__main__':
            main()
        

        How do I retrieve a command call from it's index number ?

        Cheers,
        Anlv

        1 Reply Last reply Reply Quote 0
        • A Offline
          atg
          last edited by

          Thanks Anlv
          It looks like its adding the emitter into a null is what's causing it.

          Fixed with deferred CallCommand(1062577) (no sub-id (1067510) silently no-ops). Emitter fields greys if the emitter/group are parented under the setup null or generator. Sibling placement below plugin object + rename works fine.

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