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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-24 01:22:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-24 01:22:13 +0400
commit7cc12e5170b8396d25db5f9e50c69088073c31f6 (patch)
tree4a31e331542213c03e512c9c1fc0b7dfa7b86e57 /source/blender/editors/physics
parentf5bf63dc96964d6d7d43a7498c678007050925bd (diff)
Fix #33279: crash in particle brush cut tool when cutting hairs that go outside the view.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 0c88519b62b..2ac5f98927c 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -401,6 +401,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
static int key_test_depth(PEData *data, const float co[3], const int screen_co[2])
{
View3D *v3d= data->vc.v3d;
+ ViewDepths *vd = data->vc.rv3d->depths;
double ux, uy, uz;
float depth;
@@ -428,12 +429,15 @@ static int key_test_depth(PEData *data, const float co[3], const int screen_co[2
/* view3d_validate_backbuf(&data->vc); */
glReadPixels(screen_co[0], screen_co[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
#else /* faster to use depths, these are calculated in PE_set_view3d_data */
- {
- ViewDepths *vd = data->vc.rv3d->depths;
- assert(vd && vd->depths);
+
+ /* check if screen_co is within bounds because brush_cut uses out of screen coords */
+ if(screen_co[0] >= 0 && screen_co[0] < vd->w && screen_co[1] >= 0 && screen_co[1] < vd->h) {
+ BLI_assert(vd && vd->depths);
/* we know its not clipped */
depth = vd->depths[screen_co[1] * vd->w + screen_co[0]];
}
+ else
+ return 0;
#endif
if ((float)uz - 0.00001f > depth)