diff options
author | Hans Goudey <h.goudey@me.com> | 2020-07-21 18:13:18 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-07-21 18:13:18 +0300 |
commit | 17ebbdf1c17dab4872d2b3deea77a35524fe14b9 (patch) | |
tree | f703a92b048f254e808c20ef78e9de09f1373c21 /source/blender/editors/mesh/editmesh_tools.c | |
parent | c2b0c64843084b6e4189d289fd2d201257fd9448 (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/editmesh_tools.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 28 |
1 files changed, 18 insertions, 10 deletions
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); } |