Page 1 of 3

Adjust Colors Script

Posted: Sat Mar 07, 2009 5:43 pm
by mkelley
For anyone who's interested here is the final (so far) script I wrote to adjust colors across a layer:

http://www.kelleytown.com/freeware/mk_adjust_colors.zip

Essentially what it does is allow you to enter RGB values which are then added or subtracted to all shapes in the selected layer. I generally use a small value like 5 and then just repeatedly mouse click (or Alt-click) to get the effect I want.

The reason I wrote it is that I often have background sets that need to be adjusted for lighting conditions, like nighttime. I could set styles for every single shape and color, but adjusting all of them would be a PITA. This makes it easy to tint your layers in any manner you'd like. Another use is for characters -- you'll notice that in many animated shows when they do a night scene they darken the character's clothes but leave the face the same as it would be in the day -- as long as your character's face is on a different layer this will do that easily.

There is a small example of the kind of thing you can easily do in the file -- just a few seconds of playing around with it.

Thanks, Wes -- without your help I'm not sure I could have finished this (or at least as quickly -- I mostly did it last night).

Posted: Sat Mar 07, 2009 6:11 pm
by synthsin75
Hey Mike,

I love this tool. One small issue...I thought you were going to have upper and lower limits on this. I just found that if I went too far, to white, then it loses the ability to get the original colors back, and only goes to black.

Not too big of a problem since frame zero should still have the original colors, and those keys can be copied and pasted.

This is a much needed tool for easy hue adjustments.

:wink:

Posted: Sat Mar 07, 2009 9:50 pm
by mkelley
Wes,

I actually adjusted the "limits" so that the colors wouldn't shift around the spectrum. If I leave limits on RGB values then you really can't lower the values of pure saturated colors (for example, if the color is 255 red then you can't darken it even if the other colors are less).

However -- that said I've decided there are *way* too many other things I want to do with this, and I shouldn't have posted so soon. For example -- instead of just adding/subtracting RGB values you could have a switch to "saturate" all your colors (the math for this is not as straightforward but it's easily doable). Saturate is good because as you lighten or darken you tend to desaturate and while you can adjust this it's a bit of a PITA to have to keep tuning the values.

There are at least four or five "standard" sort of color adjustments that can be programmed, so I want to do all of those. Ideally, if AS had a database approach to things I could actually have user defined adjustments that could be saved/loaded, but I won't go that far (because, after all, this is just a tool for me :>).

Anyway, if folks want something like this they might want to hold off until I release version 2.0 <bg>.

Posted: Sat Mar 07, 2009 10:02 pm
by synthsin75
Sounds good, Mike. This version will definitely work in the meantime, though.

:wink:

Posted: Sun Mar 08, 2009 12:28 am
by Ovjeh
This is great! Finaly some global color correction tools! Already useful, looking forward for more additions.
This also screams for a new UI element in AS. Sliders. (Sliders would be useful for many other things too)


--

Posted: Sun Mar 08, 2009 12:29 am
by rylleman
Looking forward to the next version, sounds like a nifty script.
Good luck.

Posted: Sun Mar 08, 2009 1:58 am
by synthsin75
This also screams for a new UI element in AS. Sliders. (Sliders would be useful for many other things too)
Now that you mention it, this sort of thing could be done with a click and drag behavior. No UI widget, but it would do the same thing. Mmm, I may have to track down some of the things that may be begging for a 'slider'.

Posted: Sun Mar 08, 2009 7:07 pm
by Ovjeh
That click and drag method is good for some "on the fly" changes.
Maybe, could be possible to combine two methods. Click and drag for fast
editing and than ClickClick for more precision.

Also, I don't know how MKelley plans to integrate another mods, but my suggestion
would be individual buttons for every one of them (Hue, Saturation, Contrast, R, G, B,..:D),
which leads to another idea, just single button in Toolbar that opens all this buttons
in Tool options.

And last one, would it be possible to apply color changes across group.
For example, select folder or bone group and than change colors of all
dependent layers and avoid all subgroups if there any.
And maybe in addition, when selecting group and clicking button, window pops up
with checker "include all subgroups" (in another UI scenario checker is included in Tool options)

All this seems like a lot of work, so, any addition to already useful tool will be great.

Anyway, something like this should be integrated into AS.



--

Posted: Sun Mar 08, 2009 7:27 pm
by synthsin75
If Mike (mkelley) gets the other modes working, I can always expand this to work over a group. Actually the child layers would be easy, it's all the sub-layers that's a bit tricky.

Mike, if you want to tackle that, the code is part of the custom layer shortcut script I wrote for you. :wink:

Posted: Sun Mar 08, 2009 7:51 pm
by Ovjeh
Hey you two "Brothers in Arms" You have all my moral support. :wink:


--

Posted: Sun Mar 08, 2009 11:07 pm
by mkelley
I've sent Wes the script that has the HSB mode added, so you can now alter values of Hue, Saturation and/or Brightness as desired. Those actually tend in practice to be much more useful than the RGB adjustments, so I'll probably just make that the default.

For me I'm going to make some presets (like for tinting things for night scenes, etc.) but that may be all I have the time and energy to do right now (believe it or not I'm really in the middle of a series production and shouldn't be coding anything at all -- it's just that I came up with a night scene and a need for this so... well, it sometimes happens you waste more time trying to save time than you actually do in saving time, if that makes sense).

If he wants to do the group/child layers thing that would be fine -- for my purposes I don't really need/want that (although if AS had that switch I wanted so you could exclude layers from scripting then I could see my own use -- what happens for me is that I might need to alter all the clothing layers of a character but NOT their face or hands. Right now unless Wes can read something like the Eye icon of a layer I can't see a way to exclude members of a group easily).

Posted: Mon Mar 09, 2009 4:00 pm
by mkelley
Okay, the above referenced script has now been updated and greatly enhanced.

It does HSB (and adds alpha to RGB) but the best thing is it does them all at the same time (well, not really -- time is God's way of keeping everything from happening at once. But it allows you to enter all the parameters at the same time).

It's pretty cool to, say, add 40 to the Blue channel while at the same time you increase your saturation by 20 or so and lower the brightness by 25 -- this is a very good nighttime setting (but I may fiddle with it until I get it right). RGB processing is done first and this seems to make the most sense, but if you want I can put a switch to allow HSB to be handled first (one or the other must be first :>).

I was thinking at first that hue shifting wouldn't be useful, but it's very cool to have, say, a tree with various green shades of leaves and then hue shift this to yellow and then red (can anyone say Autumn?).

Remember that to "undo" this just delete the key it sets. What I really want to add is the ability to define and save your own presets -- this shouldn't be impossible (similar to defining groups) but I need to decide where to store them as well as wrestle with the GUI (my weakness is GUI). Perhaps Wes will help me out with that part.

Posted: Mon Mar 09, 2009 9:24 pm
by Ovjeh
I couldn't post anything earlier so first things first.

One of the things I completely forgot (been away from AS for some time) is this nifty feature of mouse scrolling in numerical boxes. Now this makes all that number jumpings much easier, and my remark about slider necessity (in this case) less important.

About "losing time to gain time", that's something I constantly have to deal with ("perfect workflow" problem )
mkelley wrote:If he wants to do the group/child layers thing that would be fine -- for my purposes I don't really need/want that (although if AS had that switch I wanted so you could exclude layers from scripting then I could see my own use -- what happens for me is that I might need to alter all the clothing layers of a character but NOT their face or hands. Right now unless Wes can read something like the Eye icon of a layer I can't see a way to exclude members of a group easily).
You have different workflow. I tend to tint whole scene, and then tweak details where necessary. About layer exclusion, I think the best (hypothetical) workflow would be to select layer in a layers tree that needs to be excluded click tool button to open tool options with list button for included layers and Include and exclude buttons.That way layers could be visible in editing view, but invisible for color changing.


About newer post

A lots of great news about new options ! Include them all !:D
More options=more variations. I like tweaking things.

Best place to save settings is Utility folder (plain txt file or plain txt file in a new folder).

Sorry for sparse post, but I need to see more to know (maybe) more.



--

Posted: Mon Mar 09, 2009 9:51 pm
by mkelley
I'll let Wes deal with the issue of applying this to anything more than the selected layer, if he wants. Right now I just don't have the time to work on something that I'd never use (because of my workflow).

The mouse wheel thing is in there -- I'm guessing what you are saying is that you noticed it. For the others, you can turn the wheel of the mouse and it will increment and decrement the number in the field you have selected (I assume it works with negative numbers too, although I haven't yet tried it).

I'm not quite sure how AS will deal with text input/output -- haven't tried anything like that yet (and the GUI is my weakest programming skill). But, yet, I want to save a text file somewhere with the settings.

Posted: Mon Mar 09, 2009 10:23 pm
by synthsin75
Mike, yes, I can exclude layers based on the 'eyes' icon in the layers window. And you should be able to store those presets as tool preferences.

Ovjeh, I'll be able to expand this to multiple layers, but I really need to finish my new select layer script, as doing this will use some of its code. I expect to be able to do the sort of exclude/include you mention. I've been working on this tool for quite some time, so I can't make any promises on when I'll get around to adding these features to this one.



:roll: :wink: