I've managed to get a Checkbox in the Paramater Interface (via Type Properties) to call a PythonModule script like this from the callback (in Python mode)…
kwargs.hdaModule().wholeNumbers()
and this in the “Script” tab/file (for PythonModule)…
def wholeNumbers():
print “wholeNumbers”, hou.ch(“whole”)
I would like to change the type of the accompanying ‘float’ slider to ‘integer’ depending on the toggle so it doesn't show decimals while ‘whole’.
Alternately is it possible to override the float to be whole numbers while changing it without a possible recursive loop? Anything like an increment value for floats even?
Anyway I've also made this modification so far. Is this the best way to get the node reference into there?
def wholeNumbers(kwargs):
print “wholeNumbers”, hou.ch(“whole”)
node = kwargs
print node.name()
and from the Script callback
kwargs.hdaModule().wholeNumbers(kwargs)
Note: the hou.phm() route is not recommended in this situation.
But more importantly how to access other neighbouring parameters?
Still looking for the way to set it from there. I wished for something like “@parm = changes” here
doing this…
print node
or
print lvar('number')
complain with
TypeError: ‘ObjNode’ object has no attribute ‘__getitem__’
and
NameError: global name ‘lvar’ is not defined
respectively. Only hou.ch(“number”) gets the value but I can't figure out how to write to it?!
hou.ch(“number”) = newnumber
SyntaxError: (“can't assign to function call”, ('opdefObject/TestPI?PythonModule', 19, None, None))
and so only one argument would follow as the next error trying to pass in new-value to the function.