Attribute Value as Label?

   6721   10   1
User Avatar
Member
29 posts
Joined: Oct. 2017
Offline
How do I use the value of a detail attribute as a Label in the Edit Parameters Interface?
I'd also be fine if I could add a float parameter and put an expression in the field that would display the value.

I tried many variations of `print detail.attribValue(“cost”)`

Trying to display the value of a findshortestpath cost attribute.

Thanks,

Tim
User Avatar
Member
4729 posts
Joined: Feb. 2012
Offline
Hi,

Try:
`detail(0, "cost", 0)`
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
animatrix3d
Hi,

Try:
`detail(0, "cost", 0)`

Ohh, it would super nice if the Label field of the editor interface could also accept hscript.
A lot of less time wasted working with parmgroup templates.
I wonder if there's any valid technical reason for not being able to do that?

Anyway, if you want instead to change the label itself, you can use the following code.
Have a look at the attached example file

node = hou.pwd()
targetParm = node.parm("targetParm")
newLabel = node.parm("newLabel").eval()

group = node.parmTemplateGroup()
oldParm = targetParm.tuple().parmTemplate()
newParm = targetParm.tuple().parmTemplate()
newParm.setLabel(newLabel)
group.replace(oldParm, newParm)
node.setParmTemplateGroup(group)
Edited by Andr - July 24, 2019 03:55:15

Attachments:
changeLabel.hiplc (66.7 KB)

User Avatar
Member
29 posts
Joined: Oct. 2017
Offline
Yeah, I ended up just making a parameter and used the detail attr. Not as elegant, but works.

I'll definitely look at that changeLabel.hiplc file!! thx!.

T
User Avatar
Member
146 posts
Joined: June 2016
Offline
Expressions in label works for me

using H17.5.327


Attachments:
parameters.png (31.1 KB)
label_works.png (11.0 KB)

Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
14 posts
Joined: May 2021
Offline
Mohanpugaz
Expressions in label works for me

using H17.5.327


the numbers (int or float attributes) work for me but not the string. it keep showing 0 instead of a word. Do you have any idea why is that?
Edited by HaniJahan - July 27, 2023 01:46:50

Attachments:
houdini_r7W3NVFNtQ.png (134.1 KB)

User Avatar
Member
8833 posts
Joined: July 2007
Offline
You need to use details() [www.sidefx.com] function for string
Edited by tamte - July 27, 2023 10:36:28
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
14 posts
Joined: May 2021
Offline
tamte
You need to use details() [www.sidefx.com] function for string

Thanks! I was trying details() function like this
`details("../OUT", "test")`
or
`details(0, "test")`
but they didn't work too

However this one worked
`details("./OUT", "test")`

not sure why ../ not working here
Edited by HaniJahan - July 27, 2023 14:39:31
User Avatar
Member
8833 posts
Joined: July 2007
Offline
Hannah Jahanshahi
not sure why ../ not working here
it's because it results in an invalid path

lets say your node is at "/obj/geo1/test_attrib_name"
since your OUT node is inside your HDA, relative path: "./OUT" or potentially also just "OUT" will result in a correct full path "/obj/geo1/test_attrib_name/OUT"

however relative path "../OUT" will result in "/obj/geo1/OUT" which is most likely nonexistent, but even if it existed and would work, it's undesirable as it's outside of your HDA and therefore not self contained
Edited by tamte - July 27, 2023 18:08:12
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1 posts
Joined: Dec. 2013
Offline
this discussion is very helpful Just wanted to ask that The Shown Info from a label could it be in block letter? is It Possible?
Thanks In Advance.
User Avatar
Member
8833 posts
Joined: July 2007
Offline
pandapin223
Just wanted to ask that The Shown Info from a label could it be in block letter?
If you mean upper case use toupper() [www.sidefx.com] expression function
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links