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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-12-22 13:54:24 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-01-20 11:30:09 +0300
commit1b6f5ecbf4aad9c6d4c58460b3e5596cd5f12399 (patch)
treee5ed7e20c0fd180dd2050df9af6ec21c8228cdda /source/blender/blenkernel/intern/cloth.c
parentbb76e96339ec26cafff57d5d7a8b015c4b1d6ef9 (diff)
Fix for invalid access to undefined hair data in edge-only cloth meshes.
Cloth data is used both for hair and actual cloth, which makes things really difficult. The face number was used for distinguishing the two types (no faces == hair mesh), but the extra hair data necessary for hair sim is generated by particles and not available for edge-only cloth meshes. This really needs to be sanitized ... Conflicts: source/blender/physics/intern/BPH_mass_spring.cpp
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 98da1cf630d..14f94735957 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1054,13 +1054,16 @@ static void cloth_free_errorsprings(Cloth *cloth, LinkNode **edgelist)
}
}
-static void cloth_update_bending_targets(ClothModifierData *clmd)
+static void cloth_hair_update_bending_targets(ClothModifierData *clmd)
{
Cloth *cloth = clmd->clothObject;
LinkNode *search = NULL;
float hair_frame[3][3], dir_old[3], dir_new[3];
int prev_mn; /* to find hair chains */
+ if (!clmd->hairdata)
+ return;
+
/* XXX Note: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
@@ -1126,13 +1129,16 @@ static void cloth_update_bending_targets(ClothModifierData *clmd)
}
}
-static void cloth_update_bending_rest_targets(ClothModifierData *clmd)
+static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd)
{
Cloth *cloth = clmd->clothObject;
LinkNode *search = NULL;
float hair_frame[3][3], dir_old[3], dir_new[3];
int prev_mn; /* to find hair roots */
+ if (!clmd->hairdata)
+ return;
+
/* XXX Note: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
@@ -1225,7 +1231,7 @@ static void cloth_update_springs( ClothModifierData *clmd )
search = search->next;
}
- cloth_update_bending_targets(clmd);
+ cloth_hair_update_bending_targets(clmd);
}
BLI_INLINE void cross_identity_v3(float r[3][3], const float v[3])
@@ -1504,7 +1510,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
- cloth_update_bending_rest_targets(clmd);
+ cloth_hair_update_bending_rest_targets(clmd);
}
/* note: the edges may already exist so run reinsert */