Help with Houdini Packages .json

   10692   15   1
User Avatar
Member
833 posts
Joined: Jan. 2018
Offline
I'm trying to wrap my head around the Houdini packages once and for all and I was wondering if someone here could offer some clarification on some things:

Question 1:

Most developers tend to want to use a variable to set up a directory, and then reference such variable. For instance:

{
“env”: [
{
“MOPS”: “C:/Users/Henry/Projects/VFX/MOPS”
},
],
“path”: “$MOPS”

}


However I have found that omitting the variable and just doing this works just as well:

{
“path”: “C:/Users/Henry/Projects/VFX/MOPS”

}


So why the need for a specific variable at all? Seems to me like simpler is always better. Am I wrong?


Question 2:

In my Houdini.env file I have the following argument:

HOUDINI_MMB_PAN = 0


Is there any way that I could set this as a .json package instead (hence leaving the Houdini.env file completely alone)?


Question 3:

I'm trying to use this Modeler add-on and reading around I found the recommendation for simplifying the .json file to this:

{
“env”: [
{
“MODELER”: “C:/Users/PATH/TO/modeler/”
},
{
“HOUDINI_PATH”: “$MODELER/”
}
]
}


However when I do it (with my proper directory of course), I get this error in Houdini:

Traceback (most recent call last):
File “align”, line 1, in <module>
File “/Users/kays/Library/Preferences/houdini/18.0/MODELER/python2.7libs/modeler/modeling_tools.py”, line 2, in <module>
import ui, geo_utils, network, soft_boolean
File “/Users/kays/Library/Preferences/houdini/18.0/MODELER/python2.7libs/modeler/ui.py”, line 29, in <module>
settings_path = modeler_path + “/modeler/settings”
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘str’


Any idea what might be going on?




Many thanks!!!!
>>Kays
For my Houdini tutorials and more visit:
https://www.youtube.com/c/RightBrainedTutorials [www.youtube.com]
User Avatar
Member
8173 posts
Joined: Sept. 2011
Offline
Midphase
So why the need for a specific variable at all? Seems to me like simpler is always better. Am I wrong?

Usually, it's to set a root directory variable for when both PATH and HOUDINI_PATH need be modified. It might also be so that the location of the tool's root is available as a variable in houdini. If it's only used once for setting HOUDINI_PATH, then yes it is not necessary to create a separate variable first.

Midphase
Is there any way that I could set this as a .json package instead (hence leaving the Houdini.env file completely alone)?

I think so, but I haven't tried using a package to set that specific variable.
User Avatar
Member
833 posts
Joined: Jan. 2018
Offline
What is the difference between PATH and HOUDINI_PATH? I spent the better part of the morning reading the SideFX docs and I still can't quite wrap my head around any of this. It's like alien technology, I can get it to work but I can't seem to understand why.
>>Kays
For my Houdini tutorials and more visit:
https://www.youtube.com/c/RightBrainedTutorials [www.youtube.com]
User Avatar
Member
8173 posts
Joined: Sept. 2011
Offline
PATH is just the system path, it's not Houdini specific. It's the search order for executables on the command line. It's needed in order for houdini to run external programs like ‘prman’ using the command name instead of the full path to the executable.

HOUDINI_PATH is the search path for the Houdini File System. If you look in the directory of Houdini's installation, you'll see all kinds of sub directories and files such as otls, toolbars, desktop, etc. You can add files to these folders by putting them into same-named folders in the Houdini path. This way you can extend houdini with more otls or scripts without modifying the install folder. If the path is ordered properly, nearly any file in the HFS can be overridden.
User Avatar
Member
404 posts
Joined: April 2017
Offline
Regarding the MOPS variable in your example package, I use that in other accessory scripts to help with the automatic updater, among other things. It isn't strictly necessary but it makes it a lot easier for me to know where the MOPs HDAs are on a user's system when I'm expanding or collapsing HDA definitions, for example.

Package files, confusingly, have a lowercase “path” key that you can set outside of the “env” object. This “path” in reality is referring to HOUDINI_PATH. If you want to set the system PATH variable, you'd have to create a variable named PATH inside the “env” object in your package.

I did a bit more explaining on the quirks of packages here: https://www.toadstorm.com/blog/?p=722 [www.toadstorm.com]
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
833 posts
Joined: Jan. 2018
Offline
Very helpful as always.

In perfect Houdini fashion, it does seem a more more convoluted than it needs to be…but what are you going to do.

I do like what 3Delight installer does which is actually automatically configure the .json file without needing the user to ever go into a text editor to change it. It just works!
>>Kays
For my Houdini tutorials and more visit:
https://www.youtube.com/c/RightBrainedTutorials [www.youtube.com]
User Avatar
Member
8173 posts
Joined: Sept. 2011
Offline
Midphase
I do like what 3Delight installer does which is actually automatically configure the .json file without needing the user to ever go into a text editor to change it. It just works!

Oh, lame! I already had one that was hand made. Now I have a second one that isn't even pretty printed. Thanks for pointing that out so I can delete it.

Mine:
{
    "enable": true,
    "env": [
        {
            "DELIGHT": "C:/Program Files/3Delight"
        }, 
        {
            "PATH": {
                "method": "append", 
                "value": [
                    "$DELIGHT/bin"
                ]
            }
        },
        {
            "HOUDINI_PATH": {
                "method": "append", 
                "value": [
                    "$DELIGHT/houdini/18.0"
                ]
            }
        },
        {
            "HOUDINI_SCRIPT_PATH": {
                "method": "prepend",
                "value": [
                    "$DELIGHT/houdini/18.0/scripts"
                ]
            }
        },
        {
            "HOUDINI_SOHO_PATH": {
                "method": "prepend",
                "value": [
                    "$DELIGHT/houdini/18.0/soho"
                ]
            }
        },
    ]
}

Theirs:

{ "env": [ { "DELIGHT":"C:\\Program Files\\3Delight" }, { "HOUDINI_PATH":"$DELIGHT\\houdini\\18.0" }, { "HOUDINI_SCRIPT_PATH":"$DELIGHT\\houdini\\18.0\\scripts" }, { "HOUDINI_SOHO_PATH":"$DELIGHT\\houdini\\18.0\\soho" } ] }
Edited by jsmack - April 21, 2020 17:43:42
User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
toadstorm
Regarding the MOPS variable in your example package, I use that in other accessory scripts to help with the automatic updater, among other things. It isn't strictly necessary but it makes it a lot easier for me to know where the MOPs HDAs are on a user's system when I'm expanding or collapsing HDA definitions, for example.

Package files, confusingly, have a lowercase “path” key that you can set outside of the “env” object. This “path” in reality is referring to HOUDINI_PATH. If you want to set the system PATH variable, you'd have to create a variable named PATH inside the “env” object in your package.

I did a bit more explaining on the quirks of packages here: https://www.toadstorm.com/blog/?p=722 [www.toadstorm.com]

“Worse still, it automatically assumes that you're using the append method, whereas the env key assumes you are using the replace method. ”

I'm not sure about your findings here, can you provide a sample where this behavior is occuring ?

Here's my test:
{
    "path" : "foo2",
    "env" :
    [
        {"HOUDINI_PATH" : "foo1"}
    ]
}

. hconfig -xa
HOUDINI_OS := 'Windows'
HOUDINI_PATH := 'foo1;foo2;&'
HOUDINI_USER_PREF_DIR := 'C:/Users/marcb/houdini18.0'

By default Houdini uses the prepend method for all path variables.

You have a point with `path`, I'm thinking of renaming it to `hpath` to remove any ambiguity, and keep the old one for backward compatibility.
User Avatar
Member
404 posts
Joined: April 2017
Offline
I'm referring to setting keys in the “env” object that are not Houdini-specific. Houdini's own documentation says that arbitrary environment variables are set by default using “replace” rather than “prepend”:

Unlike under the path key, under env the default is to set a variable, rather than prepend to a path.

So only Houdini-specific variables are automatically given the “prepend” behavior?

Also, regarding this:
“Worse still, it automatically assumes that you're using the append method, whereas the env key assumes you are using the replace method. ”

It's weird that you're seeing “append” there on that post… I corrected that typo almost a month ago to the day. I wonder if it's a cache thing?

Changing “path” to “hpath” seems a good idea to me. Maybe this auto-prepend behavior can be clarified in the documentation so that it's apparent that only Houdini-specific variables receive it?
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
833 posts
Joined: Jan. 2018
Offline
BTW, thanks to Henry's very informative blog I was able to wrap my head enough around the packages ideas to make a short tutorial video for anyone interested in using Houdini packages:




Thank you so much!!!
>>Kays
For my Houdini tutorials and more visit:
https://www.youtube.com/c/RightBrainedTutorials [www.youtube.com]
User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
toadstorm
I'm referring to setting keys in the “env” object that are not Houdini-specific. Houdini's own documentation says that arbitrary environment variables are set by default using “replace” rather than “prepend”:

Unlike under the path key, under env the default is to set a variable, rather than prepend to a path.

So only Houdini-specific variables are automatically given the “prepend” behavior?

Also, regarding this:
“Worse still, it automatically assumes that you're using the append method, whereas the env key assumes you are using the replace method. ”

It's weird that you're seeing “append” there on that post… I corrected that typo almost a month ago to the day. I wonder if it's a cache thing?

Changing “path” to “hpath” seems a good idea to me. Maybe this auto-prepend behavior can be clarified in the documentation so that it's apparent that only Houdini-specific variables receive it?

Right, you can only append/prepend to HOUDINI paths and the system PATH so far. Support for custom path variables is not there yet.

I'll clarify the doc.

Thanks for your input!
User Avatar
Member
767 posts
Joined: April 2014
Offline
I read the documentation on packages for Houdini; and this is what I have in my package_dir.json file;

{
"enable": true,

"package_path": "B:\\CGs\\Octane",
"path": "B:\\Cloud\\Sync\\HoudiniSettings\\extra_render"
[
{
"value": "",
"method":""
}
}

The package path is pointing to the Octane plugin path but when starting Houdini, the Octane tab is not found ?
【T】【C】【S】
User Avatar
Member
404 posts
Joined: April 2017
Offline
use forward slashes for paths, not backslashes. you can remove the "value" and "method" lines as well as the curly braces surrounding them, and the square bracket immediately above them.

use a JSON validator to check your syntax. right now it's invalid.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
767 posts
Joined: April 2014
Offline
Alright but the Octane tab is still not showing.

{
    "enable": true,

    "package_path": "B://CGs//Octane",
    "path": "B://Cloud//Sync//HoudiniSettings//extra_render"
}

I have the same folder that is located in the packaged path, in the path; hoping that would have got it to work, nope.

As it states in the documentation, Houdini will scan this path first; HOUDINI_USER_PREF_DIR/packages. In my case I have a custom path for the variable HOUDINI_USER_PREF_DIR but in that custom path I do not have a packages directory/folder, I assume I should create one in this path ?

For the variable $HOUDINI_PATH I have three paths, out of those three which should I use in the packages.json file PATH in the JSON file ? As there is PATH and PACKAGED_PATH both seem similar ?
Edited by _Christopher_ - Jan. 14, 2022 10:35:40
【T】【C】【S】
User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
The value used for overriding HOUDINI_USER_PREF_DIR must contain __HVER__
E.g.
. export HOUDINI_USER_PREF_DIR=~/myprefdir__HVER__
. hconfig -xa
HFS := 'C:/Users/marcb/DEV/HOUDINI/dev/hfs'
HOME := 'C:/Users/marcb'
HOUDINI_DESKTOP_DIR := 'C:/Users/marcb/Desktop'
HOUDINI_OS := 'Windows'
HOUDINI_PATH := 'C:/Users/marcb/DEV/HOUDINI/dev/hfs/packages/kinefx;&'
HOUDINI_TEMP_DIR := 'C:/Users/marcb/AppData/Local/Temp/houdini_temp'
HOUDINI_USER_PREF_DIR := 'C:/Users/marcb/myprefdir19.5'
SHELL := 'C:/PROGRA~1/Git/usr/bin/bash.exe'
USER := 'marcb'

PATH is the system path environment variable. There is no such environment variable as PACKAGED_PATH.

The package_path keyword can be used to specify a package folder to scan from a package file. So in your case b:/CGs/Octane would be scanned by Houdini for extra packages to load.
Edited by mabelzile - Jan. 17, 2022 10:24:20
User Avatar
Member
767 posts
Joined: April 2014
Offline
$HOUDINI_PACKAGE_PATH takes your package path and appends a sub-path; as done here, "HOUDINI_PATH": "$HOUDINI_PACKAGE_PATH/../tools". The /tools sub-directory is appended to whatever the path is to the $HOUDINI_PACKAGE_PATH. If your $HOUDINI_PACKAGE_PATH is; C:\houdini\files\package then after appending /tools to C:\houdini\files\package it will be C:\houdini\files\package\tools.

Therefore it's not defaulting to your houdini19/packages folder.
【T】【C】【S】
  • Quick Links