Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-11-02 18:32:31 +0300
committerAntonioya <blendergit@gmail.com>2018-11-02 18:35:53 +0300
commitf3ffb4e0499d23df127f316f3767a35e551e7ed1 (patch)
treea97b41e64acaf968a79d0704cb42d4791ec3bdb0
parentd3ade457745023af22ec1bb09e94e334f06208ad (diff)
Add new factor parameter to layout.separator()
The new parameter allows to define the scale of the space.
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c9
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c6
3 files changed, 14 insertions, 2 deletions
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");