Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2019-04-23 18:15:45 +0300
committerRay Molenkamp <github@lazydodo.com>2019-04-23 18:15:45 +0300
commit8e861725dc9e9388c1c764491676c0684b1b6f8f (patch)
tree41aeb7ff4672bbacbef62ec873366029e23a3765 /source
parent58a1eb9a00290adc68ea5391de9d188fc108a945 (diff)
Space_node: Add draw backdrop callback.
Add a callback to allow custom node editors to draw their own backdrop. Differential Revision: https://developer.blender.org/D4709 Reviewed by: JacquesLucke
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_space_api.h1
-rw-r--r--source/blender/editors/space_node/drawnode.c9
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c1
4 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 01de5fd8441..766f2b31192 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -62,6 +62,7 @@ void ED_file_exit(void);
#define REGION_DRAW_POST_VIEW 0
#define REGION_DRAW_POST_PIXEL 1
#define REGION_DRAW_PRE_VIEW 2
+#define REGION_DRAW_BACKDROP 3
void *ED_region_draw_cb_activate(struct ARegionType *,
void (*draw)(const struct bContext *, struct ARegion *, void *),
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index eb9c1cc2965..447fea8098c 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -55,6 +55,7 @@
#include "RNA_define.h"
#include "ED_node.h"
+#include "ED_space_api.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -3414,6 +3415,14 @@ void draw_nodespace_back_pix(const bContext *C,
void *lock;
ImBuf *ibuf;
+ GPU_matrix_push_projection();
+ GPU_matrix_push();
+ wmOrtho2_region_pixelspace(ar);
+ GPU_matrix_identity_set();
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_BACKDROP);
+ GPU_matrix_pop_projection();
+ GPU_matrix_pop();
+
if (!(snode->flag & SNODE_BACKDRAW) || !ED_node_is_compositor(snode)) {
return;
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index ed8bbe939af..6f93e42ce19 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -8836,7 +8836,7 @@ PyDoc_STRVAR(
"(:class:`bpy.types.Region.type`)\n"
" :type region_type: str\n"
" :param draw_type: Usually `POST_PIXEL` for 2D drawing and `POST_VIEW` for 3D drawing. In "
- "some cases `PRE_VIEW` can be used.\n"
+ "some cases `PRE_VIEW` can be used. `BACKDROP` can be used for backdrops in the node editor.\n"
" :type draw_type: str\n"
" :return: Handler that can be removed later on.\n"
" :rtype: object");
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 7d690cb7d47..e44fda1e892 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -54,6 +54,7 @@ static const EnumPropertyItem region_draw_mode_items[] = {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
+ {REGION_DRAW_BACKDROP, "BACKDROP", 0, "Backdrop", ""},
{0, NULL, 0, NULL, NULL},
};