diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 20:38:47 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 20:38:47 +0400 |
commit | 2e96e41da31ce463c6dd808d774cea371ba6e78b (patch) | |
tree | 557268eb6deda6583821f9ea8b1b24b1f8ad953e | |
parent | 4f5f97254c06e0043b34df9a689dc45899c011cc (diff) |
Made bundles in 3D viewport have constant size
This means bundles' size is not affected by camera scale.
This way it's more useful to work with -- bundles never
becomes too small or too large (depending on reconstructed
scene scale).
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 09a2384e868..fdc6c308cbd 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1482,12 +1482,20 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D unsigned char col_unsel[4], col_sel[4]; int tracknr = *global_track_index; ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object); + float camera_size[3]; UI_GetThemeColor4ubv(TH_TEXT, col_unsel); UI_GetThemeColor4ubv(TH_SELECT, col_sel); BKE_tracking_get_camera_object_matrix(scene, base->object, mat); + /* we're compensating camera size for bundles size, + * to make it so bundles are always displayed with the same size + */ + copy_v3_v3(camera_size, base->object->size); + if ((tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0) + mul_v3_fl(camera_size, tracking_object->scale); + glPushMatrix(); if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { @@ -1522,7 +1530,9 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D glPushMatrix(); glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]); - glScalef(v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f); + glScalef(v3d->bundle_size / 0.05f / camera_size[0], + v3d->bundle_size / 0.05f / camera_size[1], + v3d->bundle_size / 0.05f / camera_size[2]); if (v3d->drawtype == OB_WIRE) { glDisable(GL_LIGHTING); |