User guide
202
Additionally, a GenericAssign can be called anywhere UI4 is available, though ideally at start-up. It can also be
manually called in the Python tab for testing.
UI4.FormMaster.ParameterPolicy.RegisterPolicyDelegate('PragmaticAssign',
UI4.FormMaster.GenericAssignParameterPolicy.GenericAssignPolicyDelegate("args"))
Python data in the form can be returned by following the sample below:
GeoAPI.Util.GenericAppenderUtil.ParseArgsFile
argsData = {}
argsData['attrs'] = [
('taco', [
('chicken', ScenegraphAttr.FloatAttr(5.0), {'help':'hmm'}),
('cheese', ScenegraphAttr.StringAttr("a"), {'widget':'popup',
'options':['a', 'b', 'c']}),
], {'open':True}),
]
argsData['fixedCEL'] = "@location"
'Attrs' is a list, where each element in the list is a tuple with (name, value, hints). The value for a group is a list of
children in this same form. The value for a scalar or array is a ScenegraphAttr. Feed this data to the GenericAssign
node:
node.updateArgsParameterDict(argsData)
Alternatively, force hinting:
node.getParameter('CEL').setHintString(repr({'widget':'null'}))
node.getParameter('location').setHintString(repr({'widget':'scenegraphLocation'}))
You can also set the cosmetic type of the node, ensuring it doesn't conflict with the name of a registered node type:
node.setType('DynamicTacoObjectSettings')
There is a hint supported in the args file entry that allows for it to be enabled by default. Refer to
VisibilityAssign.xml within the GenericAssign directory of the Katana install for more information.
When registering a node type to NodegraphAPI, you can also set the node "flavor", which determines where in the
menus it appears.
26 CREATING A GENERICASSIGN-BASED NODE TYPE |