e.g. I have a primitive which has a series of prim attribs: a, b, c, d …
i want to create an otl to visualize a selected attrib from this list.
how to use Hscript of Python script to list out all the attribs of this object in an Ordered Menu?
thanks!
how to list all the prim attribs in a Ordered Menu?
8763 5 1- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
- mawi
- Member
- 242 posts
- Joined: Jan. 2008
- Offline
oat
e.g. I have a primitive which has a series of prim attribs: a, b, c, d …
i want to create an otl to visualize a selected attrib from this list.
how to use Hscript of Python script to list out all the attribs of this object in an Ordered Menu?
thanks!
Something like this in the menu script tab will give you that menu.
menu =
attribs = hou.pwd().geometry().primAttribs()
for each in attribs:
menu.append(each.name())
menu.append(each.name())
return menu
If i remember correct orderd menu returns a index number from the list so you will have to extract that in you code via hou.ch.
There are a few examples in the help if you search on asset scripts.
Short of time now but might be able to create an example for you later.
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
dear mawi, thank you very much!
you suggestion is exactly what I'm looking for!
May i ask another question based on this:
if I “chs” hscript to retrieve the current value of the ordered menu, it will only return the index number of the current item as picked in the ordered menu.
how to retrieve the string that the current index in the ordered menu represents?
e.g. in the ordered menu, 0 means north, 1 means east, 2 means south, and 3 means west. how to retrieve the string of “north” etc instead of their respective index number?
Thanks!
you suggestion is exactly what I'm looking for!
May i ask another question based on this:
if I “chs” hscript to retrieve the current value of the ordered menu, it will only return the index number of the current item as picked in the ordered menu.
how to retrieve the string that the current index in the ordered menu represents?
e.g. in the ordered menu, 0 means north, 1 means east, 2 means south, and 3 means west. how to retrieve the string of “north” etc instead of their respective index number?
Thanks!
- rdg
- Member
- 401 posts
- Joined:
- Offline
- mawi
- Member
- 242 posts
- Joined: Jan. 2008
- Offline
oatDont know if this is the best way…
dear mawi, thank you very much!
you suggestion is exactly what I'm looking for!
May i ask another question based on this:
if I “chs” hscript to retrieve the current value of the ordered menu, it will only return the index number of the current item as picked in the ordered menu.
how to retrieve the string that the current index in the ordered menu represents?
e.g. in the ordered menu, 0 means north, 1 means east, 2 means south, and 3 means west. how to retrieve the string of “north” etc instead of their respective index number?
Thanks!
attribs = hou.pwd().geometry().primAttribs()
index = hou.evalParm(“orderdmenu”)
print attribs.name()
-
- Quick Links