Jump to content
LaidlawFX

Python read primitive attribute

Recommended Posts

Hello,

I feel like I should know this but Houdini keeps erroring on me so I am doing something wrong.

I want to read the primitive attribute Cd, multiple the values by say 6, and then add it to a new attribute called color.

For the example scene, drop a box, a color sop and set it to primitive and bounding color, followed with a python sop.

I am not looking for this in VEX, via nodes, or any other language. It has to be in python for this case.

Thanks for the help,

-Ben

Share this post


Link to post
Share on other sites
color = geo.addAttrib(hou.attribType.Prim, 'Color', hou.Vector3(0,0,0))
for prim in geo.prims() :
    v = hou.Vector3(prim.attribValue('Cd'))
    v *= 6
    prim.setAttribValue('Color', v)

This worked for me.

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

×