gpu.types.GPUOffscreen.py example file: Delete the reference of the previous shader.

Strange that the `bpy.utils.register_class` utility does not remove the reference of the class with same name.
This commit is contained in:
Germano Cavalcante 2018-09-21 12:36:38 -03:00
parent d2a491da5f
commit 964bb28e21
1 changed files with 5 additions and 2 deletions

View File

@ -241,8 +241,11 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
def register():
if hasattr(bpy.types, "VIEW3D_OT_draw_offscreen"):
del VIEW3D_OT_draw_offscreen.global_shader
try:
cls = getattr(bpy.types, "VIEW3D_OT_draw_offscreen")
del cls.global_shader
except:
pass
shader = gpu.types.GPUShader(g_imageVertSrc, g_imageFragSrc)
VIEW3D_OT_draw_offscreen.global_shader = shader