minor cleanup
[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         sc = context.space_data
478         tracking = sc.clip.tracking
479         stab = tracking.stabilization
480
481         self.layout.prop(stab, "use_2d_stabilization", text="")
482
483     def draw(self, context):
484         layout = self.layout
485         sc = context.space_data
486         tracking = sc.clip.tracking
487         stab = tracking.stabilization
488
489         layout.active = stab.use_2d_stabilization
490
491         row = layout.row()
492         row.template_list(stab, "tracks", stab, "active_track_index", rows=3)
493
494         sub = row.column(align=True)
495
496         sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="")
497         sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
498
499         sub.menu('CLIP_MT_stabilize_2d_specials', text="",
500                  icon='DOWNARROW_HLT')
501
502         layout.prop(stab, "influence_location")
503
504         layout.prop(stab, "use_autoscale")
505         col = layout.column()
506         col.active = stab.use_autoscale
507         col.prop(stab, "scale_max")
508         col.prop(stab, "influence_scale")
509
510         layout.prop(stab, "use_stabilize_rotation")
511         col = layout.column()
512         col.active = stab.use_stabilize_rotation
513
514         row = col.row(align=True)
515         row.prop_search(stab, "rotation_track", tracking, "tracks", text="")
516         row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN')
517
518         row = col.row()
519         row.active = stab.rotation_track is not None
520         row.prop(stab, "influence_rotation")
521
522
523 class CLIP_PT_marker(Panel):
524     bl_space_type = 'CLIP_EDITOR'
525     bl_region_type = 'UI'
526     bl_label = "Marker"
527     bl_options = {'DEFAULT_CLOSED'}
528
529     @classmethod
530     def poll(cls, context):
531         sc = context.space_data
532         clip = sc.clip
533
534         return sc.mode == 'TRACKING' and clip
535
536     def draw(self, context):
537         layout = self.layout
538         sc = context.space_data
539         clip = context.space_data.clip
540         act_track = clip.tracking.tracks.active
541
542         if act_track:
543             layout.template_marker(sc, "clip", sc.clip_user, act_track, False)
544         else:
545             layout.active = False
546             layout.label(text="No active track")
547
548
549 class CLIP_PT_proxy(Panel):
550     bl_space_type = 'CLIP_EDITOR'
551     bl_region_type = 'UI'
552     bl_label = "Proxy / Timecode"
553     bl_options = {'DEFAULT_CLOSED'}
554
555     @classmethod
556     def poll(cls, context):
557         sc = context.space_data
558
559         return sc.clip
560
561     def draw_header(self, context):
562         sc = context.space_data
563
564         self.layout.prop(sc.clip, "use_proxy", text="")
565
566     def draw(self, context):
567         layout = self.layout
568         sc = context.space_data
569         clip = sc.clip
570
571         layout.active = clip.use_proxy
572
573         layout.label(text="Build Sizes:")
574
575         row = layout.row()
576         row.prop(clip.proxy, "build_25")
577         row.prop(clip.proxy, "build_50")
578
579         row = layout.row()
580         row.prop(clip.proxy, "build_75")
581         row.prop(clip.proxy, "build_100")
582
583         layout.prop(clip.proxy, "build_undistorted")
584
585         layout.prop(clip.proxy, "quality")
586
587         layout.prop(clip, 'use_proxy_custom_directory')
588         if clip.use_proxy_custom_directory:
589             layout.prop(clip.proxy, "directory")
590
591         layout.operator("clip.rebuild_proxy", text="Rebuild Proxy")
592
593         if clip.source == 'MOVIE':
594             col = layout.column()
595
596             col.label(text="Use timecode index:")
597             col.prop(clip.proxy, "timecode", text="")
598
599         col = layout.column()
600         col.label(text="Proxy render size:")
601
602         col.prop(sc.clip_user, "proxy_render_size", text="")
603         col.prop(sc.clip_user, "use_render_undistorted")
604
605
606 class CLIP_PT_footage(Panel):
607     bl_space_type = 'CLIP_EDITOR'
608     bl_region_type = 'UI'
609     bl_label = "Footage Settings"
610     bl_options = {'DEFAULT_CLOSED'}
611
612     @classmethod
613     def poll(cls, context):
614         sc = context.space_data
615
616         return sc.clip
617
618     def draw(self, context):
619         layout = self.layout
620
621         sc = context.space_data
622         clip = sc.clip
623
624         if clip:
625             layout.template_movieclip(sc, "clip", compact=True)
626         else:
627             layout.operator("clip.open", icon='FILESEL')
628
629
630 class CLIP_PT_tools_clip(Panel):
631     bl_space_type = 'CLIP_EDITOR'
632     bl_region_type = 'TOOLS'
633     bl_label = "Clip"
634
635     @classmethod
636     def poll(cls, context):
637         sc = context.space_data
638
639         return sc.clip
640
641     def draw(self, context):
642         layout = self.layout
643
644         layout.operator("clip.set_viewport_background")
645
646
647 class CLIP_MT_view(Menu):
648     bl_label = "View"
649
650     def draw(self, context):
651         layout = self.layout
652
653         layout.operator("clip.properties", icon='MENU_PANEL')
654         layout.operator("clip.tools", icon='MENU_PANEL')
655         layout.separator()
656
657         layout.operator("clip.view_selected")
658         layout.operator("clip.view_all")
659
660         layout.separator()
661         layout.operator("clip.view_zoom_in")
662         layout.operator("clip.view_zoom_out")
663
664         layout.separator()
665
666         ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
667
668         for a, b in ratios:
669             text = "Zoom %d:%d" % (a, b)
670             layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
671
672         layout.separator()
673         layout.operator("screen.area_dupli")
674         layout.operator("screen.screen_full_area")
675
676
677 class CLIP_MT_clip(Menu):
678     bl_label = "Clip"
679
680     def draw(self, context):
681         layout = self.layout
682
683         sc = context.space_data
684         clip = sc.clip
685
686         layout.operator("clip.open")
687
688         if clip:
689             layout.operator("clip.reload")
690             layout.menu("CLIP_MT_proxy")
691
692
693 class CLIP_MT_proxy(Menu):
694     bl_label = "Proxy"
695
696     def draw(self, context):
697         layout = self.layout
698
699         layout.operator("clip.rebuild_proxy")
700         layout.operator("clip.delete_proxy")
701
702
703 class CLIP_MT_track(Menu):
704     bl_label = "Track"
705
706     def draw(self, context):
707         layout = self.layout
708
709         layout.operator("clip.clear_solution")
710         layout.operator("clip.solve_camera")
711
712         layout.separator()
713         props = layout.operator("clip.clear_track_path", text="Clear After")
714         props.action = 'REMAINED'
715
716         props = layout.operator("clip.clear_track_path", text="Clear Before")
717         props.action = 'UPTO'
718
719         props = layout.operator("clip.clear_track_path",
720             text="Clear Track Path")
721         props.action = 'ALL'
722
723         layout.separator()
724         layout.operator("clip.join_tracks")
725
726         layout.separator()
727         layout.operator("clip.clean_tracks")
728
729         layout.separator()
730         props = layout.operator("clip.track_markers",
731             text="Track Frame Backwards")
732         props.backwards = True
733
734         props = layout.operator("clip.track_markers", text="Track Backwards")
735         props.backwards = True
736         props.sequence = True
737
738         props = layout.operator("clip.track_markers", text="Track Forwards")
739         props.sequence = True
740         layout.operator("clip.track_markers", text="Track Frame Forwards")
741
742         layout.separator()
743         layout.operator("clip.delete_track")
744         layout.operator("clip.delete_marker")
745
746         layout.separator()
747         layout.operator("clip.add_marker_move")
748
749         layout.separator()
750         layout.menu("CLIP_MT_track_visibility")
751         layout.menu("CLIP_MT_track_transform")
752
753
754 class CLIP_MT_reconstruction(Menu):
755     bl_label = "Reconstruction"
756
757     def draw(self, context):
758         layout = self.layout
759
760         layout.operator("clip.set_origin")
761         layout.operator("clip.set_floor")
762
763         layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
764         layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
765
766         layout.operator("clip.set_scale")
767
768         layout.separator()
769
770         layout.operator("clip.track_to_empty")
771         layout.operator("clip.tracks_to_mesh")
772
773
774 class CLIP_MT_track_visibility(Menu):
775     bl_label = "Show/Hide"
776
777     def draw(self, context):
778         layout = self.layout
779
780         layout.operator("clip.hide_tracks_clear", text="Show Hidden")
781         layout.operator("clip.hide_tracks", text="Hide Selected")
782
783         props = layout.operator("clip.hide_tracks", text="Hide Unselected")
784         props.unselected = True
785
786
787 class CLIP_MT_track_transform(Menu):
788     bl_label = "Transform"
789
790     def draw(self, context):
791         layout = self.layout
792
793         layout.operator("transform.translate")
794         layout.operator("transform.resize")
795
796
797 class CLIP_MT_select(Menu):
798     bl_label = "Select"
799
800     def draw(self, context):
801         layout = self.layout
802
803         layout.operator("clip.select_border")
804         layout.operator("clip.select_circle")
805
806         layout.separator()
807
808         layout.operator("clip.select_all", text="Select/Deselect all")
809         layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
810
811         layout.menu("CLIP_MT_select_grouped")
812
813
814 class CLIP_MT_select_grouped(Menu):
815     bl_label = "Select Grouped"
816
817     def draw(self, context):
818         layout = self.layout
819
820         layout.operator_enum("clip.select_grouped", "group")
821
822
823 class CLIP_MT_tracking_specials(Menu):
824     bl_label = "Specials"
825
826     @classmethod
827     def poll(cls, context):
828         return context.space_data.clip
829
830     def draw(self, context):
831         layout = self.layout
832
833         props = layout.operator("clip.disable_markers", text="Enable Markers")
834         props.action = 'ENABLE'
835
836         props = layout.operator("clip.disable_markers", text="Disable markers")
837         props.action = 'DISABLE'
838
839         layout.separator()
840         layout.operator("clip.set_origin")
841
842         layout.separator()
843         layout.operator("clip.hide_tracks")
844         layout.operator("clip.hide_tracks_clear", text="Show Tracks")
845
846         layout.separator()
847         props = layout.operator("clip.lock_tracks", text="Lock Tracks")
848         props.action = 'LOCK'
849
850         props = layout.operator("clip.lock_tracks", text="Unlock Tracks")
851         props.action = 'UNLOCK'
852
853
854 class CLIP_MT_camera_presets(Menu):
855     """Predefined tracking camera intrinsics"""
856     bl_label = "Camera Presets"
857     preset_subdir = "tracking_camera"
858     preset_operator = "script.execute_preset"
859     draw = bpy.types.Menu.draw_preset
860
861
862 class CLIP_MT_track_color_presets(Menu):
863     """Predefined track color"""
864     bl_label = "Color Presets"
865     preset_subdir = "tracking_track_color"
866     preset_operator = "script.execute_preset"
867     draw = bpy.types.Menu.draw_preset
868
869
870 class CLIP_MT_track_color_specials(Menu):
871     bl_label = "Track Color Specials"
872
873     def draw(self, context):
874         layout = self.layout
875
876         layout.operator('clip.track_copy_color', icon='COPY_ID')
877
878
879 class CLIP_MT_stabilize_2d_specials(Menu):
880     bl_label = "Track Color Specials"
881
882     def draw(self, context):
883         layout = self.layout
884
885         layout.operator('clip.stabilize_2d_select')
886
887 if __name__ == "__main__":  # only for live edit.
888     bpy.utils.register_module(__name__)