Dynamic parm maxValue

   3067   8   1
User Avatar
Member
65 posts
Joined: March 2017
Offline
Hi guys,

I'm building an interface for an OTL, and here is what I'm trying to do :

- I have a list base on a mutliparm tabs, which give me a number of entries in my list. They have their own set of parameters. All good so far.

- I have a separate integer parm, and I want to dynamically set its maxValue to the number of entries in my mutliparm list.

What would be the easiest way to get this working ?

I attached a mockup of the interface in a null node, so you can get the gist of it.

Thanks a lot,

Julien

Attachments:
dynamicParm.hipnc (58.2 KB)

VFX Supervisor @ MPC London
User Avatar
Member
85 posts
Joined: May 2011
Offline
Attachment Not Found

Attachments:
dynamicParm_001.hipnc (58.6 KB)

— dedeks 3000 —
User Avatar
Member
65 posts
Joined: March 2017
Offline
Hi,

Thanks for looking at it, but this is not what I'm looking for …
In your scene, the integer parm controls the number of entries in my multiparm, which is not what I'm after.
What I want to achieve is that if the multiparm has 4 entries, the integer parm (isolateLayerN) has its range from 1 to 4, if you add an entry in the multiparm, I want the range to be updated from 1 to 5 etc.

Hope this makes sense.

Thanks,

Julien
VFX Supervisor @ MPC London
User Avatar
Member
7759 posts
Joined: Sept. 2011
Offline
You cannot dynamically update the range values. You can clamp the value where it is used instead. You could maybe rethink your approach. Perhaps use a radio tab based multiparm? This will give you an integer value that changes depending on which tab is current.
Edited by jsmack - Jan. 20, 2018 14:22:19
User Avatar
Member
8539 posts
Joined: July 2007
Online
you can do it for spare parms, as in your example, using callback when modifying number of layers, that would change parm template of isolateLayerN parm
see example file(obviously you may need to make it more robust to avoid errors for 1-1 range etc)
layers = kwargs['parm']
node = layers.node()
ptg = node.parmTemplateGroup()
pt = ptg.find("isolateLayerN")
pt.setMinValue(1) # for 1 based multiparm
pt.setMaxValue(layers.eval())
pt.setMinIsStrict(1)
pt.setMaxIsStrict(1)
ptg.replace("isolateLayerN", pt)
node.setParmTemplateGroup(ptg)

but if you turn it into HDA you will not be able to modify template of HDA parms so you'd have to dynamically create/modify a Spare parm on top of HDA, similar process though, with the advantage of being able to define code in hdamodule instead of callback oneliner

EDIT: attached the file
Edited by tamte - Jan. 20, 2018 17:46:33

Attachments:
dynamicParm_x.hipnc (58.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
65 posts
Joined: March 2017
Offline
Thanks Tomas !

I believe you haven't put the file in attachment, would be great to see how you implemented the multiline script in the callback.
I indeed intend to change this into an hda, what would be the strategy here ?
Spare parameter wouldn't exist when I create a new node, right ? so I would have to create it when I create the node ?
And how would I link your code to the hda ?

Thanks again,

Julien
VFX Supervisor @ MPC London
User Avatar
Member
8539 posts
Joined: July 2007
Online
Sorry, seems like it didn't attach
Essentially instead of each newline separate commands with ;
I'll attach the file once I get home

And yes, for hda you'd have to create it during OnCreated callback and then simply edit the same way as here, with the difference that you can have the code in hdamodule in that case which is cleaner

But personally I'd avoid doing that as it's dangerous to have important parms as spares that are not part of hda

I'd rather add Isolate checkbox to each multiparm instance and let it's callback clear all other isilate checkboxes
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8539 posts
Joined: July 2007
Online
here is the alternative I mentioned with isolate checkbox per instance and callback that turns others off

Attachments:
isolate_multiparm_checkbox.hipnc (62.9 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
65 posts
Joined: March 2017
Offline
Thanks Tomas,

It makes all sense, I thought about this before, but I didn't know my method would be not desirable.

Cheers,

Julien
VFX Supervisor @ MPC London
  • Quick Links