python – how to check if input exist when creating node?

Hi i’m trying to do some action when a gizmo is created , based on whether this Node has its input connected to something or not. So i use addOnUserCreate() or addOnCreate() and code like :

Code:

if nuke.thisNode().input(0) !=None :
  plan A
else :
  plan B


before i call this gizmo, i select something on DAG, so when the gizmo is created, it will automatically connect its input to what previously selected. But i always got ‘plan B’ as result. Seems that the connecting process is done just after the oncreate() is called. Is ther any way out?

thanx

No Responses to “python – how to check if input exist when creating node?”

Post a Comment