May 2009
1 / 5
May 2009
Apr 2015

I need to rename a bunch of shapeNodes. These shape nodes won't rename when I change the name of the transform, because they were renamed individually (I think that is it).

Perhaps I want to access the the shape nodes of a multi selection, in MEL via an array.

Know of a renaming script that can do? I tried a few things but no dice yet. If this is an easy one for you, I would appreciate any help.

W

  • created

    May '09
  • last reply

    Apr '15
  • 4

    replies

  • 8.8k

    views

  • 1

    user

QUOTE(mrwolfy @ 05/28/09, 01:19 PM) [snapback]308449[/snapback]
Know of a renaming script that can do?

Lots of them. Aside form the small fact that this is probably the second thing i ever learned to do in mel so i dont see any point in keeping ones around*. As it takes me less time to type a rename than it takes me to move mouse to activate a button.
CODE
for ($i in ls -sl -dag -shapes -l)
  rename $i "aa";

Ofcourse you can go all fancy in naming like following which would revert to original naming convention:
CODE
for ($i in ls -sl -dag -shapes -l){
  $parent=listRelatives -p $i;
  rename $i substitute ((string)$parent[0]) "s/[0-9]*$/Shape$0/";
}

You can go as far as you liek in complexity offcourse

*Its a personal choice i could have a button for this but then id constantly forget how to write for. By not taking this particular step i train my brain to learn the one thing about programming one should never forget. After awhile you don't miss a button anymore

4 years later

/users/joojaa/forums
Joojaa, thank you very much for the code - however this crashes Maya when the loop runs into an instanced object. Do you know how to fix it? I've been trying myself but haven't made any progress over the last couple of days.

11 months later

joojaa this works great.

can you explain to us - does this use regex? i can't find any info in the cm docmumentation that includes to format and ((string) that you appended, as well as the /s$ segments.

Thanks again!