2D stabilizer: One more occurrence of len() in the drawing code
[blender.git] / release / scripts / startup / bl_ui / space_clip.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7 #
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.
12 #
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.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8-80 compliant>
20
21 import bpy
22 from bpy.types import Panel, Header, Menu, UIList
23 from bpy.app.translations import pgettext_iface as iface_
24 from bl_ui.properties_grease_pencil_common import (
25         GreasePencilDrawingToolsPanel,
26         GreasePencilStrokeEditPanel,
27         GreasePencilStrokeSculptPanel,
28         GreasePencilBrushPanel,
29         GreasePencilBrushCurvesPanel,
30         GreasePencilDataPanel,
31         GreasePencilPaletteColorPanel)
32
33
34 class CLIP_UL_tracking_objects(UIList):
35     def draw_item(self, context, layout, data, item, icon,
36                   active_data, active_propname, index):
37         # assert(isinstance(item, bpy.types.MovieTrackingObject)
38         tobj = item
39         if self.layout_type in {'DEFAULT', 'COMPACT'}:
40             layout.prop(tobj, "name", text="", emboss=False,
41                         icon='CAMERA_DATA' if tobj.is_camera
42                         else 'OBJECT_DATA')
43         elif self.layout_type == 'GRID':
44             layout.alignment = 'CENTER'
45             layout.label(text="",
46                          icon='CAMERA_DATA' if tobj.is_camera
47                          else 'OBJECT_DATA')
48
49
50 class CLIP_HT_header(Header):
51     bl_space_type = 'CLIP_EDITOR'
52
53     def _draw_tracking(self, context):
54         layout = self.layout
55
56         sc = context.space_data
57         clip = sc.clip
58
59         row = layout.row(align=True)
60         row.template_header()
61
62         CLIP_MT_tracking_editor_menus.draw_collapsible(context, layout)
63
64         row = layout.row()
65         row.template_ID(sc, "clip", open="clip.open")
66
67         if clip:
68             tracking = clip.tracking
69             active_object = tracking.objects.active
70
71             if sc.view == 'CLIP':
72                 layout.prop(sc, "mode", text="")
73                 layout.prop(sc, "view", text="", expand=True)
74                 layout.prop(sc, "pivot_point", text="", icon_only=True)
75
76                 r = active_object.reconstruction
77
78                 if r.is_valid and sc.view == 'CLIP':
79                     layout.label(text="Solve error: %.4f" %
80                                  (r.average_error))
81             elif sc.view == 'GRAPH':
82                 layout.prop(sc, "view", text="", expand=True)
83
84                 row = layout.row(align=True)
85                 row.prop(sc, "show_graph_only_selected", text="")
86                 row.prop(sc, "show_graph_hidden", text="")
87
88                 row = layout.row(align=True)
89
90                 if sc.show_filters:
91                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN',
92                              text="Filters")
93
94                     sub = row.row(align=True)
95                     sub.active = clip.tracking.reconstruction.is_valid
96                     sub.prop(sc, "show_graph_frames", icon='SEQUENCE', text="")
97
98                     row.prop(sc, "show_graph_tracks_motion", icon='IPO', text="")
99                     row.prop(sc, "show_graph_tracks_error", icon='ANIM', text="")
100                 else:
101                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT',
102                              text="Filters")
103             elif sc.view == 'DOPESHEET':
104                 dopesheet = tracking.dopesheet
105                 layout.prop(sc, "view", text="", expand=True)
106
107                 row = layout.row(align=True)
108                 row.prop(dopesheet, "show_only_selected", text="")
109                 row.prop(dopesheet, "show_hidden", text="")
110
111                 row = layout.row(align=True)
112                 row.prop(dopesheet, "sort_method", text="")
113                 row.prop(dopesheet, "use_invert_sort",
114                          text="Invert", toggle=True)
115         else:
116             layout.prop(sc, "view", text="", expand=True)
117
118     def _draw_masking(self, context):
119         layout = self.layout
120
121         toolsettings = context.tool_settings
122         sc = context.space_data
123         clip = sc.clip
124
125         row = layout.row(align=True)
126         row.template_header()
127
128         CLIP_MT_masking_editor_menus.draw_collapsible(context, layout)
129
130         row = layout.row()
131         row.template_ID(sc, "clip", open="clip.open")
132
133         if clip:
134             layout.prop(sc, "mode", text="")
135
136             row = layout.row()
137             row.template_ID(sc, "mask", new="mask.new")
138
139             layout.prop(sc, "pivot_point", text="", icon_only=True)
140
141             row = layout.row(align=True)
142             row.prop(toolsettings, "use_proportional_edit_mask",
143                      text="", icon_only=True)
144             if toolsettings.use_proportional_edit_mask:
145                 row.prop(toolsettings, "proportional_edit_falloff",
146                          text="", icon_only=True)
147
148     def draw(self, context):
149         layout = self.layout
150
151         sc = context.space_data
152
153         if sc.mode == 'TRACKING':
154             self._draw_tracking(context)
155         else:
156             self._draw_masking(context)
157
158         layout.template_running_jobs()
159
160
161 class CLIP_MT_tracking_editor_menus(Menu):
162     bl_idname = "CLIP_MT_tracking_editor_menus"
163     bl_label = ""
164
165     def draw(self, context):
166         self.draw_menus(self.layout, context)
167
168     @staticmethod
169     def draw_menus(layout, context):
170         sc = context.space_data
171         clip = sc.clip
172
173         layout.menu("CLIP_MT_view")
174
175         if sc.view == 'CLIP':
176             if clip:
177                 layout.menu("CLIP_MT_select")
178                 layout.menu("CLIP_MT_clip")
179                 layout.menu("CLIP_MT_track")
180                 layout.menu("CLIP_MT_reconstruction")
181             else:
182                 layout.menu("CLIP_MT_clip")
183
184
185 class CLIP_MT_masking_editor_menus(Menu):
186
187     bl_idname = "CLIP_MT_masking_editor_menus"
188     bl_label = ""
189
190     def draw(self, context):
191         self.draw_menus(self.layout, context)
192
193     @staticmethod
194     def draw_menus(layout, context):
195         sc = context.space_data
196         clip = sc.clip
197
198         layout.menu("CLIP_MT_view")
199
200         if clip:
201             layout.menu("MASK_MT_select")
202             layout.menu("CLIP_MT_clip")  # XXX - remove?
203             layout.menu("MASK_MT_mask")
204         else:
205             layout.menu("CLIP_MT_clip")  # XXX - remove?
206
207
208 class CLIP_PT_clip_view_panel:
209
210     @classmethod
211     def poll(cls, context):
212         sc = context.space_data
213         clip = sc.clip
214
215         return clip and sc.view == 'CLIP'
216
217
218 class CLIP_PT_tracking_panel:
219
220     @classmethod
221     def poll(cls, context):
222         sc = context.space_data
223         clip = sc.clip
224
225         return clip and sc.mode == 'TRACKING' and sc.view == 'CLIP'
226
227
228 class CLIP_PT_reconstruction_panel:
229
230     @classmethod
231     def poll(cls, context):
232         sc = context.space_data
233         clip = sc.clip
234
235         return clip and sc.view == 'CLIP'
236
237
238 class CLIP_PT_tools_clip(Panel):
239     bl_space_type = 'CLIP_EDITOR'
240     bl_region_type = 'TOOLS'
241     bl_label = "Clip"
242     bl_translation_context = bpy.app.translations.contexts.id_movieclip
243     bl_category = "Track"
244
245     @classmethod
246     def poll(cls, context):
247         sc = context.space_data
248         clip = sc.clip
249
250         return clip and sc.view == 'CLIP' and sc.mode != 'MASK'
251
252     def draw(self, context):
253         layout = self.layout
254         col = layout.column(align=True)
255         row = col.row(align=True)
256         row.operator("clip.prefetch", text="Prefetch")
257         row.operator("clip.reload", text="Reload")
258         col.operator("clip.set_scene_frames")
259
260
261 class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
262     bl_space_type = 'CLIP_EDITOR'
263     bl_region_type = 'TOOLS'
264     bl_label = "Marker"
265     bl_category = "Track"
266
267     def draw(self, context):
268         layout = self.layout
269
270         # sc = context.space_data
271         # clip = sc.clip
272
273         col = layout.column(align=True)
274         row = col.row(align=True)
275         row.operator("clip.add_marker_at_click", text="Add")
276         row.operator("clip.delete_track", text="Delete")
277         col.operator("clip.detect_features")
278
279
280 class CLIP_PT_tracking_settings(CLIP_PT_tracking_panel, Panel):
281     bl_space_type = 'CLIP_EDITOR'
282     bl_region_type = 'TOOLS'
283     bl_label = "Tracking Settings"
284     bl_category = "Track"
285
286     def draw(self, context):
287
288         sc = context.space_data
289         clip = sc.clip
290         settings = clip.tracking.settings
291         layout = self.layout
292         col = layout.column()
293
294         row = col.row(align=True)
295         label = CLIP_MT_tracking_settings_presets.bl_label
296         row.menu('CLIP_MT_tracking_settings_presets', text=label)
297         row.operator("clip.tracking_settings_preset_add",
298                      text="", icon='ZOOMIN')
299         row.operator("clip.tracking_settings_preset_add",
300                      text="", icon='ZOOMOUT').remove_active = True
301
302         row = col.row(align=True)
303         row.prop(settings, "use_default_red_channel",
304                  text="R", toggle=True)
305         row.prop(settings, "use_default_green_channel",
306                  text="G", toggle=True)
307         row.prop(settings, "use_default_blue_channel",
308                  text="B", toggle=True)
309
310         col.separator()
311
312         sub = col.column(align=True)
313         sub.prop(settings, "default_pattern_size")
314         sub.prop(settings, "default_search_size")
315
316         col.prop(settings, "default_motion_model")
317
318         row = col.row(align=True)
319         row.label(text="Match:")
320         row.prop(settings, "default_pattern_match", text="")
321
322         row = col.row(align=True)
323         row.prop(settings, "use_default_brute")
324         row.prop(settings, "use_default_normalization")
325
326         col.separator()
327         col.operator("clip.track_settings_as_default",
328                      text="Copy From Active Track")
329
330         box = layout.box()
331         row = box.row(align=True)
332         row.prop(settings, "show_default_expanded", text="", emboss=False)
333         row.label(text="Extra Settings")
334
335         if settings.show_default_expanded:
336             col = box.column()
337             row = col.row()
338             row.prop(settings, "use_default_mask")
339
340             sub = col.column(align=True)
341             sub.prop(settings, "default_correlation_min")
342             sub.prop(settings, "default_frames_limit")
343             sub.prop(settings, "default_margin")
344
345             col = box.column()
346             col.prop(settings, "default_weight")
347
348
349 class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
350     bl_space_type = 'CLIP_EDITOR'
351     bl_region_type = 'TOOLS'
352     bl_label = "Track"
353     bl_category = "Track"
354
355     def draw(self, context):
356         layout = self.layout
357
358         row = layout.row(align=True)
359         row.label(text="Track:")
360
361         props = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
362         props.backwards = True
363         props.sequence = False
364         props = row.operator("clip.track_markers", text="",
365                              icon='PLAY_REVERSE')
366         props.backwards = True
367         props.sequence = True
368         props = row.operator("clip.track_markers", text="", icon='PLAY')
369         props.backwards = False
370         props.sequence = True
371         props = row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
372         props.backwards = False
373         props.sequence = False
374
375         col = layout.column(align=True)
376         row = col.row(align=True)
377         row.label(text="Clear:")
378         row.scale_x = 2.0
379
380         props = row.operator("clip.clear_track_path", text="", icon='BACK')
381         props.action = 'UPTO'
382
383         props = row.operator("clip.clear_track_path", text="", icon='FORWARD')
384         props.action = 'REMAINED'
385
386         col = layout.column()
387         row = col.row(align=True)
388         row.label(text="Refine:")
389         row.scale_x = 2.0
390
391         props = row.operator("clip.refine_markers", text="", icon='LOOP_BACK')
392         props.backwards = True
393
394         props = row.operator("clip.refine_markers", text="", icon='LOOP_FORWARDS')
395         props.backwards = False
396
397         col = layout.column(align=True)
398         row = col.row(align=True)
399         row.label(text="Merge:")
400         row.operator("clip.join_tracks", text="Join Tracks")
401
402
403 class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel):
404     bl_space_type = 'CLIP_EDITOR'
405     bl_region_type = 'TOOLS'
406     bl_label = "Plane Track"
407     bl_options = {'DEFAULT_CLOSED'}
408     bl_category = "Solve"
409
410     def draw(self, context):
411         layout = self.layout
412         layout.operator("clip.create_plane_track")
413
414
415 class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
416     bl_space_type = 'CLIP_EDITOR'
417     bl_region_type = 'TOOLS'
418     bl_label = "Solve"
419     bl_category = "Solve"
420
421     def draw(self, context):
422         layout = self.layout
423
424         clip = context.space_data.clip
425         tracking = clip.tracking
426         settings = tracking.settings
427         tracking_object = tracking.objects.active
428
429         col = layout.column()
430         row = col.row()
431         row.prop(settings, "use_tripod_solver", text="Tripod")
432         sub = row.row()
433         sub.active = not settings.use_tripod_solver
434         sub.prop(settings, "use_keyframe_selection", text="Keyframe")
435
436         col = layout.column(align=True)
437         col.active = (not settings.use_tripod_solver and
438                       not settings.use_keyframe_selection)
439         col.prop(tracking_object, "keyframe_a")
440         col.prop(tracking_object, "keyframe_b")
441
442         col = layout.column(align=True)
443         col.active = tracking_object.is_camera
444         row = col.row(align=True)
445         row.label(text="Refine:")
446         row.prop(settings, "refine_intrinsics", text="")
447
448         col = layout.column(align=True)
449         col.scale_y = 2.0
450
451         col.operator("clip.solve_camera",
452                      text="Solve Camera Motion" if tracking_object.is_camera
453                      else "Solve Object Motion")
454
455
456 class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
457     bl_space_type = 'CLIP_EDITOR'
458     bl_region_type = 'TOOLS'
459     bl_label = "Clean up"
460     bl_options = {'DEFAULT_CLOSED'}
461     bl_category = "Solve"
462
463     def draw(self, context):
464         layout = self.layout
465         clip = context.space_data.clip
466         settings = clip.tracking.settings
467
468         layout.operator("clip.clean_tracks")
469
470         layout.prop(settings, "clean_frames", text="Frames")
471         layout.prop(settings, "clean_error", text="Error")
472         layout.prop(settings, "clean_action", text="")
473         layout.operator("clip.filter_tracks")
474
475
476 class CLIP_PT_tools_geometry(CLIP_PT_tracking_panel, Panel):
477     bl_space_type = 'CLIP_EDITOR'
478     bl_region_type = 'TOOLS'
479     bl_label = "Geometry"
480     bl_options = {'DEFAULT_CLOSED'}
481     bl_category = "Solve"
482
483     def draw(self, context):
484         layout = self.layout
485
486         layout.operator("clip.bundles_to_mesh")
487         layout.operator("clip.track_to_empty")
488
489
490 class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, Panel):
491     bl_space_type = 'CLIP_EDITOR'
492     bl_region_type = 'TOOLS'
493     bl_label = "Orientation"
494     bl_category = "Solve"
495
496     def draw(self, context):
497         sc = context.space_data
498         layout = self.layout
499         settings = sc.clip.tracking.settings
500
501         col = layout.column(align=True)
502         row = col.row(align=True)
503         row.operator("clip.set_plane", text="Floor").plane = 'FLOOR'
504         row.operator("clip.set_plane", text="Wall").plane = 'WALL'
505
506         col.operator("clip.set_origin")
507
508         row = col.row(align=True)
509         row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
510         row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
511
512         layout.separator()
513
514         col = layout.column()
515         row = col.row(align=True)
516         row.operator("clip.set_scale")
517         row.operator("clip.apply_solution_scale", text="Apply Scale")
518
519         col.prop(settings, "distance")
520
521
522 class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
523     bl_space_type = 'CLIP_EDITOR'
524     bl_region_type = 'TOOLS'
525     bl_label = "Object"
526     bl_category = "Solve"
527
528     @classmethod
529     def poll(cls, context):
530         if CLIP_PT_reconstruction_panel.poll(context):
531             sc = context.space_data
532             clip = sc.clip
533
534             tracking_object = clip.tracking.objects.active
535
536             return not tracking_object.is_camera
537
538         return False
539
540     def draw(self, context):
541         layout = self.layout
542
543         sc = context.space_data
544         clip = sc.clip
545         tracking_object = clip.tracking.objects.active
546         settings = sc.clip.tracking.settings
547
548         col = layout.column()
549
550         col.prop(tracking_object, "scale")
551
552         col.separator()
553
554         col.operator("clip.set_solution_scale", text="Set Scale")
555         col.prop(settings, "object_distance")
556
557
558 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
559     bl_space_type = 'CLIP_EDITOR'
560     bl_region_type = 'UI'
561     bl_label = "Objects"
562     bl_options = {'DEFAULT_CLOSED'}
563
564     def draw(self, context):
565         layout = self.layout
566
567         sc = context.space_data
568         tracking = sc.clip.tracking
569
570         row = layout.row()
571         row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects",
572                           tracking, "active_object_index", rows=1)
573
574         sub = row.column(align=True)
575
576         sub.operator("clip.tracking_object_new", icon='ZOOMIN', text="")
577         sub.operator("clip.tracking_object_remove", icon='ZOOMOUT', text="")
578
579
580 class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
581     bl_space_type = 'CLIP_EDITOR'
582     bl_region_type = 'UI'
583     bl_label = "Track"
584
585     def draw(self, context):
586         layout = self.layout
587
588         sc = context.space_data
589         clip = context.space_data.clip
590         act_track = clip.tracking.tracks.active
591
592         if not act_track:
593             layout.active = False
594             layout.label(text="No active track")
595             return
596
597         row = layout.row()
598         row.prop(act_track, "name", text="")
599
600         sub = row.row(align=True)
601
602         sub.template_marker(sc, "clip", sc.clip_user, act_track, True)
603
604         icon = 'LOCKED' if act_track.lock else 'UNLOCKED'
605         sub.prop(act_track, "lock", text="", icon=icon)
606
607         layout.template_track(sc, "scopes")
608
609         row = layout.row(align=True)
610         sub = row.row(align=True)
611         sub.prop(act_track, "use_red_channel", text="R", toggle=True)
612         sub.prop(act_track, "use_green_channel", text="G", toggle=True)
613         sub.prop(act_track, "use_blue_channel", text="B", toggle=True)
614
615         row.separator()
616
617         row.prop(act_track, "use_grayscale_preview", text="B/W", toggle=True)
618
619         row.separator()
620         row.prop(act_track, "use_alpha_preview",
621                  text="", toggle=True, icon='IMAGE_ALPHA')
622
623         layout.prop(act_track, "weight")
624         layout.prop(act_track, "weight_stab")
625
626         if act_track.has_bundle:
627             label_text = "Average Error: %.4f" % (act_track.average_error)
628             layout.label(text=label_text)
629
630         layout.separator()
631
632         row = layout.row(align=True)
633         label = bpy.types.CLIP_MT_track_color_presets.bl_label
634         row.menu('CLIP_MT_track_color_presets', text=label)
635         row.menu('CLIP_MT_track_color_specials', text="", icon='DOWNARROW_HLT')
636         row.operator("clip.track_color_preset_add", text="", icon='ZOOMIN')
637         row.operator("clip.track_color_preset_add",
638                      text="", icon='ZOOMOUT').remove_active = True
639
640         row = layout.row()
641         row.prop(act_track, "use_custom_color")
642         if act_track.use_custom_color:
643             row.prop(act_track, "color", text="")
644
645
646 class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
647     bl_space_type = 'CLIP_EDITOR'
648     bl_region_type = 'UI'
649     bl_label = "Plane Track"
650     bl_options = {'DEFAULT_CLOSED'}
651
652     def draw(self, context):
653         layout = self.layout
654
655         clip = context.space_data.clip
656         active_track = clip.tracking.plane_tracks.active
657
658         if not active_track:
659             layout.active = False
660             layout.label(text="No active plane track")
661             return
662
663         layout.prop(active_track, "name")
664         layout.prop(active_track, "use_auto_keying")
665         layout.prop(active_track, "image")
666
667         row = layout.row()
668         row.active = active_track.image is not None
669         row.prop(active_track, "image_opacity", text="Opacity")
670
671
672 class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
673     bl_space_type = 'CLIP_EDITOR'
674     bl_region_type = 'UI'
675     bl_label = "Tracking Settings"
676     bl_options = {'DEFAULT_CLOSED'}
677
678     def draw(self, context):
679         layout = self.layout
680
681         clip = context.space_data.clip
682         settings = clip.tracking.settings
683
684         col = layout.column()
685
686         active = clip.tracking.tracks.active
687         if active:
688             col.prop(active, "motion_model")
689             col.prop(active, "pattern_match", text="Match")
690             col = layout.column()
691             row = col.row(align=True)
692             row.prop(active, "use_brute")
693             row.prop(active, "use_normalization")
694
695             box = layout.box()
696             row = box.row(align=True)
697             row.prop(settings, "show_extra_expanded", text="", emboss=False)
698             row.label(text="Extra Settings")
699
700             if settings.show_extra_expanded:
701                 col = box.column()
702                 row = col.row()
703                 row.prop(active, "use_mask")
704
705                 sub = col.column(align=True)
706                 sub.prop(active, "correlation_min")
707                 sub.prop(active, "frames_limit")
708                 sub.prop(active, "margin")
709                 sub.separator()
710                 sub.prop(settings, "speed")
711
712
713 class CLIP_PT_tracking_camera(Panel):
714     bl_space_type = 'CLIP_EDITOR'
715     bl_region_type = 'UI'
716     bl_label = "Camera"
717     bl_options = {'DEFAULT_CLOSED'}
718
719     @classmethod
720     def poll(cls, context):
721         if CLIP_PT_clip_view_panel.poll(context):
722             sc = context.space_data
723
724             return sc.mode == 'TRACKING' and sc.clip
725
726         return False
727
728     def draw(self, context):
729         layout = self.layout
730
731         sc = context.space_data
732         clip = sc.clip
733
734         row = layout.row(align=True)
735         label = bpy.types.CLIP_MT_camera_presets.bl_label
736         row.menu('CLIP_MT_camera_presets', text=label)
737         row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
738         row.operator("clip.camera_preset_add", text="",
739                      icon='ZOOMOUT').remove_active = True
740
741         col = layout.column(align=True)
742         col.label(text="Sensor:")
743         col.prop(clip.tracking.camera, "sensor_width", text="Width")
744         col.prop(clip.tracking.camera, "pixel_aspect")
745
746         col = layout.column()
747         col.label(text="Optical Center:")
748         row = col.row()
749         row.prop(clip.tracking.camera, "principal", text="")
750         col.operator("clip.set_center_principal", text="Center")
751
752
753 class CLIP_PT_tracking_lens(Panel):
754     bl_space_type = 'CLIP_EDITOR'
755     bl_region_type = 'UI'
756     bl_label = "Lens"
757     bl_options = {'DEFAULT_CLOSED'}
758
759     @classmethod
760     def poll(cls, context):
761         if CLIP_PT_clip_view_panel.poll(context):
762             sc = context.space_data
763
764             return sc.mode == 'TRACKING' and sc.clip
765
766         return False
767
768     def draw(self, context):
769         layout = self.layout
770
771         sc = context.space_data
772         clip = sc.clip
773
774         row = layout.row(align=True)
775         sub = row.split(percentage=0.65, align=True)
776         if clip.tracking.camera.units == 'MILLIMETERS':
777             sub.prop(clip.tracking.camera, "focal_length")
778         else:
779             sub.prop(clip.tracking.camera, "focal_length_pixels")
780         sub.prop(clip.tracking.camera, "units", text="")
781
782         col = layout.column()
783         col.label(text="Lens Distortion:")
784         camera = clip.tracking.camera
785         col.prop(camera, "distortion_model", text="")
786         if camera.distortion_model == 'POLYNOMIAL':
787             col = layout.column(align=True)
788             col.prop(camera, "k1")
789             col.prop(camera, "k2")
790             col.prop(camera, "k3")
791         elif camera.distortion_model == 'DIVISION':
792             col = layout.column(align=True)
793             col.prop(camera, "division_k1")
794             col.prop(camera, "division_k2")
795
796
797 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
798     bl_space_type = 'CLIP_EDITOR'
799     bl_region_type = 'UI'
800     bl_label = "Display"
801
802     def draw(self, context):
803         layout = self.layout
804         sc = context.space_data
805
806         row = layout.row(align=True)
807
808         sub = row.row(align=True)
809         sub.prop(sc, "show_red_channel", text="R", toggle=True)
810         sub.prop(sc, "show_green_channel", text="G", toggle=True)
811         sub.prop(sc, "show_blue_channel", text="B", toggle=True)
812         row.separator()
813         row.prop(sc, "use_grayscale_preview", text="B/W", toggle=True)
814         row.separator()
815         row.prop(sc, "use_mute_footage", text="", icon='VISIBLE_IPO_ON', toggle=True)
816
817         col = layout.column(align=True)
818         col.prop(sc.clip_user, "use_render_undistorted", text="Render Undistorted")
819         col.prop(sc, "lock_selection", text="Lock to Selection")
820         col.prop(sc, "show_stable", text="Display Stabilization")
821         if sc.view == 'GRAPH':
822             col.prop(sc, "lock_time_cursor")
823         row = col.row(align=True)
824         row.prop(sc, "show_grid", text="Grid")
825         row.prop(sc, "use_manual_calibration", text="Calibration")
826
827         clip = sc.clip
828         if clip:
829             col.label(text="Display Aspect Ratio:")
830             row = col.row()
831             row.prop(clip, "display_aspect", text="")
832
833
834 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
835     bl_space_type = 'CLIP_EDITOR'
836     bl_region_type = 'UI'
837     bl_label = "Marker Display"
838
839     @classmethod
840     def poll(cls, context):
841         sc = context.space_data
842
843         return sc.mode != 'MASK'
844
845     def draw(self, context):
846         layout = self.layout
847         sc = context.space_data
848
849         col = layout.column(align=True)
850         row = col.row(align=True)
851         row.prop(sc, "show_marker_pattern", text="Pattern")
852         row.prop(sc, "show_marker_search", text="Search")
853
854         row = col.row(align=True)
855         row.active = sc.show_track_path
856         row.prop(sc, "show_track_path", text="Path")
857         row.prop(sc, "path_length", text="Length")
858
859         col = layout.column(align=True)
860         row = col.row(align=True)
861         row.prop(sc, "show_disabled", "Disabled")
862         row.prop(sc, "show_names", text="Info")
863
864         row = col.row(align=True)
865         if sc.mode != 'MASK':
866             row.prop(sc, "show_bundles", text="3D Markers")
867         row.prop(sc, "show_tiny_markers", text="Thin")
868
869
870 class CLIP_PT_marker(CLIP_PT_tracking_panel, Panel):
871     bl_space_type = 'CLIP_EDITOR'
872     bl_region_type = 'UI'
873     bl_label = "Marker"
874     bl_options = {'DEFAULT_CLOSED'}
875
876     def draw(self, context):
877         layout = self.layout
878         sc = context.space_data
879         clip = context.space_data.clip
880         act_track = clip.tracking.tracks.active
881
882         if act_track:
883             layout.template_marker(sc, "clip", sc.clip_user, act_track, False)
884         else:
885             layout.active = False
886             layout.label(text="No active track")
887
888
889 class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
890     bl_space_type = 'CLIP_EDITOR'
891     bl_region_type = 'UI'
892     bl_label = "2D Stabilization"
893     bl_category = "Stabilization"
894     bl_options = {'DEFAULT_CLOSED'}
895
896     @classmethod
897     def poll(cls, context):
898         if CLIP_PT_clip_view_panel.poll(context):
899             sc = context.space_data
900
901             return sc.mode == 'TRACKING' and sc.clip
902
903         return False
904
905     def draw_header(self, context):
906         stab = context.space_data.clip.tracking.stabilization
907
908         self.layout.prop(stab, "use_2d_stabilization", text="")
909
910     def draw(self, context):
911         tracking = context.space_data.clip.tracking
912         stab = tracking.stabilization
913
914         layout = self.layout
915         layout.active = stab.use_2d_stabilization
916
917         layout.prop(stab, "anchor_frame")
918
919         layout.prop(stab, "use_stabilize_rotation")
920
921         box = layout.box()
922         row = box.row(align=True)
923         row.prop(stab, "show_tracks_expanded", text="", emboss=False)
924
925         if not stab.show_tracks_expanded:
926             row.label(text="Tracks For Stabilization")
927         else:
928             row.label(text="Tracks For Location")
929             row = box.row()
930             row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks",
931                               stab, "active_track_index", rows=2)
932
933             sub = row.column(align=True)
934
935             sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="")
936             sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
937
938             sub.menu('CLIP_MT_stabilize_2d_specials', text="",
939                      icon='DOWNARROW_HLT')
940
941             row = box.row()
942             row.label(text="Tracks For Rotation / Scale")
943             row = box.row()
944             row.active = stab.use_stabilize_rotation
945             row.template_list("UI_UL_list", "stabilization_rotation_tracks", stab, "rotation_tracks",
946                               stab, "active_rotation_track_index", rows=2)
947
948             sub = row.column(align=True)
949
950             sub.operator("clip.stabilize_2d_rotation_add", icon='ZOOMIN', text="")
951             sub.operator("clip.stabilize_2d_rotation_remove", icon='ZOOMOUT', text="")
952
953             sub.menu('CLIP_MT_stabilize_2d_rotation_specials', text="",
954                      icon='DOWNARROW_HLT')
955
956         row = layout.row()
957         row.active = stab.use_stabilize_rotation
958         row.prop(stab, "use_stabilize_scale")
959         if stab.use_autoscale:
960             row = layout.row(align=True)
961             row.prop(stab, "use_autoscale")
962             row.prop(stab, "scale_max", text="Max")
963         else:
964             layout.prop(stab, "use_autoscale")
965
966         layout.separator()
967         layout.label(text="Expected Position")
968         layout.prop(stab, "target_position", text="")
969         layout.prop(stab, "target_rotation")
970         if stab.use_autoscale:
971             layout.label(text="Auto Scale Factor: %5.3f" % (1.0 / stab.target_zoom))
972         else:
973             layout.prop(stab, "target_zoom")
974
975         layout.separator()
976         layout.prop(stab, "influence_location")
977
978         col = layout.column()
979         col.active = stab.use_stabilize_rotation
980         row = col.row()
981         row.prop(stab, "influence_rotation")
982         row = col.row()
983         row.prop(stab, "influence_scale")
984
985         layout.prop(stab, "filter_type")
986
987
988 class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
989     bl_space_type = 'CLIP_EDITOR'
990     bl_region_type = 'UI'
991     bl_label = "Proxy/Timecode"
992     bl_options = {'DEFAULT_CLOSED'}
993
994     def draw_header(self, context):
995         sc = context.space_data
996
997         self.layout.prop(sc.clip, "use_proxy", text="")
998
999     def draw(self, context):
1000         layout = self.layout
1001
1002         sc = context.space_data
1003         clip = sc.clip
1004
1005         col = layout.column()
1006         col.active = clip.use_proxy
1007
1008         col.label(text="Build Original:")
1009
1010         row = col.row(align=True)
1011         row.prop(clip.proxy, "build_25", toggle=True)
1012         row.prop(clip.proxy, "build_50", toggle=True)
1013         row.prop(clip.proxy, "build_75", toggle=True)
1014         row.prop(clip.proxy, "build_100", toggle=True)
1015
1016         col.label(text="Build Undistorted:")
1017
1018         row = col.row(align=True)
1019         row.prop(clip.proxy, "build_undistorted_25", toggle=True)
1020         row.prop(clip.proxy, "build_undistorted_50", toggle=True)
1021         row.prop(clip.proxy, "build_undistorted_75", toggle=True)
1022         row.prop(clip.proxy, "build_undistorted_100", toggle=True)
1023
1024         col.prop(clip.proxy, "quality")
1025
1026         col.prop(clip, "use_proxy_custom_directory")
1027         if clip.use_proxy_custom_directory:
1028             col.prop(clip.proxy, "directory")
1029
1030         col.operator("clip.rebuild_proxy",
1031                      text="Build Proxy / Timecode" if clip.source == 'MOVIE'
1032                                                    else "Build Proxy")
1033
1034         if clip.source == 'MOVIE':
1035             col2 = col.column()
1036
1037             col2.label(text="Use timecode index:")
1038             col2.prop(clip.proxy, "timecode", text="")
1039
1040         col2 = col.column()
1041         col2.label(text="Proxy render size:")
1042
1043         col.prop(sc.clip_user, "proxy_render_size", text="")
1044
1045
1046 # -----------------------------------------------------------------------------
1047 # Mask (similar code in space_image.py, keep in sync)
1048
1049 from bl_ui.properties_mask_common import (
1050         MASK_PT_mask,
1051         MASK_PT_layers,
1052         MASK_PT_spline,
1053         MASK_PT_point,
1054         MASK_PT_display,
1055         MASK_PT_tools,
1056         MASK_PT_transforms,
1057         MASK_PT_add,
1058         )
1059
1060
1061 class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
1062     bl_space_type = 'CLIP_EDITOR'
1063     bl_region_type = 'UI'
1064
1065
1066 class CLIP_PT_mask_display(MASK_PT_display, Panel):
1067     bl_space_type = 'CLIP_EDITOR'
1068     bl_region_type = 'UI'
1069
1070
1071 class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
1072     bl_space_type = 'CLIP_EDITOR'
1073     bl_region_type = 'UI'
1074
1075
1076 class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
1077     bl_space_type = 'CLIP_EDITOR'
1078     bl_region_type = 'UI'
1079
1080
1081 class CLIP_PT_mask(MASK_PT_mask, Panel):
1082     bl_space_type = 'CLIP_EDITOR'
1083     bl_region_type = 'UI'
1084
1085
1086 class CLIP_PT_tools_mask_add(MASK_PT_add, Panel):
1087     bl_space_type = 'CLIP_EDITOR'
1088     bl_region_type = 'TOOLS'
1089
1090
1091 class CLIP_PT_tools_mask_transforms(MASK_PT_transforms, Panel):
1092     bl_space_type = 'CLIP_EDITOR'
1093     bl_region_type = 'TOOLS'
1094
1095
1096 class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
1097     bl_space_type = 'CLIP_EDITOR'
1098     bl_region_type = 'TOOLS'
1099
1100 # --- end mask ---
1101
1102
1103 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
1104     bl_space_type = 'CLIP_EDITOR'
1105     bl_region_type = 'UI'
1106     bl_label = "Footage Settings"
1107     bl_options = {'DEFAULT_CLOSED'}
1108
1109     def draw(self, context):
1110         layout = self.layout
1111
1112         sc = context.space_data
1113         clip = sc.clip
1114
1115         col = layout.column()
1116         col.template_movieclip(sc, "clip", compact=True)
1117         col.prop(clip, "frame_start")
1118         col.prop(clip, "frame_offset")
1119
1120
1121 class CLIP_PT_footage_info(CLIP_PT_clip_view_panel, Panel):
1122     bl_space_type = 'CLIP_EDITOR'
1123     bl_region_type = 'UI'
1124     bl_label = "Footage Information"
1125     bl_options = {'DEFAULT_CLOSED'}
1126
1127     def draw(self, context):
1128         layout = self.layout
1129
1130         sc = context.space_data
1131
1132         col = layout.column()
1133         col.template_movieclip_information(sc, "clip", sc.clip_user)
1134
1135
1136 class CLIP_PT_tools_scenesetup(Panel):
1137     bl_space_type = 'CLIP_EDITOR'
1138     bl_region_type = 'TOOLS'
1139     bl_label = "Scene Setup"
1140     bl_translation_context = bpy.app.translations.contexts.id_movieclip
1141     bl_category = "Solve"
1142
1143     @classmethod
1144     def poll(cls, context):
1145         sc = context.space_data
1146         clip = sc.clip
1147
1148         return clip and sc.view == 'CLIP' and sc.mode != 'MASK'
1149
1150     def draw(self, context):
1151         layout = self.layout
1152
1153         layout.operator("clip.set_viewport_background")
1154         layout.operator("clip.setup_tracking_scene")
1155
1156
1157 # Grease Pencil properties
1158 class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Panel):
1159     bl_space_type = 'CLIP_EDITOR'
1160     bl_region_type = 'UI'
1161     bl_options = {'DEFAULT_CLOSED'}
1162
1163     # NOTE: this is just a wrapper around the generic GP Panel
1164     # But, this should only be visible in "clip" view
1165
1166
1167 # Grease Pencil palette colors
1168 class CLIP_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, CLIP_PT_clip_view_panel, Panel):
1169     bl_space_type = 'CLIP_EDITOR'
1170     bl_region_type = 'UI'
1171     bl_options = {'DEFAULT_CLOSED'}
1172
1173     # NOTE: this is just a wrapper around the generic GP Panel
1174     # But, this should only be visible in "clip" view
1175
1176
1177 # Grease Pencil drawing tools
1178 class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
1179     bl_space_type = 'CLIP_EDITOR'
1180
1181
1182 # Grease Pencil stroke editing tools
1183 class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
1184     bl_space_type = 'CLIP_EDITOR'
1185
1186
1187 # Grease Pencil stroke sculpting tools
1188 class CLIP_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel):
1189     bl_space_type = 'CLIP_EDITOR'
1190
1191
1192 # Grease Pencil drawing brushes
1193 class CLIP_PT_tools_grease_pencil_brush(GreasePencilBrushPanel, Panel):
1194     bl_space_type = 'CLIP_EDITOR'
1195
1196
1197 # Grease Pencil drawing curves
1198 class CLIP_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Panel):
1199     bl_space_type = 'CLIP_EDITOR'
1200
1201 class CLIP_MT_view(Menu):
1202     bl_label = "View"
1203
1204     def draw(self, context):
1205         layout = self.layout
1206
1207         sc = context.space_data
1208
1209         if sc.view == 'CLIP':
1210             layout.operator("clip.properties", icon='MENU_PANEL')
1211             layout.operator("clip.tools", icon='MENU_PANEL')
1212             layout.separator()
1213
1214             layout.operator("clip.view_selected")
1215             layout.operator("clip.view_all")
1216             layout.operator("clip.view_all", text="View Fit").fit_view = True
1217
1218             layout.separator()
1219             layout.operator("clip.view_zoom_in")
1220             layout.operator("clip.view_zoom_out")
1221
1222             layout.separator()
1223             layout.prop(sc, "show_metadata")
1224             layout.separator()
1225
1226             ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
1227
1228             text = iface_("Zoom %d:%d")
1229             for a, b in ratios:
1230                 layout.operator("clip.view_zoom_ratio",
1231                                 text=text % (a, b),
1232                                 translate=False).ratio = a / b
1233         else:
1234             if sc.view == 'GRAPH':
1235                 layout.operator_context = 'INVOKE_REGION_PREVIEW'
1236                 layout.operator("clip.graph_center_current_frame")
1237                 layout.operator("clip.graph_view_all")
1238                 layout.operator_context = 'INVOKE_DEFAULT'
1239
1240             layout.prop(sc, "show_seconds")
1241             layout.prop(sc, "show_locked_time")
1242             layout.separator()
1243
1244         layout.separator()
1245         layout.operator("screen.area_dupli")
1246         layout.operator("screen.screen_full_area")
1247         layout.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True
1248
1249
1250 class CLIP_MT_clip(Menu):
1251     bl_label = "Clip"
1252     bl_translation_context = bpy.app.translations.contexts.id_movieclip
1253
1254     def draw(self, context):
1255         layout = self.layout
1256
1257         sc = context.space_data
1258         clip = sc.clip
1259
1260         layout.operator("clip.open")
1261
1262         if clip:
1263             layout.operator("clip.prefetch")
1264             layout.operator("clip.reload")
1265             layout.menu("CLIP_MT_proxy")
1266
1267
1268 class CLIP_MT_proxy(Menu):
1269     bl_label = "Proxy"
1270
1271     def draw(self, context):
1272         layout = self.layout
1273
1274         layout.operator("clip.rebuild_proxy")
1275         layout.operator("clip.delete_proxy")
1276
1277
1278 class CLIP_MT_track(Menu):
1279     bl_label = "Track"
1280
1281     def draw(self, context):
1282         layout = self.layout
1283
1284         layout.operator("clip.clear_solution")
1285         layout.operator("clip.solve_camera")
1286
1287         layout.separator()
1288         props = layout.operator("clip.clear_track_path", text="Clear After")
1289         props.clear_active = False
1290         props.action = 'REMAINED'
1291
1292         props = layout.operator("clip.clear_track_path", text="Clear Before")
1293         props.clear_active = False
1294         props.action = 'UPTO'
1295
1296         props = layout.operator("clip.clear_track_path", text="Clear Track Path")
1297         props.clear_active = False
1298         props.action = 'ALL'
1299
1300         layout.separator()
1301         layout.operator("clip.join_tracks")
1302
1303         layout.separator()
1304         layout.operator("clip.clean_tracks")
1305
1306         layout.separator()
1307         layout.operator("clip.copy_tracks")
1308         layout.operator("clip.paste_tracks")
1309
1310         layout.separator()
1311         props = layout.operator("clip.track_markers", text="Track Frame Backwards")
1312         props.backwards = True
1313         props.sequence = False
1314
1315         props = layout.operator("clip.track_markers", text="Track Backwards")
1316         props.backwards = True
1317         props.sequence = True
1318
1319         props = layout.operator("clip.track_markers", text="Track Forwards")
1320         props.backwards = False
1321         props.sequence = True
1322
1323         props = layout.operator("clip.track_markers", text="Track Frame Forwards")
1324         props.backwards = False
1325         props.sequence = False
1326
1327         layout.separator()
1328         layout.operator("clip.delete_track")
1329         layout.operator("clip.delete_marker")
1330
1331         layout.separator()
1332         layout.operator("clip.add_marker_move")
1333
1334         layout.separator()
1335         layout.menu("CLIP_MT_track_visibility")
1336         layout.menu("CLIP_MT_track_transform")
1337
1338
1339 class CLIP_MT_reconstruction(Menu):
1340     bl_label = "Reconstruction"
1341
1342     def draw(self, context):
1343         layout = self.layout
1344
1345         layout.operator("clip.set_origin")
1346         layout.operator("clip.set_plane", text="Set Floor").plane = 'FLOOR'
1347         layout.operator("clip.set_plane", text="Set Wall").plane = 'WALL'
1348
1349         layout.operator("clip.set_axis", text="Set X Axis").axis = 'X'
1350         layout.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
1351
1352         layout.operator("clip.set_scale")
1353
1354         layout.separator()
1355
1356         layout.operator("clip.track_to_empty")
1357         layout.operator("clip.bundles_to_mesh")
1358
1359
1360 class CLIP_MT_track_visibility(Menu):
1361     bl_label = "Show/Hide"
1362
1363     def draw(self, context):
1364         layout = self.layout
1365
1366         layout.operator("clip.hide_tracks_clear", text="Show Hidden")
1367         layout.operator("clip.hide_tracks", text="Hide Selected").unselected = False
1368         layout.operator("clip.hide_tracks", text="Hide Unselected").unselected = True
1369
1370
1371 class CLIP_MT_track_transform(Menu):
1372     bl_label = "Transform"
1373
1374     def draw(self, context):
1375         layout = self.layout
1376
1377         layout.operator("transform.translate")
1378         layout.operator("transform.resize")
1379
1380
1381 class CLIP_MT_select(Menu):
1382     bl_label = "Select"
1383
1384     def draw(self, context):
1385         layout = self.layout
1386
1387         layout.operator("clip.select_border")
1388         layout.operator("clip.select_circle")
1389
1390         layout.separator()
1391
1392         layout.operator("clip.select_all"
1393                         ).action = 'TOGGLE'
1394         layout.operator("clip.select_all",
1395                         text="Inverse").action = 'INVERT'
1396
1397         layout.menu("CLIP_MT_select_grouped")
1398
1399
1400 class CLIP_MT_select_grouped(Menu):
1401     bl_label = "Select Grouped"
1402
1403     def draw(self, context):
1404         layout = self.layout
1405
1406         layout.operator_enum("clip.select_grouped", "group")
1407
1408
1409 class CLIP_MT_tracking_specials(Menu):
1410     bl_label = "Specials"
1411
1412     @classmethod
1413     def poll(cls, context):
1414         return context.space_data.clip
1415
1416     def draw(self, context):
1417         layout = self.layout
1418
1419         layout.operator("clip.disable_markers",
1420                         text="Enable Markers").action = 'ENABLE'
1421
1422         layout.operator("clip.disable_markers",
1423                         text="Disable markers").action = 'DISABLE'
1424
1425         layout.separator()
1426         layout.operator("clip.set_origin")
1427
1428         layout.separator()
1429         layout.operator("clip.hide_tracks")
1430         layout.operator("clip.hide_tracks_clear", text="Show Tracks")
1431
1432         layout.separator()
1433         layout.operator("clip.lock_tracks", text="Lock Tracks").action = 'LOCK'
1434
1435         layout.operator("clip.lock_tracks",
1436                         text="Unlock Tracks").action = 'UNLOCK'
1437
1438
1439 class CLIP_MT_camera_presets(Menu):
1440     """Predefined tracking camera intrinsics"""
1441     bl_label = "Camera Presets"
1442     preset_subdir = "tracking_camera"
1443     preset_operator = "script.execute_preset"
1444     draw = Menu.draw_preset
1445
1446
1447 class CLIP_MT_track_color_presets(Menu):
1448     """Predefined track color"""
1449     bl_label = "Color Presets"
1450     preset_subdir = "tracking_track_color"
1451     preset_operator = "script.execute_preset"
1452     draw = Menu.draw_preset
1453
1454
1455 class CLIP_MT_tracking_settings_presets(Menu):
1456     """Predefined tracking settings"""
1457     bl_label = "Tracking Presets"
1458     preset_subdir = "tracking_settings"
1459     preset_operator = "script.execute_preset"
1460     draw = Menu.draw_preset
1461
1462
1463 class CLIP_MT_track_color_specials(Menu):
1464     bl_label = "Track Color Specials"
1465
1466     def draw(self, context):
1467         layout = self.layout
1468
1469         layout.operator("clip.track_copy_color", icon='COPY_ID')
1470
1471
1472 class CLIP_MT_stabilize_2d_specials(Menu):
1473     bl_label = "Translation Track Specials"
1474
1475     def draw(self, context):
1476         layout = self.layout
1477
1478         layout.operator("clip.stabilize_2d_select")
1479
1480
1481 class CLIP_MT_stabilize_2d_rotation_specials(Menu):
1482     bl_label = "Rotation Track Specials"
1483
1484     def draw(self, context):
1485         layout = self.layout
1486
1487         layout.operator("clip.stabilize_2d_rotation_select")
1488
1489
1490 if __name__ == "__main__":  # only for live edit.
1491     bpy.utils.register_module(__name__)