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>2010-10-25 11:12:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-25 11:12:29 +0400
commit904f82b49fb8a5169deaab707fe01333c077119f (patch)
tree72cc53a2cae2ccb6ce1a1180a0bbe65eb6b20146
parent3320b6fdd6ac436ffa55567d0577791ffa5e736c (diff)
bugfix [#24376] Fly mode disturbs the rotation or scale of the camera object
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/intern/object.c8
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_relations.c4
-rw-r--r--source/blender/editors/object/object_transform.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c28
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt6
-rw-r--r--source/blender/makesrna/intern/rna_object.c6
9 files changed, 33 insertions, 31 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 7451d43a578..b64011a7c9a 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -98,10 +98,10 @@ void disable_speed_curve(int val);
float bsystem_time(struct Scene *scene, struct Object *ob, float cfra, float ofs);
void object_scale_to_mat3(struct Object *ob, float mat[][3]);
void object_rot_to_mat3(struct Object *ob, float mat[][3]);
-void object_mat3_to_rot(struct Object *ob, float mat[][3], int use_compat);
+void object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat);
void object_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat4(struct Object *ob, float mat[][4]);
-void object_apply_mat4(struct Object *ob, float mat[][4]);
+void object_apply_mat4(struct Object *ob, float mat[][4], short use_compat);
void set_no_parent_ipo(int val);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 96f90473814..9d93fac8ad0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1550,7 +1550,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
if(gob) {
ob->rotmode= target->rotmode;
mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
- object_apply_mat4(ob, ob->obmat);
+ object_apply_mat4(ob, ob->obmat, FALSE);
}
else {
copy_object_transform(ob, target);
@@ -1678,7 +1678,7 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
mul_m3_m3m3(mat, dmat, rmat);
}
-void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat)
+void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
{
if (ob->rotmode == ROT_MODE_QUAT)
mat3_to_quat(ob->quat, mat);
@@ -1696,7 +1696,7 @@ void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat)
}
/* see pchan_apply_mat4() for the equivalent 'pchan' function */
-void object_apply_mat4(Object *ob, float mat[][4])
+void object_apply_mat4(Object *ob, float mat[][4], short use_compat)
{
float mat3[3][3]; /* obmat -> 3x3 */
float mat3_n[3][3]; /* obmat -> normalized, 3x3 */
@@ -1718,7 +1718,7 @@ void object_apply_mat4(Object *ob, float mat[][4])
}
/* rotation */
- object_mat3_to_rot(ob, mat3_n, 0);
+ object_mat3_to_rot(ob, mat3_n, use_compat);
/* scale */
/* note: mat4_to_size(ob->size, mat) fails for negative scale */
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;
}
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 5fd7ae1bd8a..ed84e4a50a9 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -27,12 +27,16 @@
# Generated code has some unused vars we can ignore.
REMOVE_STRICT_FLAGS()
+MESSAGE(STATUS "Configuring makesrna")
+
FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c")
LIST(REMOVE_ITEM DEFSRC rna_access.c rna_define.c makesrna.c)
LIST(REMOVE_ITEM DEFSRC ${APISRC})
STRING(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
+SET_SOURCE_FILES_PROPERTIES(GENSRC PROPERTIES GENERATED true)
+
SET(SRC
makesrna.c
@@ -147,5 +151,3 @@ ADD_CUSTOM_COMMAND(
# Build bf_rna
SET(SRC rna_access.c ${GENSRC})
BLENDERLIB(bf_rna "${SRC}" "${INC}")
-
-MESSAGE(STATUS "Configuring makesrna")
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index c29ad0d9adf..599aa4abc91 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -143,7 +143,8 @@ static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *pt
static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat);
+ /* dont use compat so we get pradictable rotation */
+ object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE);
rna_Object_internal_update(bmain, scene, ptr);
}
@@ -177,7 +178,8 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
copy_m4_m4(ob->obmat, (float(*)[4])values);
}
- object_apply_mat4(ob, ob->obmat);
+ /* dont use compat so we get pradictable rotation */
+ object_apply_mat4(ob, ob->obmat, FALSE);
}
void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)