1 # SPDX-FileCopyrightText: 2016-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 "name": "Hotkey: 'Ctrl Alt S' ",
7 "description": "Switch Editor Type Menu",
8 "author": "saidenka, meta-androcto",
10 "blender": (3, 40, 1),
11 "location": "All Editors",
14 "category": "Editor Switch Pie"
18 from bpy
.types
import (
22 from bpy
.props
import (
29 class PIE_MT_AreaPieEditor(Menu
):
30 bl_idname
= "PIE_MT_editor"
31 bl_label
= "Editor Switch"
33 def draw(self
, context
):
35 pie
= layout
.menu_pie()
37 pie
.operator(PIE_OT_SetAreaType
.bl_idname
,
38 text
="Video Sequence Editor", icon
="SEQUENCE").types
= "SEQUENCE_EDITOR"
40 pie
.menu(PIE_MT_AreaTypePieNode
.bl_idname
, text
="Node Editors", icon
="NODETREE")
42 pie
.menu(PIE_MT_AreaTypePieOther
.bl_idname
, text
="Script/Data Editors", icon
="PREFERENCES")
44 pie
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="3D View", icon
="VIEW3D").types
= "VIEW_3D"
46 pie
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Image Editor", icon
="IMAGE").types
= "IMAGE_EDITOR"
48 pie
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="UV Editor", icon
="UV").types
= "UV"
50 pie
.operator(PIE_OT_SetAreaType
.bl_idname
,
51 text
="Movie Clip Editor", icon
="TRACKER").types
= "CLIP_EDITOR"
53 pie
.menu(PIE_MT_AreaTypePieAnim
.bl_idname
, text
="Animation Editors", icon
="ACTION")
55 # Sub Menu Script/Data Editors
58 class PIE_MT_AreaTypePieOther(Menu
):
59 bl_idname
= "TOPBAR_MT_window_pie_area_type_other"
60 bl_label
= "Editor Type (other)"
61 bl_description
= "Is pie menu change editor type (other)"
63 def draw(self
, context
):
64 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Outliner", icon
="OUTLINER").types
= "OUTLINER"
65 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Properties", icon
="PROPERTIES").types
= "PROPERTIES"
67 PIE_OT_SetAreaType
.bl_idname
,
69 icon
="FILEBROWSER").types
= "FILES"
70 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Preferences",
71 icon
="PREFERENCES").types
= "PREFERENCES"
72 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Text Editor", icon
="TEXT").types
= "TEXT_EDITOR"
73 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Python Console", icon
="CONSOLE").types
= "CONSOLE"
74 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Info", icon
="INFO").types
= "INFO"
75 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Spreadsheet", icon
="SPREADSHEET").types
= "SPREADSHEET"
76 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Asset Browser", icon
="ASSET_MANAGER").types
= "ASSETS"
79 # Sub Menu Node editors.
80 class PIE_MT_AreaTypePieNode(Menu
):
81 bl_idname
= "TOPBAR_MT_window_pie_area_type_node"
82 bl_label
= "Editor Type (Node)"
83 bl_description
= "Menu to change node editor types"
85 def draw(self
, context
):
86 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Shader", icon
="NODE_MATERIAL").types
= "ShaderNodeTree"
87 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Compositor",
88 icon
="NODE_COMPOSITING").types
= "CompositorNodeTree"
89 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Texture",
90 icon
="NODE_TEXTURE").types
= "TextureNodeTree"
91 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Geometry",
92 icon
="NODETREE").types
= "GeometryNodeTree"
95 # Sub Menu animation Editors.
96 class PIE_MT_AreaTypePieAnim(Menu
):
97 bl_idname
= "TOPBAR_MT_window_pie_area_type_anim"
98 bl_label
= "Editor Type (Animation)"
99 bl_description
= "Menu for changing editor type (animation related)"
101 def draw(self
, context
):
102 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="DopeSheet", icon
="ACTION").types
= "DOPESHEET"
103 self
.layout
.operator(PIE_OT_Timeline
.bl_idname
, text
="Timeline", icon
="TIME")
104 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Graph Editor", icon
="GRAPH").types
= "FCURVES"
105 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="Drivers", icon
="DRIVER").types
= "DRIVERS"
106 self
.layout
.operator(PIE_OT_SetAreaType
.bl_idname
, text
="NLA Editor", icon
="NLA").types
= "NLA_EDITOR"
110 class PIE_OT_SetAreaType(Operator
):
111 bl_idname
= "wm.set_area_type"
112 bl_label
= "Change Editor Type"
113 bl_description
= "Change Editor Type"
114 bl_options
= {'REGISTER'}
116 types
: StringProperty(name
="Area Type")
118 def execute(self
, context
):
119 context
.area
.ui_type
= self
.types
123 class PIE_OT_Timeline(Operator
):
124 bl_idname
= "wm.set_timeline"
125 bl_label
= "Change Editor Type"
126 bl_description
= "Change Editor Type"
127 bl_options
= {'REGISTER'}
129 def execute(self
, context
):
130 bpy
.context
.area
.ui_type
= 'TIMELINE'
135 PIE_MT_AreaPieEditor
,
136 PIE_MT_AreaTypePieOther
,
138 PIE_MT_AreaTypePieAnim
,
140 PIE_MT_AreaTypePieNode
148 bpy
.utils
.register_class(cls
)
150 wm
= bpy
.context
.window_manager
151 if wm
.keyconfigs
.addon
:
153 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Window')
154 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'S', 'PRESS', ctrl
=True, alt
=True)
155 kmi
.properties
.name
= "PIE_MT_editor"
156 addon_keymaps
.append((km
, kmi
))
161 bpy
.utils
.unregister_class(cls
)
163 wm
= bpy
.context
.window_manager
164 kc
= wm
.keyconfigs
.addon
166 for km
, kmi
in addon_keymaps
:
167 km
.keymap_items
.remove(kmi
)
168 addon_keymaps
.clear()
171 if __name__
== "__main__":