Jump to content

Houdini Universal Unique ID (UUID)?


Jiceq

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.

Link to comment
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
Link to comment
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 5
Link to comment
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.

Link to comment
Share on other sites

  • 11 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...