a9db1266bc68a7d4e2d97957e9034dcaeffa2279
[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_pos", text="")
969         layout.prop(stab, "target_rot")
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         row = layout.row()
977         row.active = 0 < len(stab.tracks.values())
978         row.prop(stab, "influence_location")
979
980         col = layout.column()
981         col.active = stab.use_stabilize_rotation and 0 < len(stab.rotation_tracks.values())
982         row = col.row()
983         row.prop(stab, "influence_rotation")
984         row = col.row()
985         row.prop(stab, "influence_scale")
986
987         layout.prop(stab, "filter_type")
988
989
990 class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
991     bl_space_type = 'CLIP_EDITOR'
992     bl_region_type = 'UI'
993     bl_label = "Proxy/Timecode"
994     bl_options = {'DEFAULT_CLOSED'}
995
996     def draw_header(self, context):
997         sc = context.space_data
998
999         self.layout.prop(sc.clip, "use_proxy", text="")
1000
1001     def draw(self, context):
1002         layout = self.layout
1003
1004         sc = context.space_data
1005         clip = sc.clip
1006
1007         col = layout.column()
1008         col.active = clip.use_proxy
1009
1010         col.label(text="Build Original:")
1011
1012         row = col.row(align=True)
1013         row.prop(clip.proxy, "build_25", toggle=True)
1014         row.prop(clip.proxy, "build_50", toggle=True)
1015         row.prop(clip.proxy, "build_75", toggle=True)
1016         row.prop(clip.proxy, "build_100", toggle=True)
1017
1018         col.label(text="Build Undistorted:")
1019
1020         row = col.row(align=True)
1021         row.prop(clip.proxy, "build_undistorted_25", toggle=True)
1022         row.prop(clip.proxy, "build_undistorted_50", toggle=True)
1023         row.prop(clip.proxy, "build_undistorted_75", toggle=True)
1024         row.prop(clip.proxy, "build_undistorted_100", toggle=True)
1025
1026         col.prop(clip.proxy, "quality")
1027
1028         col.prop(clip, "use_proxy_custom_directory")
1029         if clip.use_proxy_custom_directory:
1030             col.prop(clip.proxy, "directory")
1031
1032         col.operator("clip.rebuild_proxy",
1033                      text="Build Proxy / Timecode" if clip.source == 'MOVIE'
1034                                                    else "Build Proxy")
1035
1036         if clip.source == 'MOVIE':
1037             col2 = col.column()
1038
1039             col2.label(text="Use timecode index:")
1040             col2.prop(clip.proxy, "timecode", text="")
1041
1042         col2 = col.column()
1043         col2.label(text="Proxy render size:")
1044
1045         col.prop(sc.clip_user, "proxy_render_size", text="")
1046
1047
1048 # -----------------------------------------------------------------------------
1049 # Mask (similar code in space_image.py, keep in sync)
1050
1051 from bl_ui.properties_mask_common import (
1052         MASK_PT_mask,
1053         MASK_PT_layers,
1054         MASK_PT_spline,
1055         MASK_PT_point,
1056         MASK_PT_display,
1057         MASK_PT_tools,
1058         MASK_PT_transforms,
1059         MASK_PT_add,
1060         )
1061
1062
1063 class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
1064     bl_space_type = 'CLIP_EDITOR'
1065     bl_region_type = 'UI'
1066
1067
1068 class CLIP_PT_mask_display(MASK_PT_display, Panel):
1069     bl_space_type = 'CLIP_EDITOR'
1070     bl_region_type = 'UI'
1071
1072
1073 class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
1074     bl_space_type = 'CLIP_EDITOR'
1075     bl_region_type = 'UI'
1076
1077
1078 class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
1079     bl_space_type = 'CLIP_EDITOR'
1080     bl_region_type = 'UI'
1081
1082
1083 class CLIP_PT_mask(MASK_PT_mask, Panel):
1084     bl_space_type = 'CLIP_EDITOR'
1085     bl_region_type = 'UI'
1086
1087
1088 class CLIP_PT_tools_mask_add(MASK_PT_add, Panel):
1089     bl_space_type = 'CLIP_EDITOR'
1090     bl_region_type = 'TOOLS'
1091
1092
1093 class CLIP_PT_tools_mask_transforms(MASK_PT_transforms, Panel):
1094     bl_space_type = 'CLIP_EDITOR'
1095     bl_region_type = 'TOOLS'
1096
1097
1098 class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
1099     bl_space_type = 'CLIP_EDITOR'
1100     bl_region_type = 'TOOLS'
1101
1102 # --- end mask ---
1103
1104
1105 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
1106     bl_space_type = 'CLIP_EDITOR'
1107     bl_region_type = 'UI'
1108     bl_label = "Footage Settings"
1109     bl_options = {'DEFAULT_CLOSED'}
1110
1111     def draw(self, context):
1112         layout = self.layout
1113
1114         sc = context.space_data
1115         clip = sc.clip
1116
1117         col = layout.column()
1118         col.template_movieclip(sc, "clip", compact=True)
1119         col.prop(clip, "frame_start")
1120         col.prop(clip, "frame_offset")
1121
1122
1123 class CLIP_PT_footage_info(CLIP_PT_clip_view_panel, Panel):
1124     bl_space_type = 'CLIP_EDITOR'
1125     bl_region_type = 'UI'
1126     bl_label = "Footage Information"
1127     bl_options = {'DEFAULT_CLOSED'}
1128
1129     def draw(self, context):
1130         layout = self.layout
1131
1132         sc = context.space_data
1133
1134         col = layout.column()
1135         col.template_movieclip_information(sc, "clip", sc.clip_user)
1136
1137
1138 class CLIP_PT_tools_scenesetup(Panel):
1139     bl_space_type = 'CLIP_EDITOR'
1140     bl_region_type = 'TOOLS'
1141     bl_label = "Scene Setup"
1142     bl_translation_context = bpy.app.translations.contexts.id_movieclip
1143     bl_category = "Solve"
1144
1145     @classmethod
1146     def poll(cls, context):
1147         sc = context.space_data
1148         clip = sc.clip
1149
1150         return clip and sc.view == 'CLIP' and sc.mode != 'MASK'
1151
1152     def draw(self, context):
1153         layout = self.layout
1154
1155         layout.operator("clip.set_viewport_background")
1156         layout.operator("clip.setup_tracking_scene")
1157
1158
1159 # Grease Pencil properties
1160 class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Panel):
1161     bl_space_type = 'CLIP_EDITOR'
1162     bl_region_type = 'UI'
1163     bl_options = {'DEFAULT_CLOSED'}
1164
1165     # NOTE: this is just a wrapper around the generic GP Panel
1166     # But, this should only be visible in "clip" view
1167
1168
1169 # Grease Pencil palette colors
1170 class CLIP_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, CLIP_PT_clip_view_panel, Panel):
1171     bl_space_type = 'CLIP_EDITOR'
1172     bl_region_type = 'UI'
1173     bl_options = {'DEFAULT_CLOSED'}
1174
1175     # NOTE: this is just a wrapper around the generic GP Panel
1176     # But, this should only be visible in "clip" view
1177
1178
1179 # Grease Pencil drawing tools
1180 class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
1181     bl_space_type = 'CLIP_EDITOR'
1182
1183
1184 # Grease Pencil stroke editing tools
1185 class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
1186     bl_space_type = 'CLIP_EDITOR'
1187
1188
1189 # Grease Pencil stroke sculpting tools
1190 class CLIP_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel):
1191     bl_space_type = 'CLIP_EDITOR'
1192
1193
1194 # Grease Pencil drawing brushes
1195 class CLIP_PT_tools_grease_pencil_brush(GreasePencilBrushPanel, Panel):
1196     bl_space_type = 'CLIP_EDITOR'
1197
1198
1199 # Grease Pencil drawing curves
1200 class CLIP_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Panel):
1201     bl_space_type = 'CLIP_EDITOR'
1202
1203 class CLIP_MT_view(Menu):
1204     bl_label = "View"
1205
1206     def draw(self, context):
1207         layout = self.layout
1208
1209         sc = context.space_data
1210
1211         if sc.view == 'CLIP':
1212             layout.operator("clip.properties", icon='MENU_PANEL')
1213             layout.operator("clip.tools", icon='MENU_PANEL')
1214             layout.separator()
1215
1216             layout.operator("clip.view_selected")
1217             layout.operator("clip.view_all")
1218             layout.operator("clip.view_all", text="View Fit").fit_view = True
1219
1220             layout.separator()
1221             layout.operator("clip.view_zoom_in")
1222             layout.operator("clip.view_zoom_out")
1223
1224             layout.separator()
1225             layout.prop(sc, "show_metadata")
1226             layout.separator()
1227
1228             ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
1229
1230             text = iface_("Zoom %d:%d")
1231             for a, b in ratios:
1232                 layout.operator("clip.view_zoom_ratio",
1233                                 text=text % (a, b),
1234                                 translate=False).ratio = a / b
1235         else:
1236             if sc.view == 'GRAPH':
1237                 layout.operator_context = 'INVOKE_REGION_PREVIEW'
1238                 layout.operator("clip.graph_center_current_frame")
1239                 layout.operator("clip.graph_view_all")
1240                 layout.operator_context = 'INVOKE_DEFAULT'
1241
1242             layout.prop(sc, "show_seconds")
1243             layout.prop(sc, "show_locked_time")
1244             layout.separator()
1245
1246         layout.separator()
1247         layout.operator("screen.area_dupli")
1248         layout.operator("screen.screen_full_area")
1249         layout.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True
1250
1251
1252 class CLIP_MT_clip(Menu):
1253     bl_label = "Clip"
1254     bl_translation_context = bpy.app.translations.contexts.id_movieclip
1255
1256     def draw(self, context):
1257         layout = self.layout
1258
1259         sc = context.space_data
1260         clip = sc.clip
1261
1262         layout.operator("clip.open")
1263
1264         if clip:
1265             layout.operator("clip.prefetch")
1266             layout.operator("clip.reload")
1267             layout.menu("CLIP_MT_proxy")
1268
1269
1270 class CLIP_MT_proxy(Menu):
1271     bl_label = "Proxy"
1272
1273     def draw(self, context):
1274         layout = self.layout
1275
1276         layout.operator("clip.rebuild_proxy")
1277         layout.operator("clip.delete_proxy")
1278
1279
1280 class CLIP_MT_track(Menu):
1281     bl_label = "Track"
1282
1283     def draw(self, context):
1284         layout = self.layout
1285
1286         layout.operator("clip.clear_solution")
1287         layout.operator("clip.solve_camera")
1288
1289         layout.separator()
1290         props = layout.operator("clip.clear_track_path", text="Clear After")
1291         props.clear_active = False
1292         props.action = 'REMAINED'
1293
1294         props = layout.operator("clip.clear_track_path", text="Clear Before")
1295         props.clear_active = False
1296         props.action = 'UPTO'
1297
1298         props = layout.operator("clip.clear_track_path", text="Clear Track Path")
1299         props.clear_active = False
1300         props.action = 'ALL'
1301
1302         layout.separator()
1303         layout.operator("clip.join_tracks")
1304
1305         layout.separator()
1306         layout.operator("clip.clean_tracks")
1307
1308         layout.separator()
1309         layout.operator("clip.copy_tracks")
1310         layout.operator("clip.paste_tracks")
1311
1312         layout.separator()
1313         props = layout.operator("clip.track_markers", text="Track Frame Backwards")
1314         props.backwards = True
1315         props.sequence = False
1316
1317         props = layout.operator("clip.track_markers", text="Track Backwards")
1318         props.backwards = True
1319         props.sequence = True
1320
1321         props = layout.operator("clip.track_markers", text="Track Forwards")
1322         props.backwards = False
1323         props.sequence = True
1324
1325         props = layout.operator("clip.track_markers", text="Track Frame Forwards")
1326         props.backwards = False
1327         props.sequence = False
1328
1329         layout.separator()
1330         layout.operator("clip.delete_track")
1331         layout.operator("clip.delete_marker")
1332
1333         layout.separator()
1334         layout.operator("clip.add_marker_move")
1335
1336         layout.separator()
1337         layout.menu("CLIP_MT_track_visibility")
1338         layout.menu("CLIP_MT_track_transform")
1339
1340
1341 class CLIP_MT_reconstruction(Menu):
1342     bl_label = "Reconstruction"
1343
1344     def draw(self, context):
1345         layout = self.layout
1346
1347         layout.operator("clip.set_origin")
1348         layout.operator("clip.set_plane", text="Set Floor").plane = 'FLOOR'
1349         layout.operator("clip.set_plane", text="Set Wall").plane = 'WALL'
1350
1351         layout.operator("clip.set_axis", text="Set X Axis").axis = 'X'
1352         layout.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
1353
1354         layout.operator("clip.set_scale")
1355
1356         layout.separator()
1357
1358         layout.operator("clip.track_to_empty")
1359         layout.operator("clip.bundles_to_mesh")
1360
1361
1362 class CLIP_MT_track_visibility(Menu):
1363     bl_label = "Show/Hide"
1364
1365     def draw(self, context):
1366         layout = self.layout
1367
1368         layout.operator("clip.hide_tracks_clear", text="Show Hidden")
1369         layout.operator("clip.hide_tracks", text="Hide Selected").unselected = False
1370         layout.operator("clip.hide_tracks", text="Hide Unselected").unselected = True
1371
1372
1373 class CLIP_MT_track_transform(Menu):
1374     bl_label = "Transform"
1375
1376     def draw(self, context):
1377         layout = self.layout
1378
1379         layout.operator("transform.translate")
1380         layout.operator("transform.resize")
1381
1382
1383 class CLIP_MT_select(Menu):
1384     bl_label = "Select"
1385
1386     def draw(self, context):
1387         layout = self.layout
1388
1389         layout.operator("clip.select_border")
1390         layout.operator("clip.select_circle")
1391
1392         layout.separator()
1393
1394         layout.operator("clip.select_all"
1395                         ).action = 'TOGGLE'
1396         layout.operator("clip.select_all",
1397                         text="Inverse").action = 'INVERT'
1398
1399         layout.menu("CLIP_MT_select_grouped")
1400
1401
1402 class CLIP_MT_select_grouped(Menu):
1403     bl_label = "Select Grouped"
1404
1405     def draw(self, context):
1406         layout = self.layout
1407
1408         layout.operator_enum("clip.select_grouped", "group")
1409
1410
1411 class CLIP_MT_tracking_specials(Menu):
1412     bl_label = "Specials"
1413
1414     @classmethod
1415     def poll(cls, context):
1416         return context.space_data.clip
1417
1418     def draw(self, context):
1419         layout = self.layout
1420
1421         layout.operator("clip.disable_markers",
1422                         text="Enable Markers").action = 'ENABLE'
1423
1424         layout.operator("clip.disable_markers",
1425                         text="Disable markers").action = 'DISABLE'
1426
1427         layout.separator()
1428         layout.operator("clip.set_origin")
1429
1430         layout.separator()
1431         layout.operator("clip.hide_tracks")
1432         layout.operator("clip.hide_tracks_clear", text="Show Tracks")
1433
1434         layout.separator()
1435         layout.operator("clip.lock_tracks", text="Lock Tracks").action = 'LOCK'
1436
1437         layout.operator("clip.lock_tracks",
1438                         text="Unlock Tracks").action = 'UNLOCK'
1439
1440
1441 class CLIP_MT_camera_presets(Menu):
1442     """Predefined tracking camera intrinsics"""
1443     bl_label = "Camera Presets"
1444     preset_subdir = "tracking_camera"
1445     preset_operator = "script.execute_preset"
1446     draw = Menu.draw_preset
1447
1448
1449 class CLIP_MT_track_color_presets(Menu):
1450     """Predefined track color"""
1451     bl_label = "Color Presets"
1452     preset_subdir = "tracking_track_color"
1453     preset_operator = "script.execute_preset"
1454     draw = Menu.draw_preset
1455
1456
1457 class CLIP_MT_tracking_settings_presets(Menu):
1458     """Predefined tracking settings"""
1459     bl_label = "Tracking Presets"
1460     preset_subdir = "tracking_settings"
1461     preset_operator = "script.execute_preset"
1462     draw = Menu.draw_preset
1463
1464
1465 class CLIP_MT_track_color_specials(Menu):
1466     bl_label = "Track Color Specials"
1467
1468     def draw(self, context):
1469         layout = self.layout
1470
1471         layout.operator("clip.track_copy_color", icon='COPY_ID')
1472
1473
1474 class CLIP_MT_stabilize_2d_specials(Menu):
1475     bl_label = "Translation Track Specials"
1476
1477     def draw(self, context):
1478         layout = self.layout
1479
1480         layout.operator("clip.stabilize_2d_select")
1481
1482
1483 class CLIP_MT_stabilize_2d_rotation_specials(Menu):
1484     bl_label = "Rotation Track Specials"
1485
1486     def draw(self, context):
1487         layout = self.layout
1488
1489         layout.operator("clip.stabilize_2d_rotation_select")
1490
1491
1492 if __name__ == "__main__":  # only for live edit.
1493     bpy.utils.register_module(__name__)