Go to: Synopsis. Return value. MEL examples.

Synopsis

renameSelectionList(string $newName)

Renames all the writable objects on the selection list using the string argument as the base name. For multiple selected objects an incremented value will be appended to the argument name.

Note this procedure does not work if any of the items in the selection list have the same child name. For example, group1|child and group2|child both have the same child name. Attempting to use this procedure with those items in the selection list will generate an error stating more than one object matches the child name.

Return value

int : The number of renamed objects. May be 0 if all the objects on the selection list are read-only. A negative number is returned for errors. -1 is returned when the selection list is empty. -2 is returned if the argument is an empty string or invalid name.

Arguments

Variable Name Variable Type Description
$newNamestringName for the objects in the selection list. Must not be an empty string. Valid names begin with a letter or underscore, followed by letters, digits or underscores.

MEL examples

	//	Create a few objects. Select one and rename it.
	//
	$cone1 = `cone`;
	$cone2 = `cone`;
	$cone3 = `cone`;
	select $cone1;
	renameSelectionList("Cone");

	//	Add the other objects to the selection list and rename
	//	them all.
	//
	select -add $cone2;
	select -add $cone3;
	renameSelectionList("Object");