Can't access to geometry on OnCreated hda event

   1694   2   1
User Avatar
Member
241 posts
Joined: Oct. 2015
Offline
Hello,

I want to access to my geometry on the “OnCreated” event of my HDA.
But it doesn't work on this event but work on the PythonModule (script function call with a button) ??

Here is the log for the same code :
- OnCreated event log :
  • OnCreated() currentNode = AtWr_BBox
    OnCreated() currentNode.type() = <hou.SopNodeType for Sop attribwrangle>
    OnCreated() geo = None

    - PythonModule log :
    currentNode = AtWr_BBox
    currentNode.type() = <hou.SopNodeType for Sop attribwrangle>
    geo = <hou.Geometry in /obj/box_object1/uvcubic1/AtWr_BBox>


    So, how can I access to my geometry in the OnCreated event ?
    Thank you.

Attachments:
screenshot_01.jpg (48.7 KB)

User Avatar
Member
241 posts
Joined: Oct. 2015
Offline
Ok, As I understand, it seems that on this “OnCreated” event, my new created hda node isn't yet connected.
That's why I can't get geometry() from my current new node and of course, it isn't cooked.

I don't see any event on the list that match my need (= “OnCreated” + just connected) .
Did I miss something or do you know a workaround ?

Thanks.
User Avatar
Member
241 posts
Joined: Oct. 2015
Offline
As a workaround to simulate a “OnCreated” + just connected event :
I use the “OnInputChanged” event, and use an invisible toggle parameter to make sure I execute my operation once.

createdHdaNode = kwargs

thisIsTheFirstConnection = createdHdaNode.evalParm(“neverConnectedBefore”)
if thisIsTheFirstConnection :
#set parameter to false to never execute again this operation
createdHdaNode.setParms({“neverConnectedBefore”: 0})

#some stuff
#….
I'm not sure if it's the best solution but it works and it's relatively easy to set up.
  • Quick Links