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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-05 13:56:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-05 14:06:01 +0300
commitd5bca524d55d929a9e725a51b373de4804e1fe2e (patch)
tree887e7dff5e39259758bebb6b7728b5cf0a1d4f07 /source/blender/editors/physics
parent304ee9af8d57695664a1f1792c9e9278b5de6fec (diff)
Fix T44960: Crash with 'Shape Cut' in edit hair mode.
This is only supported for mesh objects so far. Also, abort in case there are no faces in dm (instead of crashing on NULL BVH tree...).
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 7abd6f4c8ef..f25679986a5 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -414,18 +414,18 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
}
}
-static void PE_create_shape_tree(PEData *data, Object *shapeob)
+static bool PE_create_shape_tree(PEData *data, Object *shapeob)
{
DerivedMesh *dm = shapeob->derivedFinal;
memset(&data->shape_bvh, 0, sizeof(data->shape_bvh));
if (!dm) {
- return;
+ return false;
}
DM_ensure_tessface(dm);
- bvhtree_from_mesh_faces(&data->shape_bvh, dm, 0.0f, 4, 8);
+ return bvhtree_from_mesh_faces(&data->shape_bvh, dm, 0.0f, 4, 8);
}
static void PE_free_shape_tree(PEData *data)
@@ -4059,11 +4059,12 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot)
static int shape_cut_poll(bContext *C)
{
if (PE_hair_poll(C)) {
- Scene *scene= CTX_data_scene(C);
- ParticleEditSettings *pset= PE_settings(scene);
+ Scene *scene = CTX_data_scene(C);
+ ParticleEditSettings *pset = PE_settings(scene);
- if (pset->shape_object)
+ if (pset->shape_object && (pset->shape_object->type == OB_MESH)) {
return true;
+ }
}
return false;
@@ -4179,7 +4180,10 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op))
int removed;
PE_set_data(C, &data);
- PE_create_shape_tree(&data, shapeob);
+ if (!PE_create_shape_tree(&data, shapeob)) {
+ /* shapeob may not have faces... */
+ return OPERATOR_CANCELLED;
+ }
if (selected)
foreach_selected_point(&data, shape_cut);