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/space_image | |
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/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 4702b01901d..4e410d35df0 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2595,7 +2595,7 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e static void image_new_draw(bContext *UNUSED(C), wmOperator *op) { - uiLayout *split, *col[2]; + uiLayout *col; uiLayout *layout = op->layout; PointerRNA ptr; #if 0 @@ -2607,33 +2607,18 @@ static void image_new_draw(bContext *UNUSED(C), wmOperator *op) /* copy of WM_operator_props_dialog_popup() layout */ - split = uiLayoutSplit(layout, 0.5f, false); - col[0] = uiLayoutColumn(split, false); - col[1] = uiLayoutColumn(split, false); - - uiItemL(col[0], IFACE_("Name"), ICON_NONE); - uiItemR(col[1], &ptr, "name", 0, "", ICON_NONE); - - uiItemL(col[0], IFACE_("Width"), ICON_NONE); - uiItemR(col[1], &ptr, "width", 0, "", ICON_NONE); - - uiItemL(col[0], IFACE_("Height"), ICON_NONE); - uiItemR(col[1], &ptr, "height", 0, "", ICON_NONE); - - uiItemL(col[0], IFACE_("Color"), ICON_NONE); - uiItemR(col[1], &ptr, "color", 0, "", ICON_NONE); - - uiItemL(col[0], "", ICON_NONE); - uiItemR(col[1], &ptr, "alpha", 0, NULL, ICON_NONE); - - uiItemL(col[0], IFACE_("Generated Type"), ICON_NONE); - uiItemR(col[1], &ptr, "generated_type", 0, "", ICON_NONE); - - uiItemL(col[0], "", ICON_NONE); - uiItemR(col[1], &ptr, "float", 0, NULL, ICON_NONE); - - uiItemL(col[0], "", ICON_NONE); - uiItemR(col[1], &ptr, "tiled", 0, NULL, ICON_NONE); + uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "name", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "width", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "height", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "color", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "alpha", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "generated_type", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "float", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "tiled", 0, NULL, ICON_NONE); #if 0 if (is_multiview) { |