Hi there,
I am working on a video for a client comprising many separate, but inter-related, scenes. Each of these scenes, for workflow management reasons, are generated by discrete Houdini projects with frame sequences rendered out using Redshift. However, most of these projects use the same set of objects (many of which are instanced onto surfaces) that have a common set of parameters across all projects (e.g. colour, number of instances, object size, etc).
The issue that I have is how to efficiently update globally this common set of parameters across these multiple projects.
At the moment I have set up a null object with a parameter interface that defines these global parameters, which are then referenced by the various components comprising the given scene. I then copy this “global parameters” null from one Houdini project to another (each of which likewise have the same set of components reference the correct parameters). This obviously is very labour intensive and prone to error when dealing with a large number of Houdini projects.
Is there a means of defining these parameters in a project independent way, and then importing these parameter settings into each project automatically? I am sure there must be some sort of mechanism for doing this, but haven't hit upon it yet. Any suggestions would be very much appreciated.
FYI. I am using Houdini 18.0.566 with RS 3.0.28 on a Windows 10 workstation.
Thanks in advance.
Peter
Update a common set of parameters across multiple projects?
3614 9 4- peter_i
- Member
- 11 posts
- Joined: 10月 2016
- Offline
- bonsak
- Member
- 459 posts
- Joined: 10月 2011
- Offline
- CYTE
- Member
- 669 posts
- Joined: 2月 2017
- Offline
- peter_i
- Member
- 11 posts
- Joined: 10月 2016
- Offline
- tshead
- Member
- 62 posts
- Joined: 9月 2014
- Offline
Peter:
Replace the hard-coded values in your global parameters nulls with Python expressions that read data from disk in the format of your choice (I’d use JSON). A quick example:
If you have lots of parameters and worry about repetitive code / hitting the disk more than once, then load and cache the parameters in the session module (use Window > Python Source Editor to modify it) for your hip file, and access the cached results in your expressions.
Cheers,
Tim
Replace the hard-coded values in your global parameters nulls with Python expressions that read data from disk in the format of your choice (I’d use JSON). A quick example:
import json import os.path path = os.path.join(hou.getenv("HIP"), "parameters.json") with open(path, "rb") as stream: config = json.load(stream) return config["foo”]
If you have lots of parameters and worry about repetitive code / hitting the disk more than once, then load and cache the parameters in the session module (use Window > Python Source Editor to modify it) for your hip file, and access the cached results in your expressions.
Cheers,
Tim
- peter_i
- Member
- 11 posts
- Joined: 10月 2016
- Offline
Thanks Tim, that's another very interesting idea!
Apologies in advance, but being a complete novice when it come to Python and its use within Houdini, I have a few follow-up questions:
Cheers,
Peter
Apologies in advance, but being a complete novice when it come to Python and its use within Houdini, I have a few follow-up questions:
- Using your method, would I still be able to retain the user-friendly functionality of the global parameters null UI to set/update values (there are a total of ~60 parameters with a ~50:50 split between colour information and other numeric values)?
- Assuming that I can retain the UI functionality, then how would I export these parameters to the JSON file - either to begin with, or if some parameters subsequently get changed?
- Where exactly/how would your Python code snippets be incorporated into the UI to replace the hard-coded values?
Cheers,
Peter
- mrCatfish
- Member
- 731 posts
- Joined: 12月 2006
- Offline
This is definitely the way I'd do it. One light-weight text file you can edit in seconds and immediately update every scene. If you don't want a scene to update or want to lock it to a different scheme, you just need to put an env file further up the HOUDINI_PATH. (I'm don't use env files, but do similar things by pushing env vars out through our env management system.)
A crude way could be to put the common parameters in your env file:
MY_START_FRAME = 0
MY_END_FRAME = 250
etc
And just reference the env vars in your different files like this:
$MY_START_FRAME
$MY_END_FRAME
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
CG Supervisor
Machine FX - Cinesite MTL
- tshead
- Member
- 62 posts
- Joined: 9月 2014
- Offline
peter_i
- Where exactly/how would your Python code snippets be incorporated into the UI to replace the hard-coded values?
Instead of entering a value for a parameter, you can enter an expression, see https://www.sidefx.com/docs/houdini/network/expressions.html [www.sidefx.com]
peter_i
- Using your method, would I still be able to retain the user-friendly functionality of the global parameters null UI to set/update values (there are a total of ~60 parameters with a ~50:50 split between colour information and other numeric values)?
- Assuming that I can retain the UI functionality, then how would I export these parameters to the JSON file - either to begin with, or if some parameters subsequently get changed?
Not sure about this one, I was assuming a read-only file with relatively static parameters. Perhaps what you want is a digital asset?
Tim
Edited by tshead - 2020年9月17日 09:46:46
- peter_i
- Member
- 11 posts
- Joined: 10月 2016
- Offline
- peter_i
- Member
- 11 posts
- Joined: 10月 2016
- Offline
Everyone,
Just tried the HDA method and it works like a dream!
The steps used were:
So now, whatever project I am working on, if I decide to change something globally, I just need to unlock the HDA, dive inside and change one or more settings, jump back out and perform “Save Node Type” and “Match Current Definition” on the HDA. The changes will be reflected across all the other projects.
Thanks to Tim and tamte specifically for the HDA suggestions/details and, once again, to everyone else for their excellent ideas!
All the best and keep safe,
Peter
Just tried the HDA method and it works like a dream!
The steps used were:
- Wrapped the “global_parameters” null into a subnet.
- Converted the subnet to an HDA with some meaningful label and saved the HDA to the scanned asset library (e.g. in C:\Users\<username>\houdini18.0\otls). N.B. no promotion of parameters is required.
- In the existing projects, installed the new HDA and then replaced the old “global_parameters” null with the above HDA.
- Used the opchange Hscript command to convert all references to “global_parameters” to (e.g.) “my_HDA/global_parameters”.
So now, whatever project I am working on, if I decide to change something globally, I just need to unlock the HDA, dive inside and change one or more settings, jump back out and perform “Save Node Type” and “Match Current Definition” on the HDA. The changes will be reflected across all the other projects.
Thanks to Tim and tamte specifically for the HDA suggestions/details and, once again, to everyone else for their excellent ideas!
All the best and keep safe,
Peter
-
- Quick Links