Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_pie_menus/pie_editor_switch_menu.py
| Show All 35 Lines | from bpy.types import ( | ||||
| Operator, | Operator, | ||||
| ) | ) | ||||
| from bpy.props import ( | from bpy.props import ( | ||||
| StringProperty, | StringProperty, | ||||
| ) | ) | ||||
| class AreaPieMenu(Menu): | class AreaPieMenu(Menu): | ||||
| bl_idname = "INFO_MT_window_pie" | bl_idname = "TOPBAR_MT_window_pie" | ||||
| bl_label = "Pie Menu" | bl_label = "Pie Menu" | ||||
| bl_description = "Window Pie Menus" | bl_description = "Window Pie Menus" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| self.layout.operator(AreaTypePieOperator.bl_idname, icon="PLUGIN") | self.layout.operator(AreaTypePieOperator.bl_idname, icon="PLUGIN") | ||||
| class AreaTypePieOperator(Operator): | class AreaTypePieOperator(Operator): | ||||
| Show All 29 Lines | def draw(self, context): | ||||
| pie.operator(SetAreaType.bl_idname, text="Node Editor", icon="NODETREE").types = "NODE_EDITOR" | pie.operator(SetAreaType.bl_idname, text="Node Editor", icon="NODETREE").types = "NODE_EDITOR" | ||||
| # 1 - BOTTOM - LEFT | # 1 - BOTTOM - LEFT | ||||
| pie.operator(SetAreaType.bl_idname, text="Outliner", icon="OOPS").types = "OUTLINER" | pie.operator(SetAreaType.bl_idname, text="Outliner", icon="OOPS").types = "OUTLINER" | ||||
| # 3 - BOTTOM - RIGHT | # 3 - BOTTOM - RIGHT | ||||
| pie.menu(AreaTypePieOther.bl_idname, text="More Editors", icon="QUESTION") | pie.menu(AreaTypePieOther.bl_idname, text="More Editors", icon="QUESTION") | ||||
| class AreaTypePieOther(Menu): | class AreaTypePieOther(Menu): | ||||
| bl_idname = "INFO_MT_window_pie_area_type_other" | bl_idname = "TOPBAR_MT_window_pie_area_type_other" | ||||
| bl_label = "Editor Type (other)" | bl_label = "Editor Type (other)" | ||||
| bl_description = "Is pie menu change editor type (other)" | bl_description = "Is pie menu change editor type (other)" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| # 4 - LEFT | # 4 - LEFT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="Logic Editor", icon="LOGIC").types = "LOGIC_EDITOR" | self.layout.operator(SetAreaType.bl_idname, text="Logic Editor", icon="LOGIC").types = "LOGIC_EDITOR" | ||||
| # 6 - RIGHT | # 6 - RIGHT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="File Browser", icon="FILESEL").types = "FILE_BROWSER" | self.layout.operator(SetAreaType.bl_idname, text="File Browser", icon="FILEBROWSER").types = "FILE_BROWSER" | ||||
| # 2 - BOTTOM | # 2 - BOTTOM | ||||
| self.layout.operator(SetAreaType.bl_idname, text="Python Console", icon="CONSOLE").types = "CONSOLE" | self.layout.operator(SetAreaType.bl_idname, text="Python Console", icon="CONSOLE").types = "CONSOLE" | ||||
| # 8 - TOP | # 8 - TOP | ||||
| # 7 - TOP - LEFT | # 7 - TOP - LEFT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="User Preferences", | self.layout.operator(SetAreaType.bl_idname, text="User Preferences", | ||||
| icon="PREFERENCES").types = "USER_PREFERENCES" | icon="PREFERENCES").types = "USER_PREFERENCES" | ||||
| # 9 - TOP - RIGHT | # 9 - TOP - RIGHT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="Info", icon="INFO").types = "INFO" | self.layout.operator(SetAreaType.bl_idname, text="Info", icon="INFO").types = "INFO" | ||||
| # 1 - BOTTOM - LEFT | # 1 - BOTTOM - LEFT | ||||
| # 3 - BOTTOM - RIGHT | # 3 - BOTTOM - RIGHT | ||||
| class SetAreaType(Operator): | class SetAreaType(Operator): | ||||
| bl_idname = "wm.set_area_type" | bl_idname = "wm.set_area_type" | ||||
| bl_label = "Change Editor Type" | bl_label = "Change Editor Type" | ||||
| bl_description = "Change Editor Type" | bl_description = "Change Editor Type" | ||||
| bl_options = {'REGISTER'} | bl_options = {'REGISTER'} | ||||
| types = StringProperty(name="Area Type") | types: StringProperty(name="Area Type") | ||||
| def execute(self, context): | def execute(self, context): | ||||
| context.area.type = self.types | context.area.type = self.types | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| class AreaTypePieAnim(Menu): | class AreaTypePieAnim(Menu): | ||||
| bl_idname = "INFO_MT_window_pie_area_type_anim" | bl_idname = "TOPBAR_MT_window_pie_area_type_anim" | ||||
| bl_label = "Editor Type (Animation)" | bl_label = "Editor Type (Animation)" | ||||
| bl_description = "Menu for changing editor type (animation related)" | bl_description = "Menu for changing editor type (animation related)" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| # 4 - LEFT | # 4 - LEFT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="NLA Editor", icon="NLA").types = "NLA_EDITOR" | self.layout.operator(SetAreaType.bl_idname, text="NLA Editor", icon="NLA").types = "NLA_EDITOR" | ||||
| # 6 - RIGHT | # 6 - RIGHT | ||||
| self.layout.operator(SetAreaType.bl_idname, text="DopeSheet", icon="ACTION").types = "DOPESHEET_EDITOR" | self.layout.operator(SetAreaType.bl_idname, text="DopeSheet", icon="ACTION").types = "DOPESHEET_EDITOR" | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||