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>2007-09-03 02:53:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-03 02:53:59 +0400
commit04a2eb2e4e95c1d87c384e69f4c3ed3a6b3552f3 (patch)
tree1312fdd3394cbac2b39b290fdd2840b0ff74b7de /source/blender/src
parentb1c30dff885aa31417ec0389c479570ad0394967 (diff)
adding 2 new functions
Mat3ToScalef and Mat4ToScalef These return a floating point scale value which is the average of the 3 axies. Use this to adjust curve radius when applying scale/rot
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/editarmature.c28
-rw-r--r--source/blender/src/editobject.c3
2 files changed, 10 insertions, 21 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 7ff6e4039a5..a5b94faf9ae 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -346,16 +346,11 @@ void apply_rot_armature (Object *ob, float mat[3][3])
ListBase list;
EditBone *ebone;
bArmature *arm;
- float scale; /* store the scale of the matrix here to use on envelopes */
+ float scale = Mat3ToScalef(mat); /* store the scale of the matrix here to use on envelopes */
arm = get_armature(ob);
- if (!arm) {
- return;
- } else {
- float tmp[3] = {1.0, 1.0, 1.0};
- Mat3MulVecfl(mat, tmp);
- scale = (fabs(tmp[0]) + fabs(tmp[1]) + fabs(tmp[2])) / 3.0f;
- }
+ if (!arm)
+ return;
/* Put the armature into editmode */
list.first= list.last = NULL;
@@ -2653,22 +2648,13 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
}
/* compute the weights based on gathered vertices and bones */
- if (heat) {
+ if (heat)
heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
root, tip, selected);
- } else {
- float scale;
- float tmp[3] = {1.0, 1.0, 1.0};
- float mat[3][3];
-
- /* scale value from matrix, wont account for non uniform scale but ok */
- Mat3CpyMat4(mat, par->obmat);
- Mat3MulVecfl(mat, tmp);
- scale = (fabs(tmp[0]) + fabs(tmp[1]) + fabs(tmp[2])) / 3.0f;
-
+ else
envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist,
- dgroupflip, root, tip, selected, scale);
- }
+ dgroupflip, root, tip, selected, Mat4ToScalef(par->obmat));
+
/* free the memory allocated */
MEM_freeN(bonelist);
MEM_freeN(dgrouplist);
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 757ca322bdd..42cec673219 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -3728,7 +3728,9 @@ void apply_object()
where_is_object(ob);
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
+ float scale;
object_to_mat3(ob, mat);
+ scale = Mat3ToScalef(mat);
cu= ob->data;
if(cu->id.us>1) {
@@ -3749,6 +3751,7 @@ void apply_object()
Mat3MulVecfl(mat, bezt->vec[0]);
Mat3MulVecfl(mat, bezt->vec[1]);
Mat3MulVecfl(mat, bezt->vec[2]);
+ bezt->radius *= scale;
bezt++;
}
}