In some cases, you might want to further process or export a Carbon Cloth Output Mesh, but you do not want the Start Mesh under the same transform.
Deleting the Start Mesh from under the transform will invalidate the simulation, so we need to follow another approach.
There are a few steps to this:
- First, select the transform of the cloth mesh (not the Cloth Output Mesh under the transform), e.g. pPlane1.
- Then, press Ctrl + D on your keyboard. This duplicates the geometry.
- Now, delete the duplicated Start Mesh from under the new transform.
- Lastly, connect the Output Mesh plug from the Carbon Cloth node to the In Mesh plug of the duplicated Cloth Output Mesh.
You can then hide the original transform / meshes.
Since these are just a few well defined steps, you can also script this.
Here is the mel script:
First select the transform of the cloth mesh (not the Cloth Output Mesh under the transform), e.g. pPlane1.
Then run:
// Get selection
string $selection = `ls -sl`;
string $selChildren = `listRelatives -children $selection[0]`;
// Get Cloth Output Mesh
string $clothOutput = `listConnections -d off -p true ($selChildren[1] + ".inMesh")`;
// Duplicate selection
string $newOutput = `duplicate -rr`;
string $children = `listRelatives -children $newOutput[0]`;
// Delete static start mesh
delete $children[0];
// Connect to cloth output mesh.
connectAttr -f $clothOutput[0] ($children[1] + ".inMesh");