Community
Arnold General Rendering Forum
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Can you "tag" a node in an AiUniverse?

1 ANTWORT 1
GELÖST
Antworten
Nachricht 1 von 2
AaronWPowell
262 Aufrufe, 1 Antwort

Can you "tag" a node in an AiUniverse?

Is there a way to add some kind of a tag to a node using the API? For example, to add a unique id or something so I can reference other related data outside of the Arnold Universe. I figured maybe this could be done with user params or the AiNodeSetLocalData function but I can't figure out how to use either with the API yet. Any tips?

Beschriftungen (3)
1 ANTWORT 1
Nachricht 2 von 2
AaronWPowell
als Antwort auf: AaronWPowell

I'm going to be honest, I don't remember exactly what I was trying to do here but I stumbled on a solution earlier this week and noticed no one had responded to this question, so I'll post my answer for completeness.

 

The easiest way I've to do this is with `AiNodeDeclare()` (https://docs.arnoldrenderer.com/api/arnold-7.1.2.0/group__ai__nodes.html#gad6d046358c6879a4df2059471...). For example, if you wanted to add a guid tag to a node for some reason, you can declare a custom value and access it like any other attribute of AtNode.

 

from arnold import *
import uuid

mesh = AiNode("polymesh")
AiNodeDeclare(mesh, "my_custom_string", "constant STRING")
AiNodeSetStr(mesh, "my_custom_string", uuid.uuid4().hex)
print(AiNodeGetStr(mesh, "my_custom_string")) # returns UUID string

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report