[Bf-blender-cvs] [43fa51835ad] blender2.8: gpu.types.GPUOffscreen.py example file: Move the shader reference removal code to execute on __main__

mano-wii noreply at git.blender.org
Fri Sep 21 18:27:17 CEST 2018


Commit: 43fa51835adee390aa4bcb9fe3bda1034480b7cf
Author: mano-wii
Date:   Fri Sep 21 13:25:38 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB43fa51835adee390aa4bcb9fe3bda1034480b7cf

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

===================================================================

M	doc/python_api/examples/gpu.types.GPUOffScreen.py

===================================================================

diff --git a/doc/python_api/examples/gpu.types.GPUOffScreen.py b/doc/python_api/examples/gpu.types.GPUOffScreen.py
index 4f601ee7ef1..66fab23b110 100644
--- a/doc/python_api/examples/gpu.types.GPUOffScreen.py
+++ b/doc/python_api/examples/gpu.types.GPUOffScreen.py
@@ -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()



More information about the Bf-blender-cvs mailing list