ID 250906 - The documentation doesn't state that ProcessAllEvents() needs to be called before checkDynamicParameters() to update dynamic node parameters

Follow

Problem summary
In Katana 2.1v2 upward it is necessary to call Utils.EventModule.ProcessAllEvents() before calling checkDynamicParameters() when updating dynamic parameters in a script. This dispatches all queued Katana events and make sure the returned result is up to date. This information is not yet reflected in the Katana Online Help on Dynamic Parameters.

For example, in RenderOutputDefine the locationSettings.renderLocation parameter can be set after locationType is set to file. renderLocation is a dynamic parameter. To set it via a script it is necessary to call Utils.EventModule.ProcessAllEvents() and then checkDynamicParameters() before getting the parameters, otherwise the result is an AttributeError: 'NoneType' object has no attribute 'setValue'. 

Customer reported version
Katana 2.5v3

Customer reported platform
CentOS7

Steps to reproduce

1) Create a shelf script containing the following:

"""NAME: RenderOutputScriptICON: icon.pngDROP_TYPES: SCOPE:"""renderOutputDefine = NodegraphAPI.GetNode('RenderOutputDefine')renderOutputDefine.getParameter('args.renderSettings.outputs.outputName.locationType.value').setValue('file', 0)renderOutputDefine.getParameter('args.renderSettings.outputs.outputName.locationType.enable').setValue(1, 0)#Utils.EventModule.ProcessAllEvents()renderOutputDefine.checkDynamicParameters()renderOutputDefine.getParameter('args.renderSettings.outputs.outputName.locationSettings.renderLocation.value').setValue('test', 0)renderOutputDefine.getParameter('args.renderSettings.outputs.outputName.locationSettings.renderLocation.enable').setValue(1, 0)
2) A RenderOutputDefine node is created and locationType is set to file, but after this point the console will show an error message

File "<string>", line 7, in <module>renderOutputDefine.getParameter('args.renderSettings.outputs.outputName.locationSettings.renderLocation.value').setValue('test', 0)AttributeError: 'NoneType' object has no attribute 'setValue'
3) Uncomment the line that says #Utils.EventModule.ProcessAllEvents() and run the script again. This time all parameters should be populated correctly.



 

    We're sorry to hear that

    Please tell us why