[Bf-blender-cvs] [703bdbe4922] soc-2021-porting-modifiers-to-nodes-decimate: removed decimate node and reformatting

Fabian Schempp noreply at git.blender.org
Fri Jul 2 21:56:50 CEST 2021


Commit: 703bdbe4922ba2193860611131baaa44108b8ffe
Author: Fabian Schempp
Date:   Fri Jul 2 21:49:59 2021 +0200
Branches: soc-2021-porting-modifiers-to-nodes-decimate
https://developer.blender.org/rB703bdbe4922ba2193860611131baaa44108b8ffe

removed decimate node and reformatting

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

M	source/blender/blenkernel/BKE_node.h
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_static_types.h
M	source/blender/nodes/geometry/nodes/node_geo_collapse.cc
D	source/blender/nodes/geometry/nodes/node_geo_decimate.cc
M	source/blender/nodes/geometry/nodes/node_geo_dissolve.cc
M	source/blender/nodes/geometry/nodes/node_geo_unsubdivide.cc

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

diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 60fe0df17cb..868d154f21e 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1439,10 +1439,9 @@ 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_DECIMATE 1062
-#define GEO_NODE_COLLAPSE 1063
-#define GEO_NODE_UNSUBDIVIDE 1064
-#define GEO_NODE_DISSOLVE 1065
+#define GEO_NODE_COLLAPSE 1062
+#define GEO_NODE_UNSUBDIVIDE 1063
+#define GEO_NODE_DISSOLVE 1064
 /** \} */
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index a8caa8b73e0..622aa1917e9 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1388,11 +1388,6 @@ typedef struct NodeGeometryRaycast {
   char _pad[1];
 } NodeGeometryRaycast;
 
-typedef struct NodeGeometryDecimate {
-  uint8_t mode;
-  char _pad[7];
-} NodeGeometryDecimate;
-
 typedef struct NodeGeometryCollapse {
   int symmetry_axis;
   char _pad[4];
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index f19a7b248cc..cd7e434fb3a 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9859,27 +9859,15 @@ static void def_geo_curve_resample(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
-static void def_geo_decimate(StructRNA *srna)
-{
-  PropertyRNA *prop;
-
-  RNA_def_struct_sdna_from(srna, "NodeGeometryDecimate", "storage");
-
-  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_items(prop, modifier_decim_mode_items);
-  RNA_def_property_ui_text(prop, "Mode", "Sets the algorithm");
-  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
-}
-
 static void def_geo_collapse(StructRNA *srna)
 {
   PropertyRNA *prop;
 
   static EnumPropertyItem symmetry_axis_items[] = {
-      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_NONE, "OFF", 0,"Off", "No Symmetry is applied"},
-      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_X, "X", 0,"X", "Symmetry is applied on X axis"},
-      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Y, "Y", 0,"Y", "Symmetry is applied on Y axis"},
-      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Z, "Z", 0,"Z", "Symmetry is applied on Z axis"},
+      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_NONE, "OFF", 0, "Off", "No Symmetry is applied"},
+      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_X, "X", 0, "X", "Symmetry is applied on X axis"},
+      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Y, "Y", 0, "Y", "Symmetry is applied on Y axis"},
+      {GEO_NODE_COLLAPSE_SYMMETRY_AXIS_Z, "Z", 0, "Z", "Symmetry is applied on Z axis"},
       {0, NULL, 0, NULL, NULL},
   };
 
@@ -9887,7 +9875,8 @@ static void def_geo_collapse(StructRNA *srna)
 
   prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, symmetry_axis_items);
-  RNA_def_property_ui_text(prop, "Symmetry", "Sets if and on what axis symmetry is applied by the operation");
+  RNA_def_property_ui_text(
+      prop, "Symmetry", "Sets if and on what axis symmetry is applied by the operation");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
@@ -9896,11 +9885,15 @@ static void def_geo_dissolve(StructRNA *srna)
   PropertyRNA *prop;
 
   static EnumPropertyItem delimiter_items[] = {
-      {GEO_NODE_DISSOLVE_DELIMITTER_NORMAL, "normal", 0,"Normal", "No Symmetry is applied"},
-      {GEO_NODE_DISSOLVE_DELIMITTER_MATERIAL, "material", 0,"Material", "Symmetry is applied on X axis"},
-      {GEO_NODE_DISSOLVE_DELIMITTER_SEAM, "seam", 0,"Seam", "Symmetry is applied on Y axis"},
-      {GEO_NODE_DISSOLVE_DELIMITTER_SHARP, "sharp", 0,"Sharp", "Symmetry is applied on Z axis"},
-      {GEO_NODE_DISSOLVE_DELIMITTER_UV, "uv", 0,"UV", "Symmetry is applied on Z axis"},
+      {GEO_NODE_DISSOLVE_DELIMITTER_NORMAL, "normal", 0, "Normal", "No Symmetry is applied"},
+      {GEO_NODE_DISSOLVE_DELIMITTER_MATERIAL,
+       "material",
+       0,
+       "Material",
+       "Symmetry is applied on X axis"},
+      {GEO_NODE_DISSOLVE_DELIMITTER_SEAM, "seam", 0, "Seam", "Symmetry is applied on Y axis"},
+      {GEO_NODE_DISSOLVE_DELIMITTER_SHARP, "sharp", 0, "Sharp", "Symmetry is applied on Z axis"},
+      {GEO_NODE_DISSOLVE_DELIMITTER_UV, "uv", 0, "UV", "Symmetry is applied on Z axis"},
       {0, NULL, 0, NULL, NULL},
   };
 
@@ -9908,7 +9901,8 @@ static void def_geo_dissolve(StructRNA *srna)
 
   prop = RNA_def_property(srna, "delimiter", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, delimiter_items);
-  RNA_def_property_ui_text(prop, "Limit", "Sets if and on what axis symmetry is applied by the operation");
+  RNA_def_property_ui_text(
+      prop, "Limit", "Sets if and on what axis symmetry is applied by the operation");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 8e6989b8cee..863b6efb897 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -172,7 +172,6 @@ set(SRC
   geometry/nodes/node_geo_curve_subdivide.cc
   geometry/nodes/node_geo_delete_geometry.cc
   geometry/nodes/node_geo_dissolve.cc
-  geometry/nodes/node_geo_decimate.cc
   geometry/nodes/node_geo_edge_split.cc
   geometry/nodes/node_geo_input_material.cc
   geometry/nodes/node_geo_is_viewport.cc
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 7d12633c7f6..27a126cbc80 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -295,7 +295,6 @@ DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, "CURVE_LENGTH", CurveLength, "Cu
 DefNode(GeometryNode, GEO_NODE_CURVE_RESAMPLE, def_geo_curve_resample, "CURVE_RESAMPLE", CurveResample, "Resample Curve", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_SUBDIVIDE, def_geo_curve_subdivide, "CURVE_SUBDIVIDE", CurveSubdivide, "Curve Subdivide", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", CurveToMesh, "Curve to Mesh", "")
-DefNode(GeometryNode, GEO_NODE_DECIMATE, def_geo_decimate, "DECIMATE", Decimate, "Decimate", "")
 DefNode(GeometryNode, GEO_NODE_DISSOLVE, def_geo_dissolve, "DISSOLVE", Dissolve, "Dissolve", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_REVERSE, 0, "CURVE_REVERSE", CurveReverse, "Curve Reverse", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, def_geo_curve_to_points, "CURVE_TO_POINTS", CurveToPoints, "Curve to Points", "")
@@ -331,7 +330,7 @@ DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, 0, "SUBDIVISION_SURFACE", Su
 DefNode(GeometryNode, GEO_NODE_SWITCH, def_geo_switch, "SWITCH", Switch, "Switch", "")
 DefNode(GeometryNode, GEO_NODE_TRANSFORM, 0, "TRANSFORM", Transform, "Transform", "")
 DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, "TRIANGULATE", Triangulate, "Triangulate", "")
-DefNode(GeometryNode, GEO_NODE_UNSUBDIVIDE, def_geo_decimate, "UNSUBDIVIDE", Unsubdivide, "Unsubdivide", "")
+DefNode(GeometryNode, GEO_NODE_UNSUBDimIVIDE, 0, "UNSUBDIVIDE", Unsubdivide, "Unsubdivide", "")
 DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "")
 
 /* undefine macros */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_collapse.cc b/source/blender/nodes/geometry/nodes/node_geo_collapse.cc
index e66628e71d8..37974931bea 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collapse.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collapse.cc
@@ -14,11 +14,14 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "UI_interface.h"
-#include "UI_resources.h"
+#include "BKE_mesh.h"
+
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
-#include "BKE_mesh.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
 #include "bmesh.h"
 #include "bmesh_tools.h"
 
@@ -37,9 +40,13 @@ static bNodeSocketTemplate geo_node_collapse_out[] = {
     {-1, ""},
 };
 
-namespace blender::nodes{
+namespace blender::nodes {
 
-static Mesh *collapseMesh(const float factor, const GVArrayPtr &selection, const bool triangulate, const int symmetry_axis, Mesh *mesh)
+static Mesh *collapseMesh(const float factor,
+                          const GVArrayPtr &selection,
+                          const bool triangulate,
+                          const int symmetry_axis,
+                          Mesh *mesh)
 {
   if (factor == 1.0f) {
     return mesh;
@@ -47,22 +54,18 @@ static Mesh *collapseMesh(const float factor, const GVArrayPtr &selection, const
 
   BMesh *bm;
 
-  float *mask = (float*)MEM_malloc_arrayN(mesh->totvert, sizeof(float), __func__);
+  float *mask = (float *)MEM_malloc_arrayN(mesh->totvert, sizeof(float), __func__);
   for (int i : selection->typed<float>().index_range()) {
     mask[i] = selection->typed<float>()[i];
   }
 
   BMeshCreateParams bmesh_create_params = {0};
-  BMeshFromMeshParams bmesh_from_mesh_params = {true ,0,0,0,{CD_MASK_ORIGINDEX,CD_MASK_ORIGINDEX,CD_MASK_ORIGINDEX}};
+  BMeshFromMeshParams bmesh_from_mesh_params = {
+      true, 0, 0, 0, {CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX}};
   bm = BKE_mesh_to_bmesh_ex(mesh, &bmesh_create_params, &bmesh_from_mesh_params);
 
- const float symmetry_eps = 0.00002f;
- BM_mesh_decimate_collapse(bm,
-                                factor, mask,
-                                1.0f,
-                                triangulate,
-                                symmetry_axis,
-                                symmetry_eps);
+  const float symmetry_eps = 0.00002f;
+  BM_mesh_decimate_collapse(bm, factor, mask, 1.0f, triangulate, symmetry_axis, symmetry_eps);
   MEM_freeN(mask);
   Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
   BM_mesh_free(bm);
@@ -90,7 +93,7 @@ static void geo_node_collapse_exec(GeoNodeExecParams params)
   GeometrySet geometry_set = param

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list