HSV Scriptable?

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

HSV Scriptable?

Post 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.
[url=http://burtabreu.animationblogspot.com:2gityfdw]My AnimationBlogSpot[/url:2gityfdw]
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post 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".
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post 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.
[url=http://burtabreu.animationblogspot.com:2gityfdw]My AnimationBlogSpot[/url:2gityfdw]
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post 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.
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post 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. :)
[url=http://burtabreu.animationblogspot.com:2gityfdw]My AnimationBlogSpot[/url:2gityfdw]
Post Reply