CinnamonMetal Posted October 19, 2017 Share Posted October 19, 2017 The class hou.polygon doesn't have a color() method. How can get the color for each primitive as a tuple in a mesh (python) ? Quote Link to comment Share on other sites More sharing options...
acey195 Posted October 19, 2017 Share Posted October 19, 2017 I think you just need to fetch it as a normal primitive attribute floatListAttribValue(name_or_attrib) http://www.sidefx.com/docs/houdini/hom/hou/Prim using "Cd" as the attribute (make sure you actually have the attribute as primitive attrib, rather than points for example) Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 19, 2017 Author Share Posted October 19, 2017 curNode = hou.pwd() prim = hou.Prim for thePrim in prim: primColor = prim.floatListAttribValue("Cd") return primColor As close to the above; although it errors ? Quote Link to comment Share on other sites More sharing options...
Atom Posted October 19, 2017 Share Posted October 19, 2017 (edited) Yep, tons of errors in that. You can only return from a function, which you have not declared. Here is my guess of what you might want. But be aware, the code will fail if there is no Cd attribute on the incoming primitives. So you may need to use hasAttribute before you attempt to retrieve the value. node = hou.pwd() geo = node.geometry() for thePrim in geo.prims(): primColor = thePrim.floatListAttribValue("Cd") Edited October 19, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 19, 2017 Author Share Posted October 19, 2017 (edited) Yes, thank you Although what direction must I need to try first, to get the values as readable (rgb) tuples rather then this; 0.33311760425567627 ? Edited October 21, 2017 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.