Get operator name ...

   3543   8   2
User Avatar
Member
26 posts
Joined: Nov. 2019
Offline
Hi!

Does somebody know whats the expression to get the name of the operator that contains the current operator (as a string).
Better to say the name of the "parent context or operator"?

I hope you know what I mean. Idk how to describe better.


Thank you and greetings!
User Avatar
Member
9384 posts
Joined: July 2007
Offline
you can use opname() Hscript expression and provide relative path to the parent node
opname("..")
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
26 posts
Joined: Nov. 2019
Offline
Hey!

Thanks, that does the job!

Got to mention that you also need the --> ` <-- signs, in front and back to evaluate (I needed to find out). Otherwise you just get --> opname("..") <-- as text written into the parameter.

`opname("..")`
User Avatar
Member
9384 posts
Joined: July 2007
Offline
You only need those if you are injecting it as a part of text (as any other hscript expression inserted into raw text)

You can also set it as proper expression (green color) and then you don't need `
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
26 posts
Joined: Nov. 2019
Offline
What do you mean with "proper expression" with green color?

If I just write opname("..") into a parameter it is just white and does nothing. So how to get it "green" and turn it into a "proper expression", as you say?
User Avatar
Member
102 posts
Joined: June 2023
Offline
tamte
You only need those if you are injecting it as a part of text (as any other hscript expression inserted into raw text)

You can also set it as proper expression (green color) and then you don't need `

I'm also very interested. What is it?
User Avatar
Member
9384 posts
Joined: July 2007
Offline
there is many ways, but one of them is:
- put cursor in the parameter
- press Alt+E to open Edit dialog
- type in the expression (without ``)
- change dropdown to Hscript Expression and Apply or Accept

but of course there is nothing wrong with using `` to insert expressions into pure string text
my point was that the expression part itself is without `` and `` are only needed when inserting Hscript expressions into the raw string and not necessary if the key is already set to Hscript expression even in string parameters
Edited by tamte - Aug. 12, 2023 16:38:26
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
26 posts
Joined: Nov. 2019
Offline
Alright thanks, that makes it clear.
User Avatar
Member
100 posts
Joined: Oct. 2021
Offline
Is it possible to get the name of a specific node in a file path?

NODE = /obj/output/filecache

$HIP/render/NODE.$F4.exr

and what would happen if I change the name of the node? Would the path change accordingly?
Edited by Kareeem - Sept. 21, 2024 10:15:25
www.rehimi.de
  • Quick Links