Set Color(Cd) from Node Color

   3047   4   0
User Avatar
Member
677 posts
Joined: Feb. 2017
Offline
Hey Everybody,

Is anybody capable of creating a node which sets the Cd attribute based on its own “node color”?
I think this would be very useful to organize streams of geometry in a network.
so you can see more easily which geometry you see in the viewport corresponds with what part of the network tree.

Cheers
Philipp
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
node = hou.pwd()
cd = node.color()
print cd
You can get the color of a node with YOURNODE.color()

-b
http://www.racecar.no [www.racecar.no]
User Avatar
Member
677 posts
Joined: Feb. 2017
Offline
Hey bonsak,

thank you very much for your help! Could you please help me a little bit more
I guess your code is for a python node? as I have no python knowledge could you be so kind and give me the full code that would store the python cd into the Houdini Cd(point) attribute?

Thanks in advantage
Philipp



node = hou.pwd()
geo = node.geometry()
mycolor = node.color()
attr = geo.addAttrib(hou.attribType.Point, "Cd", mycolor)

how do I correctly insert mycolor into the attr…..?
Edited by CYTE - May 7, 2018 14:49:37
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
node = hou.pwd()
geo = node.geometry()
mycolor = node.color()
attr = geo.addAttrib(hou.attribType.Point, "Cd", (1.0, 1.0, 1.0))

for point in geo.points():
    point.setAttribValue(attr, mycolor.rgb())

Close You have to loop over all the points in the geo to set the attribute.
The color doesnt change when you change it in the network viewer. It changes when the networks cooks again. So the workflow is a little rough

-b
Edited by bonsak - May 8, 2018 04:53:19
http://www.racecar.no [www.racecar.no]
User Avatar
Member
677 posts
Joined: Feb. 2017
Offline
Hey bonsak,

you are my hero!
Thanks a ton!

Cheers
Philipp
  • Quick Links