Changeset View
Changeset View
Standalone View
Standalone View
doc/python_api/examples/bpy.types.Operator.2.py
| Show All 37 Lines | |||||
| # Only needed if you want to add into a dynamic menu | # Only needed if you want to add into a dynamic menu | ||||
| def menu_func(self, context): | def menu_func(self, context): | ||||
| self.layout.operator_context = 'INVOKE_DEFAULT' | self.layout.operator_context = 'INVOKE_DEFAULT' | ||||
| self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") | self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") | ||||
| # Register and add to the file selector | # Register and add to the file selector (required to also use F3 search "Text Export Operator" for quick access) | ||||
| bpy.utils.register_class(ExportSomeData) | bpy.utils.register_class(ExportSomeData) | ||||
| bpy.types.TOPBAR_MT_file_export.append(menu_func) | bpy.types.TOPBAR_MT_file_export.append(menu_func) | ||||
| # test call | # test call | ||||
| bpy.ops.export.some_data('INVOKE_DEFAULT') | bpy.ops.export.some_data('INVOKE_DEFAULT') | ||||