Callback script not executing when parm toggled with code

   6912   8   3
User Avatar
Member
322 posts
Joined:
Offline
Hello,

If I have a checkbox with a python callback script on it, how do I get that callback script to execute when toggling that checkbox via python?!

So I'm toggling the checkbox just with myParm.set(1) for example, but it refuses to execute the python callback attached to the parm ‘myParm’ (callback executes fine when manually toggling the checkbox).

Thanks!

Dean.
User Avatar
Member
2658 posts
Joined: June 2008
Offline
I just ran into this problem the other day. You can't set parameters on yourself.

Add a new python node and put the set code in that node and you will be able to trigger the other node's parameter.

It is probably to avoid some cyclic issue…?
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
322 posts
Joined:
Offline
The parameter triggers fine, I can turn the checkbox on and off via code but the callback associated with it won't execute.

I don't think its a cyclic thing as checking the checkbox from the python shell also has the same result, the checkbox gets checked, but the callback attached to the checkbox is not executed.
User Avatar
Member
1926 posts
Joined: Nov. 2006
Online
You need to manually trigger the callback with hou.Parm.pressButton()
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
322 posts
Joined:
Offline
You are correct!

Captain Hammy strikes again! Nice one Cap.
User Avatar
Member
388 posts
Joined: July 2018
Offline
same problem here but i am trying to trigger the callback script from TOPs

Attachments:
evaluate_callback_script.hip (156.7 KB)

User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
papsphilip
same problem here but i am trying to trigger the callback script from TOPs


this seems to work, when you cook the workitems.
User Avatar
Member
388 posts
Joined: July 2018
Offline
Andr
papsphilip
same problem here but i am trying to trigger the callback script from TOPs


this seems to work, when you cook the workitems.

yes you're right! didn't think to cook, i was expecting a live update as i click through the workitems.
Seems the python script runs only when we cook the node
User Avatar
Member
388 posts
Joined: July 2018
Offline
so after cooking i realised this method is actually not working.

After the python script in my original scene file i attach a rop geometry output and the python script runs for every workitem before that, so when the geometry output saves out my mesh the callback script is not being evaluated.

In order for the callback script to be called every time a workitem is saved to disk i had to write the same python script inside the Rop geometry output-->Scripts-->Pre-Render Script set to python.

This is working for now.

If anyone has a better idea please let me know
Edited by papsphilip - Oct. 22, 2021 13:11:10

Attachments:
evaluate_callback_script.hip (254.6 KB)

  • Quick Links