View Full Version : How can I get a shape node name from existing object?
Hi there,
How can I get a shape node name after object has been created?
Basically, I want to check the object type of existing object.
For example, I select a polyCube (pCube1 polyCube1), then try below:
string $selected[] = `ls -sl -fl`;
string $type = objectType ($selected[0]);
$type always have "transform" instead of "polyCube"...
Thanks
|
|
azshall
02-13-2008, 12:27 AM
Hi there,
How can I get a shape node name after object has been created?
Basically, I want to check the object type of existing object.
For example, I select a polyCube (pCube1 polyCube1), then try below:
string $selected[] = `ls -sl -fl`;
string $type = objectType ($selected[0]);
$type always have "transform" instead of "polyCube"...
Thanks
close :)
string $selected[] = `ls -sl`;
string $shape[] = `listRelatives -s $selected[0]`;
string $type = `nodeType $shape[0]`;
print("The shapeNode is: " + $shape[0] + "\n");
print ("The type is : " + $type + "\n");
r4inm4ker
02-13-2008, 12:54 AM
maybe this command is what you want: `ls -sl -fl -dag -type "shape"`
`ls` is a very powerful command, and you may try a lot of combination to get interesting results.
Mikademius
02-13-2008, 02:29 PM
You could also pickWalk :) Not the best one suited for this task maybe, but it also does the job you can do with your arrows on the keyboard.
Buexe
02-13-2008, 02:49 PM
I would use the ls and listRelatives commands like azshall already said. Since you are working with selections, it is a little bit safer to use ls with the -long flag, so that you get the full dag path. The appropriate flag with listRelatives is -path. This helps to prevent errors when you have different objects with the same name in the scene.
Thank you everyone!
Both "listRelatives" and "`ls -sl -fl -dag -type "shape"`" command worked!
You guys are fantastic.
CGTalk Moderation
02-13-2008, 11:25 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.