-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpanels.py
122 lines (99 loc) · 3.72 KB
/
panels.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import bpy
from bpy.types import Panel
from .preferences import get_addon_prefs
class SWD_PT_quick_pref_ui(Panel):
bl_label = "Sound waveform quick prefs"
bl_space_type = 'GRAPH_EDITOR'
bl_region_type = 'UI'
bl_category = "Display"
bl_options = {'INSTANCED'}
# bl_context = "Display"
def draw(self, context):
prefs = get_addon_prefs()
layout = self.layout
# layout.use_property_split = True
layout.prop(prefs, 'wave_color', text='Color')
layout.prop(prefs, 'wave_detail', text='Detail')
# layout.prop(prefs, 'force_mixdown')
layout.operator("swd.open_addon_prefs", text='Open All Prefs', icon='PREFERENCES')
def side_menu(self, context):
layout = self.layout
scn = context.scene
row = layout.row()
# row.operator('anim.timeline_draw_test', icon = 'NORMALIZE_FCURVES')
row.operator('anim.enable_draw', text='On', icon = 'NORMALIZE_FCURVES')
row.operator('anim.disable_draw', text='Off')
row = layout.row()
row.prop(scn.swd_settings, 'height_offset')
row = layout.row()
row.prop(scn.swd_settings, 'use_dope')
row.prop(scn.swd_settings, 'use_graph')
row = layout.row()
row.prop(scn.swd_settings, 'use_time')
## Direct prefs
# row.operator("swd.open_addon_prefs", text='Prefs', icon='PREFERENCES')
## quick prefs
row.popover('SWD_PT_quick_pref_ui', text='Prefs', icon='PREFERENCES')
layout.prop(scn.swd_settings, 'source')
if scn.swd_settings.source == 'SEQUENCER':
vse = scn.sequence_editor
if not vse:
layout.label(text='No sequencer active in scene')
return
layout.prop(scn.swd_settings, 'vse_target')
if scn.swd_settings.vse_target == 'LIST':
layout.template_list("SWD_UL_sound_list", "", vse, "sequences", \
scn.swd_settings, "seq_idx", rows=3)
# elif scn.swd_settings.source == 'SPEAKERS':
# layout.prop(scn.swd_settings, 'spk_target')
# row = layout.row()
# row.prop(scn.swd_settings, 'color')
def header_layout(self, context):
layout = self.layout
row = layout.row()
row.alignment = 'RIGHT'
row.operator("swd.open_addon_prefs", text='', icon='PREFERENCES')
class SWD_PT_SWD_GRAPH_ui(Panel):
bl_label = "Display waveform"
bl_space_type = 'GRAPH_EDITOR'
bl_region_type = 'UI'
bl_category = "Display"
# def draw_header(self, context):
# header_layout(self, context)
def draw(self, context):
side_menu(self, context)
# layout = self.layout
# row = layout.row()
# # row.operator('anim.timeline_draw_test', icon = 'NORMALIZE_FCURVES')
# row.operator('anim.enable_draw', text='On', icon = 'NORMALIZE_FCURVES')
# row.operator('anim.disable_draw', text='Off')
class SWD_PT_SWD_DOPE_ui(Panel):
bl_label = "Display waveform"
bl_space_type = 'DOPESHEET_EDITOR'
bl_region_type = 'UI'
bl_category = "Display"
# def draw_header(self, context):
# header_layout(self, context)
def draw(self, context):
side_menu(self, context)
## function to append in a menu
def palette_manager_menu(self, context):
"""Palette menu to append in existing menu"""
# GPENCIL_MT_material_context_menu
layout = self.layout
# {'EDIT_GPENCIL', 'PAINT_GPENCIL','SCULPT_GPENCIL','WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
layout.separator()
prefs = get_addon_prefs()
layout.operator("", text='do stuff from material submenu', icon='MATERIAL')
#-# REGISTER
classes=(
SWD_PT_quick_pref_ui,
SWD_PT_SWD_GRAPH_ui,
SWD_PT_SWD_DOPE_ui,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)