How to get a unique ID / UUIDish thing for each object (for use as a random seed)?

   6043   6   0
User Avatar
Member
141 posts
Joined: 9月 2011
Offline
I'm manually placing copies of objects (ie at the /obj level) but need each to have some random stuff internally - spin axis etc. So each object needs a different seed value to work with internally (@ptnum has no relevance here

Houdini must use some kinda UUID-ish thing internally to refer to objects, so you can rename stuff and all the references across the scene are updated (right? Or does Houdini just do a global “search and replace” whenever you rename something?)

But I can't find any kinda unique number in objects' detail attributes.

Or do I just have to hash the objects' nodepaths and make my own? (I'd rather not if I don't have to: it'd be nice to be able to rename a node without it altering its unique seed)
User Avatar
Member
1265 posts
Joined: 3月 2014
Offline
Assemble SOP gives you access to each piece
Werner Ziemerink
Head of 3D
www.luma.co.za
User Avatar
Member
141 posts
Joined: 9月 2011
Offline
Thanks - but I'm not sure how this helps. I'm using instancing, so these are basically just objects with a single point inside, referring to a disk instance. Not sure what the Assemble SOP would give me in this situation (unless you mean I should hash one of the attribs it generates?)
User Avatar
Member
15 posts
Joined: 2月 2019
Offline
I'm a new guy about houdini,I'm not sure whether it is you want.
I think may be it's the same as what @Werner Ziemerink means.

Attachments:
learnt2.jpg (1.3 MB)

User Avatar
Member
731 posts
Joined: 12月 2006
Offline
There's a lot of ways to do this, but let's say you have /obj/foo1 and /obj/foo2, etc. Inside each, you might have an attribute create node with this in it:

attribute:  id
value: rand(opdigits(".."))

opdigits extracts the digits only from any node, thus geo1 and geo2 will have different id attributes
Edited by mrCatfish - 2019年4月2日 10:56:34
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
7570 posts
Joined: 9月 2011
Offline
howiem
Houdini must use some kinda UUID-ish thing internally to refer to objects, so you can rename stuff and all the references across the scene are updated (right? Or does Houdini just do a global “search and replace” whenever you rename something?)

Nodes have an op id, but it is only unique within a given session. Reloading your scene in a new session will assign new ids. The node name is the unique identifier stored with the scene file.

One solution to your workflow that would allow renaming the nodes as you please, would be to create a shelf tool script that creates a geo node with your setup inside, and adds a spare parameter to the geo node. The script would then set the value to a random number such as with the python random module. You can drag a selection to your toolbar to create an initial tool starting point, and modify the script to add the spare parm/random number.
Edited by jsmack - 2019年4月2日 13:44:46
User Avatar
Member
141 posts
Joined: 9月 2011
Offline
Ahh - so Houdini *does* use the node path/name as its sole identifier. Fair enough. I can work with that.

Thanks all for your help and insights
  • Quick Links