diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-30 22:06:02 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-30 22:06:02 +0400 |
commit | 3c6e818b22ed9153604cfb87476845416112b7d8 (patch) | |
tree | 903339376cb68d49151d2b2f83543f07610e79d9 /release | |
parent | 532afede0236bdf6e29dd4dfc746a1ee0959d8a5 (diff) | |
parent | c2ae77e5bdd60e4cfe9b1f9d3d54e66f8089245c (diff) |
Object tracking integration
This commits merges object tracking implementation from tomato branch.
Summarized changes from branch:
- Added list of objects to be tracked. Default there's only one object called
"Camera" which is used for solving camera motion. Other objects can be added
and each of them will have it;s own list of tracks. Only one object can be used
for camera solving at this moment.
- Added new constraint called "Object Tracking" which makes oriented object be
moving in the save way as solved object motion.
- Scene orientation tools can be used for orienting object to bundles.
- Object has got scale to define "depth" in camera space.
- All tools which works with list of tracks or reconstruction data now
gets that lists from active editing object.
- All objects and their tracking data are available via python api.
- Improvements in witness cameras workflow,
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/presets/tracking_track_color/object.py | 5 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_object_constraint.py | 35 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_clip.py | 87 |
3 files changed, 122 insertions, 5 deletions
diff --git a/release/scripts/presets/tracking_track_color/object.py b/release/scripts/presets/tracking_track_color/object.py new file mode 100644 index 00000000000..5cb663d3f97 --- /dev/null +++ b/release/scripts/presets/tracking_track_color/object.py @@ -0,0 +1,5 @@ +import bpy +track = bpy.context.edit_movieclip.tracking.tracks.active + +track.color = (1.0, 0.0, 1.0) +track.use_custom_color = True diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 038d7a38fd6..32ed1c3f1b1 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -755,7 +755,16 @@ class ConstraintButtonsPanel(): col = layout.column() col.prop(con, "rotation_range", text="Pivot When") + @staticmethod + def _getConstraintClip(context, con): + if not con.use_active_clip: + return con.clip + else: + return context.scene.active_clip + def FOLLOW_TRACK(self, context, layout, con): + clip = self._getConstraintClip(context, con) + row = layout.row() row.prop(con, "use_active_clip") row.prop(con, "use_3d_position") @@ -763,7 +772,11 @@ class ConstraintButtonsPanel(): if not con.use_active_clip: layout.prop(con, "clip") - layout.prop(con, "track") + if clip: + layout.prop_search(con, "object", clip.tracking, "objects", icon='OBJECT_DATA') + layout.prop_search(con, "track", clip.tracking, "tracks", icon='ANIMATION_DATA') + + layout.prop(con, "camera") layout.operator("clip.constraint_to_fcurve") @@ -775,6 +788,26 @@ class ConstraintButtonsPanel(): layout.operator("clip.constraint_to_fcurve") + def OBJECT_SOLVER(self, context, layout, con): + scene = context.scene + clip = self._getConstraintClip(context, con) + + layout.prop(con, "use_active_clip") + + if not con.use_active_clip: + layout.prop(con, "clip") + + if clip: + layout.prop_search(con, "object", clip.tracking, "objects", icon='OBJECT_DATA') + + layout.prop(con, "camera") + + row = layout.row() + row.operator("constraint.objectsolver_set_inverse") + row.operator("constraint.objectsolver_clear_inverse") + + layout.operator("clip.constraint_to_fcurve") + def SCRIPT(self, context, layout, con): layout.label("Blender 2.5 has no py-constraints") diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index e4f1a12f60b..5234ffbcc32 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -70,7 +70,13 @@ class CLIP_HT_header(Header): row.template_ID(sc, "clip", open='clip.open') if clip: - r = clip.tracking.reconstruction + tracking = clip.tracking + active = tracking.objects.active + + if active and not active.is_camera: + r = active.reconstruction + else: + r = tracking.reconstruction if r.is_valid: layout.label(text="Average solve error: %.4f" % @@ -197,10 +203,18 @@ class CLIP_PT_tools_solve(Panel): def draw(self, context): layout = self.layout clip = context.space_data.clip - settings = clip.tracking.settings + tracking = clip.tracking + settings = tracking.settings + tracking_object = tracking.objects.active col = layout.column(align=True) - col.operator("clip.solve_camera", text="Camera Motion") + + if tracking_object.is_camera: + solve_text = "Camera Motion" + else: + solve_text = "Object Motion" + + col.operator("clip.solve_camera", text=solve_text) col.operator("clip.clear_solution") col = layout.column(align=True) @@ -208,6 +222,7 @@ class CLIP_PT_tools_solve(Panel): col.prop(settings, "keyframe_b") col = layout.column(align=True) + col.active = tracking_object.is_camera col.label(text="Refine:") col.prop(settings, "refine_intrinsics", text="") @@ -287,6 +302,39 @@ class CLIP_PT_tools_orientation(Panel): col.prop(settings, "distance") +class CLIP_PT_tools_object(Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'TOOLS' + bl_label = "Object" + + @classmethod + def poll(cls, context): + sc = context.space_data + clip = sc.clip + + if clip and sc.mode == 'RECONSTRUCTION': + tracking_object = clip.tracking.objects.active + return not tracking_object.is_camera + + return False + + def draw(self, context): + sc = context.space_data + clip = sc.clip + layout = self.layout + tracking_object = clip.tracking.objects.active + settings = sc.clip.tracking.settings + + col = layout.column() + + col.prop(tracking_object, "scale") + + col.separator() + + col.operator("clip.set_solution_scale", text="Set Scale") + col.prop(settings, "object_distance") + + class CLIP_PT_tools_grease_pencil(Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' @@ -316,6 +364,37 @@ class CLIP_PT_tools_grease_pencil(Panel): row.prop(context.tool_settings, "use_grease_pencil_sessions") +class CLIP_PT_objects(Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + bl_label = "Objects" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + sc = context.space_data + + return sc.clip + + def draw(self, context): + layout = self.layout + sc = context.space_data + clip = context.space_data.clip + tracking = clip.tracking + + row = layout.row() + row.template_list(tracking, "objects", tracking, "active_object_index", rows=3) + + sub = row.column(align=True) + + sub.operator("clip.tracking_object_new", icon='ZOOMIN', text="") + sub.operator("clip.tracking_object_remove", icon='ZOOMOUT', text="") + + active = tracking.objects.active + if active: + layout.prop(active, "name") + + class CLIP_PT_track(Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'UI' @@ -428,7 +507,7 @@ class CLIP_PT_tracking_camera(Panel): col.operator("clip.set_center_principal", text="Center") col = layout.column(align=True) - col.label(text="Undistortion:") + col.label(text="Lens Distortion:") col.prop(clip.tracking.camera, "k1") col.prop(clip.tracking.camera, "k2") col.prop(clip.tracking.camera, "k3") |