1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
22 from bpy.types import Panel, Header, Menu
25 class CLIP_HT_header(Header):
26 bl_space_type = 'CLIP_EDITOR'
28 def _draw_tracking(self, context):
31 sc = context.space_data
34 row = layout.row(align=True)
37 if context.area.show_menus:
38 sub = row.row(align=True)
39 sub.menu("CLIP_MT_view")
43 sub.menu("CLIP_MT_select")
44 sub.menu("CLIP_MT_clip")
45 sub.menu("CLIP_MT_track")
46 sub.menu("CLIP_MT_reconstruction")
48 sub.menu("CLIP_MT_clip")
51 row.template_ID(sc, "clip", open="clip.open")
54 tracking = clip.tracking
55 active_object = tracking.objects.active
58 layout.prop(sc, "mode", text="")
59 layout.prop(sc, "view", text="", expand=True)
60 layout.prop(sc, "pivot_point", text="", icon_only=True)
62 r = active_object.reconstruction
64 if r.is_valid and sc.view == 'CLIP':
65 layout.label(text="Solve error: %.4f" %
67 elif sc.view == 'GRAPH':
68 layout.prop(sc, "view", text="", expand=True)
70 row = layout.row(align=True)
71 row.prop(sc, "show_graph_only_selected", text="")
72 row.prop(sc, "show_graph_hidden", text="")
74 row = layout.row(align=True)
77 row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN',
81 sub.active = clip.tracking.reconstruction.is_valid
82 sub.prop(sc, "show_graph_frames", icon='SEQUENCE', text="")
84 row.prop(sc, "show_graph_tracks", icon='ANIM', text="")
86 row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT',
88 elif sc.view == 'DOPESHEET':
89 dopesheet = tracking.dopesheet
90 layout.prop(sc, "view", text="", expand=True)
92 row = layout.row(align=True)
93 row.prop(dopesheet, "show_only_selected", text="")
94 row.prop(dopesheet, "show_hidden", text="")
96 row = layout.row(align=True)
97 row.prop(dopesheet, "sort_method", text="")
98 row.prop(dopesheet, "use_invert_sort",
99 text="Invert", toggle=True)
101 layout.prop(sc, "view", text="", expand=True)
103 def _draw_masking(self, context):
106 toolsettings = context.tool_settings
107 sc = context.space_data
110 row = layout.row(align=True)
111 row.template_header()
113 if context.area.show_menus:
114 sub = row.row(align=True)
115 sub.menu("CLIP_MT_view")
118 sub.menu("MASK_MT_select")
119 sub.menu("CLIP_MT_clip") # XXX - remove?
120 sub.menu("MASK_MT_mask")
122 sub.menu("CLIP_MT_clip") # XXX - remove?
125 row.template_ID(sc, "clip", open="clip.open")
127 layout.prop(sc, "mode", text="")
130 row.template_ID(sc, "mask", new="mask.new")
132 layout.prop(sc, "pivot_point", text="", icon_only=True)
134 row = layout.row(align=True)
135 row.prop(toolsettings, "use_proportional_edit_mask",
136 text="", icon_only=True)
137 if toolsettings.use_proportional_edit_mask:
138 row.prop(toolsettings, "proportional_edit_falloff",
139 text="", icon_only=True)
141 def draw(self, context):
144 sc = context.space_data
146 if sc.mode in {'TRACKING', 'RECONSTRUCTION', 'DISTORTION'}:
147 self._draw_tracking(context)
149 self._draw_masking(context)
151 layout.template_running_jobs()
154 class CLIP_PT_clip_view_panel:
157 def poll(cls, context):
158 sc = context.space_data
161 return clip and sc.view == 'CLIP'
164 class CLIP_PT_tracking_panel:
167 def poll(cls, context):
168 sc = context.space_data
171 return clip and sc.mode == 'TRACKING' and sc.view == 'CLIP'
174 class CLIP_PT_reconstruction_panel:
177 def poll(cls, context):
178 sc = context.space_data
181 return clip and sc.mode == 'RECONSTRUCTION' and sc.view == 'CLIP'
184 class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
185 bl_space_type = 'CLIP_EDITOR'
186 bl_region_type = 'TOOLS'
189 def draw(self, context):
190 sc = context.space_data
192 settings = clip.tracking.settings
195 col = layout.column(align=True)
196 col.operator("clip.add_marker_move")
197 col.operator("clip.detect_features")
198 col.operator("clip.delete_track")
201 row = box.row(align=True)
202 row.prop(settings, "show_default_expanded", text="", emboss=False)
203 row.label(text="Tracking Settings")
205 if settings.show_default_expanded:
207 row = col.row(align=True)
208 label = CLIP_MT_tracking_settings_presets.bl_label
209 row.menu('CLIP_MT_tracking_settings_presets', text=label)
210 row.operator("clip.tracking_settings_preset_add",
211 text="", icon='ZOOMIN')
212 props = row.operator("clip.tracking_settings_preset_add",
213 text="", icon='ZOOMOUT')
214 props.remove_active = True
218 row = col.row(align=True)
219 row.prop(settings, "use_default_red_channel",
220 text="R", toggle=True)
221 row.prop(settings, "use_default_green_channel",
222 text="G", toggle=True)
223 row.prop(settings, "use_default_blue_channel",
224 text="B", toggle=True)
228 sub = col.column(align=True)
229 sub.prop(settings, "default_pattern_size")
230 sub.prop(settings, "default_search_size")
232 col.label(text="Tracker:")
233 col.prop(settings, "default_motion_model")
234 col.prop(settings, "default_use_brute")
235 col.prop(settings, "default_use_normalization")
236 col.prop(settings, "default_use_mask")
237 col.prop(settings, "default_correlation_min")
241 sub = col.column(align=True)
242 sub.prop(settings, "default_frames_limit")
243 sub.prop(settings, "default_margin")
245 col.label(text="Match:")
246 col.prop(settings, "default_pattern_match", text="")
249 col.operator("clip.track_settings_as_default",
250 text="Copy From Active Track")
253 class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
254 bl_space_type = 'CLIP_EDITOR'
255 bl_region_type = 'TOOLS'
258 def draw(self, context):
261 row = layout.row(align=True)
263 props = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
264 props.backwards = True
265 props.sequence = False
266 props = row.operator("clip.track_markers", text="",
268 props.backwards = True
269 props.sequence = True
270 props = row.operator("clip.track_markers", text="", icon='PLAY')
271 props.backwards = False
272 props.sequence = True
273 props = row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
274 props.backwards = False
275 props.sequence = False
277 col = layout.column(align=True)
278 props = col.operator("clip.clear_track_path", text="Clear After")
279 props.action = 'REMAINED'
281 props = col.operator("clip.clear_track_path", text="Clear Before")
282 props.action = 'UPTO'
283 col.operator("clip.clear_track_path", text="Clear").action = 'ALL'
285 layout.operator("clip.join_tracks", text="Join")
288 class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
289 bl_space_type = 'CLIP_EDITOR'
290 bl_region_type = 'TOOLS'
293 def draw(self, context):
295 clip = context.space_data.clip
296 tracking = clip.tracking
297 settings = tracking.settings
298 tracking_object = tracking.objects.active
300 col = layout.column(align=True)
302 col.operator("clip.solve_camera",
303 text="Camera Motion" if tracking_object.is_camera
304 else "Object Motion")
305 col.operator("clip.clear_solution")
307 col = layout.column()
308 col.prop(settings, "use_tripod_solver")
310 col = layout.column(align=True)
311 col.active = not settings.use_tripod_solver
312 col.prop(settings, "keyframe_a")
313 col.prop(settings, "keyframe_b")
315 col = layout.column(align=True)
316 col.active = (tracking_object.is_camera and
317 not settings.use_tripod_solver)
318 col.label(text="Refine:")
319 col.prop(settings, "refine_intrinsics", text="")
322 class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
323 bl_space_type = 'CLIP_EDITOR'
324 bl_region_type = 'TOOLS'
325 bl_label = "Clean up"
327 def draw(self, context):
329 clip = context.space_data.clip
330 settings = clip.tracking.settings
332 layout.operator("clip.clean_tracks")
334 layout.prop(settings, "clean_frames", text="Frames")
335 layout.prop(settings, "clean_error", text="Error")
336 layout.prop(settings, "clean_action", text="")
339 class CLIP_PT_tools_geometry(CLIP_PT_reconstruction_panel, Panel):
340 bl_space_type = 'CLIP_EDITOR'
341 bl_region_type = 'TOOLS'
342 bl_label = "Geometry"
344 def draw(self, context):
347 layout.operator("clip.bundles_to_mesh")
348 layout.operator("clip.track_to_empty")
351 class CLIP_PT_tools_orientation(CLIP_PT_reconstruction_panel, Panel):
352 bl_space_type = 'CLIP_EDITOR'
353 bl_region_type = 'TOOLS'
354 bl_label = "Orientation"
356 def draw(self, context):
357 sc = context.space_data
359 settings = sc.clip.tracking.settings
361 col = layout.column(align=True)
363 props = row.operator("clip.set_plane", text="Floor")
364 props.plane = 'FLOOR'
365 props = row.operator("clip.set_plane", text="Wall")
367 col.operator("clip.set_origin")
370 row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
371 row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
375 col = layout.column()
376 col.operator("clip.set_scale")
377 col.prop(settings, "distance")
380 class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
381 bl_space_type = 'CLIP_EDITOR'
382 bl_region_type = 'TOOLS'
386 def poll(cls, context):
387 if CLIP_PT_reconstruction_panel.poll(context):
388 sc = context.space_data
391 tracking_object = clip.tracking.objects.active
393 return not tracking_object.is_camera
397 def draw(self, context):
400 sc = context.space_data
402 tracking_object = clip.tracking.objects.active
403 settings = sc.clip.tracking.settings
405 col = layout.column()
407 col.prop(tracking_object, "scale")
411 col.operator("clip.set_solution_scale", text="Set Scale")
412 col.prop(settings, "object_distance")
415 class CLIP_PT_tools_grease_pencil(Panel):
416 bl_space_type = 'CLIP_EDITOR'
417 bl_region_type = 'TOOLS'
418 bl_label = "Grease Pencil"
421 def poll(cls, context):
422 sc = context.space_data
428 if sc.mode == 'DISTORTION':
429 return sc.view == 'CLIP'
430 elif sc.mode == 'MASK':
435 def draw(self, context):
438 col = layout.column(align=True)
440 row = col.row(align=True)
441 row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
442 row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
444 row = col.row(align=True)
445 row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
446 row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
449 row.prop(context.tool_settings, "use_grease_pencil_sessions")
452 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
453 bl_space_type = 'CLIP_EDITOR'
454 bl_region_type = 'UI'
456 bl_options = {'DEFAULT_CLOSED'}
458 def draw(self, context):
461 sc = context.space_data
462 tracking = sc.clip.tracking
465 row.template_list(tracking, "objects",
466 tracking, "active_object_index", rows=3)
468 sub = row.column(align=True)
470 sub.operator("clip.tracking_object_new", icon='ZOOMIN', text="")
471 sub.operator("clip.tracking_object_remove", icon='ZOOMOUT', text="")
473 active = tracking.objects.active
475 layout.prop(active, "name")
478 class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
479 bl_space_type = 'CLIP_EDITOR'
480 bl_region_type = 'UI'
483 def draw(self, context):
485 sc = context.space_data
486 clip = context.space_data.clip
487 act_track = clip.tracking.tracks.active
490 layout.active = False
491 layout.label(text="No active track")
495 row.prop(act_track, "name", text="")
497 sub = row.row(align=True)
499 sub.template_marker(sc, "clip", sc.clip_user, act_track, True)
501 icon = 'LOCKED' if act_track.lock else 'UNLOCKED'
502 sub.prop(act_track, "lock", text="", icon=icon)
504 layout.template_track(sc, "scopes")
506 row = layout.row(align=True)
508 sub.prop(act_track, "use_red_channel", text="R", toggle=True)
509 sub.prop(act_track, "use_green_channel", text="G", toggle=True)
510 sub.prop(act_track, "use_blue_channel", text="B", toggle=True)
515 sub.prop(act_track, "use_grayscale_preview", text="B/W", toggle=True)
519 sub.prop(act_track, "use_alpha_preview",
520 text="", toggle=True, icon='IMAGE_ALPHA')
524 row = layout.row(align=True)
525 label = bpy.types.CLIP_MT_track_color_presets.bl_label
526 row.menu('CLIP_MT_track_color_presets', text=label)
527 row.menu('CLIP_MT_track_color_specials', text="", icon='DOWNARROW_HLT')
528 row.operator("clip.track_color_preset_add", text="", icon='ZOOMIN')
529 props = row.operator("clip.track_color_preset_add",
530 text="", icon='ZOOMOUT')
531 props.remove_active = True
534 row.prop(act_track, "use_custom_color")
535 if act_track.use_custom_color:
536 row.prop(act_track, "color", text="")
538 if act_track.has_bundle:
539 label_text = "Average Error: %.4f" % (act_track.average_error)
540 layout.label(text=label_text)
543 class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
544 bl_space_type = 'CLIP_EDITOR'
545 bl_region_type = 'UI'
546 bl_label = "Tracking Settings"
547 bl_options = {'DEFAULT_CLOSED'}
549 def draw(self, context):
551 clip = context.space_data.clip
552 settings = clip.tracking.settings
554 col = layout.column()
556 active = clip.tracking.tracks.active
558 col.prop(active, "motion_model")
559 col.prop(active, "use_brute")
560 col.prop(active, "use_normalization")
561 col.prop(active, "use_mask")
562 col.prop(active, "correlation_min")
565 col.prop(active, "frames_limit")
566 col.prop(active, "margin")
567 col.prop(active, "pattern_match", text="Match")
569 col.prop(settings, "speed")
572 class CLIP_PT_tracking_camera(Panel):
573 bl_space_type = 'CLIP_EDITOR'
574 bl_region_type = 'UI'
575 bl_label = "Camera Data"
576 bl_options = {'DEFAULT_CLOSED'}
579 def poll(cls, context):
580 if CLIP_PT_clip_view_panel.poll(context):
581 sc = context.space_data
583 return sc.mode in {'TRACKING', 'DISTORTION'} and sc.clip
587 def draw(self, context):
590 sc = context.space_data
593 row = layout.row(align=True)
594 label = bpy.types.CLIP_MT_camera_presets.bl_label
595 row.menu('CLIP_MT_camera_presets', text=label)
596 row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
597 props = row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT')
598 props.remove_active = True
600 row = layout.row(align=True)
601 sub = row.split(percentage=0.65)
602 if clip.tracking.camera.units == 'MILLIMETERS':
603 sub.prop(clip.tracking.camera, "focal_length")
605 sub.prop(clip.tracking.camera, "focal_length_pixels")
606 sub.prop(clip.tracking.camera, "units", text="")
608 col = layout.column(align=True)
609 col.label(text="Sensor:")
610 col.prop(clip.tracking.camera, "sensor_width", text="Width")
611 col.prop(clip.tracking.camera, "pixel_aspect")
613 col = layout.column()
614 col.label(text="Optical Center:")
616 row.prop(clip.tracking.camera, "principal", text="")
617 col.operator("clip.set_center_principal", text="Center")
619 col = layout.column(align=True)
620 col.label(text="Lens Distortion:")
621 col.prop(clip.tracking.camera, "k1")
622 col.prop(clip.tracking.camera, "k2")
623 col.prop(clip.tracking.camera, "k3")
626 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
627 bl_space_type = 'CLIP_EDITOR'
628 bl_region_type = 'UI'
631 def draw(self, context):
633 sc = context.space_data
635 row = layout.row(align=True)
637 sub.prop(sc, "show_red_channel", text="R", toggle=True)
638 sub.prop(sc, "show_green_channel", text="G", toggle=True)
639 sub.prop(sc, "show_blue_channel", text="B", toggle=True)
644 sub.prop(sc, "use_grayscale_preview", text="B/W", toggle=True)
646 col = layout.column(align=True)
648 col.prop(sc, "show_disabled", "Disabled Tracks")
649 col.prop(sc, "show_names", text="Names and Status")
650 col.prop(sc, "show_bundles", text="3D Markers")
652 col.prop(sc, "use_mute_footage", text="Mute Footage")
653 col.prop(sc, "lock_selection")
655 if sc.view == 'GRAPH':
656 col.prop(sc, "lock_time_cursor")
658 if sc.mode == 'DISTORTION':
659 col.prop(sc, "show_grid", text="Grid")
660 col.prop(sc, "use_manual_calibration")
661 elif sc.mode == 'RECONSTRUCTION':
662 col.prop(sc, "show_stable", text="Stable")
666 col.label(text="Display Aspect Ratio:")
668 row.prop(clip, "display_aspect", text="")
671 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
672 bl_space_type = 'CLIP_EDITOR'
673 bl_region_type = 'UI'
674 bl_label = "Marker Display"
677 def poll(cls, context):
678 sc = context.space_data
680 return sc.mode != 'MASK'
682 def draw(self, context):
684 sc = context.space_data
686 col = layout.column(align=True)
689 row.prop(sc, "show_marker_pattern", text="Pattern")
690 row.prop(sc, "show_marker_search", text="Search")
692 col.prop(sc, "show_tiny_markers", text="Thin Markers")
693 col.prop(sc, "show_track_path", text="Path")
696 row.active = sc.show_track_path
697 row.prop(sc, "path_length", text="Length")
700 class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
701 bl_space_type = 'CLIP_EDITOR'
702 bl_region_type = 'UI'
703 bl_label = "2D Stabilization"
704 bl_options = {'DEFAULT_CLOSED'}
706 def draw_header(self, context):
707 stab = context.space_data.clip.tracking.stabilization
709 self.layout.prop(stab, "use_2d_stabilization", text="")
711 def draw(self, context):
714 tracking = context.space_data.clip.tracking
715 stab = tracking.stabilization
717 layout.active = stab.use_2d_stabilization
720 row.template_list(stab, "tracks", stab, "active_track_index", rows=3)
722 sub = row.column(align=True)
724 sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="")
725 sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
727 sub.menu('CLIP_MT_stabilize_2d_specials', text="",
728 icon='DOWNARROW_HLT')
730 layout.prop(stab, "influence_location")
732 layout.prop(stab, "use_autoscale")
733 col = layout.column()
734 col.active = stab.use_autoscale
735 col.prop(stab, "scale_max")
736 col.prop(stab, "influence_scale")
738 layout.prop(stab, "use_stabilize_rotation")
739 col = layout.column()
740 col.active = stab.use_stabilize_rotation
742 row = col.row(align=True)
743 row.prop_search(stab, "rotation_track", tracking, "tracks", text="")
744 row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN')
747 row.active = stab.rotation_track is not None
748 row.prop(stab, "influence_rotation")
750 layout.prop(stab, "filter_type")
753 class CLIP_PT_marker(CLIP_PT_tracking_panel, Panel):
754 bl_space_type = 'CLIP_EDITOR'
755 bl_region_type = 'UI'
757 bl_options = {'DEFAULT_CLOSED'}
759 def draw(self, context):
761 sc = context.space_data
762 clip = context.space_data.clip
763 act_track = clip.tracking.tracks.active
766 layout.template_marker(sc, "clip", sc.clip_user, act_track, False)
768 layout.active = False
769 layout.label(text="No active track")
772 class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
773 bl_space_type = 'CLIP_EDITOR'
774 bl_region_type = 'UI'
775 bl_label = "Proxy / Timecode"
776 bl_options = {'DEFAULT_CLOSED'}
778 def draw_header(self, context):
779 sc = context.space_data
781 self.layout.prop(sc.clip, "use_proxy", text="")
783 def draw(self, context):
785 sc = context.space_data
788 layout.active = clip.use_proxy
790 layout.label(text="Build Original:")
792 row = layout.row(align=True)
793 row.prop(clip.proxy, "build_25", toggle=True)
794 row.prop(clip.proxy, "build_50", toggle=True)
795 row.prop(clip.proxy, "build_75", toggle=True)
796 row.prop(clip.proxy, "build_100", toggle=True)
798 layout.label(text="Build Undistorted:")
800 row = layout.row(align=True)
801 row.prop(clip.proxy, "build_undistorted_25", toggle=True)
802 row.prop(clip.proxy, "build_undistorted_50", toggle=True)
803 row.prop(clip.proxy, "build_undistorted_75", toggle=True)
804 row.prop(clip.proxy, "build_undistorted_100", toggle=True)
806 layout.prop(clip.proxy, "quality")
808 layout.prop(clip, "use_proxy_custom_directory")
809 if clip.use_proxy_custom_directory:
810 layout.prop(clip.proxy, "directory")
812 layout.operator("clip.rebuild_proxy", text="Build Proxy")
814 if clip.source == 'MOVIE':
815 col = layout.column()
817 col.label(text="Use timecode index:")
818 col.prop(clip.proxy, "timecode", text="")
820 col = layout.column()
821 col.label(text="Proxy render size:")
823 col.prop(sc.clip_user, "proxy_render_size", text="")
824 col.prop(sc.clip_user, "use_render_undistorted")
827 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
828 bl_space_type = 'CLIP_EDITOR'
829 bl_region_type = 'UI'
830 bl_label = "Footage Settings"
831 bl_options = {'DEFAULT_CLOSED'}
833 def draw(self, context):
836 sc = context.space_data
839 col = layout.column()
840 col.template_movieclip(sc, "clip", compact=True)
841 col.prop(clip, "start_frame")
842 col.prop(clip, "frame_offset")
845 class CLIP_PT_tools_clip(CLIP_PT_clip_view_panel, Panel):
846 bl_space_type = 'CLIP_EDITOR'
847 bl_region_type = 'TOOLS'
850 def draw(self, context):
853 layout.operator("clip.set_viewport_background")
854 layout.operator("clip.setup_tracking_scene")
857 class CLIP_MT_view(Menu):
860 def draw(self, context):
862 sc = context.space_data
864 if sc.view == 'CLIP':
865 layout.operator("clip.properties", icon='MENU_PANEL')
866 layout.operator("clip.tools", icon='MENU_PANEL')
869 layout.operator("clip.view_selected")
870 layout.operator("clip.view_all")
873 layout.operator("clip.view_zoom_in")
874 layout.operator("clip.view_zoom_out")
878 ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
881 text = "Zoom %d:%d" % (a, b)
882 layout.operator("clip.view_zoom_ratio",
883 text=text).ratio = a / b
885 layout.prop(sc, "show_seconds")
889 layout.operator("screen.area_dupli")
890 layout.operator("screen.screen_full_area")
893 class CLIP_MT_clip(Menu):
896 def draw(self, context):
899 sc = context.space_data
902 layout.operator("clip.open")
905 layout.operator("clip.reload")
906 layout.menu("CLIP_MT_proxy")
909 class CLIP_MT_proxy(Menu):
912 def draw(self, context):
915 layout.operator("clip.rebuild_proxy")
916 layout.operator("clip.delete_proxy")
919 class CLIP_MT_track(Menu):
922 def draw(self, context):
925 layout.operator("clip.clear_solution")
926 layout.operator("clip.solve_camera")
929 props = layout.operator("clip.clear_track_path", text="Clear After")
930 props.action = 'REMAINED'
932 props = layout.operator("clip.clear_track_path", text="Clear Before")
933 props.action = 'UPTO'
935 props = layout.operator("clip.clear_track_path",
936 text="Clear Track Path")
940 layout.operator("clip.join_tracks")
943 layout.operator("clip.clean_tracks")
946 layout.operator("clip.copy_tracks")
947 layout.operator("clip.paste_tracks")
950 props = layout.operator("clip.track_markers",
951 text="Track Frame Backwards")
952 props.backwards = True
954 props = layout.operator("clip.track_markers", text="Track Backwards")
955 props.backwards = True
956 props.sequence = True
958 props = layout.operator("clip.track_markers", text="Track Forwards")
959 props.sequence = True
960 layout.operator("clip.track_markers", text="Track Frame Forwards")
963 layout.operator("clip.delete_track")
964 layout.operator("clip.delete_marker")
967 layout.operator("clip.add_marker_move")
970 layout.menu("CLIP_MT_track_visibility")
971 layout.menu("CLIP_MT_track_transform")
974 class CLIP_MT_reconstruction(Menu):
975 bl_label = "Reconstruction"
977 def draw(self, context):
980 layout.operator("clip.set_origin")
981 props = layout.operator("clip.set_plane", text="Set Floor")
982 props.plane = 'FLOOR'
983 props = layout.operator("clip.set_plane", text="Set Wall")
986 layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
987 layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
989 layout.operator("clip.set_scale")
993 layout.operator("clip.track_to_empty")
994 layout.operator("clip.bundles_to_mesh")
997 class CLIP_MT_track_visibility(Menu):
998 bl_label = "Show/Hide"
1000 def draw(self, context):
1001 layout = self.layout
1003 layout.operator("clip.hide_tracks_clear", text="Show Hidden")
1004 layout.operator("clip.hide_tracks", text="Hide Selected")
1006 props = layout.operator("clip.hide_tracks", text="Hide Unselected")
1007 props.unselected = True
1010 class CLIP_MT_track_transform(Menu):
1011 bl_label = "Transform"
1013 def draw(self, context):
1014 layout = self.layout
1016 layout.operator("transform.translate")
1017 layout.operator("transform.resize")
1020 class CLIP_MT_select(Menu):
1023 def draw(self, context):
1024 layout = self.layout
1026 layout.operator("clip.select_border")
1027 layout.operator("clip.select_circle")
1031 layout.operator("clip.select_all"
1033 layout.operator("clip.select_all",
1034 text="Inverse").action = 'INVERT'
1036 layout.menu("CLIP_MT_select_grouped")
1039 class CLIP_MT_select_grouped(Menu):
1040 bl_label = "Select Grouped"
1042 def draw(self, context):
1043 layout = self.layout
1045 layout.operator_enum("clip.select_grouped", "group")
1048 class CLIP_MT_tracking_specials(Menu):
1049 bl_label = "Specials"
1052 def poll(cls, context):
1053 return context.space_data.clip
1055 def draw(self, context):
1056 layout = self.layout
1058 props = layout.operator("clip.disable_markers",
1059 text="Enable Markers")
1060 props.action = 'ENABLE'
1062 props = layout.operator("clip.disable_markers", text="Disable markers")
1063 props.action = 'DISABLE'
1066 layout.operator("clip.set_origin")
1069 layout.operator("clip.hide_tracks")
1070 layout.operator("clip.hide_tracks_clear", text="Show Tracks")
1073 props = layout.operator("clip.lock_tracks", text="Lock Tracks")
1074 props.action = 'LOCK'
1076 props = layout.operator("clip.lock_tracks", text="Unlock Tracks")
1077 props.action = 'UNLOCK'
1080 class CLIP_MT_select_mode(Menu):
1081 bl_label = "Select Mode"
1083 def draw(self, context):
1084 layout = self.layout
1086 layout.operator_context = 'INVOKE_REGION_WIN'
1088 layout.operator_enum("clip.mode_set", "mode")
1091 class CLIP_MT_camera_presets(Menu):
1092 """Predefined tracking camera intrinsics"""
1093 bl_label = "Camera Presets"
1094 preset_subdir = "tracking_camera"
1095 preset_operator = "script.execute_preset"
1096 draw = Menu.draw_preset
1099 class CLIP_MT_track_color_presets(Menu):
1100 """Predefined track color"""
1101 bl_label = "Color Presets"
1102 preset_subdir = "tracking_track_color"
1103 preset_operator = "script.execute_preset"
1104 draw = Menu.draw_preset
1107 class CLIP_MT_tracking_settings_presets(Menu):
1108 """Predefined tracking settings"""
1109 bl_label = "Tracking Presets"
1110 preset_subdir = "tracking_settings"
1111 preset_operator = "script.execute_preset"
1112 draw = Menu.draw_preset
1115 class CLIP_MT_track_color_specials(Menu):
1116 bl_label = "Track Color Specials"
1118 def draw(self, context):
1119 layout = self.layout
1121 layout.operator("clip.track_copy_color", icon='COPY_ID')
1124 class CLIP_MT_stabilize_2d_specials(Menu):
1125 bl_label = "Track Color Specials"
1127 def draw(self, context):
1128 layout = self.layout
1130 layout.operator("clip.stabilize_2d_select")
1133 # -----------------------------------------------------------------------------
1134 # Mask (similar code in space_image.py, keep in sync)
1137 from bl_ui.properties_mask_common import (MASK_PT_mask,
1145 class CLIP_PT_mask(MASK_PT_mask, Panel):
1146 bl_space_type = 'CLIP_EDITOR'
1147 bl_region_type = 'UI'
1150 class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
1151 bl_space_type = 'CLIP_EDITOR'
1152 bl_region_type = 'UI'
1155 class CLIP_PT_mask_display(MASK_PT_display, Panel):
1156 bl_space_type = 'CLIP_EDITOR'
1157 bl_region_type = 'UI'
1160 class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
1161 bl_space_type = 'CLIP_EDITOR'
1162 bl_region_type = 'UI'
1165 class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
1166 bl_space_type = 'CLIP_EDITOR'
1167 bl_region_type = 'UI'
1169 class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
1170 bl_space_type = 'CLIP_EDITOR'
1171 bl_region_type = 'TOOLS'
1175 if __name__ == "__main__": # only for live edit.
1176 bpy.utils.register_module(__name__)