[Sidefx-houdini-list] problem using hom setExpression from callback script
daniel.flood at drdstudios.com
Sun Sep 11 03:05:17 EDT 2011
Both examples were used on the same parameter, which is a string. Entering
the expression into the parm (and also running it from the callback) does
result in correct evaluation, however there is a silent "red node" error
revealed on middle mouse click.
I tried running this instead:
And then the expression doesn't evaluate, i'm not sure this is correct as
the expression being set is in hscript and not python. Not sure how to do
the if statement as a one liner for a python expression.
2011/9/11 François Duchesneau <sidefx at trinix.ca>
> Just throwing ideas here. Do you mean when you type
> directly in your parameter it works?
> Also when you say that when you use
> it works, are you setting this expression in the same parameter as the ifs
> version that doesn't work? If yes, then it makes sense you've got an error
> if you're trying to set a string inside a float parameter for example.
> Also, make sure that when you set the expression via Python your parameter
> is actually evaluating a Python expression and not an Hscript.
> Hope this help.
> Daniel Flood wrote:
>> Hey folks,
>> I'm setting an expression via hou.node().parm().**setExpression(), and I
>> 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:
>> 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:
>> So it seems I am not doing a good job of declaring my data types as it
>> happy with integers and not strings. Could this be because strcmp returns
>> integer, I'm mixing up data types? If so any suggestions for how I should
>> 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
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
More information about the Sidefx-houdini-list