Jump to content

Python setHSV


blackchicken

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

 

 

 

Link to comment
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)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...