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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-06-05 18:05:41 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-06-30 21:01:20 +0400
commita51aeedade2d0620d8509602ab04c2ec00e06053 (patch)
tree7a2f697942ebb94f13073136af72568663513ffc /source/blender/editors
parente919a37e97874d2e7b5abc134eab7ed43c993b18 (diff)
Experiment with the compositor border in editor
Preserve buffer form previous runs so it's possible to make a compo of full frame, then draw a border and start tweaking nodes and see updates in that border. Main idea is to make it able to visually compare difference between what was changed inside the border and how frame looked before the tweaks outside of the border. Also implemented Clear Viewer Border in compositor, shortcut it Ctrl-Alt-B. Reviewers: lukastoenne, jbakker CC: venomgfx, sebastian_k Differential Revision: https://developer.blender.org/D582
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/BIF_glutil.h2
-rw-r--r--source/blender/editors/screen/glutil.c39
-rw-r--r--source/blender/editors/space_image/image_draw.c34
-rw-r--r--source/blender/editors/space_node/drawnode.c23
-rw-r--r--source/blender/editors/space_node/node_edit.c35
-rw-r--r--source/blender/editors/space_node/node_intern.h1
-rw-r--r--source/blender/editors/space_node/node_ops.c2
7 files changed, 82 insertions, 54 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 48440d10ae3..b401f06f484 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -222,5 +222,7 @@ void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter,
/* Draw imbuf on a screen, preferably using GLSL display transform */
void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter);
+void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy);
+
#endif /* __BIF_GLUTIL_H__ */
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index f31d79ff76b..0edde66ffff 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -50,6 +50,8 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
+#include "UI_interface.h"
+
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
@@ -1139,3 +1141,40 @@ void cpack(unsigned int x)
(((x) >> 8) & 0xFF),
(((x) >> 16) & 0xFF) );
}
+
+void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy)
+{
+ float delta_x = 4.0f * UI_DPI_FAC / zoomx;
+ float delta_y = 4.0f * UI_DPI_FAC / zoomy;
+
+ delta_x = min_ff(delta_x, border->xmax - border->xmin);
+ delta_y = min_ff(delta_y, border->ymax - border->ymin);
+
+ /* left bottom corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmin, border->ymin + delta_y);
+ glVertex2f(border->xmin, border->ymin);
+ glVertex2f(border->xmin + delta_x, border->ymin);
+ glEnd();
+
+ /* left top corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmin, border->ymax - delta_y);
+ glVertex2f(border->xmin, border->ymax);
+ glVertex2f(border->xmin + delta_x, border->ymax);
+ glEnd();
+
+ /* right bottom corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmax - delta_x, border->ymin);
+ glVertex2f(border->xmax, border->ymin);
+ glVertex2f(border->xmax, border->ymin + delta_y);
+ glEnd();
+
+ /* right top corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmax - delta_x, border->ymax);
+ glVertex2f(border->xmax, border->ymax);
+ glVertex2f(border->xmax, border->ymax - delta_y);
+ glEnd();
+}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 5f996f94a81..79c21bab01c 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -119,39 +119,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
UI_ThemeColor(TH_FACE_SELECT);
for (i = 0, tile = tiles; i < total_tiles; i++, tile++) {
- float delta_x = 4.0f * UI_DPI_FAC / zoomx;
- float delta_y = 4.0f * UI_DPI_FAC / zoomy;
-
- delta_x = min_ff(delta_x, tile->xmax - tile->xmin);
- delta_y = min_ff(delta_y, tile->ymax - tile->ymin);
-
- /* left bottom corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmin, tile->ymin + delta_y);
- glVertex2f(tile->xmin, tile->ymin);
- glVertex2f(tile->xmin + delta_x, tile->ymin);
- glEnd();
-
- /* left top corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmin, tile->ymax - delta_y);
- glVertex2f(tile->xmin, tile->ymax);
- glVertex2f(tile->xmin + delta_x, tile->ymax);
- glEnd();
-
- /* right bottom corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmax - delta_x, tile->ymin);
- glVertex2f(tile->xmax, tile->ymin);
- glVertex2f(tile->xmax, tile->ymin + delta_y);
- glEnd();
-
- /* right top corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmax - delta_x, tile->ymax);
- glVertex2f(tile->xmax, tile->ymax);
- glVertex2f(tile->xmax, tile->ymax - delta_y);
- glEnd();
+ glaDrawBorderCorners(tile, zoomx, zoomy);
}
MEM_freeN(tiles);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 2f265d21a38..ef23fc24194 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3122,20 +3122,17 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
}
if ((snode->nodetree->flag & NTREE_VIEWER_BORDER) &&
- viewer_border->xmin < viewer_border->xmax &&
- viewer_border->ymin < viewer_border->ymax)
+ viewer_border->xmin < viewer_border->xmax &&
+ viewer_border->ymin < viewer_border->ymax)
{
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- setlinestyle(3);
- cpack(0x4040FF);
-
- glRectf(x + snode->zoom * viewer_border->xmin * ibuf->x,
- y + snode->zoom * viewer_border->ymin * ibuf->y,
- x + snode->zoom * viewer_border->xmax * ibuf->x,
- y + snode->zoom * viewer_border->ymax * ibuf->y);
-
- setlinestyle(0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ rcti pixel_border;
+ UI_ThemeColor(TH_ACTIVE);
+ BLI_rcti_init(&pixel_border,
+ x + snode->zoom * viewer_border->xmin * ibuf->x,
+ x + snode->zoom * viewer_border->xmax * ibuf->x,
+ y + snode->zoom * viewer_border->ymin * ibuf->y,
+ y + snode->zoom * viewer_border->ymax * ibuf->y);
+ glaDrawBorderCorners(&pixel_border, 1.0f, 1.0f);
}
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 5bbe0c1c229..1c41ce9d86d 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2482,14 +2482,6 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
btree->flag &= ~NTREE_VIEWER_BORDER;
}
else {
- if (ibuf->rect)
- memset(ibuf->rect, 0, 4 * ibuf->x * ibuf->y);
-
- if (ibuf->rect_float)
- memset(ibuf->rect_float, 0, 4 * ibuf->x * ibuf->y * sizeof(float));
-
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
-
btree->flag |= NTREE_VIEWER_BORDER;
}
@@ -2526,3 +2518,30 @@ void NODE_OT_viewer_border(wmOperatorType *ot)
/* properties */
WM_operator_properties_gesture_border(ot, true);
}
+
+static int clear_viewer_border_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNodeTree *btree = snode->nodetree;
+
+ btree->flag &= ~NTREE_VIEWER_BORDER;
+ snode_notify(C, snode);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void NODE_OT_clear_viewer_border(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Clear Viewer Border";
+ ot->description = "Clear the boundaries for viewer operations";
+ ot->idname = "NODE_OT_clear_viewer_border";
+
+ /* api callbacks */
+ ot->exec = clear_viewer_border_exec;
+ ot->poll = composite_node_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index fa20aeb8624..86c8e80a228 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -217,6 +217,7 @@ void NODE_OT_tree_socket_move(struct wmOperatorType *ot);
void NODE_OT_shader_script_update(struct wmOperatorType *ot);
void NODE_OT_viewer_border(struct wmOperatorType *ot);
+void NODE_OT_clear_viewer_border(struct wmOperatorType *ot);
extern const char *node_context_dir[];
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index ac541ef6a28..807ed756c77 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -122,6 +122,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_shader_script_update);
WM_operatortype_append(NODE_OT_viewer_border);
+ WM_operatortype_append(NODE_OT_clear_viewer_border);
WM_operatortype_append(NODE_OT_tree_socket_add);
WM_operatortype_append(NODE_OT_tree_socket_remove);
@@ -321,6 +322,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_clipboard_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "NODE_OT_viewer_border", BKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "NODE_OT_clear_viewer_border", BKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
}