creating spare properties in python

   4145   3   2
User Avatar
Member
29 posts
Joined: June 2012
Offline
I would like to translate this hscript into python:

opproperty -f $arg1 rman* ri_bezshutteropening

opproperty creates a spare property from a set of pre-defined properties. I can't find anything in the python API that seems to do that.

Do you have any hints?

Thanks
Chris
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
http://www.sidefx.com/docs/houdini13.0/hom/hou/ParmTemplateGroup [sidefx.com]

if you want to add an aditional parmto the UI


you need to open the
1 parmTemplateGroup of your node.

2 make the new parmTemplate. (is just an instance of the parameter type)

3 stick that parmTemplate into the parmTemplateGroup.

4 set that new parmTempalte back into your node.



example:
assuming in houdini there is a node obj/geo1

def test():
node = hou.node('/obj/geo3')
node_tg = node.parmTemplateGroup()

my_parm = hou.FloatParmTemplate(name=“bla”, label=“bla”,num_components= 1, default_value = )

node_tg.append(my_parm)

node.setParmTemplateGroup(node_tg)


nothing actually happen with the node, everything happen behind door in an area call templates, and when the last line setParmTemplateGroup is just moving all those changes to the front of the door .

as i understand if the name of the parameter match the name of the property will work.

naming a toggle parameter call vm_renderable (assuming the parm doesnt exist) will add the property renderable to the object. since mantra will read the parameter and check for the value.
User Avatar
Member
29 posts
Joined: June 2012
Offline
Thank Pelos.

Creating a new template from scratch is documented. I am looking for something slightly different.

In the “Edit Parameter Interface” there are a bunch of pre canned parameters in the “Render Properties” or “Node Properties” tab. These have predefined labels and are tagged with where they should be placed.

I want to script selecting one of those parameters in that dialog and pressing the right arrow button.

opproperty does that in hscript. If there is a python equivalent, it is not documented.
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
What about writing a custom Python function for doing that ?

for example put this code in the Python Source Editor :

def JKOPPROPERTY(node , category , pattern):
—-command = ‘opproperty -f -F Render ’
—-command = command + node + ‘ ’ + category + ‘ ’ + pattern
—-hou.hscript(command)


Then use this command every where that you wanna add properties :

hou.session.JKOPPROPERTY('obj/geo2','mantra*','*blur*')
https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
  • Quick Links