-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgui.py
222 lines (180 loc) · 8.48 KB
/
gui.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import bpy
from bpy.types import Panel, PropertyGroup, UIList, Operator, OperatorFileListElement
#from bpy.props import StringProperty, CollectionProperty, IntProperty, PointerProperty, BoolProperty
#from pathlib import Path
#import bpy
#from bpy_extras.io_utils import ImportHelper
#from os import path
class SCREENWRITER_PT_panel(bpy.types.Panel):
"""Preview fountain script as formatted screenplay"""
bl_label = "Screenwriter"
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
class SCREENWRITER_PT_preview_panel(bpy.types.Panel):
"""Screenwriter Setup Options"""
bl_label = "Preview"
bl_parent_id = "SCREENWRITER_PT_panel"
#bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
column = layout.column(heading="Split", align=True)
split = column.split(factor=0.4, align=True)
split.alignment = 'RIGHT'
split.label(text="Add")
split.operator("screenwriter.dual_view", text="Dual View")
column = layout.column(heading="Refresh", align=True)
repl = context.scene.text_replace
column.prop(repl, "enabled", text="Auto", toggle=True)
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="")
split.operator("scene.preview_fountain", text="Manual")
split.active = not repl.enabled
prefs = context.preferences
view = prefs.view
layout.prop(view, "font_path_ui_mono", text="Font")
class SCREENWRITER_PT_layout_panel(bpy.types.Panel):
"""Screenwriter Layout Options"""
bl_label = "Layout"
bl_parent_id = "SCREENWRITER_PT_panel"
#bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
column = layout.column(align=True)
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="Insert")
split.operator("screenwriter.insert_title_page", text="Title Page")
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="")
split.operator("screenwriter.insert_scene_numbers", text="Scene Numbers")
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="")
split.operator("screenwriter.insert_shot", text="Shot")
column = layout.column(align=True)
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="Correct")
split.operator("screenwriter.correct_caps", text="Caps")
class SCREENWRITER_PT_screenplayer_panel(bpy.types.Panel):
"""Screenwriter Screenplayer Options"""
bl_label = "Screenplayer"
bl_parent_id = "SCREENWRITER_PT_panel"
#bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
scn = context.scene
props = scn.keywords_assigner
layout = layout.column(align=False)
layout.label(text="Keywords from Screenplay:")
row = layout.row(align=False)
row.prop(props, "new_keyword", text="")
row.operator("ops.get_keyword", text="", icon="EYEDROPPER")
row = layout.row()
row.template_list("OBJECT_UL_screenwriter_keywords", "", props, "keywords", props, "keyword_index", rows=5)
col = row.column()
col.operator("ops.add_keyword", text="", icon="ADD")
col.operator("ops.sw_remove_keyword", text="", icon="REMOVE")
col.operator("ops.sw_move_keyword_up", text="", icon="TRIA_UP")
col.operator("ops.sw_move_keyword_down", text="", icon="TRIA_DOWN")
col.operator("ops.rename_keyword", text="", icon="COPY_ID")
if 0 <= props.keyword_index < len(props.keywords):
layout.label(text="Assigned 3D Objects:")
keyword = props.keywords[props.keyword_index]
row = layout.row()
row.template_list("OBJECT_UL_screenwriter_objects", "", keyword, "objects", keyword, "object_index",
rows=7)
col = row.column()
col.operator("ops.sw_add_objects", text="", icon="ADD")
col.operator("ops.sw_remove_file", text="", icon="REMOVE")
col.operator("ops.sw_move_file_up", text="", icon="TRIA_UP")
col.operator("ops.sw_move_file_down", text="", icon="TRIA_DOWN")
# layout.separator()
# col = layout.row(align=True)
# col.operator("ops.sw_load_reload_objects", icon="FILE_REFRESH")
# col.operator("ops.sw_remove_keyword_objects", icon="REMOVE")
# col = layout.row(align=True)
# col.operator("ops.sw_save_keyword_objects", icon="WINDOW")
# col.operator("ops.sw_run_objects", icon="PLAY")
#layout.operator("text.scenes_to_strips")
layout_big = layout.column(align=False)
layout_big.separator()
layout_big.scale_y = 1.3
layout_big.operator("screenwriter.fountain_to_strips", text="Generate Movie")
#layout.operator("screenwriter.strips_to_markers")
#layout.operator("screenwriter.clear_markers")
#layout.prop(context.scene, 'screenwriter_channel')
class SCREENWRITER_PT_mindmap_panel(bpy.types.Panel):
"""Screenwriter Mindmap Options"""
bl_label = "Mindmap"
bl_parent_id = "SCREENWRITER_PT_screenplayer_panel"
#bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
layout_big = layout.column(align=False)
layout_big.scale_y = 1.3
layout_big.operator("screenwriter.mindmap_fountain", text="Generate Mindmap")
layout_big.operator("screenwriter.return_mindmap", text="Return Mindmap")
class SCREENWRITER_PT_navigation_panel(bpy.types.Panel):
"""Screenwriter Navigation Options"""
bl_label = "Navigation"
bl_parent_id = "SCREENWRITER_PT_screenplayer_panel"
#bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Screenwriter"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
column = layout.column(heading="Switch to", align=True)
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="Switch to")
split.operator("text.switch_to_scene", text="Screenplay Scene")
split = column.split(factor=0.4, align=False)
split.alignment = 'RIGHT'
split.label(text="")
split.operator("text.switch_to_master", text="Master Scene")
# ---------------------------------------------------------------------------------------------
# UI LISTS
# ---------------------------------------------------------------------------------------------
class OBJECT_UL_screenwriter_keywords(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
row = layout.row(align=True)
row.label(text=item.name)
row.label(text="{} Object(s)".format(len(item.objects)))
class OBJECT_UL_screenwriter_objects(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
row = layout.row(align=True)
row.label(text=item.objectname)
row.label(text=item.objecttype.title())
# row.prop(item, "runnable", text="Visible")
def screenwriter_menu_export(self, context):
self.layout.separator()
self.layout.operator("export.screenplay", text="Export Screenplay")