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, UIList
23 from bpy.app.translations import pgettext_iface as iface_
26 class CLIP_UL_tracking_objects(UIList):
27 def draw_item(self, context, layout, data, item, icon,
28 active_data, active_propname, index):
29 # assert(isinstance(item, bpy.types.MovieTrackingObject)
31 if self.layout_type in {'DEFAULT', 'COMPACT'}:
32 layout.label(text=tobj.name, translate=False,
33 icon='CAMERA_DATA' if tobj.is_camera
35 elif self.layout_type in {'GRID'}:
36 layout.alignment = 'CENTER'
38 icon='CAMERA_DATA' if tobj.is_camera
42 class CLIP_HT_header(Header):
43 bl_space_type = 'CLIP_EDITOR'
45 def _draw_tracking(self, context):
48 sc = context.space_data
51 row = layout.row(align=True)
54 if context.area.show_menus:
55 sub = row.row(align=True)
56 sub.menu("CLIP_MT_view")
60 sub.menu("CLIP_MT_select")
61 sub.menu("CLIP_MT_clip")
62 sub.menu("CLIP_MT_track")
63 sub.menu("CLIP_MT_reconstruction")
65 sub.menu("CLIP_MT_clip")
68 row.template_ID(sc, "clip", open="clip.open")
71 tracking = clip.tracking
72 active_object = tracking.objects.active
75 layout.prop(sc, "mode", text="")
76 layout.prop(sc, "view", text="", expand=True)
77 layout.prop(sc, "pivot_point", text="", icon_only=True)
79 r = active_object.reconstruction
81 if r.is_valid and sc.view == 'CLIP':
82 layout.label(text="Solve error: %.4f" %
84 elif sc.view == 'GRAPH':
85 layout.prop(sc, "view", text="", expand=True)
87 row = layout.row(align=True)
88 row.prop(sc, "show_graph_only_selected", text="")
89 row.prop(sc, "show_graph_hidden", text="")
91 row = layout.row(align=True)
94 row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN',
97 sub = row.row(align=True)
98 sub.active = clip.tracking.reconstruction.is_valid
99 sub.prop(sc, "show_graph_frames", icon='SEQUENCE', text="")
101 row.prop(sc, "show_graph_tracks", icon='ANIM', text="")
103 row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT',
105 elif sc.view == 'DOPESHEET':
106 dopesheet = tracking.dopesheet
107 layout.prop(sc, "view", text="", expand=True)
109 row = layout.row(align=True)
110 row.prop(dopesheet, "show_only_selected", text="")
111 row.prop(dopesheet, "show_hidden", text="")
113 row = layout.row(align=True)
114 row.prop(dopesheet, "sort_method", text="")
115 row.prop(dopesheet, "use_invert_sort",
116 text="Invert", toggle=True)
118 layout.prop(sc, "view", text="", expand=True)
120 def _draw_masking(self, context):
123 toolsettings = context.tool_settings
124 sc = context.space_data
127 row = layout.row(align=True)
128 row.template_header()
130 if context.area.show_menus:
131 sub = row.row(align=True)
132 sub.menu("CLIP_MT_view")
135 sub.menu("MASK_MT_select")
136 sub.menu("CLIP_MT_clip") # XXX - remove?
137 sub.menu("MASK_MT_mask")
139 sub.menu("CLIP_MT_clip") # XXX - remove?
142 row.template_ID(sc, "clip", open="clip.open")
144 layout.prop(sc, "mode", text="")
147 row.template_ID(sc, "mask", new="mask.new")
149 layout.prop(sc, "pivot_point", text="", icon_only=True)
151 row = layout.row(align=True)
152 row.prop(toolsettings, "use_proportional_edit_mask",
153 text="", icon_only=True)
154 if toolsettings.use_proportional_edit_mask:
155 row.prop(toolsettings, "proportional_edit_falloff",
156 text="", icon_only=True)
158 def draw(self, context):
161 sc = context.space_data
163 if sc.mode in {'TRACKING', 'RECONSTRUCTION', 'DISTORTION'}:
164 self._draw_tracking(context)
166 self._draw_masking(context)
168 layout.template_running_jobs()
171 class CLIP_PT_clip_view_panel:
174 def poll(cls, context):
175 sc = context.space_data
178 return clip and sc.view == 'CLIP'
181 class CLIP_PT_tracking_panel:
184 def poll(cls, context):
185 sc = context.space_data
188 return clip and sc.mode == 'TRACKING' and sc.view == 'CLIP'
191 class CLIP_PT_reconstruction_panel:
194 def poll(cls, context):
195 sc = context.space_data
198 return clip and sc.mode == 'RECONSTRUCTION' and sc.view == 'CLIP'
201 class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
202 bl_space_type = 'CLIP_EDITOR'
203 bl_region_type = 'TOOLS'
206 def draw(self, context):
209 sc = context.space_data
211 settings = clip.tracking.settings
213 col = layout.column(align=True)
214 col.operator("clip.add_marker_at_click", text="Add Marker")
215 col.operator("clip.detect_features")
216 col.operator("clip.delete_track")
219 row = box.row(align=True)
220 row.prop(settings, "show_default_expanded", text="", emboss=False)
221 row.label(text="Tracking Settings")
223 if settings.show_default_expanded:
225 row = col.row(align=True)
226 label = CLIP_MT_tracking_settings_presets.bl_label
227 row.menu('CLIP_MT_tracking_settings_presets', text=label)
228 row.operator("clip.tracking_settings_preset_add",
229 text="", icon='ZOOMIN')
230 row.operator("clip.tracking_settings_preset_add",
231 text="", icon='ZOOMOUT').remove_active = True
235 row = col.row(align=True)
236 row.prop(settings, "use_default_red_channel",
237 text="R", toggle=True)
238 row.prop(settings, "use_default_green_channel",
239 text="G", toggle=True)
240 row.prop(settings, "use_default_blue_channel",
241 text="B", toggle=True)
245 sub = col.column(align=True)
246 sub.prop(settings, "default_pattern_size")
247 sub.prop(settings, "default_search_size")
249 col.label(text="Tracker:")
250 col.prop(settings, "default_motion_model")
251 col.prop(settings, "use_default_brute")
252 col.prop(settings, "use_default_normalization")
253 col.prop(settings, "use_default_mask")
254 col.prop(settings, "default_correlation_min")
258 sub = col.column(align=True)
259 sub.prop(settings, "default_frames_limit")
260 sub.prop(settings, "default_margin")
262 col.label(text="Match:")
263 col.prop(settings, "default_pattern_match", text="")
266 col.operator("clip.track_settings_as_default",
267 text="Copy From Active Track")
270 class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
271 bl_space_type = 'CLIP_EDITOR'
272 bl_region_type = 'TOOLS'
275 def draw(self, context):
278 row = layout.row(align=True)
280 props = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
281 props.backwards = True
282 props.sequence = False
283 props = row.operator("clip.track_markers", text="",
285 props.backwards = True
286 props.sequence = True
287 props = row.operator("clip.track_markers", text="", icon='PLAY')
288 props.backwards = False
289 props.sequence = True
290 props = row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
291 props.backwards = False
292 props.sequence = False
294 col = layout.column()
295 col.label(text="Refine:")
296 row = col.row(align=True)
297 row.operator("clip.refine_markers", text="Backwards").backwards = True
298 row.operator("clip.refine_markers", text="Forwards").backwards = False
300 col = layout.column()
301 col.label(text="Clear:")
302 row = col.row(align=True)
303 row.operator("clip.clear_track_path", text="Before").action = 'UPTO'
304 row.operator("clip.clear_track_path", text="After").action = 'REMAINED'
306 layout.operator("clip.join_tracks", text="Join")
309 class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel):
310 bl_space_type = 'CLIP_EDITOR'
311 bl_region_type = 'TOOLS'
312 bl_label = "Plane Track"
313 bl_options = {'DEFAULT_CLOSED'}
315 def draw(self, context):
317 layout.operator("clip.create_plane_track")
320 class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
321 bl_space_type = 'CLIP_EDITOR'
322 bl_region_type = 'TOOLS'
325 def draw(self, context):
328 clip = context.space_data.clip
329 tracking = clip.tracking
330 settings = tracking.settings
331 tracking_object = tracking.objects.active
333 col = layout.column(align=True)
335 col.operator("clip.solve_camera",
336 text="Camera Motion" if tracking_object.is_camera
337 else "Object Motion")
338 col.operator("clip.clear_solution")
340 col = layout.column()
341 col.prop(settings, "use_tripod_solver")
342 col.prop(settings, "use_keyframe_selection")
344 col = layout.column(align=True)
345 col.active = (not settings.use_tripod_solver and
346 not settings.use_keyframe_selection)
347 col.prop(tracking_object, "keyframe_a")
348 col.prop(tracking_object, "keyframe_b")
350 col = layout.column(align=True)
351 col.active = tracking_object.is_camera
352 col.label(text="Refine:")
353 col.prop(settings, "refine_intrinsics", text="")
356 class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
357 bl_space_type = 'CLIP_EDITOR'
358 bl_region_type = 'TOOLS'
359 bl_label = "Clean up"
361 def draw(self, context):
363 clip = context.space_data.clip
364 settings = clip.tracking.settings
366 layout.operator("clip.clean_tracks")
368 layout.prop(settings, "clean_frames", text="Frames")
369 layout.prop(settings, "clean_error", text="Error")
370 layout.prop(settings, "clean_action", text="")
373 class CLIP_PT_tools_geometry(CLIP_PT_reconstruction_panel, Panel):
374 bl_space_type = 'CLIP_EDITOR'
375 bl_region_type = 'TOOLS'
376 bl_label = "Geometry"
378 def draw(self, context):
381 layout.operator("clip.bundles_to_mesh")
382 layout.operator("clip.track_to_empty")
385 class CLIP_PT_tools_orientation(CLIP_PT_reconstruction_panel, Panel):
386 bl_space_type = 'CLIP_EDITOR'
387 bl_region_type = 'TOOLS'
388 bl_label = "Orientation"
390 def draw(self, context):
391 sc = context.space_data
393 settings = sc.clip.tracking.settings
395 col = layout.column(align=True)
396 row = col.row(align=True)
397 row.operator("clip.set_plane", text="Floor").plane = 'FLOOR'
398 row.operator("clip.set_plane", text="Wall").plane = 'WALL'
400 col.operator("clip.set_origin")
402 row = col.row(align=True)
403 row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
404 row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
408 col = layout.column()
409 row = col.row(align=True)
410 row.operator("clip.set_scale")
411 row.operator("clip.apply_solution_scale", text="Apply Scale")
413 col.prop(settings, "distance")
416 class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
417 bl_space_type = 'CLIP_EDITOR'
418 bl_region_type = 'TOOLS'
422 def poll(cls, context):
423 if CLIP_PT_reconstruction_panel.poll(context):
424 sc = context.space_data
427 tracking_object = clip.tracking.objects.active
429 return not tracking_object.is_camera
433 def draw(self, context):
436 sc = context.space_data
438 tracking_object = clip.tracking.objects.active
439 settings = sc.clip.tracking.settings
441 col = layout.column()
443 col.prop(tracking_object, "scale")
447 col.operator("clip.set_solution_scale", text="Set Scale")
448 col.prop(settings, "object_distance")
451 class CLIP_PT_tools_grease_pencil(Panel):
452 bl_space_type = 'CLIP_EDITOR'
453 bl_region_type = 'TOOLS'
454 bl_label = "Grease Pencil"
457 def poll(cls, context):
458 sc = context.space_data
464 if sc.mode == 'DISTORTION':
465 return sc.view == 'CLIP'
466 elif sc.mode == 'MASK':
471 def draw(self, context):
474 col = layout.column(align=True)
476 row = col.row(align=True)
477 row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
478 row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
480 row = col.row(align=True)
481 row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
482 row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
484 row = col.row(align=True)
485 row.prop(context.tool_settings, "use_grease_pencil_sessions")
488 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
489 bl_space_type = 'CLIP_EDITOR'
490 bl_region_type = 'UI'
492 bl_options = {'DEFAULT_CLOSED'}
494 def draw(self, context):
497 sc = context.space_data
498 tracking = sc.clip.tracking
501 row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects",
502 tracking, "active_object_index", rows=1)
504 sub = row.column(align=True)
506 sub.operator("clip.tracking_object_new", icon='ZOOMIN', text="")
507 sub.operator("clip.tracking_object_remove", icon='ZOOMOUT', text="")
509 active = tracking.objects.active
511 layout.prop(active, "name")
514 class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
515 bl_space_type = 'CLIP_EDITOR'
516 bl_region_type = 'UI'
519 def draw(self, context):
522 sc = context.space_data
523 clip = context.space_data.clip
524 act_track = clip.tracking.tracks.active
527 layout.active = False
528 layout.label(text="No active track")
532 row.prop(act_track, "name", text="")
534 sub = row.row(align=True)
536 sub.template_marker(sc, "clip", sc.clip_user, act_track, True)
538 icon = 'LOCKED' if act_track.lock else 'UNLOCKED'
539 sub.prop(act_track, "lock", text="", icon=icon)
541 layout.template_track(sc, "scopes")
543 row = layout.row(align=True)
544 sub = row.row(align=True)
545 sub.prop(act_track, "use_red_channel", text="R", toggle=True)
546 sub.prop(act_track, "use_green_channel", text="G", toggle=True)
547 sub.prop(act_track, "use_blue_channel", text="B", toggle=True)
551 row.prop(act_track, "use_grayscale_preview", text="B/W", toggle=True)
554 row.prop(act_track, "use_alpha_preview",
555 text="", toggle=True, icon='IMAGE_ALPHA')
559 row = layout.row(align=True)
560 label = bpy.types.CLIP_MT_track_color_presets.bl_label
561 row.menu('CLIP_MT_track_color_presets', text=label)
562 row.menu('CLIP_MT_track_color_specials', text="", icon='DOWNARROW_HLT')
563 row.operator("clip.track_color_preset_add", text="", icon='ZOOMIN')
564 row.operator("clip.track_color_preset_add",
565 text="", icon='ZOOMOUT').remove_active = True
568 row.prop(act_track, "use_custom_color")
569 if act_track.use_custom_color:
570 row.prop(act_track, "color", text="")
572 layout.prop(act_track, "weight")
574 if act_track.has_bundle:
575 label_text = "Average Error: %.4f" % (act_track.average_error)
576 layout.label(text=label_text)
579 class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
580 bl_space_type = 'CLIP_EDITOR'
581 bl_region_type = 'UI'
582 bl_label = "Plane Track"
583 bl_options = {'DEFAULT_CLOSED'}
585 def draw(self, context):
588 sc = context.space_data
589 clip = context.space_data.clip
590 active_track = clip.tracking.plane_tracks.active
593 layout.active = False
594 layout.label(text="No active plane track")
597 layout.prop(active_track, "name")
598 layout.prop(active_track, "use_auto_keying")
601 class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
602 bl_space_type = 'CLIP_EDITOR'
603 bl_region_type = 'UI'
604 bl_label = "Tracking Settings"
605 bl_options = {'DEFAULT_CLOSED'}
607 def draw(self, context):
610 clip = context.space_data.clip
611 settings = clip.tracking.settings
613 col = layout.column()
615 active = clip.tracking.tracks.active
617 col.prop(active, "motion_model")
618 col.prop(active, "use_brute")
619 col.prop(active, "use_normalization")
620 col.prop(active, "use_mask")
621 col.prop(active, "correlation_min")
624 col.prop(active, "frames_limit")
625 col.prop(active, "margin")
626 col.prop(active, "pattern_match", text="Match")
628 col.prop(settings, "speed")
631 class CLIP_PT_tracking_camera(Panel):
632 bl_space_type = 'CLIP_EDITOR'
633 bl_region_type = 'UI'
634 bl_label = "Camera Data"
635 bl_options = {'DEFAULT_CLOSED'}
638 def poll(cls, context):
639 if CLIP_PT_clip_view_panel.poll(context):
640 sc = context.space_data
642 return sc.mode in {'TRACKING', 'DISTORTION'} and sc.clip
646 def draw(self, context):
649 sc = context.space_data
652 row = layout.row(align=True)
653 label = bpy.types.CLIP_MT_camera_presets.bl_label
654 row.menu('CLIP_MT_camera_presets', text=label)
655 row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
656 row.operator("clip.camera_preset_add", text="",
657 icon='ZOOMOUT').remove_active = True
659 row = layout.row(align=True)
660 sub = row.split(percentage=0.65, align=True)
661 if clip.tracking.camera.units == 'MILLIMETERS':
662 sub.prop(clip.tracking.camera, "focal_length")
664 sub.prop(clip.tracking.camera, "focal_length_pixels")
665 sub.prop(clip.tracking.camera, "units", text="")
667 col = layout.column(align=True)
668 col.label(text="Sensor:")
669 col.prop(clip.tracking.camera, "sensor_width", text="Width")
670 col.prop(clip.tracking.camera, "pixel_aspect")
672 col = layout.column()
673 col.label(text="Optical Center:")
675 row.prop(clip.tracking.camera, "principal", text="")
676 col.operator("clip.set_center_principal", text="Center")
678 col = layout.column(align=True)
679 col.label(text="Lens Distortion:")
680 col.prop(clip.tracking.camera, "k1")
681 col.prop(clip.tracking.camera, "k2")
682 col.prop(clip.tracking.camera, "k3")
685 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
686 bl_space_type = 'CLIP_EDITOR'
687 bl_region_type = 'UI'
690 def draw(self, context):
692 sc = context.space_data
694 row = layout.row(align=True)
695 sub = row.row(align=True)
696 sub.prop(sc, "show_red_channel", text="R", toggle=True)
697 sub.prop(sc, "show_green_channel", text="G", toggle=True)
698 sub.prop(sc, "show_blue_channel", text="B", toggle=True)
702 row.prop(sc, "use_grayscale_preview", text="B/W", toggle=True)
704 col = layout.column(align=True)
706 col.prop(sc, "show_disabled", "Disabled Tracks")
707 col.prop(sc, "show_names", text="Names and Status")
708 if sc.mode != 'MASK':
709 col.prop(sc, "show_bundles", text="3D Markers")
711 col.prop(sc, "use_mute_footage", text="Mute Footage")
712 col.prop(sc, "lock_selection")
714 if sc.view == 'GRAPH':
715 col.prop(sc, "lock_time_cursor")
717 if sc.mode == 'DISTORTION':
718 col.prop(sc, "show_grid", text="Grid")
719 col.prop(sc, "use_manual_calibration")
720 elif sc.mode == 'RECONSTRUCTION':
721 col.prop(sc, "show_stable", text="Stable")
725 col.label(text="Display Aspect Ratio:")
727 row.prop(clip, "display_aspect", text="")
730 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
731 bl_space_type = 'CLIP_EDITOR'
732 bl_region_type = 'UI'
733 bl_label = "Marker Display"
736 def poll(cls, context):
737 sc = context.space_data
739 return sc.mode != 'MASK'
741 def draw(self, context):
743 sc = context.space_data
745 col = layout.column(align=True)
747 row = col.row(align=True)
748 row.prop(sc, "show_marker_pattern", text="Pattern")
749 row.prop(sc, "show_marker_search", text="Search")
751 col.prop(sc, "show_tiny_markers", text="Thin Markers")
752 col.prop(sc, "show_track_path", text="Path")
754 row = col.row(align=True)
755 row.active = sc.show_track_path
756 row.prop(sc, "path_length", text="Length")
759 class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
760 bl_space_type = 'CLIP_EDITOR'
761 bl_region_type = 'UI'
762 bl_label = "2D Stabilization"
763 bl_options = {'DEFAULT_CLOSED'}
765 def draw_header(self, context):
766 stab = context.space_data.clip.tracking.stabilization
768 self.layout.prop(stab, "use_2d_stabilization", text="")
770 def draw(self, context):
773 tracking = context.space_data.clip.tracking
774 stab = tracking.stabilization
776 layout.active = stab.use_2d_stabilization
779 row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks",
780 stab, "active_track_index", rows=2)
782 sub = row.column(align=True)
784 sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="")
785 sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
787 sub.menu('CLIP_MT_stabilize_2d_specials', text="",
788 icon='DOWNARROW_HLT')
790 layout.prop(stab, "influence_location")
792 layout.prop(stab, "use_autoscale")
793 col = layout.column()
794 col.active = stab.use_autoscale
795 col.prop(stab, "scale_max")
796 col.prop(stab, "influence_scale")
798 layout.prop(stab, "use_stabilize_rotation")
799 col = layout.column()
800 col.active = stab.use_stabilize_rotation
802 row = col.row(align=True)
803 row.prop_search(stab, "rotation_track", tracking, "tracks", text="")
804 row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN')
807 row.active = stab.rotation_track is not None
808 row.prop(stab, "influence_rotation")
810 layout.prop(stab, "filter_type")
813 class CLIP_PT_marker(CLIP_PT_tracking_panel, Panel):
814 bl_space_type = 'CLIP_EDITOR'
815 bl_region_type = 'UI'
817 bl_options = {'DEFAULT_CLOSED'}
819 def draw(self, context):
821 sc = context.space_data
822 clip = context.space_data.clip
823 act_track = clip.tracking.tracks.active
826 layout.template_marker(sc, "clip", sc.clip_user, act_track, False)
828 layout.active = False
829 layout.label(text="No active track")
832 class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
833 bl_space_type = 'CLIP_EDITOR'
834 bl_region_type = 'UI'
835 bl_label = "Proxy / Timecode"
836 bl_options = {'DEFAULT_CLOSED'}
838 def draw_header(self, context):
839 sc = context.space_data
841 self.layout.prop(sc.clip, "use_proxy", text="")
843 def draw(self, context):
846 sc = context.space_data
849 col = layout.column()
850 col.active = clip.use_proxy
852 col.label(text="Build Original:")
854 row = col.row(align=True)
855 row.prop(clip.proxy, "build_25", toggle=True)
856 row.prop(clip.proxy, "build_50", toggle=True)
857 row.prop(clip.proxy, "build_75", toggle=True)
858 row.prop(clip.proxy, "build_100", toggle=True)
860 col.label(text="Build Undistorted:")
862 row = col.row(align=True)
863 row.prop(clip.proxy, "build_undistorted_25", toggle=True)
864 row.prop(clip.proxy, "build_undistorted_50", toggle=True)
865 row.prop(clip.proxy, "build_undistorted_75", toggle=True)
866 row.prop(clip.proxy, "build_undistorted_100", toggle=True)
868 col.prop(clip.proxy, "quality")
870 col.prop(clip, "use_proxy_custom_directory")
871 if clip.use_proxy_custom_directory:
872 col.prop(clip.proxy, "directory")
874 col.operator("clip.rebuild_proxy", text="Build Proxy")
876 if clip.source == 'MOVIE':
879 col2.label(text="Use timecode index:")
880 col2.prop(clip.proxy, "timecode", text="")
883 col2.label(text="Proxy render size:")
885 col.prop(sc.clip_user, "proxy_render_size", text="")
887 col = layout.column()
888 col.prop(sc.clip_user, "use_render_undistorted")
891 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
892 bl_space_type = 'CLIP_EDITOR'
893 bl_region_type = 'UI'
894 bl_label = "Footage Settings"
895 bl_options = {'DEFAULT_CLOSED'}
897 def draw(self, context):
900 sc = context.space_data
903 col = layout.column()
904 col.template_movieclip(sc, "clip", compact=True)
905 col.prop(clip, "frame_start")
906 col.prop(clip, "frame_offset")
909 class CLIP_PT_footage_info(CLIP_PT_clip_view_panel, Panel):
910 bl_space_type = 'CLIP_EDITOR'
911 bl_region_type = 'UI'
912 bl_label = "Footage Information"
913 bl_options = {'DEFAULT_CLOSED'}
915 def draw(self, context):
918 sc = context.space_data
921 col = layout.column()
922 col.template_movieclip_information(sc, "clip", sc.clip_user)
925 class CLIP_PT_tools_clip(CLIP_PT_clip_view_panel, Panel):
926 bl_space_type = 'CLIP_EDITOR'
927 bl_region_type = 'TOOLS'
929 bl_translation_context = bpy.app.translations.contexts.id_movieclip
931 def draw(self, context):
934 layout.operator("clip.set_viewport_background")
935 layout.operator("clip.setup_tracking_scene")
936 layout.operator("clip.prefetch")
937 layout.operator("clip.set_scene_frames")
940 class CLIP_MT_view(Menu):
943 def draw(self, context):
946 sc = context.space_data
948 if sc.view == 'CLIP':
949 layout.operator("clip.properties", icon='MENU_PANEL')
950 layout.operator("clip.tools", icon='MENU_PANEL')
953 layout.operator("clip.view_selected")
954 layout.operator("clip.view_all")
957 layout.operator("clip.view_zoom_in")
958 layout.operator("clip.view_zoom_out")
962 ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
964 text = iface_("Zoom %d:%d")
966 layout.operator("clip.view_zoom_ratio",
968 translate=False).ratio = a / b
970 if sc.view == 'GRAPH':
971 layout.operator_context = 'INVOKE_REGION_PREVIEW'
972 layout.operator("clip.graph_center_current_frame")
973 layout.operator("clip.graph_view_all")
974 layout.operator_context = 'INVOKE_DEFAULT'
976 layout.prop(sc, "show_seconds")
980 layout.operator("screen.area_dupli")
981 layout.operator("screen.screen_full_area")
984 class CLIP_MT_clip(Menu):
986 bl_translation_context = bpy.app.translations.contexts.id_movieclip
988 def draw(self, context):
991 sc = context.space_data
994 layout.operator("clip.open")
997 layout.operator("clip.prefetch")
998 layout.operator("clip.reload")
999 layout.menu("CLIP_MT_proxy")
1002 class CLIP_MT_proxy(Menu):
1005 def draw(self, context):
1006 layout = self.layout
1008 layout.operator("clip.rebuild_proxy")
1009 layout.operator("clip.delete_proxy")
1012 class CLIP_MT_track(Menu):
1015 def draw(self, context):
1016 layout = self.layout
1018 layout.operator("clip.clear_solution")
1019 layout.operator("clip.solve_camera")
1022 layout.operator("clip.clear_track_path",
1023 text="Clear After").action = 'REMAINED'
1025 layout.operator("clip.clear_track_path",
1026 text="Clear Before").action = 'UPTO'
1028 layout.operator("clip.clear_track_path",
1029 text="Clear Track Path").action = 'ALL'
1032 layout.operator("clip.join_tracks")
1035 layout.operator("clip.clean_tracks")
1038 layout.operator("clip.copy_tracks")
1039 layout.operator("clip.paste_tracks")
1042 layout.operator("clip.track_markers",
1043 text="Track Frame Backwards").backwards = True
1045 props = layout.operator("clip.track_markers", text="Track Backwards")
1046 props.backwards = True
1047 props.sequence = True
1049 layout.operator("clip.track_markers",
1050 text="Track Forwards").sequence = True
1051 layout.operator("clip.track_markers", text="Track Frame Forwards")
1054 layout.operator("clip.delete_track")
1055 layout.operator("clip.delete_marker")
1058 layout.operator("clip.add_marker_move")
1061 layout.menu("CLIP_MT_track_visibility")
1062 layout.menu("CLIP_MT_track_transform")
1065 class CLIP_MT_reconstruction(Menu):
1066 bl_label = "Reconstruction"
1068 def draw(self, context):
1069 layout = self.layout
1071 layout.operator("clip.set_origin")
1072 layout.operator("clip.set_plane", text="Set Floor").plane = 'FLOOR'
1073 layout.operator("clip.set_plane", text="Set Wall").plane = 'WALL'
1075 layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
1076 layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
1078 layout.operator("clip.set_scale")
1082 layout.operator("clip.track_to_empty")
1083 layout.operator("clip.bundles_to_mesh")
1086 class CLIP_MT_track_visibility(Menu):
1087 bl_label = "Show/Hide"
1089 def draw(self, context):
1090 layout = self.layout
1092 layout.operator("clip.hide_tracks_clear", text="Show Hidden")
1093 layout.operator("clip.hide_tracks", text="Hide Selected")
1095 layout.operator("clip.hide_tracks",
1096 text="Hide Unselected").unselected = True
1099 class CLIP_MT_track_transform(Menu):
1100 bl_label = "Transform"
1102 def draw(self, context):
1103 layout = self.layout
1105 layout.operator("transform.translate")
1106 layout.operator("transform.resize")
1109 class CLIP_MT_select(Menu):
1112 def draw(self, context):
1113 layout = self.layout
1115 layout.operator("clip.select_border")
1116 layout.operator("clip.select_circle")
1120 layout.operator("clip.select_all"
1122 layout.operator("clip.select_all",
1123 text="Inverse").action = 'INVERT'
1125 layout.menu("CLIP_MT_select_grouped")
1128 class CLIP_MT_select_grouped(Menu):
1129 bl_label = "Select Grouped"
1131 def draw(self, context):
1132 layout = self.layout
1134 layout.operator_enum("clip.select_grouped", "group")
1137 class CLIP_MT_tracking_specials(Menu):
1138 bl_label = "Specials"
1141 def poll(cls, context):
1142 return context.space_data.clip
1144 def draw(self, context):
1145 layout = self.layout
1147 layout.operator("clip.disable_markers",
1148 text="Enable Markers").action = 'ENABLE'
1150 layout.operator("clip.disable_markers",
1151 text="Disable markers").action = 'DISABLE'
1154 layout.operator("clip.set_origin")
1157 layout.operator("clip.hide_tracks")
1158 layout.operator("clip.hide_tracks_clear", text="Show Tracks")
1161 layout.operator("clip.lock_tracks", text="Lock Tracks").action = 'LOCK'
1163 layout.operator("clip.lock_tracks",
1164 text="Unlock Tracks").action = 'UNLOCK'
1167 class CLIP_MT_select_mode(Menu):
1168 bl_label = "Select Mode"
1170 def draw(self, context):
1171 layout = self.layout
1173 layout.operator_context = 'INVOKE_REGION_WIN'
1175 layout.operator_enum("clip.mode_set", "mode")
1178 class CLIP_MT_camera_presets(Menu):
1179 """Predefined tracking camera intrinsics"""
1180 bl_label = "Camera Presets"
1181 preset_subdir = "tracking_camera"
1182 preset_operator = "script.execute_preset"
1183 draw = Menu.draw_preset
1186 class CLIP_MT_track_color_presets(Menu):
1187 """Predefined track color"""
1188 bl_label = "Color Presets"
1189 preset_subdir = "tracking_track_color"
1190 preset_operator = "script.execute_preset"
1191 draw = Menu.draw_preset
1194 class CLIP_MT_tracking_settings_presets(Menu):
1195 """Predefined tracking settings"""
1196 bl_label = "Tracking Presets"
1197 preset_subdir = "tracking_settings"
1198 preset_operator = "script.execute_preset"
1199 draw = Menu.draw_preset
1202 class CLIP_MT_track_color_specials(Menu):
1203 bl_label = "Track Color Specials"
1205 def draw(self, context):
1206 layout = self.layout
1208 layout.operator("clip.track_copy_color", icon='COPY_ID')
1211 class CLIP_MT_stabilize_2d_specials(Menu):
1212 bl_label = "Track Color Specials"
1214 def draw(self, context):
1215 layout = self.layout
1217 layout.operator("clip.stabilize_2d_select")
1220 # -----------------------------------------------------------------------------
1221 # Mask (similar code in space_image.py, keep in sync)
1224 from bl_ui.properties_mask_common import (MASK_PT_mask,
1232 class CLIP_PT_mask(MASK_PT_mask, Panel):
1233 bl_space_type = 'CLIP_EDITOR'
1234 bl_region_type = 'UI'
1237 class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
1238 bl_space_type = 'CLIP_EDITOR'
1239 bl_region_type = 'UI'
1242 class CLIP_PT_mask_display(MASK_PT_display, Panel):
1243 bl_space_type = 'CLIP_EDITOR'
1244 bl_region_type = 'UI'
1247 class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
1248 bl_space_type = 'CLIP_EDITOR'
1249 bl_region_type = 'UI'
1252 class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
1253 bl_space_type = 'CLIP_EDITOR'
1254 bl_region_type = 'UI'
1257 class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
1258 bl_space_type = 'CLIP_EDITOR'
1259 bl_region_type = 'TOOLS'
1263 if __name__ == "__main__": # only for live edit.
1264 bpy.utils.register_module(__name__)