Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-19 23:23:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-19 23:23:25 +0400
commit1f84876e899ab58fc0832aaa4364fce6e8dc36c5 (patch)
tree40900ad9ffd40c96cc49f957a3e05ee5ae8c02e5 /source/blender
parent7c82dbe68b13c4becd8585ac1895b929ee8421a9 (diff)
ensure defoem DM has tessface data for the few places that need it.
also add a workaround for CDDM_recalc_tesselation_ex() which would add a CD_NORMAL to dm->fdata and then overwrite immediate
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h1
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c22
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/physics/particle_object.c4
4 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 569524aa2d4..ce9e8dcf92a 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -115,6 +115,7 @@ void CDDM_calc_edges(struct DerivedMesh *dm);
/* reconstitute face triangulation */
void CDDM_recalc_tesselation(struct DerivedMesh *dm);
+void CDDM_recalc_tesselation_ex(struct DerivedMesh *dm, const int do_face_nor_cpy);
/* lowers the number of vertices/edges/faces in a CDDerivedMesh
* the layer data stays the same size
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index aa8227c39ff..de21f47069f 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1578,14 +1578,14 @@ static void cdDM_foreachMappedFaceCenter(
}
-void CDDM_recalc_tesselation(DerivedMesh *dm)
+void CDDM_recalc_tesselation_ex(DerivedMesh *dm, const int do_face_nor_cpy)
{
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
dm->numTessFaceData = mesh_recalcTesselation(&dm->faceData, &dm->loopData, &dm->polyData,
cddm->mvert,
dm->numTessFaceData, dm->numLoopData, dm->numPolyData,
- TRUE);
+ do_face_nor_cpy);
if (!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX)) {
int *polyIndex = CustomData_get_layer(&dm->faceData, CD_POLYINDEX);
@@ -1599,6 +1599,11 @@ void CDDM_recalc_tesselation(DerivedMesh *dm)
CustomData_bmesh_update_active_layers(&dm->faceData, &dm->polyData, &dm->loopData);
}
+void CDDM_recalc_tesselation(DerivedMesh *dm)
+{
+ CDDM_recalc_tesselation_ex(dm, TRUE);
+}
+
static void cdDM_free_internal(CDDerivedMesh *cddm)
{
if(cddm->fmap) MEM_freeN(cddm->fmap);
@@ -2160,10 +2165,13 @@ DerivedMesh *CDDM_copy(DerivedMesh *source, int faces_from_tessfaces)
cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
+ /* any callers that need tessface data can calculate it - campbell */
+#if 0
/* BMESH_TODO: Find out why this is necessary (or else find a way to remove
it). If it is necessary, add a comment explaining why. */
CDDM_recalc_tesselation((DerivedMesh *)cddm);
-
+#endif
+
return dm;
}
@@ -2258,8 +2266,12 @@ void CDDM_calc_normals_mapping(DerivedMesh *dm)
if (dm->numTessFaceData == 0) {
- /* No tesselation on this mesh yet, need to calculate one */
- CDDM_recalc_tesselation(dm);
+ /* No tesselation on this mesh yet, need to calculate one.
+ *
+ * Important not to update face normals from polys since it
+ * interfears with assigning the new normal layer in the following code.
+ */
+ CDDM_recalc_tesselation_ex(dm, FALSE);
}
else {
/* A tesselation already exists, it should always have a CD_POLYINDEX */
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index a912fb5f81b..9929de8e89c 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3067,6 +3067,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
return 0;
}
+ /* BMESH_ONLY, deform dm may not have tessface */
+ DM_ensure_tessface(dm);
if(pa_minmax==0){
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index bc3cfa2ca92..5732f6419d1 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -649,6 +649,10 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
else
dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
+ /* BMESH_ONLY, deform dm may not have tessface */
+ DM_ensure_tessface(dm);
+
+
numverts = dm->getNumVerts (dm);
/* convert to global coordinates */