Rename Window


hi all,

i want to made a window to rename window for rigging that have 4 text fields the first contain the node type the second contain the direction then the node id then the node number and there is a button to rename.

so the way this works by filling the text fields the click on rename button.

	string $nodeType = `textField`;
	string $direction = `textField`;
	string $nodeID = `textField`;
	string $nodeNumber = `textField`;

	button -l "Rename" -c "Rename($nodeTypeQ)";

	string $nodeTypeQ = `textField -q -text $nodeType`;

global proc Rename(string $name){
	string $selected[] = `ls -sl`;
	for ($sel in $selected){
		 rename $sel $name;

 // Error: Rename($nodeTypeQ); // 
// Error: "$nodeTypeQ" is an undeclared variable. //

i dont know what to do


name your controls (at least the ones you want to query later) as it makes this stuff far easier to do.

textField myUI_nodeType;
button -l "Rename" -c "Rename `textField -q -text myUI_nodeType`";

but if you did want to do it with $vars:

string $nodeType = `textField`;
button -l "Rename" -c ("Rename `textField -q -text "+$nodeType+"`");

however, because you are going to (hopefully) want to avoid errors, like having multiple objects selected, vertices? (they can’t be renamed!) or the user typing in a wrong name “1-(Bad-Name$” it may be best to make the button simply call a global proc called, say, “myRenamer” that does full error checking before querying the text fields and doing the rename…



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.