diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-05 18:05:41 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-30 21:01:20 +0400 |
commit | a51aeedade2d0620d8509602ab04c2ec00e06053 (patch) | |
tree | 7a2f697942ebb94f13073136af72568663513ffc /source/blender/editors/space_node | |
parent | e919a37e97874d2e7b5abc134eab7ed43c993b18 (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/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 35 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_ops.c | 2 |
4 files changed, 40 insertions, 21 deletions
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); } |