[Bf-blender-cvs] [f3ffb4e0499] blender2.8: Add new factor parameter to layout.separator()
Antonioya
noreply at git.blender.org
Fri Nov 2 16:36:02 CET 2018
Commit: f3ffb4e0499d23df127f316f3767a35e551e7ed1
Author: Antonioya
Date: Fri Nov 2 16:32:31 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBf3ffb4e0499d23df127f316f3767a35e551e7ed1
Add new factor parameter to layout.separator()
The new parameter allows to define the scale of the space.
===================================================================
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_layout.c
M source/blender/makesrna/intern/rna_ui_api.c
===================================================================
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 0f160d7263b..51347c7c230 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1187,6 +1187,7 @@ void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int
void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); /* menu */
void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
void uiItemS(uiLayout *layout); /* separator */
+void uiItemS_ex(uiLayout *layout, float factor);
void uiItemSpacer(uiLayout *layout); /* Special separator. */
void uiItemPopoverPanel_ptr(
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 973a47c5305..41df694176a 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2419,16 +2419,23 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
}
/* separator item */
-void uiItemS(uiLayout *layout)
+void uiItemS_ex(uiLayout *layout, float factor)
{
uiBlock *block = layout->root->block;
bool is_menu = ui_block_is_menu(block);
int space = (is_menu) ? 0.45f * UI_UNIT_X : 0.3f * UI_UNIT_X;
+ space *= factor;
UI_block_layout_set_current(block, layout);
uiDefBut(block, (is_menu) ? UI_BTYPE_SEPR_LINE : UI_BTYPE_SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, "");
}
+/* separator item */
+void uiItemS(uiLayout *layout)
+{
+ uiItemS_ex(layout, 1.0f);
+}
+
/* Flexible spacing. */
void uiItemSpacer(uiLayout *layout)
{
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 84673029eb9..7f956233012 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -760,8 +760,12 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "category", NULL, 0, "", "panel type category");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- func = RNA_def_function(srna, "separator", "uiItemS");
+ func = RNA_def_function(srna, "separator", "uiItemS_ex");
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
+ RNA_def_float(
+ func, "factor", 0.0f, 0.0f, FLT_MAX, "Percentage",
+ "Percentage of width to space (leave unset for default space)",
+ 0.0f, FLT_MAX);
func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer");
RNA_def_function_ui_description(func, "Item. Inserts horizontal spacing empty space into the layout between items");
More information about the Bf-blender-cvs
mailing list