Undo doesn't work properly in Node Editor #69520

Closed
opened 2019-09-05 08:25:27 +02:00 by Robbie K. · 6 comments

System Information
Operating system: Windows 7
Graphics card: 'GeForce GTX 1050 Ti/PCIe/SSE2'

     	               'NVIDIA Corporation'
                     '4.5.0 NVIDIA 384.94'

Blender Version
version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449, type:
build date: 2019-07-29, 09:41 AM

Short description of error
Making a cut and undoing works fine.

But any of steps below results in problems with undo:
Make a cut and move a node requires 3 undo's.
Make a cut and move a node and move a node again requires 5 undo's. One more move and it requires 7 undos.
If I make a cut and move a node 9 times it takes 19 times to undo.

Using a group node : Cutting a link and undoing in Edit Mode doesn't work at all.

Exact steps for others to reproduce the error

  • Default Cube : Click use Nodes.
  • Try any of the steps described above

Node Editor Undo Cube.blend

Node Editor Undo on Group Node.blend

**System Information** Operating system: Windows 7 Graphics card: 'GeForce GTX 1050 Ti/PCIe/SSE2' ``` 'NVIDIA Corporation' '4.5.0 NVIDIA 384.94' ``` **Blender Version** version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f54494e, type: build date: 2019-07-29, 09:41 AM **Short description of error** Making a cut and undoing works fine. But any of steps below results in problems with undo: Make a cut and move a node requires 3 undo's. Make a cut and move a node and move a node again requires 5 undo's. One more move and it requires 7 undos. If I make a cut and move a node 9 times it takes 19 times to undo. Using a group node : Cutting a link and undoing in Edit Mode doesn't work at all. **Exact steps for others to reproduce the error** - Default Cube : Click use Nodes. - Try any of the steps described above [Node Editor Undo Cube.blend](https://archive.blender.org/developer/F7717865/Node_Editor_Undo_Cube.blend) [Node Editor Undo on Group Node.blend](https://archive.blender.org/developer/F7717866/Node_Editor_Undo_on_Group_Node.blend)
Author

Added subscriber: @RobbieK

Added subscriber: @RobbieK

Added subscribers: @ideasman42, @brecht, @mano-wii

Added subscribers: @ideasman42, @brecht, @mano-wii
Campbell Barton was assigned by Germano Cavalcante 2019-10-17 17:00:10 +02:00

@ideasman42, since this involves the undo system, I designed it for you.

Apparently the Links Cut tool increases the undo stack even when it does not cut any links.
Also, with the selection tool, click and drag correspond to two undos (select and move).

Cc @brecht

@ideasman42, since this involves the undo system, I designed it for you. Apparently the `Links Cut` tool increases the undo stack even when it does not cut any links. Also, with the selection tool, click and drag correspond to two undos (select and move). Cc @brecht
Campbell Barton was unassigned by Dalai Felinto 2019-12-23 13:52:13 +01:00

It seems wrong to assume that WM_gesture_lasso_modal always returns OPERATOR_FINISHED with the mouse click.
The operator's return is ignored and an undo step is always added.

It seems that the correct should be this:

diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index a5f32b4ff1f..d907b142f21 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -607,8 +607,9 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event)
   return OPERATOR_RUNNING_MODAL;
 }
 
-static void gesture_lasso_apply(bContext *C, wmOperator *op)
+static int gesture_lasso_apply(bContext *C, wmOperator *op)
 {
+  int retval = OPERATOR_FINISHED;
   wmGesture *gesture = op->customdata;
   PointerRNA itemptr;
   float loc[2];
@@ -628,9 +629,11 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op)
   gesture_modal_end(C, op);
 
   if (op->type->exec) {
-    int retval = op->type->exec(C, op);
+    retval = op->type->exec(C, op);
     OPERATOR_RETVAL_CHECK(retval);
   }
+
+  return retval;
 }
 
 int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -672,8 +675,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
     case MIDDLEMOUSE:
     case RIGHTMOUSE:
       if (event->val == KM_RELEASE) { /* key release */
-        gesture_lasso_apply(C, op);
-        return OPERATOR_FINISHED;
+        return gesture_lasso_apply(C, op);
       }
       break;
     case ESCKEY:

It seems wrong to assume that `WM_gesture_lasso_modal` always returns `OPERATOR_FINISHED` with the mouse click. The operator's `return` is ignored and an undo step is always added. It seems that the correct should be this: ``` diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index a5f32b4ff1f..d907b142f21 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -607,8 +607,9 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static void gesture_lasso_apply(bContext *C, wmOperator *op) +static int gesture_lasso_apply(bContext *C, wmOperator *op) { + int retval = OPERATOR_FINISHED; wmGesture *gesture = op->customdata; PointerRNA itemptr; float loc[2]; @@ -628,9 +629,11 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op) gesture_modal_end(C, op); if (op->type->exec) { - int retval = op->type->exec(C, op); + retval = op->type->exec(C, op); OPERATOR_RETVAL_CHECK(retval); } + + return retval; } int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) @@ -672,8 +675,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) case MIDDLEMOUSE: case RIGHTMOUSE: if (event->val == KM_RELEASE) { /* key release */ - gesture_lasso_apply(C, op); - return OPERATOR_FINISHED; + return gesture_lasso_apply(C, op); } break; case ESCKEY: ```

Thanks for the report.
4b14f763da brought some change to the undo in that operator.
Problems with undo in Edit Mode has already been reported in #71895 (Undo doesn't consider changes in nodetree when object is in edit and texture paint mode)
So I will close this report as a duplicate.

Thanks for the report. 4b14f763da brought some change to the undo in that operator. Problems with undo in Edit Mode has already been reported in #71895 (Undo doesn't consider changes in nodetree when object is in edit and texture paint mode) So I will close this report as a duplicate.

Closed as duplicate of #71895

Closed as duplicate of #71895
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#69520
No description provided.