Changeset View
Changeset View
Standalone View
Standalone View
doc/python_api/examples/bpy.types.Operator.3.py
| Show All 21 Lines | def execute(self, context): | ||||
| ) | ) | ||||
| self.report({'INFO'}, message) | self.report({'INFO'}, message) | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| def invoke(self, context, event): | def invoke(self, context, event): | ||||
| wm = context.window_manager | wm = context.window_manager | ||||
| return wm.invoke_props_dialog(self) | return wm.invoke_props_dialog(self) | ||||
| # Only needed if you want to add into a dynamic menu | |||||
| def menu_func(self, context): | |||||
| self.layout.operator(DialogOperator.bl_idname, text="Dialog Operator") | |||||
| # Register and add to the object menu (required to also use F3 search "Dialog Operator" for quick access) | |||||
lichtwerk: please add the //(required to use F3 search....// part here as well | |||||
| bpy.utils.register_class(DialogOperator) | bpy.utils.register_class(DialogOperator) | ||||
| bpy.types.VIEW3D_MT_object.append(menu_func) | |||||
| # Test call. | # Test call. | ||||
| bpy.ops.object.dialog_operator('INVOKE_DEFAULT') | bpy.ops.object.dialog_operator('INVOKE_DEFAULT') | ||||
please add the (required to use F3 search.... part here as well