[Bf-blender-cvs] [a940f4e6535] temp-checkbox-layout-tweaks: Support using property split for menu items & use for output FPS setting
Julian Eisel
noreply at git.blender.org
Mon Apr 13 18:25:14 CEST 2020
Commit: a940f4e653500205f0a9cd72a74a1ce41ccd9d13
Author: Julian Eisel
Date: Mon Apr 13 18:22:26 2020 +0200
Branches: temp-checkbox-layout-tweaks
https://developer.blender.org/rBa940f4e653500205f0a9cd72a74a1ce41ccd9d13
Support using property split for menu items & use for output FPS setting
We could add an extra parameter for the label string, for now we can
just use the headings. So if a layout heading is available (set and not
already added) use that to enable the split layout.
===================================================================
M release/scripts/addons
M release/scripts/addons_contrib
M release/scripts/startup/bl_ui/properties_output.py
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/release/scripts/addons b/release/scripts/addons
index d348bde0f96..8d4ee1fb6b0 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit d348bde0f96809e289b0514c015cafb97f2dcf79
+Subproject commit 8d4ee1fb6b02f838352f74ad726e73b34b15ac94
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 7077ff07384..9468c406fb5 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 7077ff07384491d1f7630484995557f1c7302dae
+Subproject commit 9468c406fb554e32ff47b62bfef356b3908ec651
diff --git a/release/scripts/startup/bl_ui/properties_output.py b/release/scripts/startup/bl_ui/properties_output.py
index e2158d3644a..e90a0a06429 100644
--- a/release/scripts/startup/bl_ui/properties_output.py
+++ b/release/scripts/startup/bl_ui/properties_output.py
@@ -94,14 +94,14 @@ class RENDER_PT_dimensions(RenderOutputButtonsPanel, Panel):
return args
@staticmethod
- def draw_framerate(layout, sub, rd):
+ def draw_framerate(layout, rd):
if RENDER_PT_dimensions._preset_class is None:
RENDER_PT_dimensions._preset_class = bpy.types.RENDER_MT_framerate_presets
args = rd.fps, rd.fps_base, RENDER_PT_dimensions._preset_class.bl_label
fps_label_text, show_framerate = RENDER_PT_dimensions._draw_framerate_label(*args)
- sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
+ layout.menu("RENDER_MT_framerate_presets", text=fps_label_text)
if show_framerate:
col = layout.column(align=True)
@@ -136,10 +136,8 @@ class RENDER_PT_dimensions(RenderOutputButtonsPanel, Panel):
col.prop(scene, "frame_end", text="End")
col.prop(scene, "frame_step", text="Step")
- col = layout.split()
- col.alignment = 'RIGHT'
- col.label(text="Frame Rate")
- self.draw_framerate(layout, col, rd)
+ col = layout.column(heading="Frame Rate")
+ self.draw_framerate(col, rd)
class RENDER_PT_frame_remapping(RenderOutputButtonsPanel, Panel):
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 90f1031490a..620ea19c9e8 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1894,7 +1894,8 @@ static uiLayout *ui_layout_heading_find(uiLayout *cur_layout)
static void ui_layout_heading_label_add(uiLayout *layout,
uiLayout *heading_layout,
- bool right_align)
+ bool right_align,
+ bool respect_prop_split)
{
const int prev_alignment = layout->alignment;
@@ -1902,7 +1903,12 @@ static void ui_layout_heading_label_add(uiLayout *layout,
uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_RIGHT);
}
- uiItemL(layout, heading_layout->heading, ICON_NONE);
+ if (respect_prop_split) {
+ uiItemL_respect_property_split(layout, heading_layout->heading, ICON_NONE);
+ }
+ else {
+ uiItemL(layout, heading_layout->heading, ICON_NONE);
+ }
/* After adding the heading label, we have to mark it somehow as added, so it's not added again
* for other items in this layout. For now just clear it. */
heading_layout->heading[0] = '\0';
@@ -2110,7 +2116,7 @@ void uiItemFullR(uiLayout *layout,
layout = uiLayoutColumn(layout_row ? layout_row : layout, true);
layout->space = 0;
if (heading_layout) {
- ui_layout_heading_label_add(layout, heading_layout, false);
+ ui_layout_heading_label_add(layout, heading_layout, false, false);
}
}
else {
@@ -2171,7 +2177,7 @@ void uiItemFullR(uiLayout *layout,
}
if (!label_added && heading_layout) {
- ui_layout_heading_label_add(layout_sub, heading_layout, true);
+ ui_layout_heading_label_add(layout_sub, heading_layout, true, false);
}
layout_split = ui_item_prop_split_layout_hack(layout_parent, layout_split);
@@ -2214,7 +2220,7 @@ void uiItemFullR(uiLayout *layout,
else if (heading_layout) {
/* Could not add heading to split layout, fallback to inserting it to the layout with the
* heading itself. */
- ui_layout_heading_label_add(heading_layout, heading_layout, false);
+ ui_layout_heading_label_add(heading_layout, heading_layout, false, false);
}
else if (inside_prop_sep) {
/* When placing further items in a split row, add them to a column so they match the column
@@ -2813,6 +2819,7 @@ static uiBut *ui_item_menu(uiLayout *layout,
bool force_menu)
{
uiBlock *block = layout->root->block;
+ uiLayout *heading_layout = ui_layout_heading_find(layout);
uiBut *but;
int w, h;
@@ -2842,6 +2849,10 @@ static uiBut *ui_item_menu(uiLayout *layout,
}
}
+ if (heading_layout) {
+ ui_layout_heading_label_add(layout, heading_layout, true, true);
+ }
+
if (name[0] && icon) {
but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
}
More information about the Bf-blender-cvs
mailing list