[Sidefx-houdini-list] problem using hom setExpression from callback script

Daniel Flood daniel.flood at drdstudios.com
Sun Sep 11 02:46:02 EDT 2011


Hey folks,

I'm setting an expression via hou.node().parm().setExpression(), and I have
a problem where the parameter expression evaluates correctly, however when
triggered from a callback script (either code in a shelf button, or a parm
gui callback script), I the node goes red and shows the following error:
"Channel Evaluation Error Bad data type for function or operation"

here's my callback:

hou.node("/obj/null1").parm("parm").setExpression("ifs(strcmp('foo','foo')==0,'true','false')",
hou.exprLanguage.Hscript)

This expression evaluates error free if ran from the hython shell, however
if called back from a shelf button, if throws up a red node / MMB click
error (note that the parm is actually being evaluated correctly).  I did
notice that the following expression when set by the same method evaluates
without any error:

hou.node("/obj/null1").parm("parm").setExpression("if(strcmp('foo','foo')==0,1,2)",
hou.exprLanguage.Hscript)

So it seems I am not doing a good job of declaring my data types as it seems
happy with integers and not strings. Could this be because strcmp returns an
integer, I'm mixing up data types? If so any suggestions for how I should do
it? Could this be some python parsing error, as the injected hscript
expression does evaluate correctly?

So I'm at my wit's end on this...any ideas would be greatly appreciated!
even the example on the sidefx docs seem to show mixing data types in an
"ifs" statement: http://www.sidefx.co...expressions/ifs

cheers,
Dan



More information about the Sidefx-houdini-list mailing list