[Bf-blender-cvs] [9bcdb19a3e0] blender2.8: Fix label misalignment when there are multiple buttons on the right side.
Brecht Van Lommel
noreply at git.blender.org
Sun Oct 28 17:48:42 CET 2018
Commit: 9bcdb19a3e0270a0e8727290111e4a1d6e15a944
Author: Brecht Van Lommel
Date: Thu Oct 25 15:27:31 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9bcdb19a3e0270a0e8727290111e4a1d6e15a944
Fix label misalignment when there are multiple buttons on the right side.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 6cc0e6f46d4..1b5d78f093c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -67,6 +67,7 @@ def draw_vpaint_symmetry(layout, vpaint):
col = layout.column()
col.use_property_split = True
+ col.use_property_decorate = False
col.prop(vpaint, "radial_symmetry", text="Radial")
# Most of these panels should not be visible in GP edit modes
@@ -571,6 +572,7 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
+ layout.use_property_decorate = False
toolsettings = context.tool_settings
ipaint = toolsettings.image_paint
@@ -746,6 +748,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
settings = self.paint_settings(context)
brush = settings.brush
layout.use_property_split = True
+ layout.use_property_decorate = False
col = layout.column()
@@ -779,16 +782,12 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
if brush.sculpt_capabilities.has_jitter:
col.separator()
- colsub = col.split(factor=0.5)
- row = colsub.row(align=True)
- row.alignment = 'RIGHT'
- row.label(text="Jitter")
- row = colsub.row(align=True)
- row.prop(brush, "use_relative_jitter", icon_only=True)
+ row = col.row(align=True)
if brush.use_relative_jitter:
- row.prop(brush, "jitter", slider=True, text="")
+ row.prop(brush, "jitter", slider=True)
else:
- row.prop(brush, "jitter_absolute", text="")
+ row.prop(brush, "jitter_absolute")
+ row.prop(brush, "use_relative_jitter", icon_only=True)
row.prop(brush, "use_pressure_jitter", toggle=True, text="")
if brush.sculpt_capabilities.has_smooth_stroke:
@@ -1002,6 +1001,7 @@ class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
row.prop(sculpt, "tile_z", text="Z", toggle=True)
layout.use_property_split = True
+ layout.use_property_decorate = False
layout.prop(sculpt, "use_symmetry_feather", text="Feather")
layout.column().prop(sculpt, "radial_symmetry", text="Radial")
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index cfc47e65a26..89b08d83b44 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -158,6 +158,9 @@ struct uiLayout {
bContextStore *context;
ListBase items;
+ /* Sub layout to add child items, if not the layout itself. */
+ uiLayout *child_items_layout;
+
int x, y, w, h;
float scale[2];
short space;
@@ -1628,6 +1631,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* Split the label / property. */
+ uiLayout *layout_parent = layout;
if (use_prop_sep) {
uiLayout *layout_row = NULL;
#ifdef UI_PROP_DECORATE
@@ -1693,6 +1697,13 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
}
+ /* Hack to add further items in a row into the second part of
+ * the split layout, so the label part keeps a fixed size. */
+ if (layout_parent && layout_parent->item.type == ITEM_LAYOUT_ROW) {
+ layout_split = uiLayoutRow(layout_split, true);
+ layout_parent->child_items_layout = layout_split;
+ }
+
/* Watch out! We can only write into the new layout now. */
if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
/* Expanded enums each have their own name. */
@@ -3608,7 +3619,13 @@ static void ui_litem_init_from_parent(uiLayout *litem, uiLayout *layout, int ali
litem->w = layout->w;
litem->emboss = layout->emboss;
litem->item.flag = (layout->item.flag & (UI_ITEM_PROP_SEP | UI_ITEM_PROP_DECORATE));
- BLI_addtail(&layout->items, litem);
+
+ if (layout->child_items_layout) {
+ BLI_addtail(&layout->child_items_layout->items, litem);
+ }
+ else {
+ BLI_addtail(&layout->items, litem);
+ }
}
/* layout create functions */
@@ -4286,7 +4303,12 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but)
bitem->item.flag |= UI_ITEM_MIN;
}
- BLI_addtail(&layout->items, bitem);
+ if (layout->child_items_layout) {
+ BLI_addtail(&layout->child_items_layout->items, bitem);
+ }
+ else {
+ BLI_addtail(&layout->items, bitem);
+ }
if (layout->context) {
but->context = layout->context;
More information about the Bf-blender-cvs
mailing list