forbidden14 Posted September 24, 2022 Share Posted September 24, 2022 (edited) 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 Edited September 26, 2022 by forbidden14 Quote Link to comment Share on other sites More sharing options...
forbidden14 Posted September 26, 2022 Author Share Posted September 26, 2022 I've also got another question regarding anaconda envs in python: I've hacked my way through the previous part, now I'm trying to load the output "test.txt" file to run as a settings file in PDG. I've loaded my environment successfully, as I've output the values to work_item attributes. Now my issue is how do I run an external script in this PDG environment? I've tried copy pasting the .py file into python script and setting my environments custom python Bin and working directory, but it seems to get held on import cv2 (I've installed in env), even though I've just imported torch successfully. I've also tried to run a command in a python processor window, which cooks fine, but nothing happens. Anybody have any tips for this environment swap? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.