how to trigger callback from another node without user chaning the parm

   3240   4   1
User Avatar
Member
9 posts
Joined: Oct. 2018
Offline
Hi,

I'm trying to check if the incoming point counts of a geometry changing with a python sop inside of an hda and set a parameter on the hda itself to say the point count changed so it can trigger the callback of that parm and do somethig. but the callback only works if user change the parm directly.

Thanks in advance.
Amir
Amir Khaefi Ashkezari
Senior FX Artist at PFX

https://github.com/Amir-Ashkezari/ [github.com]
https://www.linkedin.com/in/amir-ashkezari/ [www.linkedin.com]
User Avatar
Member
209 posts
Joined: March 2018
Offline
You can create an intermediate parameter which is controlled with Python script.
I create a simple HIP file with a self-contained digital asset which I probably does what you want.
In this HIP file changing number of points cause to Python SOP to call callback function in the embedded asset.
Hope it helps you!

Attachments:
Python Callback.hip (68.8 KB)

User Avatar
Member
9 posts
Joined: Oct. 2018
Offline
N-G
You can create an intermediate parameter which is controlled with Python script.
I create a simple HIP file with a self-contained digital asset which I probably does what you want.
In this HIP file changing number of points cause to Python SOP to call callback function in the embedded asset.
Hope it helps you!

Thanks a lot for taking the time to look into this.
I tried this method but in houdini17.5 when the python sop calls the method to do something which in my case is removing some nodes in the network editor it will errors out and saying can't destroy node while its cooking, so the callback inside python sop doesn't work in this case, what I'm after is when the new parm changes the old parm callback trigger which I attached the file.
If you try to change the old parm the callback will print hi but if you change the point numbers to drive new parm it won't trigger the callback.
Edited by AmirAshkezari - Sept. 9, 2019 16:46:38

Attachments:
Python Callback.hip (73.2 KB)

Amir Khaefi Ashkezari
Senior FX Artist at PFX

https://github.com/Amir-Ashkezari/ [github.com]
https://www.linkedin.com/in/amir-ashkezari/ [www.linkedin.com]
User Avatar
Member
209 posts
Joined: March 2018
Offline
You can call the callback function explicitly or just write all the code in Python SOP.
Can you post a HIP file which tells exactly what you want to achieve?
User Avatar
Member
5 posts
Joined: March 2020
Offline
The solution is quite simple, if you do it through the parameter UI, you can create a spare parameter button and link the target parameter. When the button is pushed, the target parameter callback script is called without changing the value.

Same logic through python. On a parameter object just execute the ".pressButton()" method.
Example:

hou.parm('/obj/smoke1/pyrosolver/solver').pressButton()

(I just had to solve this because when changing the (sop-pyro-solver's) solver mode through the ".set()" method, the callback script isn't triggered, which meant that the values on the solver for solving were not updated.)
Edited by megger - March 30, 2022 08:42:43
  • Quick Links