[Bf-blender-cvs] [b7864161061] master: Fix T59151 Bevel modifier has bad input width for percent.

Howard Trickey noreply at git.blender.org
Mon Jan 7 13:34:48 CET 2019


Commit: b786416106136ac5fd0b9ea55a0b0cf0c029243e
Author: Howard Trickey
Date:   Mon Jan 7 07:29:54 2019 -0500
Branches: master
https://developer.blender.org/rBb786416106136ac5fd0b9ea55a0b0cf0c029243e

Fix T59151 Bevel modifier has bad input width for percent.

The units scaling was inappropriate when the bevel value was
to be interpreted as a percent, so added a separate rna property
for "Width Percent" and made UI show the width appropriate for
current offset_type.

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_bevel.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 345b7d27872..8eafc437295 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 345b7d27872d87ae5074a83d8b9995b37bc56f1b
+Subproject commit 8eafc437295b0edc990db231fe957e2ad42af70d
diff --git a/release/scripts/addons b/release/scripts/addons
index 40340832e39..d31844cc0b3 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 40340832e3992f46034b470aef1af6f7a3a4410f
+Subproject commit d31844cc0b3be397b5032cb0c5d8daea39584783
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 52af0512a0c..a6bab561e29 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -136,7 +136,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         split = layout.split()
 
         col = split.column()
-        col.prop(md, "width")
+        if md.offset_type == 'PERCENT':
+            col.prop(md, "width_pct")
+        else:
+            col.prop(md, "width")
         col.prop(md, "segments")
         col.prop(md, "profile")
         col.prop(md, "material")
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 5bc925ea969..2ef4773de20 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3066,7 +3066,14 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "value");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
-	RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
+	RNA_def_property_ui_text(prop, "Width", "Bevel amount");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "width_pct", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_float_sdna(prop, NULL, "value");
+	RNA_def_property_range(prop, 0, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 5.0, 2);
+	RNA_def_property_ui_text(prop, "Width Percent", "Bevel amount for percentage method");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 363cdb083d4..6eee697a739 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -112,6 +112,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 	const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
 	const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
 	const int offset_type = bmd->val_flags;
+	const float value = bmd->value;
 	const int mat = CLAMPIS(bmd->mat, -1, ctx->object->totcol - 1);
 	const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0;
 	const bool mark_seam = (bmd->edge_flags & MOD_BEVEL_MARK_SEAM);
@@ -192,7 +193,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 		harden_normals = false;
 	}
 
-	BM_mesh_bevel(bm, bmd->value, offset_type, bmd->res, bmd->profile,
+	BM_mesh_bevel(bm, value, offset_type, bmd->res, bmd->profile,
 	              vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp,
 	              dvert, vgroup, mat, loop_slide, mark_seam, mark_sharp,
 	              harden_normals, face_strength_mode, mesh->smoothresh);



More information about the Bf-blender-cvs mailing list