DELETE NODE IN PYTHON INSIDE HDA

   1269   4   1
User Avatar
Member
125 posts
Joined: 6月 2008
Offline
Hi

How come I can create nodes inside an HDA with Python, but I cant delete them later ?

I need to dynamicaly create shaders on the fly, but need my material network not to get overcrowded with nodes after a few iterations. But I could'nt find a way to clean my network at the beggining of each new "cyle".

Any clue on how to workaround this annoying "cannot delete nodes while cooking" error?

THX
User Avatar
Member
8513 posts
Joined: 7月 2007
Offline
NAHASSIA
Any clue on how to workaround this annoying "cannot delete nodes while cooking" error?
why are you trying to delete nodes during cooking?
generally even creating nodes within Python SOP is a bad idea, can you move your code to HDA python module and execute it with a button press or a callback, or does it need to be all the time during cook?
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
125 posts
Joined: 6月 2008
Offline
Thanks tamte

Ok I get that its not a good idea, but.... it is working for createNode...
I'v tryed to call a kill conction on my HDA.module but as I call it from a python inside the hda it gives the same result
I will see if there is some other place where I could trigger this kill fonction. Somesthing like "on recook"
Any way thanks a lot for giving me a direction to where to look.
By the way, I'm not sure to undeerstand why it's a "bad idea"

cheers
User Avatar
Member
8513 posts
Joined: 7月 2007
Offline
NAHASSIA
I'v tryed to call a kill conction on my HDA.module but as I call it from a python inside the hda it gives the same result
yes, because you are still technically calling it from within the Python SOP evaluation which is during cook

NAHASSIA
By the way, I'm not sure to undeerstand why it's a "bad idea"
it may of course depend on your exact usecase, I just try to avoid any manipulation of live houdini file from within Python SOP and purely restrict its function to modifying the geometry that's being passed to output, as that's its purpose

modifying the scene outside of this scope can lead to all sorts of issues like triggering additional cooks, or even of the same node leading to infinite recursions or crashing
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
125 posts
Joined: 6月 2008
Offline
@tamte thx
  • Quick Links