Search - User list
Full Version: Ideas for new Python tool
Root » Houdini Lounge » Ideas for new Python tool
Iamgroot93
Hi everyone, I've just started to learn some basic Python scripting. I'm currently a student and I'm experimenting with Python. I'm thinking to develop a tool that could simplify or share more data in the passage between Houdini and Nuke.
But I'm not sure if this will be the right path to take.

I just wondered if anyone had any suggestions for repetitive or boring tasks that I could implement with a Python shelf tool? Or there is any tool that you think it's missing from Houdini?

Thank you so much,
Alice
anon_user_89151269
Hey Alice,
If this is up your alley, a button equivalent to pressing all those three at once would be cool.
Iamgroot93
inhiding
Hey Alice,
If this is up your alley, a button equivalent to pressing all those three at once would be cool.
Thank you for the suggestion. I've been trying for the last few days to create it, but it's a little more complicate than i thought. I reverse engineer the geometry node and this is the code for one of the scale button:

hou_parm_template2 = hou.FloatParmTemplate(“s”, “Scale”, 3, default_value), min=0, max=10, min_is_strict=False, max_is_strict=False, look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.XYZW)
hou_parm_template2.setTags({“autoscope”: “1111111111111111111111111111111”, “script_action”: “import objecttoolutils\nobjecttoolutils.matchTransform(kwargs, 2)”, “script_action_help”: “Select an object to match the scale with.”, “script_action_icon”: “BUTTONS_match_scale”})
hou_parm_template.addParmTemplate(hou_parm_template2)


But I'm having trouble to get the name of the specific button. I'm going to keep trying for the next days. Hope I'll make it.

Thank you again for the suggestion
anon_user_89151269
Hopefully Mark (mtucker) will see this and chime in to help. Or someone else…
anon_user_00157425
Those are called “Action Buttons”, with HDA's they can be found under the Parameter Description, in the Action Button tab. Starting with H16 I believe, they can also be implemented with Parameter Tags, as you've done with…

hou_parm_template2.setTags({“autoscope”: “1111111111111111111111111111111”,
“script_action”: “import objecttoolutils\nobjecttoolutils.matchTransform(kwargs, 2)”,
“script_action_help”: “Select an object to match the scale with.”,
“script_action_icon”: “BUTTONS_match_scale”})

All that said, they are not parameters. So you can't call pressButton() them AFAIK. You can however, get the “script_action” string and call it with exec or eval(python built-ins to run an arbitrary string as python code I forgot exactly how or which call). Or you can copy and paste the “script_action” string into your python code (as regular python code).

All the action button does is call matchTransform() in objecttoolutils module. matchTransform(node=hou.pwd(), parmTuple : hou.pwd().parm('s')) may work, though if I recall the kwargs argument isn't **kwargs in some Hou modules, I could be totally wrong about that though. matchTransform({node : hou.pwd(), parmTuple : hou.pwd().parm('s')}, 2) should work though.

kwargs is a dict passed to all sorts of UI items, its pretty easy to recreate, the errors should tell you exactly what the function wants.
Iamgroot93
Just saw your replay
Thomas Bishop
Qu
.

Thank you so much
I'll try it. I'm pretty new in all the scripting world so I'm pretty bad at the moment, but hope I'm going to improve.
Thank you again
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB