Jump to content
Sign in to follow this  

Run anaconda env and use settings file generated in PDG

Recommended Posts

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]+'"'
        strv = '"'+q+'"'+":"+str(vars[q])


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! 


Edited by forbidden14

Share this post

Link to post
Share on other sites

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!



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this