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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2009   #1
Rename all non-DAG nodes that are not read-only?

Hi!

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;

for($x=0;$x<size($sel);$x++)
{
	$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 ...

Otto
 
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
ngskintools.com - 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
ngskintools.com - 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`;
 
 for($y=0;$y<size($se2);$y++)
 {
 	print ("SEL = " + $se2[$y] + "\n");
 }
 
 string $se3[] = `listConnections defaultTextureList1`;
 
 for($t=0;$t<size($se3);$t++)
 {
 	print ("SEL3 = " + $se3[$t] + "\n");
 }
 
 string $se4[] = `listConnections renderPartition`;
 
 for($i=0;$i<size($se4);$i++)
 {
 	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

Otto


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");
 	}
 	else
 	{
 		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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 02:52 PM.


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