How to modify HDA context visibility with python?

   1495   7   2
User Avatar
Member
43 posts
Joined: 4月 2012
Offline
Hi!

I'm generating my own HDA with python and everything works fine, except I can't see it in context menu. Easy to fix by removing HDA_TABLE_AND_NAME and set VOP checkbox in my case.

But how to do this with python automatically during HDA creation?
It looks like there is a tool inside HDA definition, which I suppose to be able to access and modify, but can't find a way.
Edited by miklem - 2023年12月12日 09:22:21

Attachments:
HDA_Visibility.PNG (36.0 KB)

User Avatar
Member
274 posts
Joined: 7月 2013
Offline
if you check the output of

hou.Node("/obj/yourHDA").asCode()

You might find some clues of what to set with python.
Edited by Jonathan de Blok - 2023年12月12日 17:21:45
More code, less clicks.
User Avatar
Member
43 posts
Joined: 4月 2012
Offline
Thank you, but unfortunately this doesn't help.
asCode() generates code to spawn HDA with parameters set. Therefore it means that context tool I`m looking in is i HDA definition
User Avatar
Member
274 posts
Joined: 7月 2013
Offline
The HDA definition is also in there if I'm not mistaken. Maybe you have to pass some extra arguments but even the UI, extra scripts etc are/should be all there in the output.

And vaguely remember something about the HDA needing to be in unlock for this..
More code, less clicks.
User Avatar
Member
43 posts
Joined: 4月 2012
Offline
I checked API and found nothing that might help. Actually it looks like a bug or someone forgot to add API connection for this thing. I could add my HDA to the shelf and spawn it from here, for sure, but this is not an option, since I have a lot of HDAs.

Need a old_school power here
Edited by miklem - 2023年12月13日 11:03:04
User Avatar
Member
1922 posts
Joined: 11月 2006
Offline
This post might be helpful as things don't seem to have changed and any creation of HDAs via Python does not generate the default tool by default: https://www.sidefx.com/forum/topic/85634/ [www.sidefx.com]

To basically change things after the fact you're pretty much forced to take the contents of the Tools.shelf section, parse the XML into a structure you can manipulate, add/modify whatever settings you want, then set the resulting data back to the definition.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
43 posts
Joined: 4月 2012
Offline
This looks like exactly the thing I need. I will give it a try, thank you!
User Avatar
Member
43 posts
Joined: 4月 2012
Offline
Okay, I made it work!
First here is the documentation
https://www.sidefx.com/docs/houdini20.0/shelf/config_file [www.sidefx.com]

Graham, I then took your code, and modified this part, by adding <contextNetType>VOP</contextNetType>.

<toolMenuContext name="network">
<contextOpType>table/operator</contextOpType>
<contextNetType>VOP</contextNetType>
</toolMenuContext>

Also for someone looking for the topic, there is relevant discussion
https://www.sidefx.com/forum/topic/40864/?page=1#post-183147 [www.sidefx.com]

Thank you for help.
Edited by miklem - 2023年12月14日 05:45:10
  • Quick Links