[Bf-blender-cvs] [7425af128f3] soc-2021-porting-modifiers-to-nodes-merge-by-distance: initial commit
Fabian Schempp
noreply at git.blender.org
Fri Jul 23 12:04:13 CEST 2021
Commit: 7425af128f370351bccf905f29d8b63cb30dd0e2
Author: Fabian Schempp
Date: Fri Jul 23 08:14:34 2021 +0200
Branches: soc-2021-porting-modifiers-to-nodes-merge-by-distance
https://developer.blender.org/rB7425af128f370351bccf905f29d8b63cb30dd0e2
initial commit
===================================================================
M release/scripts/startup/nodeitems_builtins.py
M source/blender/CMakeLists.txt
M source/blender/blenkernel/BKE_node.h
M source/blender/blenkernel/intern/node.cc
A source/blender/geometry/CMakeLists.txt
A source/blender/geometry/GEO_weld.h
A source/blender/geometry/intern/weld.c
M source/blender/makesdna/DNA_defaults.h
M source/blender/makesdna/DNA_modifier_defaults.h
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/RNA_enum_types.h
M source/blender/makesrna/intern/CMakeLists.txt
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/intern/MOD_weld.c
M source/blender/nodes/CMakeLists.txt
M source/blender/nodes/NOD_geometry.h
M source/blender/nodes/NOD_static_types.h
A source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc
D source/blender/nodes/geometry/nodes/node_geo_remesh_quads.cc
===================================================================
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 309c2b542bb..1a81e79c8f4 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -550,7 +550,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeEdgeSplit"),
NodeItem("GeometryNodeSubdivisionSurface"),
NodeItem("GeometryNodeMeshSubdivide"),
- NodeItem("GeometryNodeRemeshQuads"),
+ NodeItem("GeometryNodeMergeByDistance"),
]),
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 8d18cf0ae9a..c1adb29812d 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -118,6 +118,7 @@ add_subdirectory(blenloader)
add_subdirectory(depsgraph)
add_subdirectory(ikplugin)
add_subdirectory(simulation)
+add_subdirectory(geometry)
add_subdirectory(gpu)
add_subdirectory(imbuf)
add_subdirectory(nodes)
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index e7ca27678a4..f6ad4f34ef3 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1465,7 +1465,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_CURVE_ENDPOINTS 1069
#define GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL 1070
#define GEO_NODE_CURVE_TRIM 1071
-#define GEO_NODE_REMESH_QUADS 1072
+#define GEO_NODE_MERGE_BY_DISTANCE 1072
/** \} */
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index e306113265c..8e7e8522b03 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5147,7 +5147,7 @@ static void registerGeometryNodes()
register_node_type_geo_point_translate();
register_node_type_geo_points_to_volume();
register_node_type_geo_raycast();
- register_node_type_geo_remesh_quads();
+ register_node_type_geo_merge_by_distance();
register_node_type_geo_sample_texture();
register_node_type_geo_select_by_material();
register_node_type_geo_separate_components();
diff --git a/source/blender/geometry/CMakeLists.txt b/source/blender/geometry/CMakeLists.txt
new file mode 100644
index 00000000000..282a041dd7b
--- /dev/null
+++ b/source/blender/geometry/CMakeLists.txt
@@ -0,0 +1,44 @@
+ # ***** BEGIN GPL LICENSE BLOCK *****
+ #
+ # 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.
+ #
+ # The Original Code is Copyright (C) 2006, Blender Foundation
+ # All rights reserved.
+ # ***** END GPL LICENSE BLOCK *****
+
+ set(INC
+ .
+ ../blenfont
+ ../blenkernel
+ ../blenlib
+ ../blentranslation
+ ../makesdna
+ ../makesrna
+ ../../../intern/guardedalloc
+ ../makesdna/intern
+ ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
+ )
+
+ set(SRC
+ intern/weld.c
+ GEO_weld.h
+ )
+
+ set(LIB
+ bf_blenkernel
+ bf_blenlib
+ )
+
+ blender_add_lib(bf_geometry "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
\ No newline at end of file
diff --git a/source/blender/makesdna/DNA_defaults.h b/source/blender/geometry/GEO_weld.h
similarity index 58%
copy from source/blender/makesdna/DNA_defaults.h
copy to source/blender/geometry/GEO_weld.h
index 1549e33b267..08bcb789eaa 100644
--- a/source/blender/makesdna/DNA_defaults.h
+++ b/source/blender/geometry/GEO_weld.h
@@ -1,4 +1,3 @@
-
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,36 +16,22 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*/
+#pragma once
/** \file
- * \ingroup DNA
- *
- * \see dna_defaults.c for details on how to use this system.
+ * \ingroup geo
*/
-#pragma once
-
-#include "BLI_utildefines.h"
-
-#include "dna_type_offsets.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-extern const void *DNA_default_table[SDNA_TYPE_MAX];
-
-char *_DNA_struct_default_alloc_impl(const char *data_src, size_t size, const char *alloc_str);
-
-/**
- * Wrap with macro that casts correctly.
- */
-#define DNA_struct_default_get(struct_name) \
- (const struct_name *)DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)]
+enum {
+ WELD_MODE_ALL = 0,
+ WELD_MODE_CONNECTED = 1,
+};
-#define DNA_struct_default_alloc(struct_name) \
- (struct_name *)_DNA_struct_default_alloc_impl( \
- DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], sizeof(struct_name), __func__)
+Mesh *GEO_weld(const Mesh *mesh, const bool *mask, const float merge_distance, const int weld_mode);
#ifdef __cplusplus
}
diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/geometry/intern/weld.c
similarity index 90%
copy from source/blender/modifiers/intern/MOD_weld.c
copy to source/blender/geometry/intern/weld.c
index fe2d699aea8..1d6933e70b9 100644
--- a/source/blender/modifiers/intern/MOD_weld.c
+++ b/source/blender/geometry/intern/weld.c
@@ -1,32 +1,3 @@
-/*
- * 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.
- *
- * The Original Code is Copyright (C) 2005 by the Blender Foundation.
- * All rights reserved.
- */
-
-/** \file
- * \ingroup modifiers
- *
- * Weld modifier: Remove doubles.
- */
-
-/* TODOs:
- * - Review weight and vertex color interpolation.;
- */
-
//#define USE_WELD_DEBUG
//#define USE_WELD_NORMALS
//#define USE_BVHTREEKDOP
@@ -36,38 +7,21 @@
#include "BLI_utildefines.h"
#include "BLI_alloca.h"
-#include "BLI_bitmap.h"
#include "BLI_kdtree.h"
#include "BLI_math.h"
-#include "BLT_translation.h"
-
-#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
#ifdef USE_BVHTREEKDOP
# include "BKE_bvhutils.h"
#endif
#include "BKE_context.h"
-#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
-#include "BKE_screen.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "RNA_access.h"
-
-#include "DEG_depsgraph.h"
-
-#include "MOD_modifiertypes.h"
-#include "MOD_ui_common.h"
+#include "GEO_weld.h" // Own include.
/* Indicates when the element was not computed. */
#define OUT_OF_CONTEXT (uint)(-1)
@@ -930,7 +884,7 @@ static void weld_poly_loop_ctx_alloc(const MPoly *mpoly,
static void weld_poly_split_recursive(const uint *vert_dest_map,
#ifdef USE_WELD_DEBUG
- const MLoop *mloop,
+ const MLoop *mloop,
#endif
uint ctx_verts_len,
WeldPoly *r_wp,
@@ -955,7 +909,7 @@ static void weld_poly_split_recursive(const uint *vert_dest_map,
}
const uint la_len = ctx_loops_len - 1;
for (uint la = 0; la < la_len; la++, wla++) {
- wa_continue:
+ wa_continue:
if (wla->flag == ELEM_COLLAPSED) {
continue;
}
@@ -1026,7 +980,7 @@ static void weld_poly_split_recursive(const uint *vert_dest_map,
new_wp->len = dist_a;
weld_poly_split_recursive(vert_dest_map,
#ifdef USE_WELD_DEBUG
- mloop,
+ mloop,
#endif
ctx_verts_len,
new_wp,
@@ -1070,7 +1024,7 @@ static void weld_poly_split_recursive(const uint *vert_dest_map,
static void weld_poly_loop_ctx_setup(const MLoop *mloop,
#ifdef USE_WELD_DEBUG
- const MPoly *mpoly,
+ const MPoly *mpoly,
const uint mpoly_len,
const uint mloop_len,
#endif
@@ -1137,7 +1091,7 @@ static void weld_poly_loop_ctx_setup(const MLoop *mloop,
weld_poly_split_recursive(vert_dest_map,
#ifdef USE_WELD_DEBUG
- mloop,
+ mloop,
#endif
ctx_verts_len,
wp,
@@ -1353,7 +1307,7 @@ static void weld_mesh_context_create(const Mesh *mesh,
weld_poly_loop_ctx_setup(mloop,
#ifdef USE_WELD_DEBUG
- mpoly,
+ mpoly,
mpoly_len,
mloop_len,
#endif
@@ -1573,15 +1527,10 @@ struct WeldVertexCluster {
uint merged_verts;
};
-static Mesh *weldModifier_doWeld(WeldModifierData *wmd,
- const ModifierEvalContext *UNUSED(ctx),
- Mesh *mesh)
+Mesh *GEO_weld(const Mesh *mesh, const bool *mask, const float merge_distance, const int weld_mode)
{
Mesh *result = mesh;
- BLI_bitmap *v_mask = NULL;
- int v_m
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list