[Python] HDA namespace and version

   1447   2   1
User Avatar
Member
49 posts
Joined: 2月 2016
Offline
https://www.sidefx.com/docs/houdini17.0/assets/namespaces.html [www.sidefx.com]
From this HDA documentation it mentioned that the version number of the asset should be formatted as : node_name
https://www.sidefx.com/docs/houdini17.0/hom/hou/HDADefinition.html [www.sidefx.com]
So I am assuming if I use the version()function it should returns from the name.
However this is not the case, it only return the version field in the type definition. Did I missed any internal function I can use?

Here is my helper function to fetch the version number.
def get_version(node):
    """
    Returns the version number of HDA if found
    Args:
        node: Houdini Node Object
    Returns:
        version Number
        None when no version number was found
    """
    name_split = node.type().definition().nodeTypeName().split("::")
    split_length = len(name_split)
    if split_length == 1:
        return None
    elif split_length == 2:
        if name_split[1].isdigit():
            return float(name_split[1])
        else:
            return None
    elif split_length == 3:
        if name_split[2].isdigit():
            return float(name_split[2])
    return None
User Avatar
スタッフ
1449 posts
Joined: 7月 2005
Offline
The version described in the documentation of the namespaces is different than version returned by hou.HDADefinition.version() function. See https://www.sidefx.com/docs/houdini17.0/assets/versioning_systems.html [www.sidefx.com]

Btw, for parsing the namespaced operator name, you can use
node.type().nameComponents()
or
hou.hda.componentsFromFullNodeTypeName()
User Avatar
Member
49 posts
Joined: 2月 2016
Offline
rafal
The version described in the documentation of the namespaces is different than version returned by hou.HDADefinition.version() function. See https://www.sidefx.com/docs/houdini17.0/assets/versioning_systems.html [www.sidefx.com]

Btw, for parsing the namespaced operator name, you can use
node.type().nameComponents()
or
hou.hda.componentsFromFullNodeTypeName()
This explains everything, thanks for the quick response!
  • Quick Links