I was wondering if anyone knew the syntax of getting multiple lines of python to execute in a toggle parameters callback section.
The following code works if only one ‘if’ statement is used, but not both:
if (kwargs['node'].parm("switch_toggle").eval() == True): kwargs['node'].parm("switch_selection").set(1)
or
if (kwargs['node'].parm("switch_toggle").eval() == False): kwargs['node'].parm("switch_selection").set(0)
From some searching I found some references to using the semi-colon as a line separater so to get both ‘if’ statements in the callback script I used the semi-colon like:
if (kwargs['node'].parm("switch_toggle").eval() == True): kwargs['node'].parm("switch_selection").set(1); if (kwargs['node'].parm("switch_toggle").eval() == False): kwargs['node'].parm("switch_selection").set(0)
But this did not work as I get a syntax error message.
I know I could create a definition in the python source editor or create an hda ( which is actually how I have it in the original context.)
But to keep this post short in explaining, I cannot in this case use the python source editor nor create an hda.
Does anyone know if it's possible to do what I want? Point me in the right direction syntax wise?
The help is much appreciated, Thanks.
P.S. the file attached is using just one of the ‘if’ statements to show what it is I wish to accomplish.
This also needs to be done in H15 ( not sure if things have changed for H16 ).