Hey guys!
I'm building a HDA that uses python code and I can't figure out how to make the HDA node error in a houdini-esque fashion.
i.e. the HDA's file parm pointing to an unreadable file.
Whenever I manage to make it error, the python console appears, making it look to the user, like the code crashed.
These are the things I've tried:
1. Python node inside the HDA's graph, connected to its output node:
Errors get propagated properly, but on the first cook, the python node does not pass through its incoming geometry.
Also this setup can lead to unwanted recooks, when the python node changes nodes upstream.
2. Python node inside the HDA, but not part of its graph. The python node is one of the HDA's message nodes, to propagate its error upwards and is force cooked through callbacks from the HDA's parms:
The propagated errors appears as warnings on the HDA node and the python console comes up, stating that the node being ‘callbacked’ has errored.
3. Python module raising NodeError:
The HDA errors as expected, but also the python console appears, making it look like the HDA crashed, rather than a user error.
4. Python node or Python module driving an “error” node inside the HDA's graph.
As soon as the HDA is locked, attempting to change the error through python results in a permission error.
Making the “error” node editable, would allow user interference.
I will try adding invisible parms to the HDA, driving those through python and referencing them from the error node, but this feels like an elaborate and dirty workaround.
There surely must be a way to make an HDA node error without raising the console, but how?
Kindly,
-Sascha
Python in HDA - how to NodeError without bringing up console?
5352 8 2- saschaherfort
- Member
- 26 posts
- Joined: April 2009
- Offline
- jsmack
- Member
- 7733 posts
- Joined: Sept. 2011
- Offline
- saschaherfort
- Member
- 26 posts
- Joined: April 2009
- Offline
Here's an example.
Is this case it only brings up the python console with the error and doesn't even show it on the node.
I understand that the error printed, is because the callback failed, but how else to run code from the python module, if not through a callback from a parm?
Is this case it only brings up the python console with the error and doesn't even show it on the node.
I understand that the error printed, is because the callback failed, but how else to run code from the python module, if not through a callback from a parm?
Edited by saschaherfort - May 17, 2019 14:43:41
- jsmack
- Member
- 7733 posts
- Joined: Sept. 2011
- Offline
- saschaherfort
- Member
- 26 posts
- Joined: April 2009
- Offline
Yes I got NodeErrors just fine, when using a python inside the HDA, but then it fails to pass through its incoming geo on the first cook.
Also my python code modifies nodes upstream, so this may cause a recook loop.
When I tried having the python sop outside of the HDA's main graph and have it be a message node, the errors would only show up as warnings on the HDA.
Also force cooking the python sop with a callback brings up the console again.
I finally used an error sop with references to invisible parameters on the HDA, but that feels like it can't be the ‘official’ way.
Also my python code modifies nodes upstream, so this may cause a recook loop.
When I tried having the python sop outside of the HDA's main graph and have it be a message node, the errors would only show up as warnings on the HDA.
Also force cooking the python sop with a callback brings up the console again.
I finally used an error sop with references to invisible parameters on the HDA, but that feels like it can't be the ‘official’ way.
Edited by saschaherfort - May 17, 2019 15:14:22
- aeaeaeae
- Member
- 126 posts
- Joined: Aug. 2010
- Offline
- Unai
- Member
- 17 posts
- Joined: Feb. 2014
- Offline
saschaherfort
I finally used an error sop with references to invisible parameters on the HDA, but that feels like it can't be the 'official' way.
I’m very interested in this. Did that result in a proper clean error, i.e. not an Invalid Source or a warning, which are the two things I’m getting over and over? If so, could you let me know which parameters you linked?
Thanks in advance!
- saschaherfort
- Member
- 26 posts
- Joined: April 2009
- Offline
Unaisaschaherfort
I finally used an error sop with references to invisible parameters on the HDA, but that feels like it can't be the 'official' way.
I’m very interested in this. Did that result in a proper clean error, i.e. not an Invalid Source or a warning, which are the two things I’m getting over and over? If so, could you let me know which parameters you linked?
Thanks in advance!
This is my setup that will make the node error without raising the python console:
- my HDA contains an error node hooked up just before the 'output' node
- it also has invisible custom parameters for the error toggle and message that are being referenced by the error node
- the HDA script (inside the 'edit operator type' window) changes these parameters when required
IIRC, editing the parameters on the error directly, or from a python SOP inside the HDA resulted in a permission error. Hence the workaround through custom parameters and the HDA python module.
It still proclaims 'invalid source', but since the python console no longer pops up, it seems to not look like a bug/crash to other users anymore.
Edited by saschaherfort - July 5, 2021 12:52:10
- Unai
- Member
- 17 posts
- Joined: Feb. 2014
- Offline
-
- Quick Links