1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # panels get subclassed (not registered directly)
22 # menus are referenced `as is`
25 from bpy.types import Menu
29 # subclasses must define...
30 #~ bl_space_type = 'CLIP_EDITOR'
31 #~ bl_region_type = 'UI'
32 bl_label = "Mask Settings"
33 bl_options = {'DEFAULT_CLOSED'}
35 def draw(self, context):
38 sc = context.space_data
41 col = layout.column(align=True)
42 col.prop(mask, "frame_start")
43 col.prop(mask, "frame_end")
46 class MASK_PT_layers():
47 # subclasses must define...
48 #~ bl_space_type = 'CLIP_EDITOR'
49 #~ bl_region_type = 'UI'
50 bl_label = "Mask Layers"
53 def poll(cls, context):
54 sc = context.space_data
56 return sc.mask and sc.mode == 'MASKEDIT'
58 def draw(self, context):
61 sc = context.space_data
63 active_layer = mask.layers.active
65 rows = 5 if active_layer else 2
68 row.template_list(mask, "layers",
69 mask, "active_layer_index", rows=rows)
71 sub = row.column(align=True)
73 sub.operator("mask.layer_new", icon='ZOOMIN', text="")
74 sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
79 props = sub.operator("mask.layer_move", icon='TRIA_UP', text="")
80 props.direction = 'UP'
82 props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="")
83 props.direction = 'DOWN'
85 layout.prop(active_layer, "name")
88 row = layout.row(align=True)
89 row.prop(active_layer, "alpha")
90 row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
92 layout.prop(active_layer, "blend")
93 layout.prop(active_layer, "falloff")
96 class MASK_PT_spline():
97 # subclasses must define...
98 #~ bl_space_type = 'CLIP_EDITOR'
99 #~ bl_region_type = 'UI'
100 bl_label = "Active Spline"
103 def poll(cls, context):
104 sc = context.space_data
107 if mask and sc.mode == 'MASKEDIT':
108 return mask.layers.active and mask.layers.active.splines.active
112 def draw(self, context):
115 sc = context.space_data
117 spline = mask.layers.active.splines.active
119 col = layout.column()
120 col.prop(spline, "weight_interpolation")
122 rowsub.prop(spline, "use_cyclic")
123 rowsub.prop(spline, "use_fill")
126 class MASK_PT_point():
127 # subclasses must define...
128 #~ bl_space_type = 'CLIP_EDITOR'
129 #~ bl_region_type = 'UI'
130 bl_label = "Active Point"
133 def poll(cls, context):
134 sc = context.space_data
137 if mask and sc.mode == 'MASKEDIT':
138 mask_layer_active = mask.layers.active
139 return (mask_layer_active and
140 mask_layer_active.splines.active_point)
144 def draw(self, context):
147 sc = context.space_data
149 point = mask.layers.active.splines.active_point
150 parent = point.parent
152 col = layout.column()
153 col.prop(point, "handle_type")
155 col = layout.column()
156 # Currently only parenting yo movie clip is allowed, so do not
157 # ver-oplicate things for now and use single template_ID
158 #col.template_any_ID(parent, "id", "id_type", text="")
161 col.prop(parent, "id", text="")
163 if parent.id_type == 'MOVIECLIP' and parent.id:
165 tracking = clip.tracking
167 col.prop_search(parent, "parent", tracking,
168 "objects", icon='OBJECT_DATA', text="Object:")
170 if parent.parent in tracking.objects:
171 object = tracking.objects[parent.parent]
172 col.prop_search(parent, "sub_parent", object,
173 "tracks", icon='ANIM_DATA', text="Track:")
175 col.prop_search(parent, "sub_parent", tracking,
176 "tracks", icon='ANIM_DATA', text="Track:")
179 class MASK_PT_display():
180 # subclasses must define...
181 #~ bl_space_type = 'CLIP_EDITOR'
182 #~ bl_region_type = 'UI'
183 bl_label = "Mask Display"
184 bl_options = {'DEFAULT_CLOSED'}
186 def draw(self, context):
189 sc = context.space_data
191 col.prop(layout, "mask_draw_type", text="")
192 col.prop(layout, "show_mask_smooth")
195 class MASK_PT_tools():
196 # subclasses must define...
197 #~ bl_space_type = 'CLIP_EDITOR'
198 #~ bl_region_type = 'TOOLS'
199 bl_label = "Mask Tools"
201 def draw(self, context):
204 col = layout.column(align=True)
205 col.label(text="Transform:")
206 col.operator("transform.translate")
207 col.operator("transform.rotate")
208 col.operator("transform.resize", text="Scale")
209 props = col.operator("transform.transform", text="Shrink/Fatten")
210 props.mode = 'MASK_SHRINKFATTEN'
212 col = layout.column(align=True)
213 col.label(text="Spline:")
214 col.operator("mask.delete")
215 col.operator("mask.cyclic_toggle")
216 col.operator("mask.switch_direction")
218 col = layout.column(align=True)
219 col.label(text="Parenting:")
220 col.operator("mask.parent_set")
221 col.operator("mask.parent_clear")
224 class MASK_MT_mask(Menu):
227 def draw(self, context):
230 layout.operator("mask.delete")
233 layout.operator("mask.cyclic_toggle")
234 layout.operator("mask.switch_direction")
235 layout.operator("mask.normals_make_consistent")
236 layout.operator("mask.feather_weight_clear") # TODO, better place?
239 layout.operator("mask.parent_clear")
240 layout.operator("mask.parent_set")
243 layout.menu("MASK_MT_visibility")
244 layout.menu("MASK_MT_transform")
245 layout.menu("MASK_MT_animation")
248 class MASK_MT_visibility(Menu):
249 bl_label = "Show/Hide"
251 def draw(self, context):
254 layout.operator("mask.hide_view_clear", text="Show Hidden")
255 layout.operator("mask.hide_view_set", text="Hide Selected")
257 props = layout.operator("mask.hide_view_set", text="Hide Unselected")
258 props.unselected = True
261 class MASK_MT_transform(Menu):
262 bl_label = "Transform"
264 def draw(self, context):
267 layout.operator("transform.translate")
268 layout.operator("transform.rotate")
269 layout.operator("transform.resize")
270 props = layout.operator("transform.transform", text="Shrink/Fatten")
271 props.mode = 'MASK_SHRINKFATTEN'
274 class MASK_MT_animation(Menu):
275 bl_label = "Animation"
277 def draw(self, context):
280 layout.operator("mask.shape_key_clear")
281 layout.operator("mask.shape_key_insert")
282 layout.operator("mask.shape_key_feather_reset")
283 layout.operator("mask.shape_key_rekey")
286 class MASK_MT_select(Menu):
289 def draw(self, context):
291 sc = context.space_data
293 layout.operator("mask.select_border")
294 layout.operator("mask.select_circle")
298 layout.operator("mask.select_all"
300 layout.operator("mask.select_all",
301 text="Inverse").action = 'INVERT'
303 if __name__ == "__main__": # only for live edit.
304 bpy.utils.register_module(__name__)