[Bf-blender-cvs] [1f70e8b748a] gsoc-2021-porting-modifiers-to-nodes-solidify: - changes based on review by Hans Goudey.

Fabian Schempp noreply at git.blender.org
Thu Jun 24 01:39:10 CEST 2021


Commit: 1f70e8b748a37cc7b4a6f037b5d4b87f22bfe566
Author: Fabian Schempp
Date:   Thu Jun 24 01:37:45 2021 +0200
Branches: gsoc-2021-porting-modifiers-to-nodes-solidify
https://developer.blender.org/rB1f70e8b748a37cc7b4a6f037b5d4b87f22bfe566

- changes based on review by Hans Goudey.

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

M	source/blender/blenkernel/intern/solidify_nonmanifold.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/nodes/geometry/nodes/node_geo_solidify.cc

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

diff --git a/source/blender/blenkernel/intern/solidify_nonmanifold.c b/source/blender/blenkernel/intern/solidify_nonmanifold.c
index b381403babd..574ab975081 100644
--- a/source/blender/blenkernel/intern/solidify_nonmanifold.c
+++ b/source/blender/blenkernel/intern/solidify_nonmanifold.c
@@ -1380,7 +1380,7 @@ Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
         int loopend = mp->loopstart + mp->totloop;
         ml = orig_mloop + mp->loopstart;
         for (int j = mp->loopstart; j < loopend; j++, ml++) {
-            scalar_vgroup = min_ff(solidify_data->distance[i], scalar_vgroup);
+          scalar_vgroup = min_ff(solidify_data->distance[i], scalar_vgroup);
         }
         scalar_vgroup = offset_fac_vg + (scalar_vgroup * offset_fac_vg_inv);
         face_weight[i] = scalar_vgroup;
@@ -1930,7 +1930,6 @@ Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
     (*r_rim_faces)[i] = false;
   }
 
-
   /* Make_new_verts. */
   {
     gs_ptr = orig_vert_groups_arr;
@@ -2164,7 +2163,7 @@ Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
               mpoly[poly_index].loopstart = (int)loop_index;
               mpoly[poly_index].totloop = (int)j;
 
-              if(g->is_orig_closed || !do_rim){
+              if (g->is_orig_closed || !do_rim) {
                 (*r_rim_faces)[poly_index] = true;
               }
 
@@ -2421,7 +2420,7 @@ Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
           mpoly[poly_index].loopstart = (int)loop_index;
           mpoly[poly_index].totloop = (int)k;
 
-          if(fr->reversed != do_flip){
+          if (fr->reversed != do_flip) {
             (*r_shell_faces)[poly_index] = true;
           }
           mpoly[poly_index].flag = fr->face->flag;
@@ -2454,26 +2453,26 @@ Mesh *solidify_nonmanifold(const SolidifyData *solidify_data,
     MEM_freeN(face_edges);
   }
   /* Haven't found a good way to generalize this. */
-  //if (edge_index != numNewEdges) {
-    /*BKE_modifier_set_error(ctx->object,
-                           md,
-                           "Internal Error: edges array wrong size: %u instead of %u",
-                           numNewEdges,
-                           edge_index);*/
+  // if (edge_index != numNewEdges) {
+  /*BKE_modifier_set_error(ctx->object,
+                         md,
+                         "Internal Error: edges array wrong size: %u instead of %u",
+                         numNewEdges,
+                         edge_index);*/
   //}
-  //if (poly_index != numNewPolys) {
-    /*BKE_modifier_set_error(ctx->object,
-                           md,
-                           "Internal Error: polys array wrong size: %u instead of %u",
-                           numNewPolys,f
-                           poly_index);*/
+  // if (poly_index != numNewPolys) {
+  /*BKE_modifier_set_error(ctx->object,
+                         md,
+                         "Internal Error: polys array wrong size: %u instead of %u",
+                         numNewPolys,f
+                         poly_index);*/
   //}
-  //if (loop_index != numNewLoops) {
-    /*BKE_modifier_set_error(ctx->object,
-                           md,
-                           "Internal Error: loops array wrong size: %u instead of %u",
-                           numNewLoops,
-                           loop_index);*/
+  // if (loop_index != numNewLoops) {
+  /*BKE_modifier_set_error(ctx->object,
+                         md,
+                         "Internal Error: loops array wrong size: %u instead of %u",
+                         numNewLoops,
+                         loop_index);*/
   //}
   BLI_assert(edge_index == numNewEdges);
   BLI_assert(poly_index == numNewPolys);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 08728f5eeb4..dd6094385e3 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1273,7 +1273,8 @@ enum {
 #endif
   MOD_SOLIDIFY_FLIP = (1 << 5),
   MOD_SOLIDIFY_SHELL = (1 << 6),
-  MOD_SOLIDIFY_NOSHELL = (1 << 7), /* MOD_SOLIDIFY_SHELL should be used. instead This is kept as long as the Modifier uses it. */
+  MOD_SOLIDIFY_NOSHELL = (1 << 7), /* MOD_SOLIDIFY_SHELL should be used. instead This is kept as
+                                      long as the Modifier uses it. */
   MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP = (1 << 8),
   MOD_SOLIDIFY_NONMANIFOLD_FLAT_FACES = (1 << 9),
 };
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index dd7e25fd2c5..6c65479ec2b 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1237,7 +1237,7 @@ typedef struct NodeInputVector {
   float vector[3];
 } NodeInputVector;
 
-typedef struct NodeGeometrySolidify{
+typedef struct NodeGeometrySolidify {
   /* GeometryNodeAttributeInputMode */
   uint8_t thickness_mode;
   uint8_t nonmanifold_offset_mode;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 3a4da9b1844..a74a1e7c184 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4566,35 +4566,31 @@ static void rna_def_modifier_surface(BlenderRNA *brna)
 
 const EnumPropertyItem nonmanifold_thickness_mode_items[] = {
     {MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_FIXED,
-        "FIXED",
-              0,
-        "Fixed",
-        "Most basic thickness calculation"},
+     "FIXED",
+     0,
+     "Fixed",
+     "Most basic thickness calculation"},
     {MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_EVEN,
-        "EVEN",
-              0,
-        "Even",
-        "Even thickness calculation which takes the angle between faces into account"},
+     "EVEN",
+     0,
+     "Even",
+     "Even thickness calculation which takes the angle between faces into account"},
     {MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS,
-        "CONSTRAINTS",
-              0,
-        "Constraints",
-        "Thickness calculation using constraints, most advanced"},
+     "CONSTRAINTS",
+     0,
+     "Constraints",
+     "Thickness calculation using constraints, most advanced"},
     {0, NULL, 0, NULL, NULL},
 };
 
 const EnumPropertyItem nonmanifold_boundary_mode_items[] = {
     {MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_NONE, "NONE", 0, "None", "No shape correction"},
     {MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_ROUND,
-                                                  "ROUND",
-                                                          0,
-                                                             "Round",
-                                                                     "Round open perimeter shape"},
-    {MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT,
-                                                  "FLAT",
-                                                          0,
-                                                             "Flat",
-                                                                     "Flat open perimeter shape"},
+     "ROUND",
+     0,
+     "Round",
+     "Round open perimeter shape"},
+    {MOD_SOLIDIFY_NONMANIFOLD_BOUNDARY_MODE_FLAT, "FLAT", 0, "Flat", "Flat open perimeter shape"},
     {0, NULL, 0, NULL, NULL},
 };
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 16cc3402911..a161728d721 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9548,12 +9548,12 @@ static void def_geo_solidify(StructRNA *srna)
 
   prop = RNA_def_property(srna, "thickness_mode", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float);
+  RNA_def_property_enum_default(prop, 1);
   RNA_def_property_ui_text(prop, "Thickness", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 
   prop = RNA_def_property(srna, "nonmanifold_offset_mode", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, nonmanifold_thickness_mode_items);
-  RNA_def_property_enum_default(prop,1);
   RNA_def_property_ui_text(prop, "Thickness", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 24d185c568d..0815711ff24 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -48,8 +48,8 @@
 #include "MEM_guardedalloc.h"
 
 #include "MOD_modifiertypes.h"
-#include "MOD_ui_common.h"
 #include "MOD_solidify_util.h"
+#include "MOD_ui_common.h"
 
 static bool dependsOnNormals(ModifierData *md)
 {
@@ -112,7 +112,7 @@ static float *get_distance_factor(Mesh *mesh, Object *ob, const char *name, bool
     }
   }
 
-  if(invert){
+  if (invert) {
     for (int i = 0; i < mesh->totvert; i++) {
       selection[i] = 1.0f - selection[i];
     }
@@ -122,7 +122,7 @@ static float *get_distance_factor(Mesh *mesh, Object *ob, const char *name, bool
 }
 
 static SolidifyData solidify_data_from_modifier_data(ModifierData *md,
-                                                           const ModifierEvalContext *ctx)
+                                                     const ModifierEvalContext *ctx)
 {
   const SolidifyModifierData *smd = (SolidifyModifierData *)md;
   SolidifyData solidify_data = {
@@ -160,20 +160,19 @@ static Mesh *MOD_solidify_nonmanifold(ModifierData *md,
   SolidifyData solidify_data = solidify_data_from_modifier_data(md, ctx);
 
   const bool defgrp_invert = (solidify_data.flag & MOD_SOLIDIFY_VGROUP_INV) != 0;
-  solidify_data.distance = get_distance_factor(
-      mesh, ctx->object, smd->defgrp_name, defgrp_invert);
+  solidify_data.distance = get_distance_factor(mesh, ctx->object, smd->defgrp_name, defgrp_invert);
 
   bool *shell_verts = NULL;
   bool *rim_verts = NULL;
   bool *shell_faces = NULL;
   bool *rim_faces = NULL;
 
-  Mesh *output_mesh = solidify_nonmanifold(&solidify_data, mesh, &shell_verts, &rim_verts, &shell_faces, &rim_faces);
+  Mesh *output_mesh = solidify_nonmanifold(
+      &soli

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list