Mariusz Szaflik
mariusz.szaflik
About Me
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Expressions python scripting March 29, 2020, 5:42 a.m.
I'm still strugling with it, as You mentioned I'v created callback function:
and the expresion looks like this:
but then the error pops in:
(related line is : node = kwargs)
What I'm doing wrong ?
bellow screnshots of what I'v done.
def mySuperFunction():
print("Test!");
node = kwargs['node']
parm = node.parm('spine_snake_lr').getReferencedParm()
parm.set(0.0)
and the expresion looks like this:
hou.pwd().hm().mySuperFunction();
return 0;
Error: Unable to evaluate expression (
Traceback (most recent call last):
File "<stdin>", line 2, in expression
File "opdef:/Object/tiger_rig_anim?PythonModule", line 3, in mySuperFunction
KeyError: ('node',)
(/obj/tiger_rig_anim1/reset)).
What I'm doing wrong ?
bellow screnshots of what I'v done.
Expressions python scripting March 25, 2020, 4:22 a.m.
tamte
create callback script for your Reset button
(not sure what the real name of your Snake L/R is called, so let me call it snake_lr)
python callback on Reset button would be something like:node = kwargs['node'] parm = node.parm('snake_lr').getReferencedParm() # to get the actual referenced parameter driving your snake_lr parameter parm.set(0.0) # to set to 0.0 # or you can do parm.revertToDefaults() to revert to defaults
you can do this as a function in hdaModule if your node is an hda and then just call that function in the parameter callback
or if you want to use it directly in the parameter callback you can compress it into one line like thisornode = kwargs['node'];parm = node.parm('snake_lr').getReferencedParm();parm.set(0.0)node = kwargs['node'];parm = node.parm('snake_lr').getReferencedParm();parm.revertToDefaults()
Something is wrong (or I'v put the script in he wrong place) but it shows something like this: (script language is set to python)
I'm missing some imports ? (from what I'v read in help kwargs should be accesible, so this is probably my fault :/)