[Bf-blender-cvs] [e4043bb908e] modifier-panels-ui: Use simpler method to create split labels for toggles
Hans Goudey
noreply at git.blender.org
Thu Apr 9 18:18:03 CEST 2020
Commit: e4043bb908eec17654b5240f490814f60e597850
Author: Hans Goudey
Date: Thu Apr 9 11:17:56 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rBe4043bb908eec17654b5240f490814f60e597850
Use simpler method to create split labels for toggles
===================================================================
M source/blender/modifiers/intern/MOD_bevel.c
M source/blender/modifiers/intern/MOD_cast.c
M source/blender/modifiers/intern/MOD_explode.c
M source/blender/modifiers/intern/MOD_laplaciansmooth.c
M source/blender/modifiers/intern/MOD_mirror.c
M source/blender/modifiers/intern/MOD_particleinstance.c
M source/blender/modifiers/intern/MOD_screw.c
M source/blender/modifiers/intern/MOD_shrinkwrap.c
M source/blender/modifiers/intern/MOD_simpledeform.c
M source/blender/modifiers/intern/MOD_skin.c
M source/blender/modifiers/intern/MOD_smooth.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index d0c4819dcd8..e508a97aa4c 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -277,7 +277,7 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *col, *split;
+ uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
PointerRNA ptr;
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 95bd4077bc2..110cb5a04ed 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -531,9 +531,9 @@ static void deformVertsEM(ModifierData *md,
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *split;
-
+ uiLayout *sub, *row, *decorator_layout;
uiLayout *layout = panel->layout;
+
PointerRNA ptr;
PointerRNA ob_ptr;
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
@@ -543,19 +543,15 @@ static void panel_draw(const bContext *C, Panel *panel)
PointerRNA cast_object_ptr = RNA_pointer_get(&ptr, "object");
uiItemR(layout, &ptr, "cast_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
uiLayoutSetPropSep(layout, true);
- /* Aligned booleans with a single label. */
- split = uiLayoutSplit(layout, 0.4f, false);
- row = uiLayoutRow(split, false);
- uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- uiItemL(row, IFACE_("Axis"), ICON_NONE);
- row = uiLayoutRow(split, true);
- uiLayoutSetPropSep(row, false);
+ row = uiLayoutRow(layout, true);
+ decorator_layout = uiItemL_respect_property_split(row, IFACE_("Axis"), ICON_NONE);
uiItemR(row, &ptr, "use_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemL(row, "", ICON_BLANK1);
+ uiItemL(decorator_layout, "", ICON_BLANK1);
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "radius", 0, NULL, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index ea6c7e4aa18..a81e9c59e50 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -1187,7 +1187,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *split;
+ uiLayout *sub, *row, *decorator_layout;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -1202,17 +1202,17 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemPointerR(layout, &ptr, "particle_uv", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
- /* Aligned axis booleans with a single label and no decorators. */
- split = uiLayoutSplit(layout, 0.4f, false);
- row = uiLayoutRow(split, false);
- uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- uiItemL(row, IFACE_("Show"), ICON_NONE);
- row = uiLayoutRow(split, true);
- uiLayoutSetPropSep(row, false);
+ /* This shouldn't be needed, but the above seems to reset prop separation. */
+ uiLayoutSetPropSep(layout, true);
+
+ row = uiLayoutRow(layout, true);
+ decorator_layout = uiItemL_respect_property_split(row, IFACE_("Show"), ICON_NONE);
uiItemR(row, &ptr, "show_alive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "show_dead", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "show_unborn", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemL(row, "", ICON_BLANK1);
+ uiItemL(decorator_layout, "", ICON_BLANK1);
+
+ uiLayoutSetPropSep(layout, true);
uiItemR(layout, &ptr, "use_edge_cut", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "use_size", 0, NULL, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 05bdd3d7f6e..82814ed193b 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -580,7 +580,7 @@ static void deformVertsEM(ModifierData *md,
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *split;
+ uiLayout *sub, *row, *decorator_layout;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -594,17 +594,12 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
- /* Aligned axis booleans with a single label and no decorators. */
- split = uiLayoutSplit(layout, 0.4f, false);
- row = uiLayoutRow(split, false);
- uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- uiItemL(row, IFACE_("Axis"), ICON_NONE);
- row = uiLayoutRow(split, true);
- uiLayoutSetPropSep(row, false);
+ row = uiLayoutRow(layout, true);
+ decorator_layout = uiItemL_respect_property_split(row, IFACE_("Axis"), ICON_NONE);
uiItemR(row, &ptr, "use_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemL(row, "", ICON_BLANK1);
+ uiItemL(decorator_layout, "", ICON_BLANK1);
uiItemR(layout, &ptr, "lambda_factor", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "lambda_border", 0, NULL, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index cbb094619c5..d784eb79f12 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -141,7 +141,6 @@ static void panel_draw(const bContext *C, Panel *panel)
/* No decorators for the first few rows. */
uiLayoutSetPropDecorate(col, false);
- /* Aligned axis booleans with a single label and no decorators. */
prop = RNA_struct_find_property(&ptr, "use_axis");
row = uiLayoutRow(col, true);
decorator_layout = uiItemL_respect_property_split(row, IFACE_("Axis"), ICON_NONE);
@@ -150,7 +149,6 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemFullR(row, &ptr, prop, 2, 0, UI_ITEM_R_TOGGLE, IFACE_("Z"), ICON_NONE);
uiItemL(decorator_layout, "", ICON_BLANK1);
- /* Aligned axis booleans with a single label and no decorators. */
prop = RNA_struct_find_property(&ptr, "use_bisect_axis");
row = uiLayoutRow(col, true);
decorator_layout = uiItemL_respect_property_split(row, IFACE_("Bisect"), ICON_NONE);
@@ -159,7 +157,6 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemFullR(row, &ptr, prop, 2, 0, UI_ITEM_R_TOGGLE, IFACE_("Z"), ICON_NONE);
uiItemL(decorator_layout, "", ICON_BLANK1);
- /* Aligned axis booleans with a single label and no decorators. */
prop = RNA_struct_find_property(&ptr, "use_bisect_flip_axis");
row = uiLayoutRow(col, true);
decorator_layout = uiItemL_respect_property_split(row, IFACE_("Flip"), ICON_NONE);
@@ -205,7 +202,7 @@ static void symmetry_panel_draw(const bContext *C, Panel *panel)
static void uv_panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *col, *row, *split, *sub, *decorator_layout;
+ uiLayout *col, *row, *sub;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -215,7 +212,7 @@ static void uv_panel_draw(const bContext *C, Panel *panel)
col = uiLayoutColumn(layout, false);
row = uiLayoutRow(col, true);
- decorator_layout = uiItemL_respect_property_split(row, IFACE_("Mirror U"), ICON_NONE);
+ uiItemL_respect_property_split(row, IFACE_("Mirror U"), ICON_NONE);
uiItemR(row, &ptr, "use_mirror_u", 0, IFACE_(""), ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_u"));
@@ -223,7 +220,7 @@ static void uv_panel_draw(const bContext *C, Panel *panel)
col = uiLayoutColumn(layout, false);
row = uiLayoutRow(col, true);
- decorator_layout = uiItemL_respect_property_split(row, IFACE_("V"), ICON_NONE);
+ uiItemL_respect_property_split(row, IFACE_("V"), ICON_NONE);
uiItemR(row, &ptr, "use_mirror_v", 0, IFACE_(""), ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_v"));
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 6a2615f8a84..57215e4af8b 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -560,7 +560,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *row, *split;
+ uiLayout *row, *decorator_layout;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -588,29 +588,19 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemS(layout);
- /* Aligned axis booleans with a single label and no decorators. */
- split = uiLayoutSplit(layout, 0.4f, false);
- row = uiLayoutRow(split, false);
- uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- uiItemL(row, IFACE_("Create Instances From"), ICON_NONE);
- row = uiLayoutRow(split, true);
- uiLayoutSetPropSep(row, false);
+ row = uiLayoutRow(layout, true);
+ decorator_layout = uiItemL_respect_property_split(row, IFACE_("Create Instances"), ICON_NONE);
uiItemR(row, &ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_children", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, &ptr, "use_size", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemL(row, "", ICON_BLANK1);
-
- /* Aligned axis booleans with a single label and no decorators. */
- split = uiLayoutSplit(layout, 0.4f, false);
- row = uiLayoutRow(split, false);
- uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- uiItemL(row, IFACE_("Show"), ICON_NONE);
- row = uiLayoutRow(split, true);
- uiLayoutSetPropSep(row, false);
+ uiItemL(decorator_layout, "", ICON_BLANK1);
+
+ row = uiLayoutRow(layout, true);
+ decorator_layout = uiItemL_respect_property_split(row, IFACE_("Show"), ICON_NONE);
uiItemR(row, &ptr, "show_alive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list