kiryha Posted January 15, 2019 Share Posted January 15, 2019 Hi, How can I change the path to the file in asset definition? Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 16, 2019 Author Share Posted January 16, 2019 Found a method to get the file path: import hou city = hou.node('/obj/geo1/CITY') print city.type().definition().libraryFilePath() But still can`t change it... Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 18, 2019 Author Share Posted January 18, 2019 Does this workflow have no sense? Does nobody ever use file versioning with HDA (only namespaces)? Quote Link to comment Share on other sites More sharing options...
anim Posted January 18, 2019 Share Posted January 18, 2019 you can set it using hou.HDADefinition.setIsPreferred() to get the list of all installed definitions for certain type do hou.NodeType.allInstalledDefinitions() so overall you would do something like this: import hou node = hou.node('/obj/path/to/my/node') type = node.type() defs = type.allInstalledDefinitions() # and then set whichever one you want defs[1].setIsPreferred(True) obviously you can use the list of definitions to find desired path in there by library path and if found then set it as preferred, or whatever you plan the logic to be 1 Quote Link to comment Share on other sites More sharing options...
anim Posted January 18, 2019 Share Posted January 18, 2019 that all being said, you need to think twice if this is the workflow you want all nodes of the same type are sourced only from your preferred library per hip file so if you change the path to the type definition, it will switch this to all the nodes of that type (as they all share the same definition) this can be dangerous and is not suitable for versioning tools that you want to keep multiple versions of in the same hip file however it can be beneficial for the utility tools that you want to keep up to date all the time and don't really care that they may break backward compatibility (as it will change all existing nodes to preferred definition) on the other hand, versioning by namespacing the type, will allow you to have multiple versions in the same hip file and even if you open the old scene with an older type it will be intact, so it's much safer workflow for that Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 18, 2019 Author Share Posted January 18, 2019 @anim Thanks, Thomas, that's what I was looking for initially! How can I get data from "defs" object? It is a list of other objects, containing strings paths, but can`t get string paths themselves (as well as their indexes)... And now I am thinking about my workflow... Currently, I use HDAs to transfer data between Houdini scenes, e.g. load environment asset into the render scene. Environment HDA itself is a simple container where all geometry caches of environment loaded and merged together (with some UI controls to switch something on or off etc). So I don't need multiple asset version in one scene, there should be only one asset of a particular type in one scene. If it`s a wrong (or wired) workflow for such task (data transfer, eg scene referencing) at this point, what alternatives do I have? Namespace versioning option has one issue: all asset versions are stored in the same file. And If an asset is big enough (which is easy could be a case for assets like environment) it will multiply file size for each asset version and sooner or later file can become unusable. Quote Link to comment Share on other sites More sharing options...
anim Posted January 18, 2019 Share Posted January 18, 2019 (edited) 1 hour ago, kiryha said: How can I get data from "defs" object? It is a list of other objects, containing strings paths, but can`t get string paths themselves (as well as their indexes)... just extract the info you need to another list for example defpaths = [d.libraryFilePath() for d in defs] indices will match, so you can use index() method from python list object to get index of a specific path if you want and then use that to get definition from def list or you can build dictionary directly defdict = {d.libraryFilePath(): d for d in defs} and then just get the definition based on the path key and set it to preferred if found 1 hour ago, kiryha said: Namespace versioning option has one issue: all asset versions are stored in the same file. And If an asset is big enough (which is easy could be a case for assets like environment) it will multiply file size for each asset version and sooner or later file can become unusable. you can have namespace versioned assets and still save each of them to different library so you can have 1 library file per type definition if you want and since each type will be versioned, you can just change your node type and it will use it's preferred definition which is the only definition it has, so there will be need to change preferred definition overall just try to get a good understanding of what namespaced type is, how it ties to definition and how definitions tie to libraries, then you can pick the workflow that suits your needs Edited January 18, 2019 by anim 1 Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 18, 2019 Author Share Posted January 18, 2019 (edited) Ok, now I understand that I need to learn way more about HDA... Is there any good explanation (tutorial, masterclass) which covers related topics? Cos this is quite confusing for me: 1 hour ago, anim said: what namespaced type is, how it ties to definition and how definitions tie to libraries Edited January 18, 2019 by kiryha 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.