Jump to content
ThomasPara

Custom parameter - Attribute dropdown list

Recommended Posts

Is it possible to recreate the Attribute dropdownlist where it finds all the attributes on the mesh, and add this to your own hda?

AttributeDropdownlist.png

Share this post


Link to post
Share on other sites

Did some more searching and i found an older topic here that had what i needed - 

Setting the list to Multiple Selection Menu instead of Single i could make a list of the attributes i didnt want with the following vex-code:

s[]@pointattribs = detailintrinsic(0,"pointattributes");
string attriblist = chs("../attribtrans"); //Multiple Selection Menu
string alist[] = split(attriblist);
foreach(string name; alist){
    removevalue(@pointattribs,name);
    }

 

 

Share this post


Link to post
Share on other sites

General way is to use Python as Menu script:

from itertools import chain

node = hou.pwd()
geo = node.geometry()
attribs = [a.name() for a in geo.pointAttribs()]

return list(chain(*zip(attribs, attribs)))

attributes_menu.hipnc

It is possible to avoid it in many cases. When you promote parameter it will usually pick the menu script (if it exist) from the node. It is not necessary to have such menu on the target node, as you may promote parameter from a different node (example).

  • Thanks 1

Share this post


Link to post
Share on other sites

Yeah, i use Python in the menu, but i needed the list in vex aswell. And having it pull the attributes from the target node was a bad idea since the attributes i removed also got removed from the list itself.

And the reason i couldnt promote the parameter is because it doesnt exist on the wrangle itself, i could have made a dummy node instead and promoted that.

My menuscript ended up like this:

result = []
geo = hou.pwd().inputs()[0].geometry()

for attr in geo.pointAttribs():
        result.append(attr.name())
        result.append(attr.name())
return result

 

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

×