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