Looking up an OP using an id

In RayTK I’m considering changes that would use OP ids instead of paths as a way to generate names that go into the shader. It would simplify things since the id wouldn’t change if things are renamed. But for the debugging tools, it’s really useful to have the paths show up in the shader.

Is it possible to take a list of numeric OP ids and efficiently map them to OP paths?

To convert back you must use the expression:

op(id) will return the OP instance corresponding to that id.

Example: op(0) # the root operator

Keep in mind though, id’s are not consistent between sessions and are changed during cut+paste.

2 Likes

But at any given moment, op(id).path is the actual path.

Personally, I don’t think it’s worth trying to use IDs except in very contained and temporary situations.