Is it possible to set an expression as a default value on a int or float while creating a paramTemplate.
At the moment i am trying to set the default value through the default_value argument. Unfortunately this creates an error as it expects an float/int.
So far the only way I have found is setting the expression after the ui has been created.
Example code:
This works fine! But I have to first apply the parm template before being allowed to turn it into an expression.
(which i preferbly do not want to do)
>>> obj = hou.node('obj')
>>> geo = obj.createNode('geo')
>>> null = geo.createNode('null')
>>> parmTemplateGrp = null.parmTemplateGroup()
>>> # here we create our float parm template
>>> hou_parm_float = hou.FloatParmTemplate("expressionTest", "works", 1, default_value=([0]), look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.Base1)
>>> parmTemplateGrp.append(hou_parm_float)
>>> null.setParmTemplateGroup(parmTemplateGrp)
>>> myParm = null.parm('expressionTest')
>>> myParm.setExpression('$TX')
This errors out. As it expects a value.
>>> hou_parm_float = hou.FloatParmTemplate("expressionTest", "fails", 1, default_value=(["$TX"]), look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.Base1)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.623/houdini/python2.6libs\hou.py", line 13723, in __init__
this = _hou.new_FloatParmTemplate(*args, **kwargs)
TypeError: in method 'new_FloatParmTemplate', argument 4 of type 'std::vector<double,std::allocator<double > > const &'
Does anyone have any ideas on how to solve this one ?
Thanks!
Jan
Edited by Jan_red, 20 June 2012 - 02:55 PM.










