I'm trying to mirror a joint chain using the built-in Mirror Tool. I want the return for the function to be the mirrored joint. For instance, if I selected the joint chain thigh_L_jnt, I want the return/result of the function to be thigh_R_jnt. Currently, it returns nothing.
Is there a way around this?
You can see the code here:
for idx, obj in enumerate(objList):
if idx == 0:
toolID = 1019953 # Mirror Tool ID
tool = c4d.plugins.FindPlugin(toolID, c4d.PLUGINTYPE_TOOL)
tool[c4d.ID_CA_MIRROR_TOOL_AXIS] = 4 # XZ
tool[c4d.ID_CA_MIRROR_TOOL_REPLACE] = '_L_'
tool[c4d.ID_CA_MIRROR_TOOL_WITH] = '_R_'
result = c4d.CallButton(tool, c4d.ID_CA_MIRROR_TOOL)
return result # this returns nothing.
RE: there is no way to retrieves the created object from the built-in Tool
Thanks for the confirmation
Correct me if I'm wrong but this works only on polygon objects. I'm mirroring a joint chain rather than a polygon object.
Actually, there is no way to retrieves the created object from the built-in Tool since CallButton is the same as if a user presses the button. So it's return nothing it simply processes the tool and inserts the needed stuff. Of course, you can check what's the behavior of this tool and how new objects are inserted.
However, for most of the tool use SendModelingCommand which is an API around tool available which will give you all need. Setting coordinate system using MCOMMAND_MIRROR provides an example for MCOMMAND_MIRROR.
If you have any questions, let me know.