[Bf-blender-cvs] [c918f24] master: Tweaks to bevel and crease transform

Sergey Sharybin noreply at git.blender.org
Tue Jun 3 18:05:55 CEST 2014


Commit: c918f24edb5df8cc837b77363c4d928f8bfa9159
Author: Sergey Sharybin
Date:   Tue Jun 3 22:02:02 2014 +0600
https://developer.blender.org/rBc918f24edb5df8cc837b77363c4d928f8bfa9159

Tweaks to bevel and crease transform

They were using INPUT_SPRING in a way which didn't allow
it to easily redo the operator because INPUT_SPRING internally
is stored as a ration between old value and new one and crease
and bevel were converting this to value delta.

Now made it special input type INPUT_SPRING_DELTA which is
storing delta of the spring, meaning now values in the redo
panel kind of makes sense -- they mean how much to add/remove
to the crease/bevel weight.

Expect to be no functional changes from interactive transform
POV, just a bit more convenient to use redo panel.

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

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_input.c

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 34e76ce..899f119 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4730,7 +4730,7 @@ static void initBevelWeight(TransInfo *t)
 	t->mode = TFM_BWEIGHT;
 	t->transform = applyBevelWeight;
 
-	initMouseInputMode(t, &t->mouse, INPUT_SPRING);
+	initMouseInputMode(t, &t->mouse, INPUT_SPRING_DELTA);
 
 	t->idx_max = 0;
 	t->num.idx_max = 0;
@@ -4754,7 +4754,6 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
 
 	weight = t->values[0];
 
-	weight -= 1.0f;
 	if (weight > 1.0f) weight = 1.0f;
 
 	snapGridIncrement(t, &weight);
@@ -4809,7 +4808,7 @@ static void initCrease(TransInfo *t)
 	t->mode = TFM_CREASE;
 	t->transform = applyCrease;
 
-	initMouseInputMode(t, &t->mouse, INPUT_SPRING);
+	initMouseInputMode(t, &t->mouse, INPUT_SPRING_DELTA);
 
 	t->idx_max = 0;
 	t->num.idx_max = 0;
@@ -4833,7 +4832,6 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
 
 	crease = t->values[0];
 
-	crease -= 1.0f;
 	if (crease > 1.0f) crease = 1.0f;
 
 	snapGridIncrement(t, &crease);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index f34d205..ae7e21f 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -600,6 +600,7 @@ typedef enum {
 	INPUT_VECTOR,
 	INPUT_SPRING,
 	INPUT_SPRING_FLIP,
+	INPUT_SPRING_DELTA,
 	INPUT_ANGLE,
 	INPUT_ANGLE_SPRING,
 	INPUT_TRACKBALL,
@@ -608,7 +609,7 @@ typedef enum {
 	INPUT_VERTICAL_RATIO,
 	INPUT_VERTICAL_ABSOLUTE,
 	INPUT_CUSTOM_RATIO,
-	INPUT_CUSTOM_RATIO_FLIP
+	INPUT_CUSTOM_RATIO_FLIP,
 } MouseInputMode;
 
 void initMouseInput(TransInfo *t, MouseInput *mi, const float center[2], const int mval[2]);
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 70b5658..6546a05 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -94,6 +94,12 @@ static void InputSpringFlip(TransInfo *t, MouseInput *mi, const int mval[2], flo
 	}
 }
 
+static void InputSpringDelta(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
+{
+	InputSpring(t, mi, mval, output);
+	output[0] -= 1.0f;
+}
+
 static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
 {
 
@@ -333,6 +339,11 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
 			mi->apply = InputSpringFlip;
 			t->helpline = HLP_SPRING;
 			break;
+		case INPUT_SPRING_DELTA:
+			calcSpringFactor(mi);
+			mi->apply = InputSpringDelta;
+			t->helpline = HLP_SPRING;
+			break;
 		case INPUT_ANGLE:
 			mi->data = MEM_callocN(sizeof(double), "angle accumulator");
 			mi->apply = InputAngle;




More information about the Bf-blender-cvs mailing list