Jump to content
Sign in to follow this  
Shalinar

Python: OnInputChanged Double eval?

Recommended Posts

Has anyone else encountered an issue with an hda python module where the OnInputChanged evaluates twice? I'm not sure what's causing it... Even simple code in the module triggers it -- eg:

node = kwargs['node']
print node

^ I get two printouts of the node each time i change the input connection.

I originally noticed this when I was trying to query the connected input. When I did

node = kwargs['node']
input = node.inputs()[0]
print input

I would get an error saying the index was out of the tuple range, followed by a correct printout of the first input connection. The first eval seems to trigger before the connection is actually made, hence why it errors the first time through. Then the second eval triggers once it's connected. This is bizarre, and I haven't yet figured out what's causing it. Surely this isn't standard behavior.

Anyone else seen this or have ideas as to what's causing it?

Thanks,

 

Chris

Share this post


Link to post
Share on other sites

You can file a bug report to support@sidefx.com.

Or just protect against it.

try:
	node = kwargs['node']
	input = node.inputs()[0]
	can_continue = True
except:
	can_continue = False
if can_continue:
	print input

 

Share this post


Link to post
Share on other sites
1 hour ago, Atom said:

Or just protect against it.


try:
	node = kwargs['node']
	input = node.inputs()[0]
	can_continue = True
except:
	can_continue = False
if can_continue:
	print input

 

Thanks for getting back to me :) Try/except is exactly what I ended up doing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×