[Bf-blender-cvs] [5a65305f899] blender-v2.91-release: Fix T81784 BGL: Gizmo glitch when using glEnable/glDisable
Clément Foucault
noreply at git.blender.org
Thu Oct 22 01:20:31 CEST 2020
Commit: 5a65305f8998a72c8bf39bc69414c7ba2da57055
Author: Clément Foucault
Date: Thu Oct 22 01:09:35 2020 +0200
Branches: blender-v2.91-release
https://developer.blender.org/rB5a65305f8998a72c8bf39bc69414c7ba2da57055
Fix T81784 BGL: Gizmo glitch when using glEnable/glDisable
This was caused by unprotected drawing callbacks.
>From 2.91, we now require that all python callbacks used for
drawing needs to be safeguarded by `GPU_bgl_end()` to end the
state tracking override.
===================================================================
M source/blender/makesrna/intern/rna_wm_gizmo.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 971991869e2..27d46e4d25b 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -61,6 +61,8 @@
# include "MEM_guardedalloc.h"
+# include "GPU_state.h"
+
# ifdef WITH_PYTHON
# include "BPY_extern.h"
# endif
@@ -84,6 +86,8 @@ static void rna_gizmo_draw_cb(const struct bContext *C, struct wmGizmo *gz)
RNA_parameter_set_lookup(&list, "context", &C);
gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
+ /* This callback may have called bgl functions. */
+ GPU_bgl_end();
}
static void rna_gizmo_draw_select_cb(const struct bContext *C, struct wmGizmo *gz, int select_id)
@@ -101,6 +105,8 @@ static void rna_gizmo_draw_select_cb(const struct bContext *C, struct wmGizmo *g
RNA_parameter_set_lookup(&list, "select_id", &select_id);
gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
+ /* This callback may have called bgl functions. */
+ GPU_bgl_end();
}
static int rna_gizmo_test_select_cb(struct bContext *C, struct wmGizmo *gz, const int location[2])
More information about the Bf-blender-cvs
mailing list