Hey All,
I'm trying to customize a python settings.json file with int, float, bool, and sting values set up on a Null control with parameter sliders. I've read in the initial file I want to modify with a Json file, and have matched all the tags with the slider controls. I'm then collecting the tags into an array called query and trying to replace the original values in the .json with the slider control values. This is what I have so far (python novice), but I feel like there is a more solid way to do this. I know I'm not actually storing any files or values, I'm just printing to console for now
import hou
parentstr = '/obj/geo1/null1'
query = work_item.stringAttribArray("query")
vars = {}
for q in query:
parmstr = parentstr + "/" + q
transval = hou.parm(parmstr).eval()
vars[q] = transval
if isinstance(vars[q], str):
strv ='"'+q+'"'+':'+'"'+vars[q]+'"'
print(strv)
else:
strv = '"'+q+'"'+":"+str(vars[q])
print(strv)
There's also one section "animation_prompts" that goes one level deeper and would need some sort of formatting love where I need to indent and put in a few other lines.
Thanks in advance!
-Dana