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
Ideas for new Python tool
2025 5 1- Iamgroot93
- Member
- 51 posts
- Joined: Feb. 2016
- Offline
- anon_user_89151269
- Member
- 1755 posts
- Joined: March 2014
- Offline
- Iamgroot93
- Member
- 51 posts
- Joined: Feb. 2016
- Offline
inhidingThank 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:
Hey Alice,
If this is up your alley, a button equivalent to pressing all those three at once would be cool.
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
- Member
- 1755 posts
- Joined: March 2014
- Offline
- anon_user_00157425
- Member
- 45 posts
- Joined: Feb. 2014
- Offline
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.
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
- Member
- 51 posts
- Joined: Feb. 2016
- Offline
-
- Quick Links