diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-09-21 18:36:38 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-09-21 18:36:38 +0300 |
commit | 964bb28e21bdaf3ab93e4665a012d717c5d5a89a (patch) | |
tree | 8f8a10f75c396fb15109a6b8cf7f9a3ef6b25d87 /doc/python_api | |
parent | d2a491da5f88d0a823d0aa6e01b9c29a9b055612 (diff) |
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.
Diffstat (limited to 'doc/python_api')
-rw-r--r-- | doc/python_api/examples/gpu.types.GPUOffScreen.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/python_api/examples/gpu.types.GPUOffScreen.py b/doc/python_api/examples/gpu.types.GPUOffScreen.py index b7f11b94a11..4f601ee7ef1 100644 --- a/doc/python_api/examples/gpu.types.GPUOffScreen.py +++ b/doc/python_api/examples/gpu.types.GPUOffScreen.py @@ -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 |