Mesh Emitter CallCommand works in Script Manager, no-op from plugin
-
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.
-
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 -
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.