[Bf-blender-cvs] [8383fc55d59] modifier-panels-ui: UI: Tweaks to modifier layouts

William Reynish noreply at git.blender.org
Thu Apr 16 21:23:49 CEST 2020


Commit: 8383fc55d593b03ef61a4673bf7df8601f4a0509
Author: William Reynish
Date:   Thu Apr 16 21:15:34 2020 +0200
Branches: modifier-panels-ui
https://developer.blender.org/rB8383fc55d593b03ef61a4673bf7df8601f4a0509

UI: Tweaks to modifier layouts

  - Use checkbox + values configuration and expand 3-axis enums.

===================================================================

M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_wave.c
M	source/blender/modifiers/intern/MOD_wireframe.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 7219c713400..fee8d284658 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -457,12 +457,12 @@ static void falloff_panel_draw(const bContext *C, Panel *panel)
 
   uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
 
-  uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
-
   row = uiLayoutRow(layout, false);
   uiLayoutSetActive(row, use_falloff);
   uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
 
+  uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
+
   if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
     uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
   }
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index ff2ba1e38af..b31af81617c 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -126,7 +126,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 
 static void panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *row, *col;
+  uiLayout *row, *col, *sub;
   uiLayout *layout = panel->layout;
   int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
 
@@ -168,32 +168,13 @@ static void panel_draw(const bContext *C, Panel *panel)
 
   uiItemR(col, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE);
 
-  modifier_panel_end(layout, &ptr);
-}
-
-static void merge_panel_draw_header(const bContext *C, Panel *panel)
-{
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiItemR(layout, &ptr, "use_mirror_merge", 0, IFACE_("Merge"), ICON_NONE);
-}
-
-static void symmetry_panel_draw(const bContext *C, Panel *panel)
-{
-  uiLayout *row;
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiLayoutSetPropSep(layout, true);
+  row = uiLayoutRowWithHeading(col, true, IFACE_("Merge"));
+  uiItemR(row, &ptr, "use_mirror_merge", 0, "", ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_merge"));
+  uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE);
 
-  row = uiLayoutRow(layout, false);
-  uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_mirror_merge"));
-  uiItemR(row, &ptr, "merge_threshold", 0, NULL, ICON_NONE);
+  modifier_panel_end(layout, &ptr);
 }
 
 static void data_panel_draw(const bContext *C, Panel *panel)
@@ -232,8 +213,6 @@ static void data_panel_draw(const bContext *C, Panel *panel)
 static void panelRegister(ARegionType *region_type)
 {
   PanelType *panel_type = modifier_panel_register(region_type, "Mirror", panel_draw);
-  modifier_subpanel_register(
-      region_type, "mirror_merge", "", merge_panel_draw_header, symmetry_panel_draw, panel_type);
   modifier_subpanel_register(
       region_type, "mirror_data", "Data", NULL, data_panel_draw, panel_type);
 }
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 4bbcb78d45e..52f9d69af3d 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -1193,7 +1193,8 @@ static void panel_draw(const bContext *C, Panel *panel)
 
   uiItemS(layout);
   col = uiLayoutColumn(layout, false);
-  uiItemR(col, &ptr, "axis", 0, NULL, ICON_NONE);
+  row = uiLayoutRow(col, false);
+  uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
   uiItemR(col, &ptr, "object", 0, IFACE_("Axis Object"), ICON_NONE);
   sub = uiLayoutColumn(col, false);
   uiLayoutSetActive(sub, !RNA_pointer_is_null(&screw_obj_ptr));
@@ -1205,6 +1206,16 @@ static void panel_draw(const bContext *C, Panel *panel)
   uiItemR(col, &ptr, "steps", 0, IFACE_("Steps Viewport"), ICON_NONE);
   uiItemR(col, &ptr, "render_steps", 0, IFACE_("Render"), ICON_NONE);
 
+  uiItemS(layout);
+
+  row = uiLayoutRowWithHeading(layout, true, IFACE_("Merge"));
+  uiItemR(row, &ptr, "use_merge_vertices", 0, "", ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_merge_vertices"));
+  uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE);
+
+  uiItemS(layout);
+
   row = uiLayoutRowWithHeading(layout, true, IFACE_("Stretch UVs"));
   uiItemR(row, &ptr, "use_stretch_u", toggles_flag, IFACE_("U"), ICON_NONE);
   uiItemR(row, &ptr, "use_stretch_v", toggles_flag, IFACE_("V"), ICON_NONE);
@@ -1212,31 +1223,6 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_end(layout, &ptr);
 }
 
-static void symmetry_panel_header_draw(const bContext *C, Panel *panel)
-{
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiItemR(layout, &ptr, "use_merge_vertices", 0, NULL, ICON_NONE);
-}
-
-static void symmetry_panel_draw(const bContext *C, Panel *panel)
-{
-  uiLayout *col;
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiLayoutSetPropSep(layout, true);
-
-  col = uiLayoutColumn(layout, false);
-  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_merge_vertices"));
-  uiItemR(col, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE);
-}
-
 static void normals_panel_draw(const bContext *C, Panel *panel)
 {
   uiLayout *col;
@@ -1256,8 +1242,6 @@ static void normals_panel_draw(const bContext *C, Panel *panel)
 static void panelRegister(ARegionType *region_type)
 {
   PanelType *panel_type = modifier_panel_register(region_type, "Screw", panel_draw);
-  modifier_subpanel_register(
-      region_type, "screw_merge", "", symmetry_panel_header_draw, symmetry_panel_draw, panel_type);
   modifier_subpanel_register(
       region_type, "screw_normals", "Normals", NULL, normals_panel_draw, panel_type);
 }
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 98202603c94..b19a1fd18c2 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -391,6 +391,14 @@ static void panel_draw(const bContext *C, Panel *panel)
 
   uiItemR(layout, &ptr, "use_cyclic", 0, NULL, ICON_NONE);
 
+  row = uiLayoutRowWithHeading(layout, true, IFACE_("Along Normals"));
+  uiItemR(row, &ptr, "use_normal", 0, "", ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_normal"));
+  uiItemR(sub, &ptr, "use_normal_x", UI_ITEM_R_TOGGLE, "X", ICON_NONE);
+  uiItemR(sub, &ptr, "use_normal_y", UI_ITEM_R_TOGGLE, "Y", ICON_NONE);
+  uiItemR(sub, &ptr, "use_normal_z", UI_ITEM_R_TOGGLE, "Z", ICON_NONE);
+
   col = uiLayoutColumn(layout, false);
   uiItemR(col, &ptr, "falloff_radius", 0, "Falloff", ICON_NONE);
   uiItemR(col, &ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -407,33 +415,6 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_end(layout, &ptr);
 }
 
-static void normal_panel_header_draw(const bContext *C, Panel *panel)
-{
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiItemR(layout, &ptr, "use_normal", 0, IFACE_("Along Normals"), ICON_NONE);
-}
-
-static void normal_panel_draw(const bContext *C, Panel *panel)
-{
-  uiLayout *col;
-  uiLayout *layout = panel->layout;
-
-  PointerRNA ptr;
-  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
-
-  uiLayoutSetPropSep(layout, true);
-
-  col = uiLayoutColumn(layout, true);
-  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_normal"));
-  uiItemR(col, &ptr, "use_normal_x", 0, "X", ICON_NONE);
-  uiItemR(col, &ptr, "use_normal_y", 0, "Y", ICON_NONE);
-  uiItemR(col, &ptr, "use_normal_z", 0, "Z", ICON_NONE);
-}
-
 static void position_panel_draw(const bContext *C, Panel *panel)
 {
   uiLayout *col;
@@ -507,8 +488,6 @@ static void texture_panel_draw(const bContext *C, Panel *panel)
 static void panelRegister(ARegionType *region_type)
 {
   PanelType *panel_type = modifier_panel_register(region_type, "Wave", panel_draw);
-  modifier_subpanel_register(
-      region_type, "normal", "", normal_panel_header_draw, normal_panel_draw, panel_type);
   modifier_subpanel_register(
       region_type, "wave_position", "Start Position", NULL, position_panel_draw, panel_type);
   modifier_subpanel_register(region_type, "wave_time", "Time", NULL, time_panel_draw, panel_type);
diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c
index 731589bc907..198fc0dceb3 100644
--- a/source/blender/modifiers/intern/MOD_wireframe.c
+++ b/source/blender/modifiers/intern/MOD_wireframe.c
@@ -121,7 +121,7 @@ static Mesh *applyModifier(ModifierData *md,
 
 static void panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *col;
+  uiLayout *col, *row, *sub;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
@@ -134,13 +134,20 @@ static void panel_draw(const bContext *C, Panel *panel)
   uiItemR(layout, &ptr, "thickness", 0, IFACE_("Thickness"), ICON_NONE);
   uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
 
-  uiItemR(layout, &ptr, "use_boundary", 0, IFACE_("Boundary"), ICON_NONE);
-  uiItemR(layout, &ptr, "use_replace", 0, IFACE_("Replace Original"), ICON_NONE);
+  col = uiLayoutColumn(layout, true);
+  uiItemR(col, &ptr, "use_boundary", 0, IFACE_("Boundary"), ICON_NONE);
+  uiItemR(col, &ptr, "use_replace", 0, IFACE_("Replace Original"), ICON_NONE);
 
-  col = uiLayoutColumnWithHeading(layout, false, IFACE_("Thickness"));
+  col = uiLayoutColumnWithHeading(layout, true, IFACE_("Thickness"));
   uiItemR(col, &ptr, "use_even_offset", 0, IFACE_("Even"), ICON_NONE);
   uiItemR(col, &ptr, "use_relative_offset", 0, IFACE_("Relative"), ICON_NONE);
 
+  row = uiLayoutRowWithHeading(layout, true, IFACE_("Crease Edges"));
+  uiItemR(row, &ptr, "use_crease", 0, "", ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_crease"));
+  uiItemR(sub, &ptr, 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list