Mariusz Szaflik

mariusz.szaflik

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Expressions python scripting 2020年3月29日5:42

I'm still strugling with it, as You mentioned I'v created callback function:
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;
but then the error pops in:
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)).
(related line is : node = kwargs)

What I'm doing wrong ?
bellow screnshots of what I'v done.

Expressions python scripting 2020年3月25日4:22

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 this
node = kwargs['node'];parm = node.parm('snake_lr').getReferencedParm();parm.set(0.0)
or
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 :/)