[Bf-blender-cvs] [ef51c65775d] gsoc-2021-porting-modifiers-to-nodes-solidify: - rebased to master - removed solidify extrude mode from node and reverted solidify extrude back to internal version in modifier - fixed vertex-groups for

Fabian Schempp noreply at git.blender.org
Tue Jun 22 10:49:52 CEST 2021


Commit: ef51c65775d0086b536a303222be485ffa2df69e
Author: Fabian Schempp
Date:   Fri Jun 18 15:59:57 2021 +0200
Branches: gsoc-2021-porting-modifiers-to-nodes-solidify
https://developer.blender.org/rBef51c65775d0086b536a303222be485ffa2df69e

- rebased to master
- removed solidify extrude mode from node and reverted solidify extrude
back to internal version in modifier
- fixed vertex-groups for

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

M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/BKE_solidifiy.h
M	source/blender/blenkernel/CMakeLists.txt
D	source/blender/blenkernel/intern/solidify_extrude.c
M	source/blender/blenkernel/intern/solidify_nonmanifold.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/intern/MOD_solidify.c
D	source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_static_types.h
R091	source/blender/nodes/geometry/nodes/node_geo_solidifiy.cc	source/blender/nodes/geometry/nodes/node_geo_solidify.cc

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

diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index c03b44bdb97..40e46c766ee 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1439,7 +1439,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_SEPARATE_COMPONENTS 1059
 #define GEO_NODE_CURVE_SUBDIVIDE 1060
 #define GEO_NODE_RAYCAST 1061
-#define GEO_NODE_SOLIDIFY 1057
+#define GEO_NODE_SOLIDIFY 1062
 
 /** \} */
 
diff --git a/source/blender/blenkernel/BKE_solidifiy.h b/source/blender/blenkernel/BKE_solidifiy.h
index 1fd885ae665..0a77673fae8 100644
--- a/source/blender/blenkernel/BKE_solidifiy.h
+++ b/source/blender/blenkernel/BKE_solidifiy.h
@@ -41,7 +41,6 @@ typedef struct SolidifyData {
   float *distance;
 } SolidifyData;
 
-Mesh *solidify_extrude(const SolidifyData *solidify_data, Mesh *mesh);
 Mesh *solidify_nonmanifold(const SolidifyData *solidify_data, Mesh *mesh, bool **r_shell_verts, bool **r_rim_verts);
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 3073e3f9142..cc98ce03a65 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -242,7 +242,6 @@ set(SRC
   intern/shrinkwrap.c
   intern/simulation.cc
   intern/softbody.c
-  intern/solidify_extrude.c
   intern/solidify_nonmanifold.c
   intern/sound.c
   intern/speaker.c
diff --git a/source/blender/blenkernel/intern/solidify_extrude.c b/source/blender/blenkernel/intern/solidify_extrude.c
deleted file mode 100644
index 03885770ff6..00000000000
--- a/source/blender/blenkernel/intern/solidify_extrude.c
+++ /dev/null
@@ -1,1253 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/** \file
- * \ingroup modifiers
- */
-
-#include "BLI_utildefines.h"
-#include <BKE_modifier.h>
-#include <DNA_modifier_types.h>
-
-#include "BLI_bitmap.h"
-#include "BLI_math.h"
-#include "BLI_utildefines_stack.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BKE_deform.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_solidifiy.h"
-
-//#include "node_geometry_util.hh"
-
-#ifdef __GNUC__
-#  pragma GCC diagnostic error "-Wsign-conversion"
-#endif
-
-/* -------------------------------------------------------------------- */
-/** \name Local Utilities
- * \{ */
-
-/* specific function for solidify - define locally */
-BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f)
-{
-  r[0] += (float)a[0] * f;
-  r[1] += (float)a[1] * f;
-  r[2] += (float)a[2] * f;
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name High Quality Normal Calculation Function
- * \{ */
-
-/* skip shell thickness for non-manifold edges, see T35710. */
-#define USE_NONMANIFOLD_WORKAROUND
-
-/* *** derived mesh high quality normal calculation function  *** */
-/* could be exposed for other functions to use */
-
-typedef struct EdgeFaceRef {
-  int p1; /* init as -1 */
-  int p2;
-} EdgeFaceRef;
-
-BLI_INLINE bool edgeref_is_init(const EdgeFaceRef *edge_ref)
-{
-  return !((edge_ref->p1 == 0) && (edge_ref->p2 == 0));
-}
-
-/**
- * \param mesh: Mesh to calculate normals for.
- * \param poly_nors: Precalculated face normals.
- * \param r_vert_nors: Return vert normals.
- */
-static void mesh_calc_hq_normal(Mesh *mesh, float (*poly_nors)[3], float (*r_vert_nors)[3])
-{
-  int i, numVerts, numEdges, numPolys;
-  MPoly *mpoly, *mp;
-  MLoop *mloop, *ml;
-  MEdge *medge, *ed;
-  MVert *mvert, *mv;
-
-  numVerts = mesh->totvert;
-  numEdges = mesh->totedge;
-  numPolys = mesh->totpoly;
-  mpoly = mesh->mpoly;
-  medge = mesh->medge;
-  mvert = mesh->mvert;
-  mloop = mesh->mloop;
-
-  /* we don't want to overwrite any referenced layers */
-
-  /* Doesn't work here! */
-#if 0
-  mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, numVerts);
-  cddm->mvert = mv;
-#endif
-
-  mv = mvert;
-  mp = mpoly;
-
-  {
-    EdgeFaceRef *edge_ref_array = MEM_calloc_arrayN(
-        (size_t)numEdges, sizeof(EdgeFaceRef), "Edge Connectivity");
-    EdgeFaceRef *edge_ref;
-    float edge_normal[3];
-
-    /* Add an edge reference if it's not there, pointing back to the face index. */
-    for (i = 0; i < numPolys; i++, mp++) {
-      int j;
-
-      ml = mloop + mp->loopstart;
-
-      for (j = 0; j < mp->totloop; j++, ml++) {
-        /* --- add edge ref to face --- */
-        edge_ref = &edge_ref_array[ml->e];
-        if (!edgeref_is_init(edge_ref)) {
-          edge_ref->p1 = i;
-          edge_ref->p2 = -1;
-        }
-        else if ((edge_ref->p1 != -1) && (edge_ref->p2 == -1)) {
-          edge_ref->p2 = i;
-        }
-        else {
-          /* 3+ faces using an edge, we can't handle this usefully */
-          edge_ref->p1 = edge_ref->p2 = -1;
-#ifdef USE_NONMANIFOLD_WORKAROUND
-          medge[ml->e].flag |= ME_EDGE_TMP_TAG;
-#endif
-        }
-        /* --- done --- */
-      }
-    }
-
-    for (i = 0, ed = medge, edge_ref = edge_ref_array; i < numEdges; i++, ed++, edge_ref++) {
-      /* Get the edge vert indices, and edge value (the face indices that use it) */
-
-      if (edgeref_is_init(edge_ref) && (edge_ref->p1 != -1)) {
-        if (edge_ref->p2 != -1) {
-          /* We have 2 faces using this edge, calculate the edges normal
-           * using the angle between the 2 faces as a weighting */
-#if 0
-          add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]);
-          normalize_v3_length(
-              edge_normal,
-              angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2]));
-#else
-          mid_v3_v3v3_angle_weighted(
-              edge_normal, poly_nors[edge_ref->p1], poly_nors[edge_ref->p2]);
-#endif
-        }
-        else {
-          /* only one face attached to that edge */
-          /* an edge without another attached- the weight on this is undefined */
-          copy_v3_v3(edge_normal, poly_nors[edge_ref->p1]);
-        }
-        add_v3_v3(r_vert_nors[ed->v1], edge_normal);
-        add_v3_v3(r_vert_nors[ed->v2], edge_normal);
-      }
-    }
-    MEM_freeN(edge_ref_array);
-  }
-
-  /* normalize vertex normals and assign */
-  for (i = 0; i < numVerts; i++, mv++) {
-    if (normalize_v3(r_vert_nors[i]) == 0.0f) {
-      normal_short_to_float_v3(r_vert_nors[i], mv->no);
-    }
-  }
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Main Solidify Function
- * \{ */
-static void get_vgroup(
-    const Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
-{
-  *defgrp_index = BKE_object_defgroup_name_index(ob, name);
-  *dvert = NULL;
-
-  if (*defgrp_index != -1) {
-    if (ob->type == OB_LATTICE) {
-      *dvert = BKE_lattice_deform_verts_get(ob);
-    }
-    else if (mesh) {
-      *dvert = mesh->dvert;
-    }
-  }
-}
-
-Mesh *solidify_extrude(const SolidifyData *solidify_data, Mesh *mesh)
-{
-  Mesh *result;
-
-  MVert *mv, *mvert, *orig_mvert;
-  MEdge *ed, *medge, *orig_medge;
-  MLoop *ml, *mloop, *orig_mloop;
-  MPoly *mp, *mpoly, *orig_mpoly;
-  const uint numVerts = (uint)mesh->totvert;
-  const uint numEdges = (uint)mesh->totedge;
-  const uint numPolys = (uint)mesh->totpoly;
-  const uint numLoops = (uint)mesh->totloop;
-  uint newLoops = 0, newPolys = 0, newEdges = 0, newVerts = 0, rimVerts = 0;
-
-  /* only use material offsets if we have 2 or more materials  */
-  const short mat_nr_max = solidify_data->object->totcol > 1 ? solidify_data->object->totcol - 1 : 0;
-  const short mat_ofs = mat_nr_max ? solidify_data->mat_ofs : 0;
-  const short mat_ofs_rim = mat_nr_max ? solidify_data->mat_ofs_rim : 0;
-
-  /* use for edges */
-  /* over-alloc new_vert_arr, old_vert_arr */
-  uint *new_vert_arr = NULL;
-  STACK_DECLARE(new_vert_arr);
-
-  uint *new_edge_arr = NULL;
-  STACK_DECLARE(new_edge_arr);
-
-  uint *old_vert_arr = MEM_calloc_arrayN(
-      numVerts, sizeof(*old_vert_arr), "old_vert_arr in solidify");
-
-  uint *edge_users = NULL;
-  int *edge_order = NULL;
-
-  float(*vert_nors)[3] = NULL;
-  float(*poly_nors)[3] = NULL;
-
-  const bool need_poly_normals = (solidify_data->flag & MOD_SOLIDIFY_NORMAL_CALC) ||
-                                 (solidify_data->flag & MOD_SOLIDIFY_EVEN) ||
-                                 (solidify_data->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP) ||
-                                 (solidify_data->bevel_convex != 0);
-
-  const float ofs_orig = -(((-solidify_data->offset_fac + 1.0f) * 0.5f) * solidify_data->offset);
-  const float ofs_new = solidify_data->offset + ofs_orig;
-  const float offset_fac_vg = solidify_data->offset_fac_vg;
-  const float offset_fac_vg_inv = 1.0f - solidify_data->offset_fac_vg;
-  const float bevel_convex = solidify_data->bevel_convex;
-  const bool do_flip = (solidify_data->flag & MOD_SOLIDIFY_FLIP) != 0;
-  const bool do_clamp = (solidify_data->offset_clamp != 0.0f);
-  const bool do_angle_clamp = do_clamp && (solidify_data->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP) != 0;
-  const bool do_bevel_convex = bevel_convex != 0.0f;
-  const bool do_rim = (solidify_data->flag & MOD_SOLIDIFY_RIM) != 0;
-  const bool do_shell = !(do_rim && (solidify_data->flag & MOD_SOLIDIFY_NOSHELL) != 0);
-
-  /* weights */
-  MDeformVert *dvert = mesh->dvert;
-  const bool defgrp_invert = (solidify_data->flag & MOD_SOLIDIFY_VGROUP_INV) != 0;
-  int defgrp_index = 0;
-  const int shell_defgrp_index = BKE_o

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list