Jean Christophe Whisperer

theratos

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

How change "type properties" with python for DA 2016年2月20日15:45

So ok, I can have token and label of my menu (already created) :

>>>a = hou.parm('/obj/characters/menu_parm')
>>>a.menuItems()
('0', ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’)
>>>a.menuLabels()
('Zero','One', ‘Two’, ‘Three’, ‘Four’, ‘Five’, ‘Six’)
In the doc help I found this :
Parameter menu scripts

You can use Python to generate dynamic parameter menus. The script must return a list of strings, where the even strings are internal names, and the odd strings are labels, for example . (This strange design is an unfortunate analogy to the output of the equivalent Hscript.)

If a Python menu script contains only one line, Houdini evaluates it as a Python expression. If it contains multiple lines, Houdini evaluates it as a function body. This behavior is the same as for Python parameter expressions.

For example, to generate a menu of Object-level digital assets using Python:
result =
for tool in hou.shelves.tools().values():
node_type_name = tool.toolMenuOpType(hou.paneTabType.NetworkEditor)
if (node_type_name.startswith(“Object/”) and
‘Digital Assets’ in tool.toolMenuLocations()):
result.append(tool.name())
result.append(tool.label())
return result

In an asset, you can put the code that generates the menu into a function in the asset’s PythonModule section (e.g. a generateMenu function) and call that function in the menu script hou.pwd().hdaModule().generateMenu()
The problem is that I understand not too code provided by the documentation and how to adapt in my case :? create a procedural “ordered menu” with :
menu Items = ('0', ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’)
menu Labels 'Zero','One', ‘Two’, ‘Three’, ‘Four’, ‘Five’, ‘Six’) .

Indeed when I type the code of the doc in the tab menu script for my menu ordered it I created a menu with 1 single input ‘characters’ (the name of my digital asset…)

How change "type properties" with python for DA 2016年2月18日15:06

How do I change parameters in “edit operator type properties” with python for a digital asset ?

Hello,

In fact, I would like to change with python the menu items (token and label) for a procedural “ordered menu”.

Thanks

How to set parmTuple with list in python ? 2016年1月8日17:49

Thanks for your help. It works…

I can retrieve each tuple of my list…


>>>Liste =
>>> a = hou.parmTuple(path_diffuse + ‘/diff_color’)
>>> a.set(eval(Liste))
>>> a.set(eval(Liste))
>>> a.set(eval(Liste))
>>> a.set(eval(Liste))