diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-09-21 19:25:38 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-09-21 19:26:23 +0300 |
commit | 43fa51835adee390aa4bcb9fe3bda1034480b7cf (patch) | |
tree | 2a0d4e743c1e8a163598683779935dcfa9cd22c8 /doc | |
parent | 18252e407f2cb6dc705e223cecf688e5eb823f42 (diff) |
gpu.types.GPUOffscreen.py example file: Move the shader reference removal code to execute on __main__
Diffstat (limited to 'doc')
-rw-r--r-- | doc/python_api/examples/gpu.types.GPUOffScreen.py | 9 |
1 files changed, 2 insertions, 7 deletions
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() |