Jump to content

How can I set the Color of points of a Curve in a Python SOP?


magneto

Recommended Posts

I have a curve that I create using a custom Python SOP, but I also want to change point colors so they are not white.

I looked at the docs but there isn't a color property to set.

So I thought I probably need to set the CD attribute but I couldn't get it to work because never did this before in code. I tried setting the attrib value but it seems like points only has P, Pw (?) I think, when I listed them.

Do I have to create an attrib called CD first?

Anyone did this before?

Thanks.

Link to comment
Share on other sites

Yes, you need to create the Cd attribute first if it doesn't already exist.

attr = geo.addAttrib(hou.attribType.Point, "Cd", (0.0, 0.0, 0.0))
for point in geo.points():
    point.setAttribValue(attr, some_color_tuple)

Edited by graham
  • Like 2
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...