Search - User list
Full Version: Attribute Value as Label?
Root » Houdini Lounge » Attribute Value as Label?
subscriptions
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
animatrix_
Hi,

Try:
`detail(0, "cost", 0)`
Andr
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)
subscriptions
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
Mohanpugaz
Expressions in label works for me

using H17.5.327


HaniJahan
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?
tamte
You need to use details() [www.sidefx.com] function for string
HaniJahan
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
tamte
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
pandapin223
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.
tamte
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
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB