[Bf-blender-cvs] [90bd44f] temp_constraint_volume: Allow disabling the volume exponent internally.

Lukas Tönne noreply at git.blender.org
Thu Jan 15 13:54:05 CET 2015


Commit: 90bd44f2a6f60a6b4963f7755d9c0741e91d6f71
Author: Lukas Tönne
Date:   Fri Jan 9 09:12:00 2015 +0100
Branches: temp_constraint_volume
https://developer.blender.org/rB90bd44f2a6f60a6b4963f7755d9c0741e91d6f71

Allow disabling the volume exponent internally.

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

M	release/scripts/startup/bl_ui/properties_constraint.py
M	source/blender/blenkernel/intern/constraint.c

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

diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py
index 6f8f321..50fdc40 100644
--- a/release/scripts/startup/bl_ui/properties_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_constraint.py
@@ -89,8 +89,10 @@ class ConstraintButtonsPanel():
         col = split.column()
         col.prop(con, "chain_count")
 
-    def volume_settings_template(self, layout, volume):
-        layout.prop(volume, "bulge", text="Volume Variation")
+    def volume_settings_template(self, layout, volume, use_exponent=True):
+        if use_exponent:
+            layout.prop(volume, "bulge", text="Volume Variation")
+
         split = layout.split()
         col = split.column(align=True)
         col.prop(volume, "use_bulge_min", text="Volume Min")
@@ -522,7 +524,7 @@ class ConstraintButtonsPanel():
         row.prop(con, "rest_length", text="Rest Length")
         row.operator("constraint.stretchto_reset", text="Reset")
 
-        self.volume_settings_template(layout, con.volume)
+        self.volume_settings_template(layout, con.volume, use_exponent=True)
 
         row.label(text="Plane:")
         row.prop(con, "keep_axis", expand=True)
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 1c3c3c6..a7f3cc5 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -590,9 +590,10 @@ static void constraint_volume_init(bConstraintVolumeSettings *vol)
 	vol->flag = 0;
 }
 
-static void constraint_volume_eval_scale(float result[3], bConstraintVolumeSettings *vol, float factor)
+static void constraint_volume_eval_scale(float result[3], bConstraintVolumeSettings *vol, float factor,
+                                         bool use_exponent)
 {
-	float bulge = powf(factor, vol->bulge);
+	float bulge = use_exponent ? powf(factor, vol->bulge) : factor;
 	
 	if (bulge > 1.0f) {
 		if (vol->flag & CONSTRAINT_VOLUME_USE_MAX) {
@@ -2767,7 +2768,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 		if (data->orglength == 0)
 			data->orglength = dist;
 
-		constraint_volume_eval_scale(scale, &data->volume, dist / data->orglength);
+		constraint_volume_eval_scale(scale, &data->volume, dist / data->orglength, true);
 		
 		/* Clear the object's rotation and scale */
 		cob->matrix[0][0] = size[0] * scale[0];




More information about the Bf-blender-cvs mailing list