Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Excess ShapeOrig nodes created bloating my scene.

Anonymous

Excess ShapeOrig nodes created bloating my scene.

Anonymous
Not applicable

So I don't have a lot of information on ShapeOrig nodes.

I do understand that maya keeps original information before deformations stored in there. That's great. But usually those deformations are so miniscule I don't need the ShapeOrig nodes bloating up my scene. And they take up A LOT of space.

For instance, if I skin to geometry (geo1), a shapeOrig node is created. Now, lets say I want to edit something on the geometry, I would duplicate geo1 (Which deletes the history, but frustratingly NOT the ShapeOrig node), do my changes on geo2 and then copy over the skinWeights from geo1 to geo2.

Now geo2 has TWO ShapeOrig nodes. One from geo1 and the new one generated when the skinWeights were copied.

Frustratingly, if I delete all the ShapeOrig nodes, I lose all shader and skinning info on my geometry. Which makes me wonder what the point of the Shape node is, if all the info is stored in the ShapeOrig.

Can't I just have one Shape node with all the info and connections stored there?

 Shall I rewrite the duplicate command to delete the ShapeOrig nodes and transfer shader connections to the Shape node?

thanks.

ShapeOrig duplicated as well.ShapeOrig duplicated as well.Extra ShapeOrig created after skinningExtra ShapeOrig created after skinning

 

Cheers

 

0 Likes
Reply
Accepted solutions (1)
5,164 Views
3 Replies
Replies (3)

will.telford
Alumni
Alumni

There is nothing special about an orig shape. It is just another shape, with a particular naming convention, marked as an intermediate object. The duplicate command knows nothing about it, so it does not special case it. It just duplicates it along with any other shape under the transform you are duplicating.

 

We are looking at ways of cleaning this workflow up, but for now, when you duplicate the geometry, you do not need to bring the duplicate shape orig with it, so feel free to delete it. If you graph the connections, you'll see nothing depends on it.

 

As far as file size bloat, if you know your two objects are going to stay with identical topology, you can wire them both to the same orig shape.

 

 

 

 


Senior Product Owner of Rigging at Autodesk
https://twitter.com/wtelford

Anonymous
Not applicable
Accepted solution

Cool, Thanks for that!

I have written a small script that will delete all the ShapeOrig nodes off selected transforms.

 

#delete shapeOrig nodes
targets = cmds.ls( sl=1, type = 'transform' )
for target in targets:
    #get all the transforms in hierarchy
    children = cmds.ls(target, cmds.listRelatives( target, ad=1, type='transform' ) )
    for child in children:
        #get the shapes of child
        shapes = cmds.listRelatives(child, s=1)
        #do not delete if there is only one shape node
        if len(shapes) > 1 :
            for shape in shapes:
                #if nothing is connected to the shape node, delete it
                connections = cmds.listConnections(shape)
                if not connections:
                    cmds.delete(shape)
0 Likes

jiajun.coding
Advocate
Advocate

Here is my solution to clean up unused shapeOrig nodes which inputs a transform name:

def cleanInvalidShapeOrigNodes(meshObjName):
    print("Cleanup shape orig nodes for : " + meshObjName)
    cmds.select(meshObjName)
    mel.eval("doBakeNonDefHistory( 1, {\"prePost\"});")

    # There maybe serveral ShapeOrig nodes or a shape orig node with different names.
    # So we need to clean them.
    validShapeOrigNames = []
    nodeShapeOrigNameWithoutParent = (meshObjName + "ShapeOrig").split(":")[-1]
    nodeShapeOrigName = meshObjName + "|" + nodeShapeOrigNameWithoutParent
    allMeshObjShapeNames = cmds.listRelatives(meshObjName, path=True) or []
    for shapeName in allMeshObjShapeNames:
        if not "ShapeOrig" in shapeName:
            continue
        
        shapeOrigTestName = shapeName
        print("Testing ShapeOrig name : " + shapeOrigTestName)
        if cmds.objExists(shapeOrigTestName):
            if cmds.listConnections(shapeOrigTestName, source=True, destination=True) == None:
                print("Delete an isolate ShapeOrig node : " + shapeOrigTestName)
                cmds.delete(shapeOrigTestName)
            else:
                print("Append a valid ShapeOrig node : " + shapeOrigTestName)
                validShapeOrigNames.append(shapeOrigTestName)
        
    if len(validShapeOrigNames) == 0:
        print("No valid ShapeOrig node? : " + meshObjName)
        return False
            
    if len(validShapeOrigNames) > 1:
        print("Not only one valid ShapeOrig node?")
        return False
        
    validShapeOrigName = validShapeOrigNames[0]
    if validShapeOrigName != nodeShapeOrigName:
        print("Rename valid ShapeOrig node : " + validShapeOrigName + ", to " + nodeShapeOrigName)
        cmds.rename(validShapeOrigName, nodeShapeOrigNameWithoutParent)
    else:
        print("Final ShapeOrig name : " + validShapeOrigName)

    return True