[Bf-blender-cvs] [aed38c2207e] modifier-panels-ui: Initial update to Bevel modifier layout
William Reynish
noreply at git.blender.org
Sun Apr 5 20:26:49 CEST 2020
Commit: aed38c2207ebb081be1b473b7b44023eff253211
Author: William Reynish
Date: Sun Apr 5 20:26:02 2020 +0200
Branches: modifier-panels-ui
https://developer.blender.org/rBaed38c2207ebb081be1b473b7b44023eff253211
Initial update to Bevel modifier layout
===================================================================
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_bevel.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index bb264db3a66..455d158fc8a 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3837,6 +3837,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem prop_affect_items[] = {
+ {0, "EDGES", 0, "Edges", "Affect only edges"},
+ {MOD_BEVEL_VERT, "VERTICES", 0, "Vertices", "Affect only vertices"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
RNA_def_struct_ui_text(
srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
@@ -3863,9 +3869,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments");
- prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
- RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
+ prop = RNA_def_property(srna, "affect", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, prop_affect_items);
+ RNA_def_property_ui_text(prop, "Affect", "Affect edges or vertices");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
@@ -3913,7 +3920,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "mat");
RNA_def_property_range(prop, -1, SHRT_MAX);
RNA_def_property_ui_text(
- prop, "Material", "Material index of generated faces, -1 for automatic");
+ prop, "Material Index Offset", "Material index of generated faces, -1 for automatic");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index b3f415db9e4..cd97414698a 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -287,7 +287,11 @@ static void panel_draw(const bContext *C, Panel *panel)
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
- col = uiLayoutColumn(layout, true);
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "affect", 0, NULL, ICON_NONE);
+
+ col = uiLayoutColumn(layout, false);
const char *offset_name = "";
if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) {
uiItemR(col, &ptr, "width_pct", 0, NULL, ICON_NONE);
@@ -306,15 +310,19 @@ static void panel_draw(const bContext *C, Panel *panel)
}
uiItemR(col, &ptr, "width", 0, IFACE_(offset_name), ICON_NONE);
}
- row = uiLayoutRow(col, true);
- uiItemR(row, &ptr, "offset_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ uiItemR(col, &ptr, "offset_type", 0, NULL, ICON_NONE);
+
+ uiItemS(layout);
+
uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.5f, true);
col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "use_only_vertices", 0, NULL, ICON_NONE);
+
uiItemR(col, &ptr, "use_clamp_overlap", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE);
+
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "mark_seam", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "mark_sharp", 0, NULL, ICON_NONE);
@@ -324,32 +332,20 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, true);
- uiItemL(col, IFACE_("Limit Method:"), ICON_NONE);
- row = uiLayoutRow(col, true);
- uiItemR(row, &ptr, "limit_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "limit_method", 0, NULL, ICON_NONE);
int limit_method = RNA_enum_get(&ptr, "limit_method");
if (limit_method == MOD_BEVEL_ANGLE) {
uiItemR(col, &ptr, "angle_limit", 0, NULL, ICON_NONE);
}
else if (limit_method == MOD_BEVEL_VGROUP) {
row = uiLayoutRow(col, true);
- uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
- uiLayoutSetPropSep(sub, false);
+ uiLayoutSetPropDecorate(sub, false);
uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
}
- col = uiLayoutColumn(layout, true);
- uiItemL(col, IFACE_("Face Strength Mode:"), ICON_NONE);
- row = uiLayoutRow(col, true);
- uiItemR(row, &ptr, "face_strength_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
- col = uiLayoutColumn(layout, true);
- uiItemL(col, IFACE_("Intersection Type:"), ICON_NONE);
- row = uiLayoutRow(col, true);
- uiItemR(row, &ptr, "vmesh_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
modifier_panel_end(layout, &ptr);
}
@@ -359,7 +355,8 @@ static void miter_panel_draw(const bContext *C, Panel *panel)
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
uiLayout *layout = panel->layout;
- uiItemL(layout, IFACE_("Miter Type:"), ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
+
uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Outer"), ICON_NONE);
uiItemR(layout, &ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE);
if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) {
@@ -367,6 +364,18 @@ static void miter_panel_draw(const bContext *C, Panel *panel)
}
}
+static void advanced_panel_draw(const bContext *C, Panel *panel)
+{
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+ uiLayout *layout = panel->layout;
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "face_strength_mode", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "vmesh_method", 0, NULL, ICON_NONE);
+}
+
static void custom_profile_panel_draw_header(const bContext *C, Panel *panel)
{
PointerRNA ptr;
@@ -396,6 +405,8 @@ static void panelRegister(ARegionType *region_type)
custom_profile_panel_draw_header,
custom_profile_panel_draw,
panel_type);
+ modifier_subpanel_register(
+ region_type, "bevel_advanced", "Advanced", NULL, advanced_panel_draw, panel_type);
}
ModifierTypeInfo modifierType_Bevel = {
More information about the Bf-blender-cvs
mailing list