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:
authorBastien Montagne <montagne29@wanadoo.fr>2012-07-14 18:03:36 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-07-14 18:03:36 +0400
commit01c3db149cfcd5cb357d8fc739bbe4beb08b35e7 (patch)
tree40bfc9e2e6a8809ee6e70c526ed32c6ecf6b9e6a /source/blender/editors/transform
parent98520ce4deccb24e5992930694bb4189f6fce0f3 (diff)
Fix [#32086] Missing bevel "hold shift" for better accuracy.
This commit adds "shift" and numtype to both Bevel and Inset mesh operators. It also gets rid of the magicnumber used in NumInput to str operation (currently, 20 chars per element, now defined as NUM_STR_REP_LEN in ED_numinput.h).
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c101
1 files changed, 56 insertions, 45 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index b355e1ee436..e2752f5e828 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2455,7 +2455,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -2584,7 +2584,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -2670,15 +2670,15 @@ void initResize(TransInfo *t)
static void headerResize(TransInfo *t, float vec[3], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
char *spos = str;
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
}
else {
- BLI_snprintf(&tvec[0], 20, "%.4f", vec[0]);
- BLI_snprintf(&tvec[20], 20, "%.4f", vec[1]);
- BLI_snprintf(&tvec[40], 20, "%.4f", vec[2]);
+ BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
+ BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", vec[1]);
+ BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", vec[2]);
}
if (t->con.mode & CON_APPLY) {
@@ -2687,17 +2687,21 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
break;
case 1:
- spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ t->con.text, t->proptext);
break;
case 2:
- spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
}
else {
if (t->flag & T_2D_EDIT)
- spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ t->con.text, t->proptext);
else
- spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
@@ -3043,7 +3047,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -3389,7 +3393,7 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
applySnapping(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -3488,13 +3492,13 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, phi);
if (hasNumInput(&t->num)) {
- char c[40];
+ char c[NUM_STR_REP_LEN * 2];
applyNumInput(&t->num, phi);
outputNumInput(&(t->num), c);
- spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
+ spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[NUM_STR_REP_LEN], t->proptext);
phi[0] = DEG2RADF(phi[0]);
phi[1] = DEG2RADF(phi[1]);
@@ -3573,9 +3577,9 @@ void initTranslation(TransInfo *t)
static void headerTranslation(TransInfo *t, float vec[3], char *str)
{
char *spos = str;
- char tvec[60];
- char distvec[20];
- char autoik[20];
+ char tvec[NUM_STR_REP_LEN * 3];
+ char distvec[NUM_STR_REP_LEN];
+ char autoik[NUM_STR_REP_LEN];
float dist;
if (hasNumInput(&t->num)) {
@@ -3593,12 +3597,13 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0;
for (i = 0; i < 3; i++)
- bUnit_AsString(&tvec[i * 20], 20, dvec[i] * t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
+ bUnit_AsString(&tvec[i * NUM_STR_REP_LEN], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length,
+ 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
}
else {
sprintf(&tvec[0], "%.4f", dvec[0]);
- sprintf(&tvec[20], "%.4f", dvec[1]);
- sprintf(&tvec[40], "%.4f", dvec[2]);
+ sprintf(&tvec[NUM_STR_REP_LEN], "%.4f", dvec[1]);
+ sprintf(&tvec[NUM_STR_REP_LEN * 2], "%.4f", dvec[2]);
}
}
@@ -3626,17 +3631,21 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
break;
case 1:
- spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ distvec, t->con.text, t->proptext, &autoik[0]);
break;
case 2:
- spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text, t->proptext, &autoik[0]);
}
}
else {
if (t->flag & T_2D_EDIT)
- spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
+ spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ distvec, t->con.text, t->proptext);
else
- spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text, t->proptext, &autoik[0]);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
@@ -3794,7 +3803,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -3863,7 +3872,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -3935,7 +3944,7 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Shrink/Fatten: %s", c);
@@ -4003,7 +4012,7 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Shrink/Fatten: %s", c);
@@ -4069,7 +4078,7 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4205,7 +4214,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4272,7 +4281,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4345,7 +4354,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4405,14 +4414,14 @@ void initBoneSize(TransInfo *t)
static void headerBoneSize(TransInfo *t, float vec[3], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
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]);
+ sprintf(&tvec[NUM_STR_REP_LEN], "%.4f", vec[1]);
+ sprintf(&tvec[NUM_STR_REP_LEN * 2], "%.4f", vec[2]);
}
/* hmm... perhaps the y-axis values don't need to be shown? */
@@ -4420,10 +4429,12 @@ static void headerBoneSize(TransInfo *t, float vec[3], char *str)
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);
+ sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
+ 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);
+ sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
+ t->con.text, t->proptext);
}
}
@@ -4536,7 +4547,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Envelope: %s", c);
@@ -5428,7 +5439,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(final, -1.0f, 1.0f);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -5494,7 +5505,7 @@ int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -5566,7 +5577,7 @@ int BakeTime(TransInfo *t, const int mval[2])
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -5759,7 +5770,7 @@ void initSeqSlide(TransInfo *t)
static void headerSeqSlide(TransInfo *t, float val[2], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -6002,7 +6013,7 @@ void initTimeTranslate(TransInfo *t)
static void headerTimeTranslate(TransInfo *t, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
/* if numeric input is active, use results from that, otherwise apply snapping to result */
if (hasNumInput(&t->num)) {
@@ -6157,7 +6168,7 @@ void initTimeSlide(TransInfo *t)
static void headerTimeSlide(TransInfo *t, float sval, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -6299,7 +6310,7 @@ void initTimeScale(TransInfo *t)
static void headerTimeScale(TransInfo *t, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num))
outputNumInput(&(t->num), tvec);