I would like to export selected Armature actions through blender export file gui. So the user would be allowed to select the actions from the list in the GUI (shown in the image) after the File->Export->ES3D has been selected.

I have tested PropertyGroups, but they seem to be quite read only once the script is running. What would be the correct way of adding arbitrary amount of toggle buttons in the export file draw function (sample code with PropertyGroups below) after the File->Export->ES3D has been selected ?

Thank you, -Mika

Example GUI

Example toggle buttons

The example "pseudo" code creates a PropertyGroup when the script is loaded to the Blender (in the blender startup) and I can not change the toggle buttons after that anymore.

class PresetsCollection(bpy.types.PropertyGroup):
    actions = {}    
    index = 0
    test = ES3D()
    for a in test.getActions(bpy.context):
        locals()['action_%s' % index] = BoolProperty(name=a, default=False)
        actions['action_%s' % index] = a
        index += 1

class ExportES3D(bpy.types.Operator, ExportHelper):
    bl_idname = "export_object.es3d"
    bl_label = "Export ES3D"
    bl_options = {'UNDO', 'PRESET'}

    filename_ext = ".es"

    def draw(self, context):
        layout = self.layout
        row = layout.row(align=True)
        # List 
        box = row.box()
        e = context.scene.presets
        for a in inspect.getmembers(e):
            if a[0][:7] == "action_":
                box.prop(e, a[0])

    def execute(self, context):
        # Export filename must be set
        if not self.filepath:
            raise Exception("filepath not set")

        # Gather all export data
        e = context.scene.presets
        selected_actions = []
        for name,data in inspect.getmembers(e):
            if name[:7] == "action_":
                if data == True:

        # Export the ES3D
        test = ES3D()
        test.convert2es(context, selected_actions, self.filepath)

        # All done



Browse other questions tagged .