Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-06-06 23:04:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-06 23:04:56 +0400
commit9695a50ec4ecf0168746238d656c9d6ebfd2a2b5 (patch)
tree052cee27831f3b5597b06e48ddd59c34ee7c6296 /source/blender/editors/space_view3d/view3d_fly.c
parentab87d4daec122aa7e060028c6838d854d4b837a4 (diff)
fix [#35650] parented camera behavior
fly mode with parenting was broken for both locked/unlocked parent mode.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_fly.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 642b1b936c4..64dc0bef689 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -227,6 +227,9 @@ typedef struct FlyInfo {
/* use for some lag */
float dvec_prev[3]; /* old for some lag */
+ /* for parenting calculation */
+ float view_mat_prev[4][4];
+
} FlyInfo;
static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
@@ -409,6 +412,8 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
/* Done with correcting for the dist */
}
+ ED_view3d_to_m4(fly->view_mat_prev, fly->rv3d->ofs, fly->rv3d->viewquat, fly->rv3d->dist);
+
/* center the mouse, probably the UI mafia are against this but without its quite annoying */
WM_cursor_warp(win, fly->ar->winrct.xmin + fly->ar->winx / 2, fly->ar->winrct.ymin + fly->ar->winy / 2);
@@ -731,21 +736,15 @@ static void flyMoveCamera(bContext *C, RegionView3D *rv3d, FlyInfo *fly,
Object *ob_update;
float view_mat[4][4];
- float prev_view_mat[4][4];
float prev_view_imat[4][4];
float diff_mat[4][4];
float parent_mat[4][4];
- float size_mat[4][4];
- ED_view3d_to_m4(prev_view_mat, fly->rv3d->ofs, fly->rv3d->viewquat, fly->rv3d->dist);
- invert_m4_m4(prev_view_imat, prev_view_mat);
+ invert_m4_m4(prev_view_imat, fly->view_mat_prev);
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
mul_m4_m4m4(diff_mat, view_mat, prev_view_imat);
mul_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat);
- size_to_mat4(size_mat, fly->root_parent->size);
- mul_m4_m4m4(parent_mat, parent_mat, size_mat);
-
BKE_object_apply_mat4(fly->root_parent, parent_mat, true, false);
// BKE_object_where_is_calc(scene, fly->root_parent);
@@ -756,6 +755,8 @@ static void flyMoveCamera(bContext *C, RegionView3D *rv3d, FlyInfo *fly,
ob_update = ob_update->parent;
}
+ copy_m4_m4(fly->view_mat_prev, view_mat);
+
id_key = &fly->root_parent->id;
}
else {
@@ -766,7 +767,7 @@ static void flyMoveCamera(bContext *C, RegionView3D *rv3d, FlyInfo *fly,
size_to_mat4(size_mat, v3d->camera->size);
mul_m4_m4m4(view_mat, view_mat, size_mat);
- BKE_object_apply_mat4(v3d->camera, view_mat, true, false);
+ BKE_object_apply_mat4(v3d->camera, view_mat, true, true);
id_key = &v3d->camera->id;
}