diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-30 16:48:55 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-30 16:49:54 +0300 |
commit | 2510bd3a5f35d14f5e0e098c79a776916d273223 (patch) | |
tree | cce1a1d6664293fa491ab3f4a6c57ae80fb51c52 /source/blender/gpu | |
parent | 04b6296e8165736d17fb5167e45a93178f9f71c2 (diff) |
Python GPU: Add new methods to port the code templates in the manual
This commit adds a new API tha allow to replace the bgl API in the exemples on:
https://docs.blender.org/api/current/gpu.html
**Overview (New API):**
```
gpu.state: active_framebuffer_get
GPUFramebuffer: read_color
GPUOffscreen: texture_color
```
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D11031
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.cc | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer_private.hh | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index f593a5e4182..487835a9d35 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -487,7 +487,7 @@ void **GPU_framebuffer_py_reference_get(GPUFrameBuffer *gpu_fb) void GPU_framebuffer_py_reference_set(GPUFrameBuffer *gpu_fb, void **py_ref) { - BLI_assert(ref == nullptr || unwrap(gpu_fb)->py_ref == nullptr); + BLI_assert(py_ref == nullptr || unwrap(gpu_fb)->py_ref == nullptr); unwrap(gpu_fb)->py_ref = py_ref; } #endif diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 6e4be6de42a..d6a30677840 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -110,6 +110,11 @@ class FrameBuffer { #endif public: + /* Reference of a pointer that needs to be cleaned when deallocating the frame-buffer. + * Points to BPyGPUFrameBuffer::fb */ + void **ref = nullptr; + + public: FrameBuffer(const char *name); virtual ~FrameBuffer(); |