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>2011-02-02 03:40:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-02 03:40:55 +0300
commit95df65f1b55d311be4171f71bb106f9c7d193a79 (patch)
tree9ceafdf50ae1afbb903722ae4979d85ad7dd300f /source/blender/editors/object
parent19efa4301a5f2545eddfd4e5e56943d9a1d9f5cf (diff)
- some parts of the code to remove rotation were not removing axis/angle rotation (only functional change of this commit).
- use BLI_math functions for removing rotations from objects and pose channels. - add unit_axis_angle() to avoid setting the Y axis inline anywhere rotation needs removing.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_edit.c6
-rw-r--r--source/blender/editors/object/object_transform.c31
2 files changed, 13 insertions, 24 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 94955e3c815..0acdc8b61fe 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1241,9 +1241,9 @@ void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
else if(event==2) { /* rot */
VECCOPY(base->object->rot, ob->rot);
VECCOPY(base->object->drot, ob->drot);
- /* Quats arnt used yet */
- /*VECCOPY(base->object->quat, ob->quat);
- VECCOPY(base->object->dquat, ob->dquat);*/
+
+ QUATCOPY(base->object->quat, ob->quat);
+ QUATCOPY(base->object->dquat, ob->dquat);
}
else if(event==3) { /* size */
VECCOPY(base->object->size, ob->size);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1af022c3c6e..024e3e8a020 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -165,24 +165,16 @@ static void object_clear_rot(Object *ob)
} // Duplicated in source/blender/editors/armature/editarmature.c
else {
if (ob->rotmode == ROT_MODE_QUAT) {
- ob->quat[1]=ob->quat[2]=ob->quat[3]= 0.0f;
- ob->quat[0]= 1.0f;
-
- ob->dquat[1]=ob->dquat[2]=ob->dquat[3]= 0.0f;
- ob->dquat[0]= 1.0f;
+ unit_qt(ob->quat);
+ unit_qt(ob->dquat);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- /* by default, make rotation of 0 radians around y-axis (roll) */
- ob->rotAxis[0]=ob->rotAxis[2]=ob->rotAngle= 0.0f;
- ob->rotAxis[1]= 1.0f;
-
- ob->drotAxis[0]=ob->drotAxis[2]=ob->drotAngle= 0.0f;
- ob->drotAxis[1]= 1.0f;
+ unit_axis_angle(ob->rotAxis, &ob->rotAngle);
+ unit_axis_angle(ob->drotAxis, &ob->drotAngle);
}
else {
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0f;
-
- ob->drot[0]= ob->drot[1]= ob->drot[2]= 0.0f;
+ zero_v3(ob->rot);
+ zero_v3(ob->drot);
}
}
}
@@ -532,16 +524,13 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
continue;
if(apply_loc)
- ob->loc[0]= ob->loc[1]= ob->loc[2]= 0.0f;
+ zero_v3(ob->loc);
if(apply_scale)
ob->size[0]= ob->size[1]= ob->size[2]= 1.0f;
if(apply_rot) {
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0f;
- ob->quat[1]= ob->quat[2]= ob->quat[3]= 0.0f;
- ob->rotAxis[0]= ob->rotAxis[2]= 0.0f;
- ob->rotAngle= 0.0f;
-
- ob->quat[0]= ob->rotAxis[1]= 1.0f;
+ zero_v3(ob->rot);
+ unit_qt(ob->quat);
+ unit_axis_angle(ob->rotAxis, &ob->rotAngle);
}
where_is_object(scene, ob);