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:
authorAntony Riakiotakis <kalast@gmail.com>2015-01-11 23:28:30 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-01-11 23:29:51 +0300
commit1864253db06957ec344e6504b1c33e7f83cdaa99 (patch)
tree1503e0cf845d98c707740824a931bafd81fb279e
parent0a5ad655122e376d1f8d4d6c21b0f83c09d5ad5d (diff)
Fix T43208 material flickering in edit mode.
Happens because material setting now occurs in the derived mesh drawing routine as it should. However that means that it also happens during selection and that influenced the drawing state somehow. In 2.72 this did not occur because material setting happened during draw setting (skip or draw) instead of after the draw setting passed (so selection would skip it by use another draw setting function). Of course this violated design but worked. Made it now so backbuffer selection does not enable materials (it's redundant in those cases anyway). This could be ported to a possible 'a' release but as is classic with display code there may be some other places that it could backfire. Tested fix with texture/vertex painting and selection which use backbuffer for both subsurf and regular meshes and it seems to work OK.
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c15
-rw-r--r--source/blender/editors/space_view3d/drawobject.c8
2 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 204a015d9fb..eb7c78c2760 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -56,7 +56,6 @@
#include "MEM_guardedalloc.h"
#include "GPU_extensions.h"
-#include "GPU_draw.h"
#include "GPU_glew.h"
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
@@ -527,7 +526,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm,
setDrawOptions(userData, BM_elem_index_get(efa)));
if (draw_option != DM_DRAW_OPTION_SKIP) {
const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
- GPU_enable_material(efa->mat_nr + 1, NULL);
+ if (setMaterial)
+ setMaterial(efa->mat_nr + 1, NULL);
if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
if (poly_prev != GL_ZERO) glEnd();
@@ -609,16 +609,17 @@ static void emDM_drawMappedFaces(DerivedMesh *dm,
int drawSmooth;
efa = ltri[0]->f;
- drawSmooth = lnors || ((flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH));
+ drawSmooth = lnors || ((flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH));
- draw_option = (!setDrawOptions ?
- DM_DRAW_OPTION_NORMAL :
- setDrawOptions(userData, BM_elem_index_get(efa)));
+ draw_option = (setDrawOptions ?
+ setDrawOptions(userData, BM_elem_index_get(efa)) :
+ DM_DRAW_OPTION_NORMAL);
if (draw_option != DM_DRAW_OPTION_SKIP) {
const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
- GPU_enable_material(efa->mat_nr + 1, NULL);
+ if (setMaterial)
+ setMaterial(efa->mat_nr + 1, NULL);
if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6c2d9dbe90a..55b621d5aba 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7978,7 +7978,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
cpack(0);
if (use_faceselect) {
- dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, em->bm, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, NULL, NULL, em->bm, 0);
if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
@@ -7990,7 +7990,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
}
else {
- dm->drawMappedFaces(dm, bbs_mesh_mask__setSolidDrawOptions, GPU_enable_material, NULL, em->bm, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_mask__setSolidDrawOptions, NULL, NULL, em->bm, 0);
}
}
@@ -8051,9 +8051,9 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob)
DM_update_materials(dm, ob);
if ((me->editflag & ME_EDIT_PAINT_FACE_SEL))
- dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, NULL, NULL, me, 0);
else
- dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, GPU_enable_material, NULL, me, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, NULL, NULL, me, 0);
dm->release(dm);
}