Jump to content

Custom parameter - Attribute dropdown list


Recommended Posts

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);
    }

 

 

  • Like 1
Link to comment
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 3
Link to comment
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

 

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...