diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-10-02 14:45:22 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-10-02 14:45:22 +0400 |
commit | d5fe701370cb431f97ad40eeaf387bb226619670 (patch) | |
tree | cbf9775c7f32b1f6423da447c1a564c8b5e7828d /source/blender/src/transform.c | |
parent | 565570058f00e4457bdcda9a5d7e89294c90b17d (diff) |
== Bone Size Transform Tool ==
Fixed a few bugs with the Alt-S transform tool when the armature drawtype is set to B-Bone:
* Transform constraints seem to have been turned off for this sometime in the past few weeks. Re-enabled this.
* Numeric input for this tool was not working correctly. You could only set the value of the x-axis width only. Also, giblish was being displayed for the other channels
* The char array used in the BoneSize function was smaller than the one used in the headerBoneSize (new function added for this transform mode instead of reusing some old one).
Also, I've added some menu entries for both Alt-S tools in editmode, which did not exist in the past. How were the users supposed to figure this out???
Diffstat (limited to 'source/blender/src/transform.c')
-rw-r--r-- | source/blender/src/transform.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 1dbb4553720..a2317ba61bb 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -2875,14 +2875,13 @@ void initBoneSize(TransInfo *t) t->mode = TFM_BONESIZE; t->transform = BoneSize; - t->idx_max = 0; - t->num.idx_max = 0; + t->idx_max = 2; + t->num.idx_max = 2; + t->num.flag |= NUM_NULL_ONE; t->snap[0] = 0.0f; t->snap[1] = 0.1f; t->snap[2] = t->snap[1] * 0.1f; - - t->flag |= T_NO_CONSTRAINT; - + t->fac = (float)sqrt( ( ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1])) + @@ -2892,6 +2891,29 @@ void initBoneSize(TransInfo *t) if(t->fac==0.0f) t->fac= 1.0f; // prevent Inf } +static void headerBoneSize(TransInfo *t, float vec[3], char *str) { + char tvec[60]; + if (hasNumInput(&t->num)) { + outputNumInput(&(t->num), tvec); + } + else { + sprintf(&tvec[0], "%.4f", vec[0]); + sprintf(&tvec[20], "%.4f", vec[1]); + sprintf(&tvec[40], "%.4f", vec[2]); + } + + /* hmm... perhaps the y-axis values don't need to be shown? */ + if (t->con.mode & CON_APPLY) { + if (t->num.idx_max == 0) + sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext); + else + sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + } + else { + sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + } +} + static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3]) { float tmat[3][3], smat[3][3], oldy; @@ -2918,7 +2940,7 @@ int BoneSize(TransInfo *t, short mval[2]) float size[3], mat[3][3]; float ratio; int i; - char str[50]; + char str[60]; /* for manipulator, center handle, the scaling can't be done relative to center */ if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) { @@ -2966,7 +2988,7 @@ int BoneSize(TransInfo *t, short mval[2]) Mat3CpyMat3(t->mat, mat); // used in manipulator - headerResize(t, size, str); + headerBoneSize(t, size, str); for(i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) |