From 06de1bddae65dca06ec44b996372ce6a6e8d70e8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 2 Jul 2020 10:47:02 -0400 Subject: UI: Small Tweaks to Modifier Layouts for Consistency These changes are smaller, made based on feedback and a pass on all the layouts for clarity and consistency. The Multires modifier UI will be addressed in a separate patch. Here is an overview of the changes: Renaming Options: - Build: "Start" -> "Start Frame" - Curve: "From Radius" -> "Size from Radius" - Screw: "Calc Order" -> "Calculate Order" - Displace, Warp, Wave: "Texture Coordinates Object" -> "Object" Move Mode Toggle to Top & Expand: - Bevel, Boolean, Normal Edit, Subdivision Use Columns for Tighter Spacing: - Displace, Explode, Ocean, Particle Instance, Remesh, Shrinkwrap, Solidify, Warp, Weighted Normal, Wave Misc: - Bevel: Set inactive properties for vertex bevel - Mesh Sequence Cache: Remove box for cache file - Skin: Don't align "Mark Loose" and "Clear Loose" - Array: Expand relative offset subpanel by default - Array: Move start cap, end cap to a new subpanel - Bevel: Move width type above width Differential Revision: https://developer.blender.org/D8115 --- source/blender/modifiers/intern/MOD_bevel.c | 129 +++++++++++++++------------- 1 file changed, 71 insertions(+), 58 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_bevel.c') diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 0a1eb8eba10..21bb7f4764a 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -279,51 +279,38 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED static void panel_draw(const bContext *C, Panel *panel) { - uiLayout *col; + uiLayout *col, *sub; uiLayout *layout = panel->layout; PointerRNA ptr; PointerRNA ob_ptr; modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT; + + uiItemR(layout, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiLayoutSetPropSep(layout, true); col = uiLayoutColumn(layout, false); - const char *offset_name = ""; + uiItemR(col, &ptr, "offset_type", 0, NULL, ICON_NONE); if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) { uiItemR(col, &ptr, "width_pct", 0, NULL, ICON_NONE); } else { - switch (RNA_enum_get(&ptr, "offset_type")) { - case BEVEL_AMT_DEPTH: - offset_name = "Depth"; - break; - case BEVEL_AMT_WIDTH: - offset_name = "Width"; - break; - case BEVEL_AMT_OFFSET: - offset_name = "Offset"; - break; - case BEVEL_AMT_ABSOLUTE: - offset_name = "Absolute"; - break; - } - uiItemR(col, &ptr, "width", 0, IFACE_(offset_name), ICON_NONE); + uiItemR(col, &ptr, "width", 0, IFACE_("Amount"), ICON_NONE); } - uiItemR(col, &ptr, "offset_type", 0, NULL, ICON_NONE); uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE); uiItemS(layout); - uiItemR(layout, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - - uiItemS(layout); - col = uiLayoutColumn(layout, false); uiItemR(col, &ptr, "limit_method", 0, NULL, ICON_NONE); int limit_method = RNA_enum_get(&ptr, "limit_method"); - if (limit_method == MOD_BEVEL_ANGLE) { + if (limit_method != MOD_BEVEL_ANGLE) { + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, edge_bevel); uiItemR(col, &ptr, "angle_limit", 0, NULL, ICON_NONE); } else if (limit_method == MOD_BEVEL_VGROUP) { @@ -333,25 +320,78 @@ static void panel_draw(const bContext *C, Panel *panel) modifier_panel_end(layout, &ptr); } +static void profile_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + int profile_type = RNA_enum_get(&ptr, "profile_type"); + int miter_inner = RNA_enum_get(&ptr, "miter_inner"); + int miter_outer = RNA_enum_get(&ptr, "miter_outer"); + bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT; + + uiItemR(layout, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + if (ELEM(profile_type, MOD_BEVEL_PROFILE_SUPERELLIPSE, MOD_BEVEL_PROFILE_CUSTOM)) { + row = uiLayoutRow(layout, false); + uiLayoutSetActive( + row, + profile_type == MOD_BEVEL_PROFILE_SUPERELLIPSE || + (profile_type == MOD_BEVEL_PROFILE_CUSTOM && edge_bevel && + !((miter_inner == MOD_BEVEL_MITER_SHARP) && (miter_outer == MOD_BEVEL_MITER_SHARP)))); + uiItemR(row, + &ptr, + "profile", + UI_ITEM_R_SLIDER, + (profile_type == MOD_BEVEL_PROFILE_SUPERELLIPSE) ? IFACE_("Shape") : + IFACE_("Miter Shape"), + ICON_NONE); + + if (profile_type == MOD_BEVEL_PROFILE_CUSTOM) { + uiLayout *sub = uiLayoutColumn(layout, false); + uiLayoutSetPropDecorate(sub, false); + uiTemplateCurveProfile(sub, &ptr, "custom_profile"); + } + } +} + static void geometry_panel_draw(const bContext *C, Panel *panel) { + uiLayout *row; uiLayout *layout = panel->layout; PointerRNA ptr; modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT; + uiLayoutSetPropSep(layout, true); - uiItemR(layout, &ptr, "miter_inner", 0, IFACE_("Miter Inner"), ICON_NONE); - uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Outer"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, edge_bevel); + uiItemR(row, &ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, edge_bevel); + uiItemR(row, &ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE); if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) { - uiItemR(layout, &ptr, "spread", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, edge_bevel); + uiItemR(row, &ptr, "spread", 0, NULL, ICON_NONE); } uiItemS(layout); - uiItemR(layout, &ptr, "vmesh_method", 0, IFACE_("Intersections"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, edge_bevel); + uiItemR(row, &ptr, "vmesh_method", 0, IFACE_("Intersections"), ICON_NONE); uiItemR(layout, &ptr, "use_clamp_overlap", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "loop_slide", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, edge_bevel); + uiItemR(row, &ptr, "loop_slide", 0, NULL, ICON_NONE); } static void shading_panel_draw(const bContext *C, Panel *panel) @@ -362,11 +402,14 @@ static void shading_panel_draw(const bContext *C, Panel *panel) PointerRNA ptr; modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT; + uiLayoutSetPropSep(layout, true); uiItemR(layout, &ptr, "harden_normals", 0, NULL, ICON_NONE); col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark")); + uiLayoutSetActive(col, edge_bevel); uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seam"), ICON_NONE); uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE); @@ -374,36 +417,6 @@ static void shading_panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "face_strength_mode", 0, NULL, ICON_NONE); } -static void profile_panel_draw(const bContext *C, Panel *panel) -{ - uiLayout *layout = panel->layout; - - PointerRNA ptr; - modifier_panel_get_property_pointers(C, panel, NULL, &ptr); - - int profile_type = RNA_enum_get(&ptr, "profile_type"); - - uiItemR(layout, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - - uiLayoutSetPropSep(layout, true); - - if (ELEM(profile_type, MOD_BEVEL_PROFILE_SUPERELLIPSE, MOD_BEVEL_PROFILE_CUSTOM)) { - uiItemR(layout, - &ptr, - "profile", - UI_ITEM_R_SLIDER, - (profile_type == MOD_BEVEL_PROFILE_SUPERELLIPSE) ? IFACE_("Shape") : - IFACE_("Miter Shape"), - ICON_NONE); - - if (profile_type == MOD_BEVEL_PROFILE_CUSTOM) { - uiLayout *sub = uiLayoutColumn(layout, false); - uiLayoutSetPropDecorate(sub, false); - uiTemplateCurveProfile(sub, &ptr, "custom_profile"); - } - } -} - static void panelRegister(ARegionType *region_type) { PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Bevel, panel_draw); -- cgit v1.2.3