From 964bb28e21bdaf3ab93e4665a012d717c5d5a89a Mon Sep 17 00:00:00 2001 From: mano-wii Date: Fri, 21 Sep 2018 12:36:38 -0300 Subject: [PATCH] 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. --- doc/python_api/examples/gpu.types.GPUOffScreen.py | 7 +++++-- 1 file 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