Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   MEL referencing (https://simplymaya.com/forum/showthread.php?t=15427)

Velusion 15-02-2005 04:59 PM

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?

kbrown 16-02-2005 10:30 AM

Hmm... good question. Not propably the best way but you could try to search with a wild card:

select -r "*rightfootgrab";

Velusion 16-02-2005 05:48 PM

Great suggestion. I'll try it tonight :)

Velusion 23-02-2005 09:18 PM

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!


All times are GMT. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018