In the parameter interface editor you can export/import selected parms to a dialogscript (.ds) file. But I can't find any documentation, besides a few vague mentions, on how to do this with python/hscript.
Any clues?
Install dialogScript (*.ds) files using python/hscript
611 4 1- Jonathan de Blok
- Member
- 274 posts
- Joined: 7月 2013
- Offline
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Online
- Jonathan de Blok
- Member
- 274 posts
- Joined: 7月 2013
- Offline
- Jonathan de Blok
- Member
- 274 posts
- Joined: 7月 2013
- Offline
graham
You could create an empty hou.ParmTemplateGroup and then use setToDialogScript() to load the saved parameters. After that you can get the entries and add them to the parm template group of the node/definition you're trying to install them to.
Thanks, didn't see your reply until after I posted my own answer
More code, less clicks.
- Jonathan de Blok
- Member
- 274 posts
- Joined: 7月 2013
- Offline
and for future reference:
import hou #target node node = hou.node('/obj/box1') cur_group=node.parmTemplateGroup() #load and use scriptdialog file ds_file="e:/test.ds" new_group = hou.ParmTemplateGroup() new_group.setToDialogScript(hou.readFile(ds_file)) #add all groups from dialogfile to node for index, group in enumerate(new_group.parmTemplates()): #tag them with ds file and index so we can detect if they are already added tags=group.tags() tags["ds_file"]=f"{ds_file}_{index}" group.setTags(tags) #check current groups if they already have a group with this tag, if so don't add again if not len([i for i in cur_group.parmTemplates() if "ds_file" in i.tags() and i.tags()["ds_file"]==f"{ds_file}_{index}"]): cur_group.append(group) #finally apply group to node node.setParmTemplateGroup(cur_group)
Edited by Jonathan de Blok - 2024年6月19日 17:49:09
More code, less clicks.
-
- Quick Links