Disabling a single field of a size > 1 custom parameter

Hi, I’m trying to figure out how the enable state works in a case like this:

I created an Int Size 2 custom par, and given a certain condition I’d need to disable its second field only.

Using the component editor I see that both fields share the same enable toggle and expression:
image

And while both pars can be accessed individually with something like this in a parexec:

def onValueChange(par, prev):
	if par.name == 'Enableint1':
		me.parent().par.Int1.enable = par.eval()
	if par.name == 'Enableint2':
		me.parent().par.Int2.enable = par.eval()
	return

changing the enable state of one affects both simultaneously.

Here’s a minimal example custom_par_disable_test.toe (3.9 KB)
Windows 10 2021.15800

hey @totally_wired, you have create a single custom parameter called “Int”. The “enable” member works on this parameter, which includes all its fields (Int1, Int2). It’s not possible to disable only certain fields of a parameter.

Yes, you’re right. But it still isn’t completely clear to me.

If I look at the custom pars of my container Int1 and Int2 seem to be two independent parameters:

python >>> op('project1/container1').customPars
[type:Par name:Int1 owner:/project1/container1 value:123, 
type:Par name:Int2 owner:/project1/container1 value:510, 
type:Par name:Enableint1 owner:/project1/container1 value:True, 
type:Par name:Enableint2 owner:/project1/container1 value:True]

Whereas if I ask for Int as if it was a single par I get this error:

python >>> op('project1/container1').par.Int
Traceback (most recent call last):
  File "<Textport>", line 1
td.Error: Parameter tuples not supported.

So Int is a tuple and Int1 and Int2 its items, although for some reason the tuple itself can’t be accessed directly?

I agree the fields can seem like full parameters, but they are not.
In a coming update of TD a new feature called parGroups will be added which in this case lets you access the “Int” object, so you can set&read all subfields in one step.

For now if you want full independent enable/disable control over each, the only option is to create two separate Int Size 1 parameters.

Thanks @nettoyeur. Looking forward to that update.