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