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:
authorPhilipp Oeser <info@graphics-engineer.com>2022-04-20 16:37:28 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-04-21 11:30:41 +0300
commit298e9c7ebd3b7f67042a4782487e0c9a51f3c975 (patch)
tree33667a191acce5e0684b52f521f79ff0c748f51f
parent01333cb47f83d19a62b5c96f2a69cb8a7c4ae7c3 (diff)
Fix T97465: Moving compositor BG image cannot be cancelled
This was possible with the gizmo, but no using the operator (e.g. from the sidebar). Now store original offsets and reset to these on calcel (ESC or RMB). Maniphest Tasks: T97465 Differential Revision: https://developer.blender.org/D14704
-rw-r--r--source/blender/editors/space_node/node_view.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_view.cc b/source/blender/editors/space_node/node_view.cc
index f5f5a9e6f67..38a0101a432 100644
--- a/source/blender/editors/space_node/node_view.cc
+++ b/source/blender/editors/space_node/node_view.cc
@@ -179,6 +179,8 @@ void NODE_OT_view_selected(wmOperatorType *ot)
struct NodeViewMove {
int mvalo[2];
int xmin, ymin, xmax, ymax;
+ /** Original Offset for cancel. */
+ float xof_orig, yof_orig;
};
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -207,13 +209,25 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e
case LEFTMOUSE:
case MIDDLEMOUSE:
- case RIGHTMOUSE:
if (event->val == KM_RELEASE) {
MEM_freeN(nvm);
op->customdata = nullptr;
return OPERATOR_FINISHED;
}
break;
+ case EVT_ESCKEY:
+ case RIGHTMOUSE:
+ snode->xof = nvm->xof_orig;
+ snode->yof = nvm->yof_orig;
+ ED_region_tag_redraw(region);
+ WM_main_add_notifier(NC_NODE | ND_DISPLAY, nullptr);
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);
+
+ MEM_freeN(nvm);
+ op->customdata = nullptr;
+
+ return OPERATOR_CANCELLED;
+ break;
}
return OPERATOR_RUNNING_MODAL;
@@ -249,6 +263,9 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
+ nvm->xof_orig = snode->xof;
+ nvm->yof_orig = snode->yof;
+
BKE_image_release_ibuf(ima, ibuf, lock);
/* add modal handler */