Jump to content

Parameter Editor - custom default channels values/expressions


Recommended Posts

Hi Odforce,
I was wondering if anyone has knowledge about how to enter your own default values of a created channel within the parameter editor.

I want to use a mulitparm block(list), created from a folder type, and add parameters according to the amount of nprims. I want the parameters within this folder multiparm block (list) to have default values/expressions.
The idea is to link each channel to an asset with a random so the parameters (see picture) are for each asset different.

Not sure if this is good idea or if it could be achieved easier, im open for other ideas.

Thanks in advance!

screenshot01.png

Link to comment
Share on other sites

Okay, i did something else, I put the assets through a forloop and gave it an ID nr and used that as a randnr. But im still curious if there is a way to create your own custom default values/expressions for a channel, within the parameter editor

Link to comment
Share on other sites

I doesn't look like you can have an expression for the default, just an integer. You can use an OnCreated script in an hda to copy the expression on to that value once that node is created though. Probably a good RFE if you wanted to submit it.

multiparmdefault.thumb.png.5502e029e7a51ac96f0b233ed36b3554.png

something like this below in the OnCreated, make sure you change the language to python if you choose that language.

kwargs["node"].parm('folder0').setExpression(opdigits("."))

 

Link to comment
Share on other sites

Hey LaidlawFX,

Thanks for the reply :)
I tried to copy your setup and added your script on the "label", but I'm afraid I don't know how to get it to work. Also, I looked up in the houdini hou python reference to understand what your script does. but Im lacking knowledge on this too.
Could you clarify it?

Link to comment
Share on other sites

So in the attached hda, check out the Script Section in the Type Properties dialog, in there is a OnCreated Script set to python. The code line reads like this:

kwargs["node"].parm('fd').setExpression('opdigits(".")')

kwargs["node"] is the node at the time of creation, parm('fd') is the multiparm blocklist, setExpression() is placing down the expression opdigits(".") which is the number at the end of the node in hscript. You can replace opdigits(".") with any hscript expression you want. In this case when you copy and paste the hda, and another parameter in the block list will show itself. Not in and of itself useful except for demonstration of what you are looking for.

multiparmBlocklistDefault.hda

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...