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:
authorMatthias Ellerbeck <voyager25>2020-02-11 17:29:24 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-11 17:32:24 +0300
commit63de8139149e2074c11d474823b566c15824aa59 (patch)
treed76ffed57fd9222a0d9a5859a1d1759b3c25f1ad /source/blender/editors/space_node
parent4aa0e2136cc9c4d663fde922bf403fdfacb5eee7 (diff)
Node Editor: node resize can now be cancelled, like other operators
Differential Revision: https://developer.blender.org/D6800
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_edit.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 9fba78682dc..21e68c0b600 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -895,10 +895,24 @@ static void node_resize_init(
WM_event_add_modal_handler(C, op);
}
-static void node_resize_exit(bContext *C, wmOperator *op, bool UNUSED(cancel))
+static void node_resize_exit(bContext *C, wmOperator *op, bool cancel)
{
WM_cursor_modal_restore(CTX_wm_window(C));
+ /* Restore old data on cancel. */
+ if (cancel) {
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNode *node = nodeGetActive(snode->edittree);
+ NodeSizeWidget *nsw = op->customdata;
+
+ node->locx = nsw->oldlocx;
+ node->locy = nsw->oldlocy;
+ node->offsetx = nsw->oldoffsetx;
+ node->offsety = nsw->oldoffsety;
+ node->width = nsw->oldwidth;
+ node->height = nsw->oldheight;
+ }
+
MEM_freeN(op->customdata);
op->customdata = NULL;
}
@@ -993,6 +1007,12 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
+ else if (event->val == KM_PRESS) {
+ node_resize_exit(C, op, true);
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_CANCELLED;
+ }
break;
}