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-02-26 11:47:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-26 11:47:20 +0300
commit2cf6141e7ca40daeaae845246ffa22258eefc579 (patch)
treed039e8f71e3f0e14328f55eaaa2c5da4865dec3a /source/blender/blenkernel
parentcf4ba30f79991e9804a6fb2b8c746b50e5cf1878 (diff)
fix for fly mode restoring non-euler rotations
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_object.h3
-rw-r--r--source/blender/blenkernel/intern/object.c60
2 files changed, 62 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 5443a5b4513..a6a641a3219 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -116,6 +116,9 @@ int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, flo
void solve_tracking (struct Object *ob, float targetmat[][4]);
int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
+void *object_tfm_backup(struct Object *ob);
+void object_tfm_restore(struct Object *ob, void *obtfm_pt);
+
void object_handle_update(struct Scene *scene, struct Object *ob);
float give_timeoffset(struct Object *ob);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 1c0f9390496..46c26524f47 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2393,7 +2393,6 @@ int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max)
float vec[3];
mul_v3_m4v3(vec, dob->mat, bb->vec[i]);
DO_MINMAX(vec, min, max);
- // print_v3(dob->ob->id.name, vec); // some dupligroups give odd results - campbell
}
ok= 1;
@@ -2406,6 +2405,65 @@ int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max)
return ok;
}
+/* copied from DNA_object_types.h */
+typedef struct ObTfmBack {
+ float loc[3], dloc[3], orig[3];
+ float size[3], dsize[3]; /* scale and delta scale */
+ float rot[3], drot[3]; /* euler rotation */
+ float quat[4], dquat[4]; /* quaternion rotation */
+ float rotAxis[3], drotAxis[3]; /* axis angle rotation - axis part */
+ float rotAngle, drotAngle; /* axis angle rotation - angle part */
+ float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */
+ float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
+ float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
+ float imat[4][4]; /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform */
+} ObTfmBack;
+
+void *object_tfm_backup(Object *ob)
+{
+ ObTfmBack *obtfm= MEM_mallocN(sizeof(ObTfmBack), "ObTfmBack");
+ copy_v3_v3(obtfm->loc, ob->loc);
+ copy_v3_v3(obtfm->dloc, ob->dloc);
+ copy_v3_v3(obtfm->orig, ob->orig);
+ copy_v3_v3(obtfm->size, ob->size);
+ copy_v3_v3(obtfm->dsize, ob->dsize);
+ copy_v3_v3(obtfm->rot, ob->rot);
+ copy_v3_v3(obtfm->drot, ob->drot);
+ copy_qt_qt(obtfm->quat, ob->quat);
+ copy_qt_qt(obtfm->dquat, ob->dquat);
+ copy_v3_v3(obtfm->rotAxis, ob->rotAxis);
+ copy_v3_v3(obtfm->drotAxis, ob->drotAxis);
+ obtfm->rotAngle= ob->rotAngle;
+ obtfm->drotAngle= ob->drotAngle;
+ copy_m4_m4(obtfm->obmat, ob->obmat);
+ copy_m4_m4(obtfm->parentinv, ob->parentinv);
+ copy_m4_m4(obtfm->constinv, ob->constinv);
+ copy_m4_m4(obtfm->imat, ob->imat);
+
+ return (void *)obtfm;
+}
+
+void object_tfm_restore(Object *ob, void *obtfm_pt)
+{
+ ObTfmBack *obtfm= (ObTfmBack *)obtfm_pt;
+ copy_v3_v3(ob->loc, obtfm->loc);
+ copy_v3_v3(ob->dloc, obtfm->dloc);
+ copy_v3_v3(ob->orig, obtfm->orig);
+ copy_v3_v3(ob->size, obtfm->size);
+ copy_v3_v3(ob->dsize, obtfm->dsize);
+ copy_v3_v3(ob->rot, obtfm->rot);
+ copy_v3_v3(ob->drot, obtfm->drot);
+ copy_qt_qt(ob->quat, obtfm->quat);
+ copy_qt_qt(ob->dquat, obtfm->dquat);
+ copy_v3_v3(ob->rotAxis, obtfm->rotAxis);
+ copy_v3_v3(ob->drotAxis, obtfm->drotAxis);
+ ob->rotAngle= obtfm->rotAngle;
+ ob->drotAngle= obtfm->drotAngle;
+ copy_m4_m4(ob->obmat, obtfm->obmat);
+ copy_m4_m4(ob->parentinv, obtfm->parentinv);
+ copy_m4_m4(ob->constinv, obtfm->constinv);
+ copy_m4_m4(ob->imat, obtfm->imat);
+}
/* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */
/* local_object->proxy == pointer to library object, saved in files and read */