Page 1 of 1

Can a script change colors in a layer?

Posted: Tue Dec 11, 2007 6:33 am
by mkelley
Is it possible to write a script that goes through all the shapes in a switch layer (the sub layers) and changes all with a certain color (let's say FFFFFF for the sake of argument) to a different color?

The reason I ask is I have a set of library mouths that have the skin shade as part of their construction, but to use them with different characters I need to go in manually and change each of the 10 shapes to the right color (by cutting and pasting). It's not terrible, but a script to do this would be tremendous. It must recognize and only change the shapes in all layers of that switch layer that match a certain color to another certain color.

I'm not asking anyone to write this for me -- I just want to know if it's doable (if it is it might give me the push to learn scripting).

Posted: Tue Dec 11, 2007 7:06 am
by Genete
Have you tried to use Styles? You define an style and apply it to a bunch of shapes. Then changing the style will change to all applied shapes.
Tutorial 2.7
-G

Posted: Tue Dec 11, 2007 8:38 am
by heyvern
Here's an additional tip for using styles with switch layers.

Save the mouth switch by itself as a separate document with a named style for the skin color.

Now let's say you have another character and you want to import the mouth switch. When you do the imported document will come in with its own styles. Just select the original character skin style and copy it. Select the imported skin color style and paste.

I save all kinds of stuff like this; mouths, eyes, ears, hands etc.

-vern

Posted: Tue Dec 11, 2007 3:27 pm
by mkelley
Thanks guys.

I thought I had done all the tutorials, but I guess I missed the styles one. Vern, your workflow sounds exactly what I'm trying to do.