Sunday, August 14, 2011

Setting locator color part 1: matchmover to maya workflow

My fluid directional light contorler is taking longer than expected.

In the mean time I'm addressing a problem with Match Mover to Maya workflow. Meaning the ability to visually distinguish which locators are associated with specific objects. ie. locators that represent a chair in the scene versus those that represent the floor or wall etc.

Eventually I hope to build this into a script that automatically sets locator colors based on key words. We'll see.

For now I've discovered the use of the "for in" loop to assign or change attributes in an array. In this instance it will be used to enable color override and to set a color value.

Here is a group of locators at the default color interface value of dark green (imagine they represent a group of locators aligned to the ground plane of a backplate.

Now after selected all the locators I run the following MEL

string $selectedlist[] = `ls -sl`;
string $currentLocator;
for ($currentLocator in $selectedlist)
{
setAttr($currentLocator + ".overrideEnabled", 1);
setAttr($currentLocator + ".overrideColor", 13);
}

This has the following effect on the locators.


As you can see the display color is now changed on all objects to red.

Ideally this functionality could be built on to set the colors for all locators upon opening a scene created by Match Mover but that's for another day.

I'll try and explain how the MEL works later (or not if I can't find the time).

2 comments: