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:
-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)