bugfix [#20401] Hair Combing with "Limit Selection to Visible" does not comb all...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 26 Jan 2010 11:51:28 +0000 (11:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 26 Jan 2010 11:51:28 +0000 (11:51 +0000)
Limit selection was totally broken (border select, circle select etc) because the depth function was using the view matrix multiplied by the object matrix.
I couldnt find any case where this was needed, but take care when using data->mats.modelview from particle mode edit tools.

source/blender/editors/physics/particle_edit.c

index 44e4f938e61c81b55357e710cfb7495485ec219f..c2ead76ff3e2fef86aae33da01fe8538968c7703 100644 (file)
@@ -374,7 +374,8 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
        PE_set_data(C, data);
 
        view3d_set_viewcontext(C, &data->vc);
-       view3d_get_transformation(data->vc.ar, data->vc.rv3d, data->ob, &data->mats);
+       /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather then (obmat * viewmat) */
+       view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
 
        if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT))
                view3d_validate_backbuf(&data->vc);
@@ -407,7 +408,8 @@ static int key_test_depth(PEData *data, float co[3])
        x+= (short)data->vc.ar->winrct.xmin;
        y+= (short)data->vc.ar->winrct.ymin;
 
-       view3d_validate_backbuf(&data->vc);
+       /* PE_set_view3d_data calls this. no need to call here */
+       /* view3d_validate_backbuf(&data->vc); */
        glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
 
        if((float)uz - 0.0001 > depth)