Hi Everyone,
Is it possible to call a function defined in the codes section of a python SOP node on pressing a button of the same node.?
Thanks a lot in advance.
Calling a function on button press
6172 4 1- Raavenish
- Member
- 52 posts
- Joined: June 2009
- Offline
- graham
- Member
- 1906 posts
- Joined: Nov. 2006
- Offline
Technically it is possible to do something like this using exec() on the contents of the assets “PythonCook” section but it won't really work and will raise an exception in 99% of cases.
The correct way is to define the function in the PythonModule and then have your cook code and your button callback access it from there.
The correct way is to define the function in the PythonModule and then have your cook code and your button callback access it from there.
Graham Thompson, Technical Artist @ Rockstar Games
- Raavenish
- Member
- 52 posts
- Joined: June 2009
- Offline
- caleb
- Member
- 30 posts
- Joined: July 2005
- Offline
- aeaeaeae
- Member
- 126 posts
- Joined: Aug. 2010
- Online
Dead thread, but still an issue. They should really get a Stackoverflow running for houdini since some questions remains relevant for a long period.
The issue with calling a HDA method with a callback is that errors won't be raise on the node but straight to the console. Workflow wise this can be rather confusing.
The issue with calling a HDA method with a callback is that errors won't be raise on the node but straight to the console. Workflow wise this can be rather confusing.
-
- Quick Links