Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_pie_menus/pie_modes_menu.py
| Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | |||||
| # Set Mode Operator # | # Set Mode Operator # | ||||
| class SetObjectModePie(Operator): | class SetObjectModePie(Operator): | ||||
| bl_idname = "object.set_object_mode_pie" | bl_idname = "object.set_object_mode_pie" | ||||
| bl_label = "Set the object interactive mode" | bl_label = "Set the object interactive mode" | ||||
| bl_description = "I set the interactive mode of object" | bl_description = "I set the interactive mode of object" | ||||
| bl_options = {'REGISTER'} | bl_options = {'REGISTER'} | ||||
| mode = bpy.props.StringProperty(name="Interactive mode", default="OBJECT") | mode: bpy.props.StringProperty(name="Interactive mode", default="OBJECT") | ||||
| def execute(self, context): | def execute(self, context): | ||||
| if (context.active_object): | if (context.active_object): | ||||
| try: | try: | ||||
| bpy.ops.object.mode_set(mode=self.mode) | bpy.ops.object.mode_set(mode=self.mode) | ||||
| except TypeError: | except TypeError: | ||||
| msg = context.active_object.name + " It is not possible to enter into the interactive mode" | msg = context.active_object.name + " It is not possible to enter into the interactive mode" | ||||
| self.report(type={"WARNING"}, message=msg) | self.report(type={"WARNING"}, message=msg) | ||||
| ▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| pie.separator() | pie.separator() | ||||
| pie.separator() | pie.separator() | ||||
| pie.separator() | pie.separator() | ||||
| # 3 - BOTTOM - RIGHT | # 3 - BOTTOM - RIGHT | ||||
| if context.gpencil_data: | if context.gpencil_data: | ||||
| pie.operator("view3d.pie_interactive_mode_grease_pencil", icon="GREASEPENCIL") | pie.operator("view3d.pie_interactive_mode_grease_pencil", icon="GREASEPENCIL") | ||||
| else: | else: | ||||
| message = "Active Object has only Object Mode available" if ob \ | message = "Active Object has only Object Mode available" if ob \ | ||||
| and ob.type in {"LAMP", "CAMERA", "EMPTY", "SPEAKER"} else \ | and ob.type in {"LIGHT", "CAMERA", "EMPTY", "SPEAKER"} else \ | ||||
| "No active object found. Please select one first" | "No active object found. Please select one first" | ||||
| pie = layout.menu_pie() | pie = layout.menu_pie() | ||||
| pie.separator() | pie.separator() | ||||
| pie.separator() | pie.separator() | ||||
| pie.separator() | pie.separator() | ||||
| box = pie.box() | box = pie.box() | ||||
| box.label(text=message, icon="INFO") | box.label(text=message, icon="INFO") | ||||
| ▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines | |||||