From 904f82b49fb8a5169deaab707fe01333c077119f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Oct 2010 07:12:29 +0000 Subject: bugfix [#24376] Fly mode disturbs the rotation or scale of the camera object --- source/blender/editors/armature/editarmature.c | 2 +- source/blender/editors/object/object_add.c | 2 +- source/blender/editors/object/object_relations.c | 4 ++-- source/blender/editors/object/object_transform.c | 4 ++-- source/blender/editors/space_view3d/view3d_fly.c | 28 +++++++++++------------- 5 files changed, 19 insertions(+), 21 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index c8c0a4e6980..28165c0e018 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -546,7 +546,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob) /* apply current transform from parent (not yet destroyed), * then calculate new parent inverse matrix */ - object_apply_mat4(ob, ob->obmat); + object_apply_mat4(ob, ob->obmat, FALSE); what_does_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 56af4ce1b1c..f9d0bddf6b2 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -985,7 +985,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) ob->lay= base->lay; copy_m4_m4(ob->obmat, dob->mat); - object_apply_mat4(ob, ob->obmat); + object_apply_mat4(ob, ob->obmat, FALSE); } copy_object_set_idnew(C, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b1c027a2f24..5f9eeb04125 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -431,7 +431,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } else if(type == 1) { ob->parent= NULL; - object_apply_mat4(ob, ob->obmat); + object_apply_mat4(ob, ob->obmat, TRUE); } else if(type == 2) unit_m4(ob->parentinv); @@ -906,7 +906,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } if(type == 1) - object_apply_mat4(ob, ob->obmat); + object_apply_mat4(ob, ob->obmat, TRUE); } CTX_DATA_END; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 66c5ab4ec4b..7be03a4c567 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -390,7 +390,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob ) /* a change was made, adjust the children to compensate */ for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) { if(ob_child->parent == ob) { - object_apply_mat4(ob_child, ob_child->obmat); + object_apply_mat4(ob_child, ob_child->obmat, TRUE); what_does_parent(scene, ob_child, &workob); invert_m4_m4(ob_child->parentinv, workob.obmat); } @@ -574,7 +574,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { where_is_object(scene, ob); - object_apply_mat4(ob, ob->obmat); + object_apply_mat4(ob, ob->obmat, TRUE); where_is_object(scene, ob); change = 1; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index db83cd4b364..5f4c551e2d6 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -377,15 +377,7 @@ static int flyEnd(bContext *C, FlyInfo *fly) } } else if (fly->persp_backup==RV3D_CAMOB) { /* camera */ - float mat3[3][3]; - if(fly->root_parent) { - DAG_id_flush_update(&fly->root_parent->id, OB_RECALC_OB); - } - else { - copy_m3_m4(mat3, v3d->camera->obmat); - object_mat3_to_rot(v3d->camera, mat3, TRUE); - DAG_id_flush_update(&v3d->camera->id, OB_RECALC_OB); - } + DAG_id_flush_update(fly->root_parent ? &fly->root_parent->id : &v3d->camera->id, OB_RECALC_OB); } else { /* not camera */ /* Apply the fly mode view */ @@ -802,7 +794,7 @@ static int flyApply(bContext *C, FlyInfo *fly) view3d_persp_mat4(rv3d, view_mat); mul_m4_m4m4(diff_mat, prev_view_imat, view_mat); mul_m4_m4m4(parent_mat, fly->root_parent->obmat, diff_mat); - object_apply_mat4(fly->root_parent, parent_mat); + object_apply_mat4(fly->root_parent, parent_mat, TRUE); // where_is_object(scene, fly->root_parent); @@ -820,7 +812,7 @@ static int flyApply(bContext *C, FlyInfo *fly) else { float view_mat[4][4]; view3d_persp_mat4(rv3d, view_mat); - object_apply_mat4(v3d->camera, view_mat); + object_apply_mat4(v3d->camera, view_mat, TRUE); id_key= &v3d->camera->id; } @@ -901,7 +893,7 @@ static int fly_cancel(bContext *C, wmOperator *op) static int fly_modal(bContext *C, wmOperator *op, wmEvent *event) { int exit_code; - + short do_draw= FALSE; FlyInfo *fly = op->customdata; fly->redraw= 0; @@ -911,14 +903,20 @@ static int fly_modal(bContext *C, wmOperator *op, wmEvent *event) if(event->type==TIMER && event->customdata == fly->timer) flyApply(C, fly); - if(fly->redraw) { - ED_region_tag_redraw(CTX_wm_region(C)); - } + do_draw |= fly->redraw; exit_code = flyEnd(C, fly); if(exit_code!=OPERATOR_RUNNING_MODAL) + do_draw= TRUE; + + if(do_draw) { + if(fly->rv3d->persp==RV3D_CAMOB) { + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, fly->root_parent ? fly->root_parent : fly->v3d->camera); + } + ED_region_tag_redraw(CTX_wm_region(C)); + } return exit_code; } -- cgit v1.2.3