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:
authorHans Goudey <h.goudey@me.com>2020-06-23 05:25:55 +0300
committerHans Goudey <h.goudey@me.com>2020-06-23 05:25:55 +0300
commit6703c7f7f1f68ae59f9ccbf4fcabc3c035d648bf (patch)
treebf5def93b54ba810bbaef693ecc79d81e97e635b /source/blender/makesrna/intern/rna_modifier.c
parent716a8241d387180fd8ad69cdec33633bc7a0f963 (diff)
Bevel: Refactor profile type input to use an enum
This will allow the easier addition of a constant radius mode in the future and some changes in the UI to mirror the recent similar change from "Only Vertices" to the "Affect" enum.
Diffstat (limited to 'source/blender/makesrna/intern/rna_modifier.c')
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 9718357420a..c468de99034 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1163,7 +1163,7 @@ static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
static void rna_BevelModifier_update_segments(Main *bmain, Scene *scene, PointerRNA *ptr)
{
BevelModifierData *bmd = (BevelModifierData *)ptr->data;
- if (RNA_boolean_get(ptr, "use_custom_profile")) {
+ if (RNA_enum_get(ptr, "profile_type") == MOD_BEVEL_PROFILE_CUSTOM) {
short segments = (short)RNA_int_get(ptr, "segments");
BKE_curveprofile_initialize(bmd->custom_profile, segments);
}
@@ -3956,6 +3956,20 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem prop_profile_type_items[] = {
+ {MOD_BEVEL_PROFILE_SUPERELLIPSE,
+ "SUPERELLIPSE",
+ 0,
+ "Superellipse",
+ "The profile can be a concave or convex curve"},
+ {MOD_BEVEL_PROFILE_CUSTOM,
+ "CUSTOM",
+ 0,
+ "Custom",
+ "The profile can be any arbitrary path between its endpoints"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
static EnumPropertyItem prop_harden_normals_items[] = {
{MOD_BEVEL_FACE_STRENGTH_NONE, "FSTR_NONE", 0, "None", "Do not set face strength"},
{MOD_BEVEL_FACE_STRENGTH_NEW, "FSTR_NEW", 0, "New", "Set face strength on new faces only"},
@@ -4066,6 +4080,13 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Width Type", "What distance Width measures");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "profile_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "profile_type");
+ RNA_def_property_enum_items(prop, prop_profile_type_items);
+ RNA_def_property_ui_text(
+ prop, "Profile Type", "The type of shape used to rebuild a beveled section");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 2);
@@ -4125,12 +4146,6 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Spread", "Spread distance for inner miter arcs");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "use_custom_profile", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_CUSTOM_PROFILE);
- RNA_def_property_ui_text(
- prop, "Custom Profile", "Whether to use a user inputted curve for the bevel's profile");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
prop = RNA_def_property(srna, "custom_profile", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "CurveProfile");
RNA_def_property_pointer_sdna(prop, NULL, "custom_profile");