[Bf-blender-cvs] [adb989768d8] modifier-panels-ui: First pass on 2.8 style UI for more modifers

Hans Goudey noreply at git.blender.org
Sun Apr 5 02:30:13 CEST 2020


Commit: adb989768d883bbf4ea1ddb26d686b66a26f0473
Author: Hans Goudey
Date:   Sat Apr 4 19:29:20 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rBadb989768d883bbf4ea1ddb26d686b66a26f0473

First pass on 2.8 style UI for more modifers

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

M	source/blender/modifiers/intern/MOD_decimate.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_normal_edit.c
M	source/blender/modifiers/intern/MOD_shrinkwrap.c
M	source/blender/modifiers/intern/MOD_skin.c
M	source/blender/modifiers/intern/MOD_weighted_normal.c

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

diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index 482af7bcc0c..a5058ff0a3d 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -228,7 +228,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 
 static void panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *sub, *row, *col, *split;
+  uiLayout *sub, *row;
 
   uiLayout *layout = panel->layout;
   PointerRNA ptr;
@@ -236,43 +236,34 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
   modifier_panel_buttons(C, panel);
 
-  /* Get info used later. */
+  uiLayoutSetPropSep(layout, true);
+
   int decimate_type = RNA_enum_get(&ptr, "decimate_type");
   char count_info[32];
   snprintf(count_info, 32, IFACE_("Face Count: %d"), RNA_int_get(&ptr, "face_count"));
   bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
 
-  uiItemR(layout, &ptr, "decimate_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "decimate_type", 0, NULL, ICON_NONE);
 
   if (decimate_type == MOD_DECIM_MODE_COLLAPSE) {
-    uiItemR(layout, &ptr, "ratio", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+    uiItemR(layout, &ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
-    split = uiLayoutSplit(layout, 0.5f, true);
-    col = uiLayoutColumn(split, true);
-    row = uiLayoutRow(col, true);
-    uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
-    sub = uiLayoutRow(row, true);
+    row = uiLayoutRow(layout, true);
+    uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+    sub = uiLayoutColumn(row, true);
     uiLayoutSetActive(sub, has_vertex_group);
     uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
-    col = uiLayoutColumn(split, true);
-    uiItemR(col, &ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
-
-    split = uiLayoutSplit(layout, 0.5f, false);
-    col = uiLayoutColumn(split, false);
-    uiItemR(col, &ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE);
-    col = uiLayoutColumn(split, false);
-    row = uiLayoutSplit(col, 0.75f, false);
-    uiItemR(row, &ptr, "use_symmetry", 0, NULL, ICON_NONE);
-    uiItemR(row, &ptr, "symmetry_axis", 0, "", ICON_NONE);
+
+    uiItemR(layout, &ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE);
+    uiItemR(layout, &ptr, "use_symmetry", 0, NULL, ICON_NONE);
+    uiItemR(layout, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, IFACE_("Symmetry Axis"), ICON_NONE);
   }
   else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) {
     uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
   }
   else { /* decimate_type == MOD_DECIM_MODE_DISSOLVE. */
     uiItemR(layout, &ptr, "angle_limit", 0, NULL, ICON_NONE);
-    uiItemL(layout, IFACE_("Delimit:"), ICON_NONE);
-    row = uiLayoutRow(layout, false);
-    uiItemR(row, &ptr, "delimit", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+    uiItemR(layout, &ptr, "delimit", 0, NULL, ICON_NONE);
     uiItemR(layout, &ptr, "use_dissolve_boundaries", 0, NULL, ICON_NONE);
   }
   uiItemL(layout, count_info, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index e5c2dd338a9..32bd4a04a4d 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 *col, *split;
+  uiLayout *row, *split;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
@@ -134,36 +134,63 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
   modifier_panel_buttons(C, panel);
 
-  split = uiLayoutSplit(layout, 0.333f, false);
-  col = uiLayoutColumn(split, true);
-  uiItemL(col, IFACE_("Axis:"), ICON_NONE);
-  PropertyRNA *prop = RNA_struct_find_property(&ptr, "use_axis");
-  uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("X"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 2, 0, 0, IFACE_("Z"), ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
 
-  col = uiLayoutColumn(split, true);
-  uiItemL(col, IFACE_("Bisect:"), ICON_NONE);
+  /* Aligned axis booleans with a single label and no decorators. */
+  split = uiLayoutSplit(layout, 0.5f, false);
+  row = uiLayoutRow(split, false);
+  uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+  uiItemL(row, IFACE_("Axis"), ICON_NONE);
+  row = uiLayoutRow(split, true);
+  uiLayoutSetPropSep(row, false);
+  PropertyRNA *prop = RNA_struct_find_property(&ptr, "use_axis");
+  uiItemFullR(row, &ptr, prop, 0, 0, UI_ITEM_R_TOGGLE, IFACE_("X"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 1, 0, UI_ITEM_R_TOGGLE, IFACE_("Y"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 2, 0, UI_ITEM_R_TOGGLE, IFACE_("Z"), ICON_NONE);
+  uiItemL(row, "", ICON_BLANK1);
+
+  /* Aligned axis booleans with a single label and no decorators. */
+  split = uiLayoutSplit(layout, 0.5f, false);
+  row = uiLayoutRow(split, false);
+  uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+  uiItemL(row, IFACE_("Bisect"), ICON_NONE);
+  row = uiLayoutRow(split, true);
+  uiLayoutSetPropSep(row, false);
   prop = RNA_struct_find_property(&ptr, "use_bisect_axis");
-  uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("X"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 2, 0, 0, IFACE_("Z"), ICON_NONE);
-
-  col = uiLayoutColumn(split, true);
-  uiItemL(col, IFACE_("Flip:"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 0, 0, UI_ITEM_R_TOGGLE, IFACE_("X"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 1, 0, UI_ITEM_R_TOGGLE, IFACE_("Y"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 2, 0, UI_ITEM_R_TOGGLE, IFACE_("Z"), ICON_NONE);
+  uiItemL(row, "", ICON_BLANK1);
+
+  /* Aligned axis booleans with a single label and no decorators. */
+  split = uiLayoutSplit(layout, 0.5f, false);
+  row = uiLayoutRow(split, false);
+  uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+  uiItemL(row, IFACE_("Flip"), ICON_NONE);
+  row = uiLayoutRow(split, true);
+  uiLayoutSetPropSep(row, false);
   prop = RNA_struct_find_property(&ptr, "use_bisect_flip_axis");
-  uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("X"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
-  uiItemFullR(col, &ptr, prop, 2, 0, 0, IFACE_("Z"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 0, 0, UI_ITEM_R_TOGGLE, IFACE_("X"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 1, 0, UI_ITEM_R_TOGGLE, IFACE_("Y"), ICON_NONE);
+  uiItemFullR(row, &ptr, prop, 2, 0, UI_ITEM_R_TOGGLE, IFACE_("Z"), ICON_NONE);
+  uiItemL(row, "", ICON_BLANK1);
 
-  col = uiLayoutColumn(layout, true);
-  uiItemL(col, IFACE_("Mirror Object:"), ICON_NONE);
-  uiItemR(col, &ptr, "mirror_object", 0, "", ICON_NONE);
+  uiItemR(layout, &ptr, "mirror_object", 0, NULL, ICON_NONE);
 
   uiItemR(layout, &ptr, "use_mirror_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
 }
 
-static void merge_panel_draw(const bContext *C, Panel *panel)
+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;
@@ -171,36 +198,42 @@ static void merge_panel_draw(const bContext *C, Panel *panel)
   PointerRNA ptr;
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
-  row = uiLayoutRow(layout, false);
-  uiItemR(row, &ptr, "use_mirror_merge", 0, IFACE_("Merge"), ICON_NONE);
-  uiItemR(row, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
+
   row = uiLayoutRow(layout, false);
   uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_mirror_merge"));
   uiItemR(row, &ptr, "merge_threshold", 0, NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE);
 }
 
-static void textures_panel_draw(const bContext *C, Panel *panel)
+static void uv_panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *col, *row;
+  uiLayout *col, *row, *split;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
-  row = uiLayoutRow(layout, false);
-  uiItemR(row, &ptr, "use_mirror_u", 0, IFACE_("Flip U"), ICON_NONE);
-  uiItemR(row, &ptr, "use_mirror_v", 0, IFACE_("Flip V"), ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
+
+  /* Flip U and V booleans aligned with one label. */
+  split = uiLayoutSplit(layout, 0.5f, false);
+  row = uiLayoutRow(split, false);
+  uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+  uiItemL(row, IFACE_("Flip"), ICON_NONE);
+  row = uiLayoutRow(split, true);
+  uiLayoutSetPropSep(row, false);
+  uiItemR(row, &ptr, "use_mirror_u", UI_ITEM_R_TOGGLE, IFACE_("U"), ICON_NONE);
+  uiItemR(row, &ptr, "use_mirror_v", UI_ITEM_R_TOGGLE, IFACE_("V"), ICON_NONE);
+  uiItemL(row, "", ICON_BLANK1);
 
   col = uiLayoutColumn(layout, true);
-  if (RNA_boolean_get(&ptr, "use_mirror_u")) {
-    uiItemR(col, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-  }
-  if (RNA_boolean_get(&ptr, "use_mirror_v")) {
-    uiItemR(col, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-  }
-  col = uiLayoutColumn(layout, true);
-  uiItemR(col, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-  uiItemR(col, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+  row = uiLayoutRow(col, true);
+  uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_mirror_u"));
+  uiItemR(row, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, IFACE_("Offset U"), ICON_NONE);
+  row = uiLayoutRow(col, true);
+  uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_mirror_v"));
+  uiItemR(row, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, IFACE_("V"), ICON_NONE);
 
   m

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list