Dear all!
I'm trying to archive an asset for a client which has outside file references (textures mainly). While the asset was living in our project structure it was sufficient to have absolute file names, but now I would like to archive it to a self contained directory structure. The most elegant way would be to reference these files relative to the hda file, which defines the asset. Is it possible?
Thanks in advance,
Mate
Referencing HDA's location
1817 2 1- gadfly16
- Member
- 65 posts
- Joined: May 2009
- Offline
- krueger
- Member
- 191 posts
- Joined: Oct. 2018
- Offline
It looks like you can use this to get the hda location in python:
It might be easier though to make a parameter for them to point to the base folder, then use that as a reference in your external file paths. They could then change the default for the base folder to wherever they put the files.
yourHDANode.type().definition().libraryFilePath()
It might be easier though to make a parameter for them to point to the base folder, then use that as a reference in your external file paths. They could then change the default for the base folder to wherever they put the files.
- gadfly16
- Member
- 65 posts
- Joined: May 2009
- Offline
Thanks Mkps,
This is exactly what I was looking for. The final content of the top level parameter on the asset that can be referenced from the inside is:
I used the awkward join/split combo, because os.path expects backslashes on windows while Houdini returns slashes.
Cheers,
Mate
This is exactly what I was looking for. The final content of the top level parameter on the asset that can be referenced from the inside is:
'/'.join(hou.pwd().type().definition().libraryFilePath().split('/')[:-1])
I used the awkward join/split combo, because os.path expects backslashes on windows while Houdini returns slashes.
Cheers,
Mate
-
- Quick Links