-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuick_Graph_Editor.py
More file actions
40 lines (30 loc) · 1.08 KB
/
Quick_Graph_Editor.py
File metadata and controls
40 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
bl_info = {
"name": "Quick Graph Editor",
"blender": (4, 1, 0),
"category": "Interface",
}
import bpy
class NewWindowOperator(bpy.types.Operator):
"""Open the graph editor in a new window"""
bl_idname = "wm.new_window_operator"
bl_label = "Quick Graph Editor"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.wm.window_new()
new_window = bpy.context.window_manager.windows[-1]
new_screen = new_window.screen
for area in new_screen.areas:
area.type = 'GRAPH_EDITOR'
return {'FINISHED'}
def draw_new_window_icon(self, context):
layout = self.layout
if context.region.alignment == 'RIGHT':
layout.operator("wm.new_window_operator", text="", icon='GRAPH')
def register():
bpy.utils.register_class(NewWindowOperator)
bpy.types.TOPBAR_HT_upper_bar.prepend(draw_new_window_icon)
def unregister():
bpy.utils.unregister_class(NewWindowOperator)
bpy.types.TOPBAR_HT_upper_bar.remove(draw_new_window_icon)
if __name__ == "__main__":
register()