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>2014-08-26 14:04:24 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-26 14:31:08 +0400
commit0e3fa0b7618fa86e97c5f46ae7208c082fd26eb7 (patch)
tree447fcae65fe6bf4086a79e03a82abb7a4138897b /source/blender/editors/transform
parent600248783b50ddef9b809b0d4c7abd9a9b20fda3 (diff)
Fix T41590: When scene scale is not 1.0, and units are "None," Blender assumes translations are in meters.
Turned out there were several issues in handling of scale parameter by numinput. Fixed that by factorizing more some code in common with 'usual' numbuttons eval code (new `bUnit_getScaleUnit()` helper will return valid scaled value, depending on given system and type). Now, numinput behaves as expected - using default unit amended by scale in case no unit is given (i.e. entering '20' with a scale of 0.01 will give you 20cm, and '20cm' as well!).
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 58dee620a61..a85801a621b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2872,7 +2872,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bend Angle: %s Radius: %s Alt, Clamp %s"),
&c[0], &c[NUM_STR_REP_LEN],
@@ -3040,7 +3040,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shear: %s %s"), c, t->proptext);
}
@@ -3141,7 +3141,7 @@ static void headerResize(TransInfo *t, float vec[3], char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
size_t ofs = 0;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -3555,7 +3555,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("To Sphere: %s %s"), c, t->proptext);
}
@@ -3919,7 +3919,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
}
@@ -4023,7 +4023,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Trackball: %s %s %s"),
&c[0], &c[NUM_STR_REP_LEN], t->proptext);
@@ -4125,7 +4125,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN]
float dist;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
dist = len_v3(t->num.val);
}
else {
@@ -4373,7 +4373,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Shrink/Fatten:"), MAX_INFO_LEN - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, " %s", c);
}
else {
@@ -4468,7 +4468,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
@@ -4546,7 +4546,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shrink/Fatten: %s"), c);
}
else {
@@ -4624,7 +4624,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Feather Shrink/Fatten: %s"), c);
}
else {
@@ -4717,7 +4717,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
}
@@ -4810,7 +4810,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
if (weight >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
@@ -4888,7 +4888,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
if (crease >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Crease: +%s %s"), c, t->proptext);
@@ -4958,7 +4958,7 @@ static void headerBoneSize(TransInfo *t, float vec[3], char str[MAX_INFO_LEN])
{
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -5095,7 +5095,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Envelope: %s"), c);
}
else {
@@ -6270,7 +6270,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
if (is_proportional) {
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Edge Slide: %s (E)ven: %s"),
@@ -6793,7 +6793,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Vert Slide: "), MAX_INFO_LEN - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
ofs += BLI_strncpy_rlen(str + ofs, &c[0], MAX_INFO_LEN - ofs);
}
else {
@@ -6860,7 +6860,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Roll: %s"), &c[0]);
}
@@ -6934,7 +6934,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), c, &t->scene->unit);
if (time >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Time: +%s %s"), c, t->proptext);
@@ -7145,7 +7145,7 @@ static void headerSeqSlide(TransInfo *t, float val[2], char str[MAX_INFO_LEN])
size_t ofs = 0;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.0f, %.0f", val[0], val[1]);
@@ -7371,7 +7371,7 @@ static void headerTimeTranslate(TransInfo *t, char str[MAX_INFO_LEN])
/* if numeric input is active, use results from that, otherwise apply snapping to result */
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
const Scene *scene = t->scene;
@@ -7535,7 +7535,7 @@ static void headerTimeSlide(TransInfo *t, float sval, char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
float minx = *((float *)(t->customData));
@@ -7683,7 +7683,7 @@ static void headerTimeScale(TransInfo *t, char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num))
- outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
+ outputNumInput(&(t->num), tvec, &t->scene->unit);
else
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values[0]);