Jump to content
blackchicken

Python setHSV

Recommended Posts

Hello I`m stuck with setting correct color to nodes. I would like to set value with HSV.  I want to do slight automatic gradient when I creating nodes in network box

 

this one work in RGB:

my_list = [nullA, nullB, nullC, nullD]

loop = 0
nodePos = -1 

for node in my_list:

	node.setColor(hou.Color(0.3, 0.5 * loop, 0.8))
	node.setPosition(hou.Vector2(0, loop * nodePos))
    
    loop += 1

but cant find the way how to set values with HSV, from doc should be something like this:

my_list = [nullA, nullB, nullC, nullD]

loop = 0
nodePos = -1 

for node in my_list:

	node.setColor(hou.Color().setHSV(50, 0.5 * loop, 0.8))
	node.setPosition(hou.Vector2(0, loop * nodePos))
    
    loop += 1

 

Thanks for help, Jan

 

 

 

Share this post


Link to post
Share on other sites
29 minutes ago, blackchicken said:

my_list = [nullA, nullB, nullC, nullD]

loop = 0
nodePos = -1 

for node in my_list:

	node.setColor(hou.Color().setHSV(50, 0.5 * loop, 0.8))
	node.setPosition(hou.Vector2(0, loop * nodePos))
    
    loop += 1

 

hou.Color().setHSV expects a tuple of floats, not three floats:

 for node in nodes:
        color = hou.Color()
        hsv = (hou.hmath.rand(node.sessionId())*360, .9, .9)
        color.setHSV(hsv)
        node.setColor(color)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×