PDA

View Full Version : duplicate question


Neilman
11-29-2012, 11:45 PM
Is there a way to duplicate just the geometry of an object? For example, here is the hierarchy of an object I wish to duplicate, but I don't want the parentConstraint to get duplicted with it. I just want the transform and the shape node.

pSphere
-pSphereShape
-pSphere_parentConstraint

Is there a direct way to duplicate pSphere along with pSphereShape without manually deleting whatever other children are contained inside the transform? I just want the raw mesh to be duplicated.

Nyro
11-30-2012, 12:43 AM
From what I can tell: no.

There is a way to duplicate just the top-level DAG node without any of its children, including the shape node. This, unfortunately, leaves you with an empty transform.

Via scripting you could determine the transform node and its (child) shapenodes and duplicate those individually, then reconnect them.

Nyro
11-30-2012, 04:02 PM
I went back over this and tried to script it myself.

As suspected, there really is no way to utilze the duplicate command on any transform node to create a non-instanced duplicate of it that has a unique duplicated shapenode and no instanced inputconnections.

However, it turns out that if you duplicate a shapeNode instead of a transform node, you get exactly what you want: a new transform and a new shapenode.
It's then a matter of simply deleting everything but the transform node from the resulting list of duplicated nodes:

$tNode = `ls -sl -as`;
$s = size($tNode);
if($s == 0) {
print "Nothing selected";
}
else if ($s > 1) {
print "Too many nodes selected";
}
else {
$transform = $tNode[0];
$shapes = `ls -dag -type "shape" $transform`;
$dNodes = `duplicate -rc $shapes`;

for($i = 1; $i < size($dNodes); $i++) {
delete $dNodes[$i];
}

}

I haven't been able to test this on a transform that has more than 1 shapeNodes connected to it, so I have no idea what exactly happens in that situation ;)

CGTalk Moderation
11-30-2012, 04:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.