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