Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndoRedo error with consecutive create_action calls #15506

Open
brainsick opened this issue Jan 8, 2018 · 4 comments
Open

UndoRedo error with consecutive create_action calls #15506

brainsick opened this issue Jan 8, 2018 · 4 comments

Comments

@brainsick
Copy link
Contributor

brainsick commented Jan 8, 2018

Godot version:
99da466

OS/device including version:
Ubuntu 17.10

Issue description:
After this, I'm done torturing UndoRedo, I think. :)

There doesn't appear to be any way out of a create_action() once you've started it. There's a commit but no rollback. If one expects another create_action() to discard the previous commands, they're treated to an error and a now-broken commit.

Steps to reproduce:

todd@todd-ab28d3:~/repos/remote/brainsick-godot-tests$ cat tests/qa/classes/UndoRedoTest-uncommit.gd 
extends MainLoop

var testobject1
var undoredo

func _initialize():
	testobject1 = TestClass.new()
	testobject1.set_prop(1)
	
	undoredo = UndoRedo.new()

# main test body
func _iteration(delta):
	test_create_uncommit()
	test_create_commit()
	
	return true # exit MainLoop

func _finalize():
	undoredo.free()

func test_create_uncommit():
	undoredo.create_action('first action - method')
	undoredo.add_do_method(testobject1, 'set_prop', 2)
	undoredo.add_undo_method(testobject1, 'set_prop', testobject1.get_prop())
	#undoredo.commit_action()
	# where's rollback?
	
	assert(testobject1.prop == 1)

func test_create_commit():
	undoredo.create_action('second action - property')
	#undoredo.create_action('second action - property', UndoRedo.MERGE_DISABLE)
	#undoredo.create_action('second action - property', UndoRedo.MERGE_ENDS)
	#undoredo.create_action('second action - property', UndoRedo.MERGE_ALL)
	undoredo.add_do_property(testobject1, 'prop', 3)
	undoredo.add_undo_property(testobject1, 'prop', testobject1.prop)
	undoredo.commit_action()
	
	assert(testobject1.prop == 3)

class TestClass:
	var prop
	
	func get_prop():
		return prop
	
	func set_prop(prop):
		self.prop = prop
todd@todd-ab28d3:~/repos/remote/brainsick-godot-tests$ ../brainsick-godot/bin/godot.x11.tools.64 -s tests/qa/classes/UndoRedoTest-uncommit.gd 
No touch devices found
OpenGL ES 3.0 Renderer: AMD Radeon (TM) R9 Fury Series (AMD FIJI / DRM 3.18.0 / 4.13.0-21-generic, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
SCRIPT ERROR: test_create_commit: Assertion failed.
   At: res://tests/qa/classes/UndoRedoTest-uncommit.gd:40.
ERROR: clear_history: Condition ' action_level > 0 ' is true.
   At: core/undo_redo.cpp:326.

I have an updated, more robust test at godotengine/godot-tests#3.

@brainsick brainsick changed the title UndoRedo error with consecutive create_commit calls UndoRedo error with consecutive create_action calls Jan 8, 2018
@Calinou
Copy link
Member

Calinou commented Jun 7, 2020

Can anyone still reproduce this bug in Godot 3.2.1 or 3.2.2beta4?

@akien-mga
Copy link
Member

akien-mga commented Jun 8, 2020

It's still reproducible with the script in OP with 3.2.1-stable and aeb5513.

Edit: Still reproducible as of 3.3-stable.

@Torguen
Copy link

Torguen commented Aug 10, 2021

A big hassle to work with this bug in 3.3.3 rc1.

The editor is constantly crashing.
in my case, using the tile editor with a tablet is causing constant crashes, godot has a terrible time with tablet events.
Disable windows ink in the tablet options fix the problem.
Captura

@Torguen
Copy link

Torguen commented Nov 19, 2021

A big hassle to work with this bug in 3.3.3 rc1.

The editor is constantly crashing. in my case, using the tile editor with a tablet is causing constant crashes, godot has a terrible time with tablet events. Disable windows ink in the tablet options fix the problem. Captura

I take it back, that doesn't fix the problem, it just makes it less constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants