Call "Set Deformed Mesh" on Weight Tag
-
Hello, I am currently trying to realize an asset pipeline for our game project that allows us to prepare our characters and clothes for processing in Unity.
Basically I have found a clean way to do this in Cinema4D that I can do by hand and that leads to success.
I create a few extra bones that we need and do some renaming. None of this is a big deal. But it is important that we then run the "Set Deformed Mesh". If I do this manually, everything works perfectly, but I just can't find a way to call this function directly in Python. I have found a way to set the button to "Set Deformed Mesh" but this does not "press" it.:def apply_deformed_mesh(meshes): """ Apply 'Set Deformed Mesh' on all meshes with weight tags. """ for obj in meshes: weight_tag = obj.GetTag(c4d.Tweights) if weight_tag: bc = weight_tag.GetDataInstance() # Set the button to 'Set Deformed Mesh' bc.SetInt32(c4d.ID_CA_WEIGHT_TAG_SET_BUTTON, c4d.ID_CA_WEIGHT_TAG_SET_DEFORMED_MESH) weight_tag.Message(c4d.MSG_UPDATE) # Update the scene c4d.EventAdd()
Is there a way to execute this command somehow to automate the whole thing?
-
Hi you need to use call button
def apply_deformed_mesh(meshes): """ Apply 'Set Deformed Mesh' on all meshes with weight tags. """ for obj in meshes: weight_tag = obj.GetTag(c4d.Tweights) if weight_tag: bc = weight_tag.GetDataInstance() # Set the button to 'Set Deformed Mesh' bc.SetInt32(c4d.ID_CA_WEIGHT_TAG_SET_BUTTON, c4d.ID_CA_WEIGHT_TAG_SET_DEFORMED_MESH) c4d.CallButton(weight_tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) # Update the scene c4d.EventAdd()
Cheers,
Maxime.