Jump to content

EventCallbackProblem


renderfan

Recommended Posts

Hello all!

I have Python Sop and inside node I have function to split some polygons. But because splitting takes long time I want to do it only if geometry of input does change. I tried to use hou.Node.addEventCallback but it does not work for me. What I have so far is code below:


event_types = (hou.nodeEventType.InputDataChanged, hou.nodeEventType.InputRewired)
def split_polygons(geo):
"do some splitting"
return polygons
def onchange(**kwargs):
node_in = kwargs["node"]
geo_in = node_in.geometry()
split_polygons(geo_in)

node.addEventCallback(event_types, onchange)
polygons = split_polygons(geo)
"do something with polygons"
[/CODE]

This does not work because I do not know how I can get the polygons which are returned by function only if input change.

Thank you in advance!!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...