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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-26 14:15:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-26 14:15:32 +0400
commite3d3ffe7469ed2e868968f8c0c4fccb6874378f1 (patch)
tree9be0bbb14261dd39bcb0676b1315fcf0796db320 /source
parent240ee2fccb8f53b41966dce9d1cb3187ac80ef47 (diff)
fix [#33303] face selection masking for painting does not work with mesh with n-gon
caused by own change to how origindex is used, now if mpoly's CD_ORIGINDEX array is missing its assumes that its the original mpoly array.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h8
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c16
-rw-r--r--source/blender/blenkernel/intern/particle.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/render/intern/source/convertblender.c4
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp8
6 files changed, 27 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index c6c54cc6e8a..617c4cd2bc8 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -709,10 +709,16 @@ void DM_debug_print(DerivedMesh *dm);
void DM_debug_print_cdlayers(CustomData *cdata);
#endif
+#ifdef __GNUC__
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
+ __attribute__((nonnull(1)))
+;
+#endif
+
BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
{
const int j = index_mf_to_mpoly[i];
- return (j != ORIGINDEX_NONE) ? index_mp_to_orig[j] : ORIGINDEX_NONE;
+ return (j != ORIGINDEX_NONE) ? (index_mp_to_orig ? index_mp_to_orig[j] : j) : ORIGINDEX_NONE;
}
#endif
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 9b1720787ed..54f69a49e70 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -623,8 +623,8 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
colType = CD_TEXTURE_MCOL;
@@ -812,8 +812,8 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
@@ -1048,8 +1048,8 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
cdDM_update_normals_from_pbvh(dm);
@@ -1349,8 +1349,8 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
cdDM_update_normals_from_pbvh(dm);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 93bf5a5c0b4..5f5a713064d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -822,8 +822,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
facearea = MEM_callocN(sizeof(float) * totorigface, "SimplifyFaceArea");
@@ -1645,8 +1645,8 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
mpoly = dm->getPolyArray(dm);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index c5eff1a1f0e..cb4b6346c2a 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -257,8 +257,8 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
/* double lookup */
const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
minabsw = 1e10;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index d6e6171047e..386086333e0 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1707,8 +1707,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
totface= psmd->dm->getNumTessFaces(psmd->dm);
index_mf_to_mpoly = psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
index_mp_to_orig = psmd->dm->getPolyDataArray(psmd->dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
for (a=0; a<totface; a++)
strandbuf->totbound = max_ii(strandbuf->totbound, (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a): a);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 8d587cf39f6..6c6ce94d8d5 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1507,8 +1507,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
/* double lookup */
const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
@@ -1816,8 +1816,8 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
/* double lookup */
const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
const int *index_mp_to_orig = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
- if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
- index_mf_to_mpoly = index_mp_to_orig = NULL;
+ if (index_mf_to_mpoly == NULL) {
+ index_mp_to_orig = NULL;
}
MFace *mf;