Accessing operator.draw() in Blender 2.8?

user-interface

#1

Hello everyone,

Does Blender 2.8 currently provide a way to call an operator’s draw() method with manually supplied (self, context) arguments?
If not, is there at least a way to access the operator’s original Python class?

Before (in pre-2.8 Blender), it was possible to get the original class using the get_instance() method. E.g.:

op = bpy.ops.export_scene.obj
op_class = type(op.get_instance())

which could then be used to draw a matching set of properties anywhere in the UI

op_class.draw(emulated_self, context)

This is really useful for “meta-operator” scenarios. For example, in one of my addons the user can specify an arbitrary exporter’s settings beforehand (which would then be executed with these settings to batch-export objects into multiple files), so displaying the exporter’s own UI layout is much more desirable than just calling layout.prop() for each operator property. :slightly_smiling_face: