Maniphest T69520

Undo doesn't work properly in Node Editor
Closed, DuplicateBUG

Assigned To
None
Authored By
Robbie K. (mindvox)
Sep 5 2019, 8:25 AM
Tags
  • BF Blender
  • Nodes & Physics
Subscribers
Brecht Van Lommel (brecht)
Campbell Barton (campbellbarton)
Germano Cavalcante (mano-wii)
Robbie K. (mindvox)

Description

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

Related Objects

Mentioned Here
T71895: Undo doesn't consider changes in nodetree when object is in edit and texture paint mode
rB4b14f763da0e: Fix 'Links Cut' adding undo steps without cutting anything
rBf6cb5f54494e: Version bump to 2.80 final release

Event Timeline

Robbie K. (mindvox) created this task.Sep 5 2019, 8:25 AM
Germano Cavalcante (mano-wii) assigned this task to Campbell Barton (campbellbarton).Oct 17 2019, 5:00 PM
Germano Cavalcante (mano-wii) lowered the priority of this task from 90 to Low.
Germano Cavalcante (mano-wii) added subscribers: Campbell Barton (campbellbarton), Brecht Van Lommel (brecht), Germano Cavalcante (mano-wii).

@Campbell Barton (campbellbarton), 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 Van Lommel (brecht)

Dalai Felinto (dfelinto) removed Campbell Barton (campbellbarton) as the assignee of this task.Dec 23 2019, 1:52 PM
Dalai Felinto (dfelinto) added a project: Tracker Curfew.
Germano Cavalcante (mano-wii) edited projects, added Nodes & Physics; removed Tracker Curfew.Jan 27 2020, 2:55 PM
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

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:
Germano Cavalcante (mano-wii) updated the task description.Sep 14 2020, 2:26 PM
Germano Cavalcante (mano-wii) added a comment.Sep 14 2020, 2:47 PM

Thanks for the report.
rB4b14f763da0e brought some change to the undo in that operator.
Problems with undo in Edit Mode has already been reported in T71895: 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.