Page 1 of 1

HSV Scriptable?

Posted: Tue Jan 16, 2007 10:31 pm
by bupaje
Not sure if I asked this before, don't remember the answer if I did. :) Can anyt scripting guru tell me if the HSV modifier feature can be accessed through scripting? For example can you use script to animate the HSV image? Right now it is static only.

Posted: Wed Jan 17, 2007 10:05 am
by Rasheed
There are two member functions to the layer object available:
string HsvImage()

Returns a file path to the layer's HSV modifier image.
Return value (string): file path

void SetHsvImage()

Sets the file path to the layer's HSV modifier image.
Return value: none
path (string): file path
So, in principle, you can write a layer script to change the HSV image based on the frame number.

Code: Select all

function LayerScript()

    local layer = moho.layer -- the current layer
    local frame = moho.frame -- the current frame number
    
    local image = {}
    image[1] = "first.jpg"
    image[2] = "second.jpg"
    
    if (frame == 0) then
        layer:SetHsvImage("")
    else
        if (frame > 0 and frame < 10) then
            layer:SetHsvImage(image[1])
        else
            layer:SetHsvImage(image[2])
        end
    end

end
I haven't tested this script, but it should work, based on the documentation. It removes the HSV image when in frame zero, between frames 1 and 9, inclusive, it uses the HSV image called "first.jpg", after frame 9, it uses the HSV image called "second.jpg".

Posted: Wed Jan 17, 2007 3:23 pm
by bupaje
Hey -thanks! When I get some play time I'll see if I can still use the other half of my brain. :) I always liked that HSV image modifier. It's cool that , unlike layer blend modes, any layer, in any position in the hiearchy, can share the same image.

Posted: Wed Jan 17, 2007 5:42 pm
by Rasheed
I know. I wasn't aware of this method of enhancing your imagery, which seems to be a kind of black magic. I know that you've posted about this in the past (see here), and I'm curious how you use the HSV layer feature to enhance your own imagery. Can't wait until you post an example of dynamic HSV animations.

Posted: Wed Jan 17, 2007 9:38 pm
by bupaje
I'm eager myself. Going to try to sneak some time away from work, internships and everything else Sunday night. :) I think there is some hidden potential with this, perhaps to fake some global lighting and shadows. I also have a half baked idea it may be suitable for faking some reflections and some other effects.

Thanks so much for doing this. I may be picking your brain this weekend some more. :)