How to set default values for abstract controls?

   969   2   2
User Avatar
Member
29 posts
Joined: May 2015
Offline
Hi there,

After adding a abstract control with
graph.addAbstractControl()
, how to set the X / Y values to 1.0 as default value?

And I also need to promote the inputs of abstract control.

Thanks!
Edited by NMVHS - Sept. 2, 2024 11:53:51
User Avatar
Staff
65 posts
Joined: Oct. 2023
Offline
Hi, Its not possible to set the defaults using the addAbstractControls at the moment. For this you will have to use updateNode().
To promote the inputs set the promote and parmnames on the addAbstactControl. To do this, enter the channel you want to promote separated by a space. Parmnames should also be separated by a space, and will name the ports in the order that they are promoted.

abs = graph.addAbstractControl(promote='x y', parmnames='one two', name='test')
abs.updateNode(parms={'x':1, 'y':1})
Edited by william_harley - Sept. 5, 2024 04:02:10

Attachments:
Screenshot 2024-09-05 100021.jpg (48.7 KB)

User Avatar
Member
29 posts
Joined: May 2015
Offline
william_harley
Hi, Its not possible to set the defaults using the addAbstractControls at the moment. For this you will have to use updateNode().
To promote the inputs set the promote and parmnames on the addAbstactControl. To do this, enter the channel you want to promote separated by a space. Parmnames should also be separated by a space, and will name the ports in the order that they are promoted.

abs = graph.addAbstractControl(promote='x y', parmnames='one two', name='test')
abs.updateNode(parms={'x':1, 'y':1})
That works! Thanks!
  • Quick Links