Merging r42621 through r42647 from trunk into soc-2011-tomato
[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 compliant>
20 import bpy
21 from bpy.types import Panel, Header, Menu
22
23
24 class CLIP_HT_header(Header):
25     bl_space_type = 'CLIP_EDITOR'
26
27     def draw(self, context):
28         layout = self.layout
29
30         sc = context.space_data
31         clip = sc.clip
32
33         row = layout.row(align=True)
34         row.template_header()
35
36         if context.area.show_menus:
37             sub = row.row(align=True)
38             sub.menu("CLIP_MT_view")
39
40             if clip:
41                 sub.menu("CLIP_MT_select")
42
43             sub.menu("CLIP_MT_clip")
44
45             if clip:
46                 sub.menu("CLIP_MT_track")
47                 sub.menu("CLIP_MT_reconstruction")
48
49         if clip:
50             layout.prop(sc, "mode", text="")
51             layout.prop(sc, "view", text="", expand=True)
52
53             if sc.view == 'GRAPH':
54                 row = layout.row(align=True)
55
56                 if sc.show_filters:
57                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN',
58                         text="Filters")
59
60                     sub = row.column()
61                     sub.active = clip.tracking.reconstruction.is_valid
62                     sub.prop(sc, "show_graph_frames", icon='SEQUENCE', text="")
63
64                     row.prop(sc, "show_graph_tracks", icon='ANIM', text="")
65                 else:
66                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT',
67                         text="Filters")
68
69         row = layout.row()
70         row.template_ID(sc, "clip", open='clip.open')
71
72         if clip:
73             tracking = clip.tracking
74             active = tracking.objects.active
75
76             if active and not active.is_camera:
77                 r = active.reconstruction
78             else:
79                 r = tracking.reconstruction
80
81             if r.is_valid:
82                 layout.label(text="Average solve error: %.4f" %
83                     (r.average_error))
84
85         layout.template_running_jobs()
86
87
88 class CLIP_PT_tools_marker(Panel):
89     bl_space_type = 'CLIP_EDITOR'
90     bl_region_type = 'TOOLS'
91     bl_label = "Marker"
92
93     @classmethod
94     def poll(cls, context):
95         sc = context.space_data
96         clip = sc.clip
97
98         return clip and sc.mode == 'TRACKING'
99
100     def draw(self, context):
101         sc = context.space_data
102         clip = sc.clip
103         settings = clip.tracking.settings
104         layout = self.layout
105
106         col = layout.column(align=True)
107         col.operator("clip.add_marker_move")
108         col.operator("clip.detect_features")
109         col.operator("clip.delete_track")
110
111         box = layout.box()
112         row = box.row(align=True)
113         row.prop(settings, "show_default_expanded", text="", emboss=False)
114         row.label(text="Tracking Settings")
115
116         if settings.show_default_expanded:
117             col = box.column()
118             row = col.row(align=True)
119             label = bpy.types.CLIP_MT_tracking_settings_presets.bl_label
120             row.menu('CLIP_MT_tracking_settings_presets', text=label)
121             row.operator("clip.tracking_settings_preset_add",
122                          text="", icon='ZOOMIN')
123             props = row.operator("clip.tracking_settings_preset_add",
124                                  text="", icon='ZOOMOUT')
125             props.remove_active = True
126
127             col.separator()
128
129             sub = col.column(align=True)
130             sub.prop(settings, "default_pattern_size")
131             sub.prop(settings, "default_search_size")
132
133             col.label(text="Tracker:")
134             col.prop(settings, "default_tracker", text="")
135
136             if settings.default_tracker == 'KLT':
137                 col.prop(settings, "default_pyramid_levels")
138             col.prop(settings, "default_correlation_min")
139
140             col.separator()
141
142             sub = col.column(align=True)
143             sub.prop(settings, "default_frames_limit")
144             sub.prop(settings, "default_margin")
145
146             col.label(text="Match:")
147             col.prop(settings, "default_pattern_match", text="")
148
149
150 class CLIP_PT_tools_tracking(Panel):
151     bl_space_type = 'CLIP_EDITOR'
152     bl_region_type = 'TOOLS'
153     bl_label = "Track"
154
155     @classmethod
156     def poll(cls, context):
157         sc = context.space_data
158         clip = sc.clip
159
160         return clip and sc.mode == 'TRACKING'
161
162     def draw(self, context):
163         layout = self.layout
164         # clip = context.space_data.clip  # UNUSED
165
166         row = layout.row(align=True)
167
168         props = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
169         props.backwards = True
170         props = row.operator("clip.track_markers", text="",
171              icon='PLAY_REVERSE')
172         props.backwards = True
173         props.sequence = True
174         props = row.operator("clip.track_markers", text="", icon='PLAY')
175         props.sequence = True
176         row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
177
178         col = layout.column(align=True)
179         props = col.operator("clip.clear_track_path", text="Clear After")
180         props.action = 'REMAINED'
181
182         props = col.operator("clip.clear_track_path", text="Clear Before")
183         props.action = 'UPTO'
184
185         props = col.operator("clip.clear_track_path", text="Clear")
186         props.action = 'ALL'
187
188         layout.operator("clip.join_tracks", text="Join")
189
190
191 class CLIP_PT_tools_solve(Panel):
192     bl_space_type = 'CLIP_EDITOR'
193     bl_region_type = 'TOOLS'
194     bl_label = "Solve"
195
196     @classmethod
197     def poll(cls, context):
198         sc = context.space_data
199         clip = sc.clip
200
201         return clip and sc.mode == 'TRACKING'
202
203     def draw(self, context):
204         layout = self.layout
205         clip = context.space_data.clip
206         tracking = clip.tracking
207         settings = tracking.settings
208         tracking_object = tracking.objects.active
209
210         col = layout.column(align=True)
211
212         if tracking_object.is_camera:
213             solve_text = "Camera Motion"
214         else:
215             solve_text = "Object Motion"
216
217         col.operator("clip.solve_camera", text=solve_text)
218         col.operator("clip.clear_solution")
219
220         col = layout.column(align=True)
221         col.prop(settings, "keyframe_a")
222         col.prop(settings, "keyframe_b")
223
224         col = layout.column(align=True)
225         col.active = tracking_object.is_camera
226         col.label(text="Refine:")
227         col.prop(settings, "refine_intrinsics", text="")
228
229
230 class CLIP_PT_tools_cleanup(Panel):
231     bl_space_type = 'CLIP_EDITOR'
232     bl_region_type = 'TOOLS'
233     bl_label = "Clean up"
234
235     @classmethod
236     def poll(cls, context):
237         sc = context.space_data
238         clip = sc.clip
239
240         return clip and sc.mode == 'TRACKING'
241
242     def draw(self, context):
243         layout = self.layout
244         clip = context.space_data.clip
245         settings = clip.tracking.settings
246
247         layout.operator("clip.clean_tracks")
248
249         layout.prop(settings, 'clean_frames', text="Frames")
250         layout.prop(settings, 'clean_error', text="Error")
251         layout.prop(settings, 'clean_action', text="")
252
253
254 class CLIP_PT_tools_geometry(Panel):
255     bl_space_type = 'CLIP_EDITOR'
256     bl_region_type = 'TOOLS'
257     bl_label = "Geometry"
258
259     @classmethod
260     def poll(cls, context):
261         sc = context.space_data
262         clip = sc.clip
263
264         return clip and sc.mode == 'RECONSTRUCTION'
265
266     def draw(self, context):
267         layout = self.layout
268
269         layout.operator("clip.bundles_to_mesh")
270         layout.operator("clip.track_to_empty")
271
272
273 class CLIP_PT_tools_orientation(Panel):
274     bl_space_type = 'CLIP_EDITOR'
275     bl_region_type = 'TOOLS'
276     bl_label = "Orientation"
277
278     @classmethod
279     def poll(cls, context):
280         sc = context.space_data
281         clip = sc.clip
282
283         return clip and sc.mode == 'RECONSTRUCTION'
284
285     def draw(self, context):
286         sc = context.space_data
287         layout = self.layout
288         settings = sc.clip.tracking.settings
289
290         col = layout.column(align=True)
291         col.operator("clip.set_floor")
292         col.operator("clip.set_origin")
293
294         row = col.row()
295         row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
296         row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
297
298         layout.separator()
299
300         col = layout.column()
301         col.operator("clip.set_scale")
302         col.prop(settings, "distance")
303
304
305 class CLIP_PT_tools_grease_pencil(Panel):
306     bl_space_type = 'CLIP_EDITOR'
307     bl_region_type = 'TOOLS'
308     bl_label = "Grease Pencil"
309
310     @classmethod
311     def poll(cls, context):
312         sc = context.space_data
313         clip = sc.clip
314
315         return clip and sc.mode == 'DISTORTION'
316
317     def draw(self, context):
318         layout = self.layout
319
320         col = layout.column(align=True)
321
322         row = col.row(align=True)
323         row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
324         row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
325
326         row = col.row(align=True)
327         row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
328         row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
329
330         row = col.row()
331         row.prop(context.tool_settings, "use_grease_pencil_sessions")
332
333
334 class CLIP_PT_objects(Panel):
335     bl_space_type = 'CLIP_EDITOR'
336     bl_region_type = 'UI'
337     bl_label = "Objects"
338     bl_options = {'DEFAULT_CLOSED'}
339
340     @classmethod
341     def poll(cls, context):
342         sc = context.space_data
343
344         return sc.clip
345
346     def draw(self, context):
347         layout = self.layout
348         sc = context.space_data
349         clip = context.space_data.clip
350         tracking = clip.tracking
351
352         row = layout.row()
353         row.template_list(tracking, "objects", tracking, "active_object_index", rows=3)
354
355         sub = row.column(align=True)
356
357         sub.operator("clip.tracking_object_new", icon='ZOOMIN', text="")
358         sub.operator("clip.tracking_object_remove", icon='ZOOMOUT', text="")
359
360         active = tracking.objects.active
361         if active:
362             layout.prop(active, "name")
363
364
365 class CLIP_PT_track(Panel):
366     bl_space_type = 'CLIP_EDITOR'
367     bl_region_type = 'UI'
368     bl_label = "Track"
369
370     @classmethod
371     def poll(cls, context):
372         sc = context.space_data
373         clip = sc.clip
374
375         return sc.mode == 'TRACKING' and clip
376
377     def draw(self, context):
378         layout = self.layout
379         sc = context.space_data
380         clip = context.space_data.clip
381         act_track = clip.tracking.tracks.active
382
383         if not act_track:
384             layout.active = False
385             layout.label(text="No active track")
386             return
387
388         row = layout.row()
389         row.prop(act_track, "name", text="")
390
391         sub = row.row(align=True)
392
393         sub.template_marker(sc, "clip", sc.clip_user, act_track, True)
394
395         icon = 'LOCKED' if act_track.lock else 'UNLOCKED'
396         sub.prop(act_track, "lock", text="", icon=icon)
397
398         layout.template_track(sc, "scopes")
399
400         row = layout.row(align=True)
401         sub = row.row()
402         sub.prop(act_track, "use_red_channel", text="R", toggle=True)
403         sub.prop(act_track, "use_green_channel", text="G", toggle=True)
404         sub.prop(act_track, "use_blue_channel", text="B", toggle=True)
405
406         row.separator()
407
408         sub = row.row()
409         sub.prop(act_track, "use_grayscale_preview", text="B/W", toggle=True)
410
411         layout.separator()
412
413         row = layout.row(align=True)
414         label = bpy.types.CLIP_MT_track_color_presets.bl_label
415         row.menu('CLIP_MT_track_color_presets', text=label)
416         row.menu('CLIP_MT_track_color_specials', text="", icon='DOWNARROW_HLT')
417         row.operator("clip.track_color_preset_add", text="", icon='ZOOMIN')
418         props = row.operator("clip.track_color_preset_add",
419                              text="", icon='ZOOMOUT')
420         props.remove_active = True
421
422         row = layout.row()
423         row.prop(act_track, "use_custom_color")
424         if act_track.use_custom_color:
425             row.prop(act_track, "color", text="")
426
427         if act_track.has_bundle:
428             label_text = "Average Error: %.4f" % (act_track.average_error)
429             layout.label(text=label_text)
430
431
432 class CLIP_PT_tracking_camera(Panel):
433     bl_space_type = 'CLIP_EDITOR'
434     bl_region_type = 'UI'
435     bl_label = "Camera Data"
436     bl_options = {'DEFAULT_CLOSED'}
437
438     @classmethod
439     def poll(cls, context):
440         sc = context.space_data
441
442         return sc.mode in ['TRACKING', 'DISTORTION'] and sc.clip
443
444     def draw(self, context):
445         layout = self.layout
446
447         sc = context.space_data
448         clip = sc.clip
449
450         row = layout.row(align=True)
451         label = bpy.types.CLIP_MT_camera_presets.bl_label
452         row.menu('CLIP_MT_camera_presets', text=label)
453         row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
454         props = row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT')
455         props.remove_active = True
456
457         row = layout.row(align=True)
458         sub = row.split(percentage=0.65)
459         if clip.tracking.camera.units == 'MILLIMETERS':
460             sub.prop(clip.tracking.camera, "focal_length")
461         else:
462             sub.prop(clip.tracking.camera, "focal_length_pixels")
463         sub.prop(clip.tracking.camera, "units", text="")
464
465         col = layout.column(align=True)
466         col.label(text="Sensor:")
467         col.prop(clip.tracking.camera, "sensor_width", text="Width")
468         col.prop(clip.tracking.camera, "pixel_aspect")
469
470         col = layout.column()
471         col.label(text="Optical Center:")
472         row = col.row()
473         row.prop(clip.tracking.camera, "principal", text="")
474         col.operator("clip.set_center_principal", text="Center")
475
476         col = layout.column(align=True)
477         col.label(text="Lens Distortion:")
478         col.prop(clip.tracking.camera, "k1")
479         col.prop(clip.tracking.camera, "k2")
480         col.prop(clip.tracking.camera, "k3")
481
482
483 class CLIP_PT_display(Panel):
484     bl_space_type = 'CLIP_EDITOR'
485     bl_region_type = 'UI'
486     bl_label = "Display"
487
488     def draw(self, context):
489         layout = self.layout
490         sc = context.space_data
491
492         col = layout.column(align=True)
493
494         col.prop(sc, "show_marker_pattern", text="Pattern")
495         col.prop(sc, "show_marker_search", text="Search")
496         col.prop(sc, "show_pyramid_levels", text="Pyramid")
497
498         col.prop(sc, "show_track_path", text="Path")
499         row = col.row()
500         row.active = sc.show_track_path
501         row.prop(sc, "path_length", text="Length")
502
503         col.prop(sc, "show_disabled", "Disabled Tracks")
504         col.prop(sc, "show_bundles", text="3D Markers")
505
506         col.prop(sc, "show_names", text="Names and Status")
507         col.prop(sc, "show_tiny_markers", text="Compact Markers")
508
509         col.prop(sc, "show_grease_pencil", text="Grease Pencil")
510         col.prop(sc, "use_mute_footage", text="Mute")
511
512         if sc.mode == 'DISTORTION':
513             col.prop(sc, "show_grid", text="Grid")
514             col.prop(sc, "use_manual_calibration")
515         elif sc.mode == 'RECONSTRUCTION':
516             col.prop(sc, "show_stable", text="Stable")
517
518         col.prop(sc, "lock_selection")
519
520         clip = sc.clip
521         if clip:
522             col.label(text="Display Aspect Ratio:")
523             col.prop(clip, "display_aspect", text="")
524
525
526 class CLIP_PT_track_settings(Panel):
527     bl_space_type = 'CLIP_EDITOR'
528     bl_region_type = 'UI'
529     bl_label = "Tracking Settings"
530     bl_options = {'DEFAULT_CLOSED'}
531
532     @classmethod
533     def poll(cls, context):
534         sc = context.space_data
535
536         return sc.mode == 'TRACKING' and sc.clip
537
538     def draw(self, context):
539         layout = self.layout
540         clip = context.space_data.clip
541         settings = clip.tracking.settings
542
543         col = layout.column()
544
545         active = clip.tracking.tracks.active
546         if active:
547             col.prop(active, "tracker")
548
549             if active.tracker == 'KLT':
550                 col.prop(active, "pyramid_levels")
551             col.prop(active, "correlation_min")
552
553             col.separator()
554             col.prop(active, "frames_limit")
555             col.prop(active, "margin")
556             col.prop(active, "pattern_match", text="Match")
557
558         col.prop(settings, "speed")
559
560
561 class CLIP_PT_stabilization(Panel):
562     bl_space_type = 'CLIP_EDITOR'
563     bl_region_type = 'UI'
564     bl_label = "2D Stabilization"
565     bl_options = {'DEFAULT_CLOSED'}
566
567     @classmethod
568     def poll(cls, context):
569         sc = context.space_data
570
571         return sc.mode == 'RECONSTRUCTION' and sc.clip
572
573     def draw_header(self, context):
574         stab = context.space_data.clip.tracking.stabilization
575
576         self.layout.prop(stab, "use_2d_stabilization", text="")
577
578     def draw(self, context):
579         layout = self.layout
580
581         tracking = context.space_data.clip.tracking
582         stab = tracking.stabilization
583
584         layout.active = stab.use_2d_stabilization
585
586         row = layout.row()
587         row.template_list(stab, "tracks", stab, "active_track_index", rows=3)
588
589         sub = row.column(align=True)
590
591         sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="")
592         sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
593
594         sub.menu('CLIP_MT_stabilize_2d_specials', text="",
595                  icon='DOWNARROW_HLT')
596
597         layout.prop(stab, "influence_location")
598
599         layout.prop(stab, "use_autoscale")
600         col = layout.column()
601         col.active = stab.use_autoscale
602         col.prop(stab, "scale_max")
603         col.prop(stab, "influence_scale")
604
605         layout.prop(stab, "use_stabilize_rotation")
606         col = layout.column()
607         col.active = stab.use_stabilize_rotation
608
609         row = col.row(align=True)
610         row.prop_search(stab, "rotation_track", tracking, "tracks", text="")
611         row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN')
612
613         row = col.row()
614         row.active = stab.rotation_track is not None
615         row.prop(stab, "influence_rotation")
616
617
618 class CLIP_PT_marker(Panel):
619     bl_space_type = 'CLIP_EDITOR'
620     bl_region_type = 'UI'
621     bl_label = "Marker"
622     bl_options = {'DEFAULT_CLOSED'}
623
624     @classmethod
625     def poll(cls, context):
626         sc = context.space_data
627         clip = sc.clip
628
629         return sc.mode == 'TRACKING' and clip
630
631     def draw(self, context):
632         layout = self.layout
633         sc = context.space_data
634         clip = context.space_data.clip
635         act_track = clip.tracking.tracks.active
636
637         if act_track:
638             layout.template_marker(sc, "clip", sc.clip_user, act_track, False)
639         else:
640             layout.active = False
641             layout.label(text="No active track")
642
643
644 class CLIP_PT_proxy(Panel):
645     bl_space_type = 'CLIP_EDITOR'
646     bl_region_type = 'UI'
647     bl_label = "Proxy / Timecode"
648     bl_options = {'DEFAULT_CLOSED'}
649
650     @classmethod
651     def poll(cls, context):
652         sc = context.space_data
653
654         return sc.clip
655
656     def draw_header(self, context):
657         sc = context.space_data
658
659         self.layout.prop(sc.clip, "use_proxy", text="")
660
661     def draw(self, context):
662         layout = self.layout
663         sc = context.space_data
664         clip = sc.clip
665
666         layout.active = clip.use_proxy
667
668         layout.label(text="Build Sizes:")
669
670         row = layout.row()
671         row.prop(clip.proxy, "build_25")
672         row.prop(clip.proxy, "build_50")
673
674         row = layout.row()
675         row.prop(clip.proxy, "build_75")
676         row.prop(clip.proxy, "build_100")
677
678         layout.prop(clip.proxy, "build_undistorted")
679
680         layout.prop(clip.proxy, "quality")
681
682         layout.prop(clip, 'use_proxy_custom_directory')
683         if clip.use_proxy_custom_directory:
684             layout.prop(clip.proxy, "directory")
685
686         layout.operator("clip.rebuild_proxy", text="Rebuild Proxy")
687
688         if clip.source == 'MOVIE':
689             col = layout.column()
690
691             col.label(text="Use timecode index:")
692             col.prop(clip.proxy, "timecode", text="")
693
694         col = layout.column()
695         col.label(text="Proxy render size:")
696
697         col.prop(sc.clip_user, "proxy_render_size", text="")
698         col.prop(sc.clip_user, "use_render_undistorted")
699
700
701 class CLIP_PT_footage(Panel):
702     bl_space_type = 'CLIP_EDITOR'
703     bl_region_type = 'UI'
704     bl_label = "Footage Settings"
705     bl_options = {'DEFAULT_CLOSED'}
706
707     @classmethod
708     def poll(cls, context):
709         sc = context.space_data
710
711         return sc.clip
712
713     def draw(self, context):
714         layout = self.layout
715
716         sc = context.space_data
717         clip = sc.clip
718
719         if clip:
720             layout.template_movieclip(sc, "clip", compact=True)
721         else:
722             layout.operator("clip.open", icon='FILESEL')
723
724
725 class CLIP_PT_tools_clip(Panel):
726     bl_space_type = 'CLIP_EDITOR'
727     bl_region_type = 'TOOLS'
728     bl_label = "Clip"
729
730     @classmethod
731     def poll(cls, context):
732         sc = context.space_data
733
734         return sc.clip
735
736     def draw(self, context):
737         layout = self.layout
738
739         layout.operator("clip.set_viewport_background")
740         layout.operator("clip.setup_tracking_scene")
741
742
743 class CLIP_MT_view(Menu):
744     bl_label = "View"
745
746     def draw(self, context):
747         layout = self.layout
748
749         layout.operator("clip.properties", icon='MENU_PANEL')
750         layout.operator("clip.tools", icon='MENU_PANEL')
751         layout.separator()
752
753         layout.operator("clip.view_selected")
754         layout.operator("clip.view_all")
755
756         layout.separator()
757         layout.operator("clip.view_zoom_in")
758         layout.operator("clip.view_zoom_out")
759
760         layout.separator()
761
762         ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
763
764         for a, b in ratios:
765             text = "Zoom %d:%d" % (a, b)
766             layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
767
768         layout.separator()
769         layout.operator("screen.area_dupli")
770         layout.operator("screen.screen_full_area")
771
772
773 class CLIP_MT_clip(Menu):
774     bl_label = "Clip"
775
776     def draw(self, context):
777         layout = self.layout
778
779         sc = context.space_data
780         clip = sc.clip
781
782         layout.operator("clip.open")
783
784         if clip:
785             layout.operator("clip.reload")
786             layout.menu("CLIP_MT_proxy")
787
788
789 class CLIP_MT_proxy(Menu):
790     bl_label = "Proxy"
791
792     def draw(self, context):
793         layout = self.layout
794
795         layout.operator("clip.rebuild_proxy")
796         layout.operator("clip.delete_proxy")
797
798
799 class CLIP_MT_track(Menu):
800     bl_label = "Track"
801
802     def draw(self, context):
803         layout = self.layout
804
805         layout.operator("clip.clear_solution")
806         layout.operator("clip.solve_camera")
807
808         layout.separator()
809         props = layout.operator("clip.clear_track_path", text="Clear After")
810         props.action = 'REMAINED'
811
812         props = layout.operator("clip.clear_track_path", text="Clear Before")
813         props.action = 'UPTO'
814
815         props = layout.operator("clip.clear_track_path",
816             text="Clear Track Path")
817         props.action = 'ALL'
818
819         layout.separator()
820         layout.operator("clip.join_tracks")
821
822         layout.separator()
823         layout.operator("clip.clean_tracks")
824
825         layout.separator()
826         props = layout.operator("clip.track_markers",
827             text="Track Frame Backwards")
828         props.backwards = True
829
830         props = layout.operator("clip.track_markers", text="Track Backwards")
831         props.backwards = True
832         props.sequence = True
833
834         props = layout.operator("clip.track_markers", text="Track Forwards")
835         props.sequence = True
836         layout.operator("clip.track_markers", text="Track Frame Forwards")
837
838         layout.separator()
839         layout.operator("clip.delete_track")
840         layout.operator("clip.delete_marker")
841
842         layout.separator()
843         layout.operator("clip.add_marker_move")
844
845         layout.separator()
846         layout.menu("CLIP_MT_track_visibility")
847         layout.menu("CLIP_MT_track_transform")
848
849
850 class CLIP_MT_reconstruction(Menu):
851     bl_label = "Reconstruction"
852
853     def draw(self, context):
854         layout = self.layout
855
856         layout.operator("clip.set_origin")
857         layout.operator("clip.set_floor")
858
859         layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
860         layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
861
862         layout.operator("clip.set_scale")
863
864         layout.separator()
865
866         layout.operator("clip.track_to_empty")
867         layout.operator("clip.bundles_to_mesh")
868
869
870 class CLIP_MT_track_visibility(Menu):
871     bl_label = "Show/Hide"
872
873     def draw(self, context):
874         layout = self.layout
875
876         layout.operator("clip.hide_tracks_clear", text="Show Hidden")
877         layout.operator("clip.hide_tracks", text="Hide Selected")
878
879         props = layout.operator("clip.hide_tracks", text="Hide Unselected")
880         props.unselected = True
881
882
883 class CLIP_MT_track_transform(Menu):
884     bl_label = "Transform"
885
886     def draw(self, context):
887         layout = self.layout
888
889         layout.operator("transform.translate")
890         layout.operator("transform.resize")
891
892
893 class CLIP_MT_select(Menu):
894     bl_label = "Select"
895
896     def draw(self, context):
897         layout = self.layout
898
899         layout.operator("clip.select_border")
900         layout.operator("clip.select_circle")
901
902         layout.separator()
903
904         layout.operator("clip.select_all", text="Select/Deselect all")
905         layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
906
907         layout.menu("CLIP_MT_select_grouped")
908
909
910 class CLIP_MT_select_grouped(Menu):
911     bl_label = "Select Grouped"
912
913     def draw(self, context):
914         layout = self.layout
915
916         layout.operator_enum("clip.select_grouped", "group")
917
918
919 class CLIP_MT_tracking_specials(Menu):
920     bl_label = "Specials"
921
922     @classmethod
923     def poll(cls, context):
924         return context.space_data.clip
925
926     def draw(self, context):
927         layout = self.layout
928
929         props = layout.operator("clip.disable_markers", text="Enable Markers")
930         props.action = 'ENABLE'
931
932         props = layout.operator("clip.disable_markers", text="Disable markers")
933         props.action = 'DISABLE'
934
935         layout.separator()
936         layout.operator("clip.set_origin")
937
938         layout.separator()
939         layout.operator("clip.hide_tracks")
940         layout.operator("clip.hide_tracks_clear", text="Show Tracks")
941
942         layout.separator()
943         props = layout.operator("clip.lock_tracks", text="Lock Tracks")
944         props.action = 'LOCK'
945
946         props = layout.operator("clip.lock_tracks", text="Unlock Tracks")
947         props.action = 'UNLOCK'
948
949
950 class CLIP_MT_camera_presets(Menu):
951     """Predefined tracking camera intrinsics"""
952     bl_label = "Camera Presets"
953     preset_subdir = "tracking_camera"
954     preset_operator = "script.execute_preset"
955     draw = bpy.types.Menu.draw_preset
956
957
958 class CLIP_MT_track_color_presets(Menu):
959     """Predefined track color"""
960     bl_label = "Color Presets"
961     preset_subdir = "tracking_track_color"
962     preset_operator = "script.execute_preset"
963     draw = bpy.types.Menu.draw_preset
964
965
966 class CLIP_MT_tracking_settings_presets(Menu):
967     """Predefined tracking settings"""
968     bl_label = "Tracking Presets"
969     preset_subdir = "tracking_settings"
970     preset_operator = "script.execute_preset"
971     draw = bpy.types.Menu.draw_preset
972
973
974 class CLIP_MT_track_color_specials(Menu):
975     bl_label = "Track Color Specials"
976
977     def draw(self, context):
978         layout = self.layout
979
980         layout.operator('clip.track_copy_color', icon='COPY_ID')
981
982
983 class CLIP_MT_stabilize_2d_specials(Menu):
984     bl_label = "Track Color Specials"
985
986     def draw(self, context):
987         layout = self.layout
988
989         layout.operator('clip.stabilize_2d_select')
990
991 if __name__ == "__main__":  # only for live edit.
992     bpy.utils.register_module(__name__)