Jump to content
Juhani Karlsson

Rename label in multiparm list.

Recommended Posts

Yo,

I have perfectly working dynamic multiparm list. I get all the values and params ect. 
only thin I can`t find is how to rename the labels of the parameters!! I`m doing it in a python callback. Sounds so simple, but I`m new to Houdini(ex-softie) so simple things can be hard haha

Thanks a bunch,
- J

Share this post


Link to post
Share on other sites

All you have to do is open the Edit Parameter Interface, select the parameter inside your Multiparm Block and rename the label with a '#' suffix, which will result in appending a number starting from 1 to your parm labels.

 

Cheers,

Manu

Share this post


Link to post
Share on other sites

Hi,

 

https://www.dropbox.com/s/xwtpkqlksjusshe/multiparm.png?dl=0

Thanks for your answer! However it is not quite like I want it.
I need to make a character asset that loads them from file structure and updates multiparm list accordingly. At the moment though, I can`t rename the labels of the characters.
Should I use some other way to do "dynamic" lists?


Thanks a lot,
- J

Share this post


Link to post
Share on other sites

How am I supposed to use the setLabel in the ParmTemplate? I`m bit confused how this should be done http://www.sidefx.com/docs/houdini14.0/hom/hou/ParmTemplate#setLabel

I suppose I have to use the ParmTemplateGroup? for the edits? Hmmmm

>>> n = hou.node('/obj/geo2/null2')
>>> ptg = n.parmTemplateGroup()
>>> for i in ptg.entries():
...     print i
... 
<hou.ToggleParmTemplate name='copyinput' label='Copy Input' default_value=True>
<hou.ToggleParmTemplate name='cacheinput' label='Cache Input' default_value=False>
<hou.FolderParmTemplate name='folder0' label='Folder Name' folder_type=MultiparmBlock>
>>> ptg.find("folder0")
<hou.FolderParmTemplate name='folder0' label='Folder Name' folder_type=MultiparmBlock>
>>> f = ptg.find("folder0")
>>> f.parmTemplates()[0]
<hou.FloatParmTemplate name='parm#' label='Label' length=1 naming_scheme=Base1 look=Regular default_value=(0,)>
>>> me = f.parmTemplates()[0]
>>> me.setName("newTest#")
>>> me
<hou.FloatParmTemplate name='newTest#' label='Label' length=1 naming_scheme=Base1 look=Regular default_value=(0,)>
>>> f.setParmTemplates((me,))
>>> ptg.replace("folder0", f)
>>> n.setParmTemplateGroup(ptg)
>>> 

In order to change the name of the parm using Python, you'll have to use parmTemplates. This is a way to do it.

For some reason, a Multiparmblock can't be found via parmTemplateGroup().findFolder(), but you can access it with just find().

Share this post


Link to post
Share on other sites

sorry for the gravedig,

 

do you know any way to set different labels to the different instances of the same multiparm parameter?

Example for a multiparmblock parameter "myParm#":
I want "myParm1" and "myParm2" instances to be labelled "Bingo", while "myParm3" instance should be labelled "Bongo".

Is this even possible to do?

cheers

Share this post


Link to post
Share on other sites

Not that I know of. Labels are part of the parm templates and I don't think there's a way to change the labels of individual instances of a parm in a multiparm block.

-J

Share this post


Link to post
Share on other sites
Posted (edited)

I have a similar desire. My workaround for now has been to to create a label parameter for each parameter I want control over. Perhaps it will soothe your needs too until there's a better solution.

For a left-justified label above the float(most easily accomplished) I would do the following:

make a string: Strmylabel# -- you can add some kind of default expression to read in whatever you need or let the user adjust this -- if you are setting it yourself then make this parm invisible

make a label: mylabel# -- turn off 'Main Label', turn on 'Horizontally Join to Next Parameter',  and turn on all 16 labels -- In 'Label 1' put "<additional common words such as 'controls for: ' >`chs('Str' + substr($CH,0,strlen($CH) - 1  ))`<additional common words such as 'controls' or >" (you need '-1' because once you have more than Label 1 turned on the labels get additional #s added to the end so you don't want to get that number also)

make a seperator: <doesn't matter> -- this will just help fill in rightspace so your label stays left-justified

make a float: myfloat# -- turn off 'Main Label', setup however you want

 

If the string parm is set to "hello3" and Label 1 has "Controls for: `chs('Str' + substr($CH,0,strlen($CH) - 1  ))` Objects" in Label 1 would yield the label:    Controls for: hello3 Objects

For right-justified labels that look like the normal label in-line with your float you can remove the seperater and move the Label expression to 'Label 16' replacing '-1' with '-2' since 16 is 2 digits long instead of 1 digit long.   This method will force everything to the far right of the parameter interface

 

You can do other similar things with attributes being read in using something like the following in the Label:

`detailsmap(0,'myAttribute', opdigits( substr($CH,0,strlen($CH) )) )` 

Edited by dejnoil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×