From 3a1cf838ca09bdc58eeab67ced640314faf49eae Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sat, 3 Oct 2020 18:24:41 +0200 Subject: Fix issues with calling View2D zoom operators in an `EXEC` context Multiple related issues: * `view_zoomdrag_exec()` required `view_zoomdrag_init()` to be called first to set up data. Can now easily be done in the `_exec()` function as well though. * Because of that the operators could not be called in an `EXEC_` context (e.g. `EXEC_REGION_WIN`). * With "Zoom to Mouse Position" enabled, zooming from a menu or script would zoom to the mouse position. That should only happen if the operators are called directly in the editor. --- release/scripts/startup/bl_ui/space_node.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_node.py') diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index e5470441ab1..4662de8b4ac 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -245,8 +245,10 @@ class NODE_MT_view(Menu): layout.separator() - layout.operator("view2d.zoom_in") - layout.operator("view2d.zoom_out") + sub = layout.column() + sub.operator_context = 'EXEC_REGION_WIN' + sub.operator("view2d.zoom_in") + sub.operator("view2d.zoom_out") layout.separator() -- cgit v1.2.3