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-07-21 18:13:18 +0300
committerHans Goudey <h.goudey@me.com>2020-07-21 18:13:18 +0300
commit17ebbdf1c17dab4872d2b3deea77a35524fe14b9 (patch)
treef703a92b048f254e808c20ef78e9de09f1373c21 /source/blender/editors/mesh
parentc2b0c64843084b6e4189d289fd2d201257fd9448 (diff)
UI: Use consistent layout for custom operator UI
Operators are one of the last places in Blender to use older UI designs that don't fit in with recent style conventions. This commit updates these custom operator UI callbacks for consistency and clarity. Some of the code is also simplified a lot. Some of the older operator layouts were much more complex (in terms of code) than they needed to be. See the differential revision for a before and after screenshot of each operator. Differential Revision: https://developer.blender.org/D8326
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c62
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c28
2 files changed, 48 insertions, 42 deletions
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 58f8c85d820..4c207e27c30 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -938,36 +938,25 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void edbm_bevel_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
- uiLayout *row, *col, *split;
+ uiLayout *col, *row;
PointerRNA ptr, toolsettings_ptr;
- PropertyRNA *prop;
- const char *offset_name;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
int profile_type = RNA_enum_get(&ptr, "profile_type");
+ int offset_type = RNA_enum_get(&ptr, "offset_type");
+
+ uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropDecorate(layout, false);
- if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) {
+ uiItemR(layout, &ptr, "offset_type", 0, NULL, ICON_NONE);
+
+ if (offset_type == BEVEL_AMT_PERCENT) {
uiItemR(layout, &ptr, "offset_pct", 0, NULL, ICON_NONE);
}
else {
- prop = RNA_struct_find_property(op->ptr, "offset_type");
- RNA_property_enum_name_gettexted(
- C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &offset_name);
- uiItemR(layout, &ptr, "offset", 0, offset_name, ICON_NONE);
+ uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
}
- row = uiLayoutRow(layout, true);
- uiItemR(row, &ptr, "offset_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.5f, true);
- col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "vertex_only", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "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);
- uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE);
if (ELEM(profile_type, BEVEL_PROFILE_SUPERELLIPSE, BEVEL_PROFILE_CUSTOM)) {
@@ -980,23 +969,32 @@ static void edbm_bevel_ui(bContext *C, wmOperator *op)
}
uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE);
- uiItemL(layout, "Miter Type:", ICON_NONE);
- uiItemR(layout, &ptr, "miter_outer", 0, "Outer", ICON_NONE);
- uiItemR(layout, &ptr, "miter_inner", 0, "Inner", ICON_NONE);
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "vertex_only", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "clamp_overlap", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE);
+
+ col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark"));
+ uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE);
+ uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE);
+
+ uiItemS(layout);
+
+ uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE);
+ uiItemR(layout, &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);
}
- uiItemL(layout, "Face Strength Mode:", ICON_NONE);
- row = uiLayoutRow(layout, true);
- uiItemR(row, &ptr, "face_strength_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemS(layout);
+
+ uiItemR(layout, &ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE);
+ uiItemR(layout, &ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE);
- uiItemL(layout, "Intersection Type:", ICON_NONE);
- row = uiLayoutRow(layout, true);
- uiItemR(row, &ptr, "vmesh_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemS(layout);
- uiItemL(layout, "Profile Type:", ICON_NONE);
- row = uiLayoutRow(layout, true);
+ row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
if (profile_type == BEVEL_PROFILE_CUSTOM) {
/* Get an RNA pointer to ToolSettings to give to the curve profile template code. */
@@ -1156,7 +1154,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
-1,
-1,
INT_MAX,
- "Material",
+ "Material Index",
"Material for bevel faces (-1 means use adjacent faces)",
-1,
100);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9d85bd46a3b..c8cf1b4a163 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3677,7 +3677,10 @@ static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op)
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_id_pointer_create((ID *)me->key, &ptr_key);
- uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", "", ICON_SHAPEKEY_DATA);
+ uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropDecorate(layout, false);
+
+ uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA);
uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE);
}
@@ -5587,25 +5590,26 @@ static bool edbm_decimate_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
static void edbm_decimate_ui(bContext *UNUSED(C), wmOperator *op)
{
- uiLayout *layout = op->layout, *box, *row, *col;
+ uiLayout *layout = op->layout, *row, *col, *sub;
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+ uiLayoutSetPropSep(layout, true);
+
uiItemR(layout, &ptr, "ratio", 0, NULL, ICON_NONE);
- box = uiLayoutBox(layout);
- uiItemR(box, &ptr, "use_vertex_group", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(box, false);
+ uiItemR(layout, &ptr, "use_vertex_group", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_vertex_group"));
uiItemR(col, &ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "invert_vertex_group", 0, NULL, ICON_NONE);
- box = uiLayoutBox(layout);
- uiItemR(box, &ptr, "use_symmetry", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, true);
- uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_symmetry"));
- uiItemR(row, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry"));
+ uiItemR(row, &ptr, "use_symmetry", 0, "", ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry"));
+ uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
void MESH_OT_decimate(wmOperatorType *ot)
@@ -8403,6 +8407,8 @@ static void edbm_point_normals_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+ uiLayoutSetPropSep(layout, true);
+
/* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, point_normals_draw_check_prop, NULL, NULL, '\0', false);
}
@@ -8875,6 +8881,8 @@ static void edbm_average_normals_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+ uiLayoutSetPropSep(layout, true);
+
/* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, average_normals_draw_check_prop, NULL, NULL, '\0', false);
}