[Bf-blender-cvs] [0501dc96cfe] refactor-mesh-position-generic: Fixes after merge
Hans Goudey
noreply at git.blender.org
Fri Oct 14 23:27:45 CEST 2022
Commit: 0501dc96cfe167cc9971c904120d7275a641c96d
Author: Hans Goudey
Date: Fri Oct 14 16:26:11 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB0501dc96cfe167cc9971c904120d7275a641c96d
Fixes after merge
===================================================================
M source/blender/blenkernel/BKE_mesh_types.h
M source/blender/blenkernel/intern/customdata.cc
M source/blender/bmesh/intern/bmesh_mesh_convert.cc
M source/blender/draw/DRW_pbvh.h
M source/blender/makesdna/DNA_mesh_types.h
===================================================================
diff --git a/source/blender/blenkernel/BKE_mesh_types.h b/source/blender/blenkernel/BKE_mesh_types.h
index dacc2188abb..92f2e617b9d 100644
--- a/source/blender/blenkernel/BKE_mesh_types.h
+++ b/source/blender/blenkernel/BKE_mesh_types.h
@@ -41,7 +41,7 @@ typedef enum eMeshBatchDirtyMode {
/** #MeshRuntime.wrapper_type */
typedef enum eMeshWrapperType {
- /** Use mesh data (#Mesh.mvert, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
+ /** Use mesh data (#Mesh.positions(), #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
ME_WRAPPER_TYPE_MDATA = 0,
/** Use edit-mesh data (#Mesh.edit_mesh, #MeshRuntime.edit_data). */
ME_WRAPPER_TYPE_BMESH = 1,
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index bb912706366..b46ab2fd799 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2105,9 +2105,6 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
"CDHairLength",
};
-/* TODO(Hans): Fix uses of #CD_MASK_BAREMESH and #CD_MASK_BAREMESH_ORIGINDEX to include "position".
- */
-
const CustomData_MeshMasks CD_MASK_BAREMESH = {
/* vmask */ CD_MASK_PROP_FLOAT3,
/* emask */ CD_MASK_MEDGE,
@@ -2123,8 +2120,8 @@ const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
/* lmask */ CD_MASK_MLOOP,
};
const CustomData_MeshMasks CD_MASK_MESH = {
- /* vmask */ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | CD_MASK_PAINT_MASK |
- CD_MASK_PROP_ALL | CD_MASK_CREASE | CD_MASK_BWEIGHT),
+ /* vmask */ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN |
+ CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE | CD_MASK_BWEIGHT),
/* emask */
(CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_BWEIGHT | CD_MASK_CREASE),
/* fmask */ 0,
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index d43107cb507..369e828f260 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -864,6 +864,7 @@ static void write_fn_to_attribute(blender::bke::MutableAttributeAccessor attribu
static void assert_bmesh_has_no_mesh_only_attributes(const BMesh &bm)
{
(void)bm; /* Unused in the release builds. */
+ BLI_assert(CustomData_get_layer_named(&bm.vdata, CD_PROP_FLOAT3, "position") == nullptr);
/* The "hide" attributes are stored as flags on #BMesh. */
BLI_assert(CustomData_get_layer_named(&bm.vdata, CD_PROP_BOOL, ".hide_vert") == nullptr);
@@ -942,6 +943,7 @@ static void convert_bmesh_selection_flags_to_mesh_attributes(BMesh &bm,
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
{
+ using namespace blender;
BMVert *v, *eve;
BMEdge *e;
BMFace *f;
@@ -1228,8 +1230,10 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
me->totloop = bm->totloop;
me->totpoly = bm->totface;
- CustomData_add_layer_named(
- &me->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, bm->totvert, "position");
+ if (!CustomData_get_layer_named(&me->vdata, CD_PROP_FLOAT3, "position")) {
+ CustomData_add_layer_named(
+ &me->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, bm->totvert, "position");
+ }
CustomData_add_layer(&me->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, bm->totedge);
CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, bm->totloop);
CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, bm->totface);
diff --git a/source/blender/draw/DRW_pbvh.h b/source/blender/draw/DRW_pbvh.h
index fa51afe786f..55f4658f55f 100644
--- a/source/blender/draw/DRW_pbvh.h
+++ b/source/blender/draw/DRW_pbvh.h
@@ -27,7 +27,6 @@ struct Object;
struct Mesh;
struct MLoopTri;
struct CustomData;
-struct MVert;
struct MEdge;
struct MLoop;
struct MPoly;
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 7f2fe4dfeb1..39253aafa7c 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -274,16 +274,6 @@ typedef struct TFace {
/* **************** MESH ********************* */
-/** #Mesh_Runtime.wrapper_type */
-typedef enum eMeshWrapperType {
- /** Use mesh data (#positions, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
- ME_WRAPPER_TYPE_MDATA = 0,
- /** Use edit-mesh data (#Mesh.edit_mesh, #Mesh_Runtime.edit_data). */
- ME_WRAPPER_TYPE_BMESH = 1,
- /** Use subdivision mesh data (#Mesh_Runtime.mesh_eval). */
- ME_WRAPPER_TYPE_SUBD = 2,
-} eMeshWrapperType;
-
/** #Mesh.texflag */
enum {
ME_AUTOSPACE = 1,
More information about the Bf-blender-cvs
mailing list