Jump to content
Jiceq

Houdini Universal Unique ID (UUID)?

Recommended Posts

Hi,

this is my first post in the forum, ive been a maya user for quite a long time and now im tinkering with Houdini.

In Maya im able to embed custom attribute values in a node and retrieve its UUID, which is a unique identifier per node. 

Im trying to figure out if its possible in Houdini to identify uniquely assets much the same way as in Maya. Does the concept UUID relate to Houdini? if not, is there anything similar allowing to uniquely identify objects in the scene?

Thanks, looking forward to contribute to this forum a lot in the future.

Share this post


Link to post
Share on other sites
23 minutes ago, Jiceq said:

Hi,

this is my first post in the forum, ive been a maya user for quite a long time and now im tinkering with Houdini.

In Maya im able to embed custom attribute values in a node and retrieve its UUID, which is a unique identifier per node. 

Im trying to figure out if its possible in Houdini to identify uniquely assets much the same way as in Maya. Does the concept UUID relate to Houdini? if not, is there anything similar allowing to uniquely identify objects in the scene?

Thanks, looking forward to contribute to this forum a lot in the future.

1. hou.Node.sessionId method: http://sidefx.com/docs/houdini/hom/hou/Node.html

2. hou.nodeBySessionId()

  • Like 1

Share this post


Link to post
Share on other sites

You can use the node path. All node paths/names in Houdini are unique.

Edited by Atom
  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, Atom said:

You can use the node path. All node paths/names in Houdini are unique.

The node can be renamed by user. sessionID is not attached to the name(path)

Edited by Alexey Vanzhula

Share this post


Link to post
Share on other sites

SessionID has it's caveats as well. Depends upon what you want to do.

Quote

So there may be a Node with the same session id as a NetworkBox.

 

Share this post


Link to post
Share on other sites

It's a coincidence that I'm working on the tools that require unique node identifiers. Unluckily Houdini doesn't provide us with a persistent UID which would be saved in a Hip file, only in the duration of the session, which is kinda useless in my opinion.

Despite the fact that I don't like Maya, there is a unique ID attached to each Maya node and this guarantees that knowing the UID you can always retrieve the node.

So in Houdini you can't rely on the node names since they inconsistent. What I ended up with is that I'm generating a UID by myself for every node I'm creating in the script.

 

import hashlib, time

def generate_uid(node):
  hash = hashlib.md5()
  hash.update(node.path() + str(time.time()))
  node.setUserData('uid', hash.hexdigest()[:10])
	
# To get the value:
node.userData.get('uid')

And there you go, you have a UID system in Houdini.

  • Like 4

Share this post


Link to post
Share on other sites

I created an RFE for having a GUID before. It could be generated automatically by Houdini on demand thus it wouldn't impact anything unless you access the property on a node instance for example.

I also think session ids are useless.

 

Share this post


Link to post
Share on other sites

What i ended up doing since session ids can be shared between different nodes of different categories according to documentation is a combination of the "session id" + "nodetype" + "nodetypeCategory". I think this guarantees a unique id. 

In order to use the hou.getNodeBySessionId() i check the node with nodetype and nodetypecategory and thats all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×