[Bf-blender-cvs] [cadf77d] master: Fix T40862: numinput transform did not take into account scale_length.

Bastien Montagne noreply at git.blender.org
Mon Jun 30 10:58:29 CEST 2014


Commit: cadf77d5ef97935885802d1841184d9a044d2249
Author: Bastien Montagne
Date:   Mon Jun 30 10:57:39 2014 +0200
https://developer.blender.org/rBcadf77d5ef97935885802d1841184d9a044d2249

Fix T40862: numinput transform did not take into account scale_length.

===================================================================

M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/include/ED_numinput.h
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/editors/mesh/editmesh_inset.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/util/numinput.c

===================================================================

diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index e0592e5..e519fc8 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -846,7 +846,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
 			applyNumInput(&mm->num, &value);
 
 			if (hasNumInput(&mm->num)) {
-				outputNumInput(&mm->num, str_tx);
+				outputNumInput(&mm->num, str_tx, scene->unit.scale_length);
 			}
 			else {
 				BLI_snprintf(str_tx, sizeof(str_tx), "%d", (int)value);
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index e7b52a4..4e96ed0 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -76,7 +76,7 @@ enum {
  */
 
 void initNumInput(NumInput *n);
-void outputNumInput(NumInput *n, char *str);
+void outputNumInput(NumInput *n, char *str, const float scale_length);
 bool hasNumInput(const NumInput *n);
 bool applyNumInput(NumInput *n, float *vec);
 bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event);
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index ec1ea3e..e25919b 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -79,13 +79,14 @@ static void edbm_bevel_update_header(wmOperator *op, bContext *C)
 
 	char msg[HEADER_LENGTH];
 	ScrArea *sa = CTX_wm_area(C);
+	Scene *sce = CTX_data_scene(C);
 
 	if (sa) {
 		BevelData *opdata = op->customdata;
 		char offset_str[NUM_STR_REP_LEN];
 
 		if (hasNumInput(&opdata->num_input)) {
-			outputNumInput(&opdata->num_input, offset_str);
+			outputNumInput(&opdata->num_input, offset_str, sce->unit.scale_length);
 		}
 		else {
 			BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index aa3a2c8..dc40330 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -85,11 +85,12 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
 
 	char msg[HEADER_LENGTH];
 	ScrArea *sa = CTX_wm_area(C);
+	Scene *sce = CTX_data_scene(C);
 
 	if (sa) {
 		char flts_str[NUM_STR_REP_LEN * 2];
 		if (hasNumInput(&opdata->num_input))
-			outputNumInput(&opdata->num_input, flts_str);
+			outputNumInput(&opdata->num_input, flts_str, sce->unit.scale_length);
 		else {
 			BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness"));
 			BLI_snprintf(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth"));
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 4ef6c13..bb044f3 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -696,10 +696,11 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
 	}
 
 	if (show_cuts) {
+		Scene *sce = CTX_data_scene(C);
 		char buf[64 + NUM_STR_REP_LEN * 2];
 		char str_rep[NUM_STR_REP_LEN * 2];
 		if (hasNumInput(&lcd->num)) {
-			outputNumInput(&lcd->num, str_rep);
+			outputNumInput(&lcd->num, str_rep, sce->unit.scale_length);
 		}
 		else {
 			BLI_snprintf(str_rep, NUM_STR_REP_LEN, "%d", cuts);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 33d52ec..32ba4ba 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2841,7 +2841,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bend Angle: %s Radius: %s Alt, Clamp %s"),
 		             &c[0], &c[NUM_STR_REP_LEN],
@@ -3009,7 +3009,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shear: %s %s"), c, t->proptext);
 	}
@@ -3108,7 +3108,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);
+		outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
 	}
 	else {
 		BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -3520,7 +3520,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("To Sphere: %s %s"), c, t->proptext);
 	}
@@ -3877,7 +3877,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		
 		ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
 	}
@@ -3981,7 +3981,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Trackball: %s %s %s"),
 		                    &c[0], &c[NUM_STR_REP_LEN], t->proptext);
@@ -4083,7 +4083,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN]
 	float dist;
 
 	if (hasNumInput(&t->num)) {
-		outputNumInput(&(t->num), tvec);
+		outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
 		dist = len_v3(t->num.val);
 	}
 	else {
@@ -4331,7 +4331,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, " %s", c);
 	}
 	else {
@@ -4426,7 +4426,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
 
@@ -4502,7 +4502,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shrink/Fatten: %s"), c);
 	}
 	else {
@@ -4578,7 +4578,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Feather Shrink/Fatten: %s"), c);
 	}
 	else {
@@ -4671,7 +4671,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
 	}
@@ -4764,7 +4764,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		if (weight >= 0.0f)
 			BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
@@ -4842,7 +4842,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		if (crease >= 0.0f)
 			BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Crease: +%s %s"), c, t->proptext);
@@ -4912,7 +4912,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);
+		outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
 	}
 	else {
 		BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -5049,7 +5049,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Envelope: %s"), c);
 	}
 	else {
@@ -6224,7 +6224,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 
 		if (is_proportional) {
 			BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Edge Slide: %s (E)ven: %s"),
@@ -6747,7 +6747,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);
+		outputNumInput(&(t->num), c, t->scene->unit.scale_length);
 		ofs += BLI_strncpy_rlen(str + ofs, &c[0], MAX_INFO_LEN - ofs);
 	}
 	else {
@@ -6814,7 +6814,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);


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list