diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-02-26 17:40:04 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-02-26 17:40:04 +0400 |
commit | 3b44ca08a99a3dfc7e6ce0a8947cb8415f34f29c (patch) | |
tree | 433e9690ee0e6bbba149deff13f5b677ea93f57d /release/scripts/startup/bl_operators/clip.py | |
parent | cf0120b18954471b112feddd1c2e18bb62625688 (diff) |
Fix 3D tracks to mesh not aligning mesh properly
Also fixed wrong frame number used for reconstructed object
visualization in 3D viewport.
Diffstat (limited to 'release/scripts/startup/bl_operators/clip.py')
-rw-r--r-- | release/scripts/startup/bl_operators/clip.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 5bce5645e42..72a26fd36e2 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -189,6 +189,15 @@ class CLIP_OT_bundles_to_mesh(Operator): new_verts = [] + scene = context.scene + camera = scene.camera + matrix = Matrix.Identity(4) + if camera: + reconstruction = tracking_object.reconstruction + framenr = scene.frame_current - clip.frame_start + 1 + reconstructed_matrix = reconstruction.cameras.matrix_for_frame(framenr) + matrix = camera.matrix_world * reconstructed_matrix.inverted() + mesh = bpy.data.meshes.new(name="Tracks") for track in tracking_object.tracks: if track.has_bundle: @@ -200,6 +209,8 @@ class CLIP_OT_bundles_to_mesh(Operator): ob = bpy.data.objects.new(name="Tracks", object_data=mesh) + ob.matrix_world = matrix + context.scene.objects.link(ob) return {'FINISHED'} |