seando

seando

About Me

Connect

LOCATION
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Python Expression on Button Running Twice Oct. 5, 2015, 5:44 p.m.

Thank you sir, that works beautifully! It does exactly what I want and it is saved in my preset.

It's a bit of a workaround to the expression running twice on the button. I'll look into sending a bug report about it since it doesn't seem intentional.

Python Expression on Button Running Twice Oct. 5, 2015, 4:55 p.m.

Before I spend the time trying to get the multiline function into what looks like a single string to attach via setUserData, it doesn't seem like the userData is able to be saved in a preset, being node specific data.

To test, I have my null, created a simple userData test, saved it as a preset, then made a new null, applied the new preset and here is what I got:

>>> hou.node('/obj/break_geo/null3').setUserData(“foo”, “print ‘user data test’”)
>>> hou.node('/obj/break_geo/null3').userDataDict()
{'___Version___': ‘14.0.361’, ‘foo’: “print ‘user data test’”}
>>> hou.node('/obj/break_geo/null4').userDataDict()
{}

Python Expression on Button Running Twice Oct. 2, 2015, 8:59 a.m.

Thank you for the idea. I just gave it a try. Unfortunately, the keyframe is what makes the expression work.

To test, I:
- made a brand new button
- right click > Expression > Edit Expression
- add my stupid print test statement
- right click > Expression > Change Language to Python
- click the button

It still prints twice. Not only that, I noticed while I was testing that by doing (right click > Expression > Edit Expression) it adds a keyframe. I can confirm by checking (right click > Channels and Keyframes) and looking at whether Set Keyframe is grayed out or not. Before I created the expression, Set Keyframe is an enabled option while Remove Keyframe is disabled. After I added the expression and change the language, the reverse is true.

If I am remembering correctly, expressions (hscript and python) are run by keyframes and the keyframe is what tells Houdini to evaluate something other than the default value of the parameter. In this case, it's what tells the button to perform some action.