recolor error

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
rocky53204
Posts: 223
Joined: Sat Sep 03, 2011 3:34 am

recolor error

Post by rocky53204 »

Hoping to automate changing of colors in a switch layer.
Specifically a hands switch layer. Multiple hands of the wrong color... tedious to change them one by one.

Thought this might do the job: https://mohoscripts.com/script/ae_recolor
But, an error developed... C:\MohoPro\Scripts\Menu\Shapes\ae_recolor.lua.230:attempt to index global 'AE_Utilities' (a nil value)

Mayhaps I am using this improperly as there are no instructions given.
Using Moho 13.5.3 Perhaps this version does not support this lua?

I seem to recall a script by Mike Kelly that did this in the past.

Kindly advise
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: recolor error

Post by Greenlaw »

This is is an 'afterthought' solution but to do this efficiently, you should create a custom Style for the 'skin' color. This way, when you change the color in the custom Style, every hand drawing will be updated all at once. Literally takes a second this way.

For an existing project using Moho's regular styles, I don't have an quick solution since there's nothing to connect the styles used in each hand drawing. The easiest way I can think of is...

1. Select a shape with the color you want using Select Shape.
2. Click the Copy button in the Style window.
3. Click on each layer and with the Select Shape tool selected, click on the Select All button*. This will select all the shapes.
4. Click the Paste button in the Style window.
5. Repeat for each hand drawing in the switch layer.

Depending on how you've drawn the hands, this shouldn't be too tedious. Naturally, this assumes you aren't using more than one style in each drawing. If you are, then after clicking Select All, you'll need to use the Select Shape button to unselect the shapes not using the 'skin' style settings. (Obviously, you should adjust these steps to suit your design/shapes.)

Actually, the 'smart' thing to do is to use the above steps to apply a proper custom 'skin' Style to the hands so you won't have to go through this again if you decide to change the skin color in the future.

Hope this helps.

*I highlighted this feature because it's fairly new and some users may not know it exists. Previously, multiple shapes in a layer had to be selected using the Select Shape tool by manually 'scribbling' over every shape in the layer. Now that was tedious! With the new way, it takes only a single button click.
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: recolor error

Post by hayasidist »

rocky53204 wrote: Mon Apr 25, 2022 4:47 pm ...
But, an error developed... C:\MohoPro\Scripts\Menu\Shapes\ae_recolor.lua.230:attempt to index global 'AE_Utilities' (a nil value)

...
Alexandra has a load of shared routines in a file called AE_Utilities .. which you can get here: https://mohoscripts.com/script/ae_utilities

it needs to go in the Script\Utility folder of your custom content.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: recolor error

Post by Greenlaw »

Oh, and after all that, I meant to comment on the script and forgot. :D

@rocky53204, please let me know if you get it to work. If it works, it does sound like an ideal solution in this situation.
rocky53204
Posts: 223
Joined: Sat Sep 03, 2011 3:34 am

Re: recolor error

Post by rocky53204 »

hayasidist nailed it! (Once again!)
"Alexandra has a load of shared routines in a file called AE_Utilities ... which you can get here: https://mohoscripts.com/script/ae_utilities"

Once I loaded all of them the dependencies (like change color) worked!

To use on a switch layer... On frame zero select/highlight the switch layer.

(In the change color popup)
On frame zero check 'Only current frame'
Check 'Change fill' It functions as a from/to color box. Use the dropper to select existing color in first box, second box selects new color.
It will step through all sub layers in a switch layer!

I now use styles but my earlier work did not. To re-use some older items this is/was helpful.

So, thanks to all who replied and a big thanks to the script developer!
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: recolor error

Post by Greenlaw »

rocky53204 wrote: Mon Apr 25, 2022 10:08 pm To use on a switch layer... On frame zero select/highlight the switch layer.

(In the change color popup)
On frame zero check 'Only current frame'
Check 'Change fill' It functions as a from/to color box. Use the dropper to select existing color in first box, second box selects new color.
It will step through all sub layers in a switch layer!
That's cool! I'll have to give it a try here later. Thanks for following up! :D
rocky53204
Posts: 223
Joined: Sat Sep 03, 2011 3:34 am

Re: recolor error

Post by rocky53204 »

A caution on this. If all you want to try is the re-color you only need 2 SCRIPTS/files.
Rather then downloading the many at https://mohoscripts.com/script/ae_utilities
I installed all of them and had far to many buttons I will never use... so lots of deletes!

Look in the upper left corner and you will find the text/script for AE_Utilities 'View Script'
Grab that text file and install it (In scripts/utility folder) and then download https://mohoscripts.com/script/ae_recolor for install using MOHO menu selection.
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: recolor error

Post by hayasidist »

rocky53204 wrote: Tue Apr 26, 2022 2:19 am ...

Look in the upper left corner and you will find the text/script for AE_Utilities 'View Script'
Grab that text file and install it (In scripts/utility folder) ...
or just use the "Download Lua file" button to get just the Utilities
Post Reply