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:
authorJoshua Leung <aligorith@gmail.com>2007-10-02 14:45:22 +0400
committerJoshua Leung <aligorith@gmail.com>2007-10-02 14:45:22 +0400
commitd5fe701370cb431f97ad40eeaf387bb226619670 (patch)
treecbf9775c7f32b1f6423da447c1a564c8b5e7828d /source/blender
parent565570058f00e4457bdcda9a5d7e89294c90b17d (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')
-rw-r--r--source/blender/src/header_view3d.c12
-rw-r--r--source/blender/src/transform.c36
2 files changed, 40 insertions, 8 deletions
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index add58a2a2ef..a5d462d3724 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -3703,12 +3703,17 @@ static void do_view3d_edit_armaturemenu(void *arg, int event)
case 13: /* flip left and right names */
armature_flip_names();
break;
- break;
case 15: /* subdivide multi */
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
waitcursor(1);
subdivide_armature(numcuts);
+ break;
+ case 16: /* Alt-S transform (BoneSize) */
+ initTransform(TFM_BONESIZE, CTX_NONE);
+ Transform();
+ break;
}
+
allqueue(REDRAWVIEW3D, 0);
}
@@ -3765,6 +3770,11 @@ static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_armature_rollmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Roll", 0, yco-=20, 120, 19, "");
+ if (arm->drawtype==ARM_ENVELOPE)
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+ else if (arm->drawtype==ARM_B_BONE)
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale B-Bone Width|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
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)