Page MenuHome
Paste P1254

Layout Hack
ActivePublic

Authored by Asher (ThatAsherGuy) on Feb 11 2020, 9:18 PM.
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 43a9bbd2e36..e1839b26ca2 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1153,6 +1153,56 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeFontStyle");
RNA_def_property_ui_text(prop, "Widget Style", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "columnspace", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "columnspace");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Column Spacing", "Column Spacing");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "templatespace", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "templatespace");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Column Spacing", "Column gutter size in pixels");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "boxspace", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "boxspace");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Box Spacing", "Box gutter size in pixels");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "buttonspacex", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "buttonspacex");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Button X Spacing", "Button X Spacing");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "buttonspacey", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "buttonspacey");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Button Y Spacing", "Button Y Spacing");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "panelspace", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "panelspace");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Panel Spacing", "Panel Spacing");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "panelouter", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_int_sdna(prop, NULL, "panelouter");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Panel Outer", "Panel Outer");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
}
static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna)

Event Timeline

This is a quick and dirty layout hack for accessing a few layout engine properties. With this patch, you can tweak things like the space between items within a layout block through Blender's python console via C.preferences.ui_styles[0]. Here are the default values for these properties, from interface_style.c:

style->columnspace = 8;
style->templatespace = 5;
style->boxspace = 5;
style->buttonspacex = 8;
style->buttonspacey = 2;
style->panelspace = 8;
style->panelouter = 4;

This is mostly for pixel-sniffing purposes.