Open
Description
Tested versions
- Reproducible in v4.4.stable.official [4c311cb]
System information
Godot v4.4.stable - Windows 10 (build 19044) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 32.0.15.7247) - AMD Ryzen 7 3700X 8-Core Processor (16 threads)
Issue description
I was testing some UndoRedo
behaviour, and realized it was not calling the result of print.bind
correctly. Digging into it, I found the same issue with push_warning
, seed
, and randomize
. It seems to be a universal problem with GlobalScope
methods (though testing this is tricky, as most of these methods do not mutate state).
Steps to reproduce
Reproduction steps:
- Open and run
test_scene.tscn
in the repro project, or run the following GDScript
var undo_redo := UndoRedo.new()
func print_wrapper(s):
print(s)
func print_rand():
prints(randf(), randi())
func randomize_wrapper():
randomize()
func seed_wrapper(s):
seed(s)
func _ready() -> void:
var neutralseed = 123456
seed(neutralseed)
print_rand()
randomize()
seed(neutralseed)
print_rand()
undo_redo.create_action("randomize")
undo_redo.add_do_method(print_wrapper.bind(" no wrappers"))
undo_redo.add_do_method(randomize)
undo_redo.add_do_method(seed.bind(neutralseed))
undo_redo.add_do_method(print_rand)
undo_redo.add_do_method(print_wrapper.bind(" both wrappers"))
undo_redo.add_do_method(randomize_wrapper)
undo_redo.add_do_method(seed_wrapper.bind(neutralseed))
undo_redo.add_do_method(print_rand)
undo_redo.add_do_method(print_wrapper.bind(" test only seed"))
undo_redo.add_do_method(randomize_wrapper)
undo_redo.add_do_method(seed.bind(neutralseed))
undo_redo.add_do_method(print_rand)
undo_redo.add_do_method(print_wrapper.bind(" test only randomize"))
undo_redo.add_do_method(seed_wrapper.bind(neutralseed))
undo_redo.add_do_method(randomize)
undo_redo.add_do_method(print_rand)
undo_redo.add_do_method(print.bind("finished!"))
undo_redo.commit_action()
Expected output:
0.61765211820602 3193628639
0.61765211820602 3193628639
no wrappers
0.61765211820602 3193628639
both wrappers
0.61765211820602 3193628639
test only seed
0.61765211820602 3193628639
test only randomize
[a random float] [a random int]
finished!
Actual output:
0.61765211820602 3193628639
0.61765211820602 3193628639
no wrappers
0.34198194742203 2576548083
both wrappers
0.61765211820602 3193628639
test only seed
0.00454090256244 1907607115
test only randomize
0.61765211820602 3193628639