Rename all non-DAG nodes that are not read-only?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 06 June 2009   #1
Rename all non-DAG nodes that are not read-only?


I want to add a prefix to all my nodes in the scene. For the dag-objects this one works fine

select -r "ALL";
SelectHierarchy ;

string $sel[] = `ls -sl -tr `;
string $newname;

	$newname = addPrefixToName( "prefixHere_", $sel[$x]);
	rename ($sel[$x])($newname);

But what if i also want to rename for example all the condition-nodes? How do I get them? Since things like the defaultLayer is read-only, I have to manually select all the nodes and then run the script .... is there another way? I have tried stuff like listConnections and listRelatives but not quite getting there ...

Old 06 June 2009   #2
I'm not sure if you want to rename only the condition nodes associated with the selected DAG objects or all the condition nodes in the scene, but if you want to do the later you can do this:

 string $conditionNodes[] = `ls -typ "condition"`;
 for ($current in $conditionNodes)
 	rename $current ("prefix_" + $current);
Old 06 June 2009   #3
Well, not really but that would work. Rather ALL non-Dag nodes, such as clamp,condition,plusminusavg or whatever ...

Select all those, and rename all of them, except the ones that a read-only. Thatīs what I would want
Old 06 June 2009   #4
See if this works:

listConnections defaultRenderUtilityList1;
Old 06 June 2009   #5
It didnīt? Or what should I do with it?
Old 06 June 2009   #6
You could use the MultiRename from my MultiTool. Tried it with some shaders and it works perfectly.
Freelance | Consulting | Development | Autodesk Authorized Developer
Boole | Stitch | Konstrukt | SmartDuplicate | Wire | Contours | MultiTool
Old 06 June 2009   #7
import your scene into an empty scene, setting "resolve: [all nodes] with this string: [your prefix]".

problem solved.
Victor - skinning plugin for Autodesk Maya
Old 06 June 2009   #8
Yeah I know there are several OTHER ways of solving this, just wanted this one right now Its for my autorig, to be able to rig several characters in the same scene
Old 06 June 2009   #9
use namespaces. or even better, write name-independed code. it's really possible. maya allows naming objects the same given they aren't under same parent.

although i don't see a problem of rigging a char per scene.
Victor - skinning plugin for Autodesk Maya
Old 06 June 2009   #10
These commands give me all the utility node, texture nodes, and shading groups in my scene.

listConnections defaultRenderUtilityList1;
listConnections defaultTextureList1;
listConnections renderPartition;
Old 06 June 2009   #11
Dont know if im tired or just retarded tonight but cant see how your doing it

This code

 string $se2[] = `listConnections defaultRenderUtilityList1`;
 	print ("SEL = " + $se2[$y] + "\n");
 string $se3[] = `listConnections defaultTextureList1`;
 	print ("SEL3 = " + $se3[$t] + "\n");
 string $se4[] = `listConnections renderPartition`;
 	print ("SEL4 = " + $se4[$i] + "\n");

Only gives me

SEL4 = initialShadingGroup
SEL4 = initialParticleSE

printed out, nothing more
Old 06 June 2009   #12
I think you ran the code in a new scene maybe? Did you create utility and textures nodes? Otherwise I'm not sure what's going on.
Old 06 June 2009   #13
Nope, hade lots of stuff in the scene. Weird.
Old 06 June 2009   #14
Maybe it has to do with your version of Maya. I'm using Maya 2009. What version do you have? Anyways, all I did was select a utility node and looked at the Output section in the channelbox and noticed that for all my scenes they were connected to a node called defaultRenderUtilityList1, so you can see if yours has something similar.

Last edited by tdHendrix : 06 June 2009 at 12:15 PM. Reason: typo
Old 06 June 2009   #15
Originally Posted by Leffler: Hi!

I want to add a prefix to all my nodes in the scene. For the dag-objects this one works fine


if you want to rename EVERYTHING, why not just:

 string $prefix= "blah_";
 for($object in `ls`)
 	if( catchQuiet(rename($object,($prefix+$object))) )
 		warning("can't rename "+$object+"\n");
 		print("renamed "+$object+"\n");
Seth Gibson
Maya Content Tools Dev, Bungie
LinkedIn // twitter // Part Time Gamers Episode 3: The E3 Aftermath! Out Now!!
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright Đ2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:24 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.