Jump to content

Rename label in multiparm list.


Juhani Karlsson

Recommended Posts

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

Link to comment
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().

Link to comment
Share on other sites

  • 3 years later...

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

Link to comment
Share on other sites

  • 8 months later...

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...