[Bf-blender-cvs] [042fab271fd] modifier-panels-ui: Implement 13 more modifier panels

Hans Goudey noreply at git.blender.org
Wed Apr 1 00:31:56 CEST 2020


Commit: 042fab271fd99db927e6b1b241661e154e574a6a
Author: Hans Goudey
Date:   Tue Mar 31 17:31:41 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB042fab271fd99db927e6b1b241661e154e574a6a

Implement 13 more modifier panels

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

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
M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/modifiers/intern/MOD_subsurf.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c
M	source/blender/modifiers/intern/MOD_triangulate.c
M	source/blender/modifiers/intern/MOD_uvproject.c
M	source/blender/modifiers/intern/MOD_uvwarp.c
M	source/blender/modifiers/intern/MOD_warp.c
M	source/blender/modifiers/intern/MOD_wave.c
M	source/blender/modifiers/intern/MOD_weighted_normal.c

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

diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index badecf55d4c..21805c9996e 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -1212,9 +1212,7 @@ static void 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, "hook_falloff", "Falloff", NULL, falloff_panel_draw, true, panel_type);
+  modifier_panel_register(region_type, "Screw", panel_draw);
 }
 
 ModifierTypeInfo modifierType_Screw = {
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 722673aa24b..17ff7083242 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -29,6 +29,7 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
+#include "DNA_screen_types.h"
 
 #include "BKE_context.h"
 #include "BKE_editmesh.h"
@@ -36,6 +37,7 @@
 #include "BKE_lib_query.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
+#include "BKE_screen.h"
 #include "BKE_shrinkwrap.h"
 
 #include "UI_interface.h"
@@ -45,6 +47,7 @@
 
 #include "DEG_depsgraph_query.h"
 
+#include "MOD_ui_common.h"
 #include "MOD_util.h"
 
 static bool dependsOnNormals(ModifierData *md);
@@ -206,69 +209,89 @@ static bool dependsOnNormals(ModifierData *md)
   return false;
 }
 
-// uiLayout *sub, *row, *col, *split;
-
-// int wrap_method = RNA_enum_get(ptr, "wrap_method");
-// bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
-
-// split = uiLayoutSplit(layout, 0.5f, false);
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Target:"), ICON_NONE);
-// uiItemR(col, ptr, "target", 0, "", ICON_NONE);
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
-// row = uiLayoutRow(col, true);
-// uiItemPointerR(row, ptr, "vertex_group", ob_ptr, "vertex_groups", "", ICON_NONE);
-// sub = uiLayoutRow(row, true);
-// uiLayoutSetActive(sub, has_vertex_group);
-// uiItemR(sub, ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
-
-// split = uiLayoutSplit(layout, 0.5f, false);
-// col = uiLayoutColumn(split, false);
-// uiItemR(col, ptr, "offset", 0, NULL, ICON_NONE);
-
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Mode:"), ICON_NONE);
-// uiItemR(col, ptr, "wrap_method", 0, "", ICON_NONE);
-
-// if (ELEM(wrap_method,
-//          MOD_SHRINKWRAP_PROJECT,
-//          MOD_SHRINKWRAP_NEAREST_SURFACE,
-//          MOD_SHRINKWRAP_TARGET_PROJECT)) {
-//   uiItemR(col, ptr, "wrap_mode", 0, "", ICON_NONE);
-// }
-
-// if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
-//   split = uiLayoutSplit(layout, 0.5f, false);
-//   col = uiLayoutColumn(split, false);
-//   uiItemR(col, ptr, "subsurf_levels", 0, NULL, ICON_NONE);
-
-//   col = uiLayoutColumn(split, false);
-//   uiItemR(col, ptr, "project_limit", 0, IFACE_("Limit"), ICON_NONE);
-
-//   split = uiLayoutSplit(layout, 0.25f, false);
-//   col = uiLayoutColumn(split, false);
-//   uiItemL(col, IFACE_("Axis:"), ICON_NONE);
-//   uiItemR(col, ptr, "use_project_x", 0, NULL, ICON_NONE);
-//   uiItemR(col, ptr, "use_project_y", 0, NULL, ICON_NONE);
-//   uiItemR(col, ptr, "use_project_z", 0, NULL, ICON_NONE);
-
-//   col = uiLayoutColumn(split, false);
-//   uiItemL(col, IFACE_("Direction:"), ICON_NONE);
-//   uiItemR(col, ptr, "use_negative_direction", 0, NULL, ICON_NONE);
-//   uiItemR(col, ptr, "use_positive_direction", 0, NULL, ICON_NONE);
-//   sub = uiLayoutColumn(col, false);
-//   uiLayoutSetActive(sub,
-//                     RNA_boolean_get(ptr, "use_negative_direction") &&
-//                         RNA_enum_get(ptr, "cull_face") != 0);
-//   uiItemR(sub, ptr, "use_invert_cull", 0, NULL, ICON_NONE);
-
-//   col = uiLayoutColumn(split, false);
-//   uiItemL(col, IFACE_("Cull Faces:"), ICON_NONE);
-//   uiItemR(col, ptr, "cull_face", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
-//   uiItemR(layout, ptr, "auxiliary_target", 0, NULL, ICON_NONE);
-// }
+static void panel_draw(const bContext *C, Panel *panel)
+{
+  uiLayout *sub, *row;
+  uiLayout *layout = panel->layout;
+
+  PointerRNA ptr;
+  PointerRNA ob_ptr;
+  modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+  bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+  uiItemR(layout, &ptr, "target", 0, "", ICON_NONE);
+
+  row = uiLayoutRow(layout, true);
+  uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, has_vertex_group);
+  uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
+
+  uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
+
+  modifier_panel_end(layout, &ptr);
+}
+
+static void mode_panel_draw(const bContext *C, Panel *panel)
+{
+  uiLayout *sub, *row, *split, *col;
+  uiLayout *layout = panel->layout;
+
+  PointerRNA ptr;
+  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+  int wrap_method = RNA_enum_get(&ptr, "wrap_method");
+
+  uiItemR(layout, &ptr, "wrap_method", 0, "", ICON_NONE);
+
+  if (ELEM(wrap_method,
+           MOD_SHRINKWRAP_PROJECT,
+           MOD_SHRINKWRAP_NEAREST_SURFACE,
+           MOD_SHRINKWRAP_TARGET_PROJECT)) {
+    uiItemR(layout, &ptr, "wrap_mode", 0, "", ICON_NONE);
+  }
+
+  if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
+    split = uiLayoutSplit(layout, 0.5f, false);
+    col = uiLayoutColumn(split, false);
+    uiItemR(col, &ptr, "subsurf_levels", 0, NULL, ICON_NONE);
+
+    col = uiLayoutColumn(split, false);
+    uiItemR(col, &ptr, "project_limit", 0, IFACE_("Limit"), ICON_NONE);
+
+    split = uiLayoutSplit(layout, 0.5f, false);
+    col = uiLayoutColumn(split, true);
+    uiItemL(col, IFACE_("Axis:"), ICON_NONE);
+    uiItemR(col, &ptr, "use_project_x", 0, NULL, ICON_NONE);
+    uiItemR(col, &ptr, "use_project_y", 0, NULL, ICON_NONE);
+    uiItemR(col, &ptr, "use_project_z", 0, NULL, ICON_NONE);
+
+    col = uiLayoutColumn(split, true);
+    uiItemL(col, IFACE_("Direction:"), ICON_NONE);
+    uiItemR(col, &ptr, "use_negative_direction", 0, NULL, ICON_NONE);
+    uiItemR(col, &ptr, "use_positive_direction", 0, NULL, ICON_NONE);
+    sub = uiLayoutColumn(col, false);
+    uiLayoutSetActive(sub,
+                      RNA_boolean_get(&ptr, "use_negative_direction") &&
+                          RNA_enum_get(&ptr, "cull_face") != 0);
+    uiItemR(sub, &ptr, "use_invert_cull", 0, NULL, ICON_NONE);
+
+    col = uiLayoutColumn(layout, true);
+    uiItemL(col, IFACE_("Cull Faces:"), ICON_NONE);
+    row = uiLayoutRow(col, false);
+    uiItemR(row, &ptr, "cull_face", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+    uiItemR(layout, &ptr, "auxiliary_target", 0, NULL, ICON_NONE);
+  }
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+  PanelType *panel_type = modifier_panel_register(region_type, "Shrinkwrap", panel_draw);
+  modifier_subpanel_register(
+      region_type, "shrinkwrap_mode", "Mode", NULL, mode_panel_draw, true, panel_type);
+}
 
 ModifierTypeInfo modifierType_Shrinkwrap = {
     /* name */ "Shrinkwrap",
@@ -298,5 +321,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = {
     /* foreachIDLink */ NULL,
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
-    /* panelRegister */ NULL,
+    /* panelRegister */ panelRegister,
 };
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 6368f74a49a..be11e5d425e 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -30,6 +30,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
+#include "DNA_screen_types.h"
 
 #include "BKE_context.h"
 #include "BKE_deform.h"
@@ -38,6 +39,7 @@
 #include "BKE_lib_query.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
+#include "BKE_screen.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
@@ -46,6 +48,7 @@
 
 #include "DEG_depsgraph_query.h"
 
+#include "MOD_ui_common.h"
 #include "MOD_util.h"
 
 #include "bmesh.h"
@@ -455,54 +458,83 @@ static void deformVertsEM(ModifierData *md,
   }
 }
 
-// uiLayout *sub, *row, *col, *split;
-
-// int deform_method = RNA_enum_get(ptr, "deform_method");
-// bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
-
-// row = uiLayoutRow(layout, false);
-// uiItemR(row, ptr, "deform_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
-// uiItemL(layout, IFACE_("Vertex Group:"), ICON_NONE);
-// row = uiLayoutRow(layout, true);
-// uiItemPointerR(row, ptr, "vertex_group", ob_ptr, "vertex_groups", "", ICON_NONE);
-// sub = uiLayoutRow(row, true);
-// uiLayoutSetActive(sub, has_vertex_group);
-// uiItemR(sub, ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
-
-// split = uiLayoutSplit(layout, 0.5f, false);
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Axis Origin:"), ICON_NONE);
-// uiItemR(col, ptr, "origin", 0, "", ICON_NONE);
-// uiItemR(col, ptr, "deform_axis", 0, NULL, ICON_NONE);
-
-// if (ELEM(deform_method,
-//          MOD_SIMPLEDEFORM_MODE_TAPER,
-//          MOD_SIMPLEDEFORM_MODE_STRETCH,
-//          MOD_SIMPLEDEFORM_MODE_TWIST)) {
-//   row = uiLayoutRow(col, true);
-//   uiItemL(row, IFACE_("Lock:"), ICON_NONE);
-//   int deform_axis = RNA_enum_get(ptr, "deform_axis");
-//   if (deform_axis != 0) {
-//     uiItemR(row, ptr, "lock_x", 0, NULL, ICON_NONE);
-//   }
-//   if (deform_axis != 1) {
-//     uiItemR(row, ptr, "lock_y", 0, NULL, ICON_NONE);
-//   }
-//   if (deform_axis != 2) {
-//     uiItemR(row, ptr, "lock_z", 0, NULL, ICON_NONE);
-//   }
-// }
-
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Deform:"), ICON_NONE);
-// if (ELEM(deform_method, MOD_SIMPLEDEFORM_MODE_TAPER, MOD_SIMPLEDEFORM_MODE_STRETCH)) {
-//   uiItemR(col, ptr, "factor", 0, NULL, ICON_NONE);
-// }
-// else {
-//   uiItemR(col, ptr, "angle", 0, NULL, ICON_NONE);
-// }
-// uiItemR(col, ptr, "limits", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+static void panel_dr

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list