[Bf-blender-cvs] [fb22ae23879] modifier-panels-ui: Initial 2.8 style layouts for more modifiers

Hans Goudey noreply at git.blender.org
Sun Apr 5 16:58:01 CEST 2020


Commit: fb22ae23879e278592d50d7e5e74efdba0c3a315
Author: Hans Goudey
Date:   Sun Apr 5 09:57:38 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rBfb22ae23879e278592d50d7e5e74efdba0c3a315

Initial 2.8 style layouts for more modifiers

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

M	source/blender/modifiers/intern/MOD_meshcache.c
M	source/blender/modifiers/intern/MOD_weighted_normal.c
M	source/blender/modifiers/intern/MOD_weightvg_util.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c
index e1141c6df08..b86ddf485d4 100644
--- a/source/blender/modifiers/intern/MOD_meshcache.c
+++ b/source/blender/modifiers/intern/MOD_meshcache.c
@@ -305,6 +305,8 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
   modifier_panel_buttons(C, panel);
 
+  uiLayoutSetPropSep(layout, true);
+
   uiItemR(layout, &ptr, "cache_format", 0, NULL, ICON_NONE);
   uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE);
 
@@ -323,6 +325,9 @@ static void time_remapping_panel_draw(const bContext *C, Panel *panel)
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
   uiItemR(layout, &ptr, "time_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+  uiLayoutSetPropSep(layout, true);
+
   uiItemR(layout, &ptr, "play_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 
   if (RNA_enum_get(&ptr, "play_mode") == MOD_MESHCACHE_PLAY_CFEA) {
@@ -345,23 +350,20 @@ static void time_remapping_panel_draw(const bContext *C, Panel *panel)
 
 static void axis_mapping_panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *row, *split;
+  uiLayout *col;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
-  split = uiLayoutSplit(layout, 0.5f, false);
-  uiItemL(split, IFACE_("Forward/Up Axis:"), ICON_NONE);
-  row = uiLayoutRow(split, true);
-  uiLayoutSetRedAlert(row, RNA_enum_get(&ptr, "forward_axis") == RNA_enum_get(&ptr, "up_axis"));
-  uiItemR(row, &ptr, "forward_axis", 0, "", ICON_NONE);
-  uiItemR(row, &ptr, "up_axis", 0, "", ICON_NONE);
-
-  split = uiLayoutSplit(layout, 0.5f, false);
-  uiItemL(split, IFACE_("Flip Axis:"), ICON_NONE);
-  row = uiLayoutRow(split, true);
-  uiItemR(row, &ptr, "flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
+
+  col = uiLayoutColumn(layout, true);
+  uiLayoutSetRedAlert(col, RNA_enum_get(&ptr, "forward_axis") == RNA_enum_get(&ptr, "up_axis"));
+  uiItemR(col, &ptr, "forward_axis", 0, NULL, ICON_NONE);
+  uiItemR(col, &ptr, "up_axis", 0, NULL, ICON_NONE);
+
+  uiItemR(layout, &ptr, "flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 }
 
 static void panelRegister(ARegionType *region_type)
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 39a560ada91..4a7f824c9d4 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -735,7 +735,7 @@ static void panel_draw(const bContext *C, Panel *panel)
 
   row = uiLayoutRow(layout, true);
   uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
-  sub = uiLayoutRow(row, true);
+  sub = uiLayoutColumn(row, true);
   uiLayoutSetActive(sub, has_vertex_group);
   uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
 
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 057e7189578..7417414e0c3 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -311,34 +311,40 @@ void weightvg_update_vg(MDeformVert *dvert,
  */
 void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
 {
-  uiLayout *sub, *row, *split;
+  uiLayout *sub, *row;
 
   PointerRNA mask_texture_ptr = RNA_pointer_get(ptr, "mask_texture");
   bool has_mask_texture = !RNA_pointer_is_null(&mask_texture_ptr);
   bool has_mask_vertex_group = RNA_string_length(ptr, "mask_vertex_group") != 0;
   int mask_tex_mapping = RNA_enum_get(ptr, "mask_tex_mapping");
 
+  uiLayoutSetPropSep(layout, true);
+
   uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE);
 
   if (!has_mask_texture) {
-    split = uiLayoutSplit(layout, 0.4f, false);
-    uiItemL(split, IFACE_("Vertex Group Mask:"), ICON_NONE);
-    row = uiLayoutRow(split, true);
-    uiItemPointerR(row, ptr, "mask_vertex_group", ob_ptr, "vertex_groups", "", ICON_NONE);
-    sub = uiLayoutRow(row, true);
+    row = uiLayoutRow(layout, true);
+    uiItemPointerR(row, ptr, "mask_vertex_group", ob_ptr, "vertex_groups", NULL, ICON_NONE);
+    sub = uiLayoutColumn(row, true);
     uiLayoutSetActive(sub, has_mask_vertex_group);
     uiItemR(sub, ptr, "invert_mask_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
   }
 
   if (!has_mask_vertex_group) {
-    uiItemL(layout, IFACE_("Mask Texture:"), ICON_NONE);
-    row = uiLayoutRow(layout, true);
-    uiTemplateID(row, C, ptr, "mask_texture", "texture.new", NULL, NULL, 0, ICON_NONE, "");
+    uiTemplateID(layout,
+                 C,
+                 ptr,
+                 "mask_texture",
+                 "texture.new",
+                 NULL,
+                 NULL,
+                 0,
+                 ICON_NONE,
+                 IFACE_("Mask Texture"));
 
     if (has_mask_texture) {
       uiItemR(layout, ptr, "mask_tex_use_channel", 0, IFACE_("Channel"), ICON_NONE);
-      uiItemL(layout, IFACE_("Texture Coordinates:"), ICON_NONE);
-      uiItemR(layout, ptr, "mask_tex_mapping", 0, "", ICON_NONE);
+      uiItemR(layout, ptr, "mask_tex_mapping", 0, NULL, ICON_NONE);
 
       if (mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
         uiItemR(layout, ptr, "mask_tex_map_object", 0, IFACE_("Object"), ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index bb7734b78bc..6581f4e9802 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -435,7 +435,6 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 
 static void panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *col, *split, *sub;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
@@ -443,22 +442,21 @@ 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.5f, true);
-  col = uiLayoutColumn(split, false);
-  sub = uiLayoutColumn(col, false);
-  uiItemL(sub, IFACE_("Vertex Group A:"), ICON_NONE);
-  uiItemPointerR(sub, &ptr, "vertex_group_a", &ob_ptr, "vertex_groups", "", ICON_NONE);
-  sub = uiLayoutColumn(col, false);
-  uiItemL(sub, IFACE_("Default Weight A:"), ICON_NONE);
-  uiItemR(sub, &ptr, "default_weight_a", 0, "", ICON_NONE);
-
-  col = uiLayoutColumn(split, false);
-  sub = uiLayoutColumn(col, false);
-  uiItemL(sub, IFACE_("Vertex Group B:"), ICON_NONE);
-  uiItemPointerR(sub, &ptr, "vertex_group_b", &ob_ptr, "vertex_groups", "", ICON_NONE);
-  sub = uiLayoutColumn(col, false);
-  uiItemL(sub, IFACE_("Default Weight B:"), ICON_NONE);
-  uiItemR(sub, &ptr, "default_weight_b", 0, "", ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
+
+  uiItemPointerR(layout, &ptr, "vertex_group_a", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "default_weight_a", 0, NULL, ICON_NONE);
+
+  uiItemPointerR(layout, &ptr, "vertex_group_b", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "default_weight_b", 0, NULL, ICON_NONE);
+
+  // col = uiLayoutColumn(split, false);
+  // sub = uiLayoutColumn(col, false);
+  // uiItemL(sub, IFACE_("Vertex Group B:"), ICON_NONE);
+  // uiItemPointerR(sub, &ptr, "vertex_group_b", &ob_ptr, "vertex_groups", "", ICON_NONE);
+  // sub = uiLayoutColumn(col, false);
+  // uiItemL(sub, IFACE_("Default Weight B:"), ICON_NONE);
+  // uiItemR(sub, &ptr, "default_weight_b", 0, "", ICON_NONE);
 
   uiItemS(layout);
 
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 24b4c09824f..2a3eef304a1 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -630,7 +630,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 
 static void panel_draw(const bContext *C, Panel *panel)
 {
-  uiLayout *row, *col, *split;
+  uiLayout *row, *col;
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
@@ -638,27 +638,23 @@ 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.5f, true);
-  col = uiLayoutColumn(split, false);
-  uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
-  uiItemPointerR(col, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
+  uiLayoutSetPropSep(layout, true);
 
-  col = uiLayoutColumn(split, true);
-  uiItemL(col, IFACE_("Target Object:"), ICON_NONE);
-  uiItemR(col, &ptr, "target", 0, "", ICON_NONE);
+  uiItemPointerR(layout, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
 
-  uiItemL(layout, IFACE_("Distance:"), ICON_NONE);
-  uiItemR(layout, &ptr, "proximity_mode", 0, "", ICON_NONE);
+  uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
+
+  uiItemR(layout, &ptr, "proximity_mode", 0, NULL, ICON_NONE);
   if (RNA_enum_get(&ptr, "proximity_mode") == MOD_WVG_PROXIMITY_GEOMETRY) {
-    row = uiLayoutRow(layout, false);
-    uiItemR(row, &ptr, "proximity_geometry", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+    uiItemR(layout, &ptr, "proximity_geometry", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
   }
 
-  uiItemR(layout, &ptr, "min_dist", 0, NULL, ICON_NONE);
-  uiItemR(layout, &ptr, "max_dist", 0, NULL, ICON_NONE);
+  col = uiLayoutColumn(layout, true);
+  uiItemR(col, &ptr, "min_dist", 0, NULL, ICON_NONE);
+  uiItemR(col, &ptr, "max_dist", 0, NULL, ICON_NONE);
 
   row = uiLayoutRow(layout, true);
-  uiItemR(row, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
+  uiItemR(row, &ptr, "falloff_type", 0, NULL, ICON_NONE);
   uiItemR(row, &ptr, "invert_falloff", 0, "", ICON_ARROW_LEFTRIGHT);
   modifier_panel_end(layout, &ptr);
 }



More information about the Bf-blender-cvs mailing list