Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 15-02-2005 , 04:59 PM
Velusion's Avatar
Registered User
Join Date: May 2004
Location: Utah, USA
Posts: 369

MEL referencing

I just ran into a problem with a couple of my MEL scripts when I tried to use them on a model that was referenced into the current scene.

The MEL script selects objects in the model's rigging and performs specific tasks on them. The problem is that the names of those objects have changes since they have been referenced. Instead of an object being called "rightfootgrab" it is being called "finishedmodel:rightfootgrab". Finishedmodel is the name of the scene that is being referenced. The MEL script is looking for "rightfootgrab"...

Please tell me that there is a way to write the script so that it will work on referenced models.. Otherwise, what is my option? Will I have to rename all of the objects that are being mentioned in the script?

# 2 16-02-2005 , 10:30 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Hmm... good question. Not propably the best way but you could try to search with a wild card:

select -r "*rightfootgrab";


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 16-02-2005 , 05:48 PM
Velusion's Avatar
Registered User
Join Date: May 2004
Location: Utah, USA
Posts: 369
Great suggestion. I'll try it tonight user added image

# 4 23-02-2005 , 09:18 PM
Velusion's Avatar
Registered User
Join Date: May 2004
Location: Utah, USA
Posts: 369
Sorry it took so long to get back. I tried it and it didn't work BUT the solution seems to be to use the NAMESPACE command. When you reference a scene into a scene, a namespace is assigned to everything in the referenced scene. By default, the referenced scene name is used as the namespace however, you can change it to whatever you want.

The easy answer is to include the name of your scene into any mel scripts that you write that will be used with the referenced scene. That way the script will be looking for the proper name.

The more complex answer would be to assign a variable as the namespace in the mel script then assign a name to it that matches the namespace of the referenced scene. By doing this, you could reference the same scene multiple times then include a short script to swap the namespace variable so that you could use the same Mel script to control all of the referenced scenes. This would be good in cases where you design a single character but want to use copies of it in a scene. By assigning a different namespace to each copy of the referenced scene and changing the namespace variable in the mel scripts you don't need a seperate script for each reference. ZoinK!


Last edited by Velusion; 23-02-2005 at 09:20 PM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads