I'm currently writing my own exporter and want to add an info text to my export options.

Inspired by the obj-Exporter i use the ExportHelper class as a basis. Sadly I could not found any good information on how this actually works. From what I can see, it uses context.window_manager.fileselect_add(self) to open the file dialog, which will then automatically show all the properties of my class.

However I would like to have a bit more control over the GUI of my exporter. Is it possible to add more kinds of control element, just like in a panel? Like a text that explains some details, or a button that performs an additional action.


Add a draw method to the Operator class, eg in text editor file export operator template operator_file_export.py

class ExportSomeData(Operator, ExportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "export_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
    bl_label = "Export Some Data"

    # ExportHelper mixin class uses this
    filename_ext = ".txt"

    filter_glob = StringProperty(
            maxlen=255,  # Max internal buffer length, longer would be clamped.

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting = BoolProperty(
            name="Example Boolean",
            description="Example Tooltip",

    type = EnumProperty(
            name="Example Enum",
            description="Choose between two items",
            items=(('OPT_A', "First Option", "Description one"),
                   ('OPT_B', "Second Option", "Description two")),

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.label("Custom Draw Method")
        row = layout.row()
        row.prop(self, "type")

    def execute(self, context):
        return write_some_data(context, self.filepath, self.use_setting)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.