gpu.types.GPUOffscreen.py example file: Move the shader reference removal code to execute on __main__

This commit is contained in:
Germano Cavalcante 2018-09-21 13:25:38 -03:00
parent 18252e407f
commit 43fa51835a
Notes: blender-bot 2023-02-14 09:44:56 +01:00
Referenced by commit a3020d5558, Fixup for gpu.types.GPUOffscreen.py example
1 changed files with 2 additions and 7 deletions

View File

@ -241,12 +241,6 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
def register():
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
@ -262,6 +256,7 @@ if __name__ == "__main__":
try:
unregister()
except RuntimeError:
pass
if hasattr(bpy.types, "VIEW3D_OT_draw_offscreen"):
del bpy.types.VIEW3D_OT_draw_offscreen.global_shader
register()