[Bf-blender-cvs] [249c5663d81] modifier-panels-ui: Implement more modifier panels

Hans Goudey noreply at git.blender.org
Tue Mar 31 19:11:41 CEST 2020


Commit: 249c5663d81e43f805ea0a490763c2a7385688d0
Author: Hans Goudey
Date:   Tue Mar 31 12:10:10 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB249c5663d81e43f805ea0a490763c2a7385688d0

Implement more modifier panels

Alphabetically to MOD_screw.c

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

M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_boolean.c
M	source/blender/modifiers/intern/MOD_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/modifiers/intern/MOD_lattice.c
M	source/blender/modifiers/intern/MOD_mask.cc
M	source/blender/modifiers/intern/MOD_meshcache.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_multires.c
M	source/blender/modifiers/intern/MOD_normal_edit.c
M	source/blender/modifiers/intern/MOD_ocean.c
M	source/blender/modifiers/intern/MOD_particleinstance.c
M	source/blender/modifiers/intern/MOD_particlesystem.c
M	source/blender/modifiers/intern/MOD_remesh.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_ui_common.c
M	source/blender/modifiers/intern/MOD_ui_common.h

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

diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 2ca876f5ec2..66f52b87a92 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -882,6 +882,8 @@ static void array_merge_panel_draw(const bContext *C, Panel *panel)
   uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_merge_vertices"));
   uiItemR(col, &ptr, "use_merge_vertices_cap", 0, IFACE_("First Last"), ICON_NONE);
   uiItemR(col, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE);
+
+  modifier_panel_end(layout, &ptr);
 }
 
 static void panelRegister(ARegionType *region_type)
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index ac21720cb76..b19076b6754 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -379,6 +379,8 @@ static void panel_draw(const bContext *C, Panel *panel)
   if (G.debug) {
     uiItemR(col, &ptr, "debug_options", 0, "", ICON_NONE);
   }
+
+  modifier_panel_end(layout, &ptr);
 }
 
 static void panelRegister(ARegionType *region_type)
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 875f0038a15..b6563823390 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -777,8 +777,8 @@ static void deformVertsEM(ModifierData *md,
 static void panel_draw(const bContext *C, Panel *panel)
 {
   uiLayout *sub, *row, *col, *split;
-
   uiLayout *layout = panel->layout;
+
   PointerRNA ptr;
   PointerRNA ob_ptr;
   modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 4e0233732a4..caf38a4d2ab 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.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_action.h"
 #include "BKE_colortools.h"
@@ -40,6 +41,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"
@@ -50,6 +52,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "MOD_ui_common.h"
 #include "MOD_util.h"
 
 static void initData(ModifierData *md)
@@ -396,53 +399,78 @@ static void deformVertsEM(struct ModifierData *md,
   }
 }
 
-// uiLayout *sub, *row, *col, *split;
-
-// bool use_falloff = RNA_enum_get(ptr, "falloff_type") != eWarp_Falloff_None;
-// PointerRNA hook_object_ptr = RNA_pointer_get(ptr, "object");
-// bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
-
-// split = uiLayoutSplit(layout, 0.5f, false);
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Object:"), ICON_NONE);
-// uiItemR(col, ptr, "object", 0, "", ICON_NONE);
-// if (!RNA_pointer_is_null(&hook_object_ptr) &&
-//     RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
-//   uiItemL(col, IFACE_("Bone:"), ICON_NONE);
-//   PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
-//   uiItemPointerR(col, ptr, "subtarget", &hook_object_data_ptr, "bones", "", 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);
-
-// uiItemS(layout);
-
-// row = uiLayoutRow(layout, true);
-// if (use_falloff) {
-//   uiItemR(row, ptr, "falloff_radius", 0, NULL, ICON_NONE);
-// }
-// uiItemR(row, ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-
-// uiItemR(layout, ptr, "falloff_type", 0, NULL, ICON_NONE);
-// if (use_falloff && RNA_enum_get(ptr, "falloff_type") == eWarp_Falloff_Curve) {
-//   uiTemplateCurveMapping(layout, ptr, "falloff_curve", 0, false, false, false, false);
-// }
-
-// uiItemR(layout, ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
-
-// if (RNA_enum_get(ob_ptr, "mode") == OB_MODE_EDIT) {
-//   row = uiLayoutRow(layout, true);
-//   uiItemO(row, "Reset", ICON_NONE, "OBJECT_OT_hook_reset");
-//   uiItemO(row, "Recenter", ICON_NONE, "OBJECT_OT_hook_recenter");
-//   row = uiLayoutRow(layout, true);
-//   uiItemO(row, "Select", ICON_NONE, "OBJECT_OT_hook_select");
-//   uiItemO(row, "Assign", ICON_NONE, "OBJECT_OT_hook_assign");
-// }
+static void panel_draw(const bContext *C, Panel *panel)
+{
+  uiLayout *sub, *row, *col, *split;
+  uiLayout *layout = panel->layout;
+
+  PointerRNA ptr;
+  PointerRNA ob_ptr;
+  modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+  PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
+  bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+  split = uiLayoutSplit(layout, 0.5f, false);
+  col = uiLayoutColumn(split, false);
+  uiItemL(col, IFACE_("Object:"), ICON_NONE);
+  uiItemR(col, &ptr, "object", 0, "", ICON_NONE);
+  if (!RNA_pointer_is_null(&hook_object_ptr) &&
+      RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
+    uiItemL(col, IFACE_("Bone:"), ICON_NONE);
+    PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
+    uiItemPointerR(col, &ptr, "subtarget", &hook_object_data_ptr, "bones", "", 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);
+
+  uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
+  if (RNA_enum_get(&ob_ptr, "mode") == OB_MODE_EDIT) {
+    row = uiLayoutRow(layout, true);
+    uiItemO(row, "Reset", ICON_NONE, "OBJECT_OT_hook_reset");
+    uiItemO(row, "Recenter", ICON_NONE, "OBJECT_OT_hook_recenter");
+    row = uiLayoutRow(layout, true);
+    uiItemO(row, "Select", ICON_NONE, "OBJECT_OT_hook_select");
+    uiItemO(row, "Assign", ICON_NONE, "OBJECT_OT_hook_assign");
+  }
+
+  modifier_panel_end(layout, &ptr);
+}
+
+static void falloff_panel_draw(const bContext *C, Panel *panel)
+{
+  uiLayout *row, *layout = panel->layout;
+
+  PointerRNA ptr;
+  modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+  bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None;
+
+  uiItemR(layout, &ptr, "falloff_type", 0, NULL, ICON_NONE);
+
+  row = uiLayoutRow(layout, false);
+  uiLayoutSetActive(row, use_falloff);
+  uiItemR(layout, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
+
+  if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
+    uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
+  }
+
+  uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+  PanelType *panel_type = modifier_panel_register(region_type, "Hook", panel_draw);
+  modifier_subpanel_register(
+      region_type, "hook_falloff", "Falloff", NULL, falloff_panel_draw, true, panel_type);
+}
 
 ModifierTypeInfo modifierType_Hook = {
     /* name */ "Hook",
@@ -470,5 +498,5 @@ ModifierTypeInfo modifierType_Hook = {
     /* foreachIDLink */ NULL,
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
-    /* panelRegister */ NULL,
+    /* panelRegister */ panelRegister,
 };
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 06c81c0c78d..a6c451773f8 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -33,6 +33,7 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_screen_types.h"
 
 #include "BKE_context.h"
 #include "BKE_deform.h"
@@ -41,12 +42,14 @@
 #include "BKE_mesh_mapping.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_particle.h"
+#include "BKE_screen.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
 
 #include "RNA_access.h"
 
+#include "MOD_ui_common.h"
 #include "MOD_util.h"
 
 #include "eigen_capi.h"
@@ -810,28 +813,43 @@ static void freeData(ModifierData *md)
   lmd->total_verts = 0;
 }
 
-// uiLayout *sub, *row;
+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 is_bind = RNA_boolean_get(ptr, "is_bind");
-// bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
+  bool is_bind = RNA_boolean_get(&ptr, "is_bind");
+  bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
 
-// uiItemR(layout, ptr, "iterations", 0, NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
 
-// row = uiLayoutRow(layout, true);
-// uiLayoutSetEnabled(row, !is_bind);
-// uiItemPointerR(row, ptr, "vertex_group", ob_ptr, "vertex_groups", NULL, ICON_NONE);
-// sub = uiLayoutRow(row, true);
-// uiLayoutSetActive(sub, has_vertex_group);
-// uiItemR(sub, ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
+  row = uiLayoutRow(layout, true);
+  uiLayoutSetEnabled(row, !is_bind);
+  uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+  sub = uiLayoutRow(row, true);
+  uiLayoutSetActive(sub, has_vertex_group);
+  uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
 
-// uiItemS(layout);
+  uiItemS(layout);
 
-// row = uiLayoutRow(layout, true);
-// uiLayoutSetEnabled(row, has_vertex_group);
-// uiItemO(row,
-//         (RNA_boolean_get(ptr, "is_bind") ? IFACE_("Unbind") : IFACE_("Bind")),
-//         ICON_NONE,
-//         "OBJECT_OT_laplaciandeform_bind");
+  row = uiLayoutRow(layout, true);
+  uiLayoutSe

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list