The EASIEST way to add Undo and Redo in Godot 4.2

Поделиться
HTML-код
  • Опубликовано: 10 июл 2024
  • In this tutorial we are taking a look at what Godot 4.2 offers in term of functionalities for easy implementation of Do, Undo and Redo behavior. In order to showcase this, I have created a small canvas which makes use of Line2D nodes in order to make drawings on it.
    A few points not touched in the video:
    add_do_reference also registers a reference for "do" that will be erased if the "do" history is lost.
    At 14:44 I say 'when we undo the methods they happen in the reverse order'. What should I have said to make it more clear is 'when we undo the methods we want them to happen in the reverse order'. This is because undo functions are called in the order they are added, thus, having the potential to break functionality if we are not careful with this.
    Links for the discussed topics:
    UndoRedo - docs.godotengine.org/en/stabl...
    Line2D - docs.godotengine.org/en/stabl...
    Input Events - docs.godotengine.org/en/stabl...
    Assets:
    Buttons - uxwing.com/
    --------------------
    Github repository for this project.
    github.com/cashew-olddew/godo...
    Support me on Ko-Fi: ko-fi.com/cashewolddew
    --------------------
    Chapters:
    0:00 - Create the drawing tool
    6:22 - Implement Undo
    11:26 - Implement Redo
    12:06 - Undo complex behavior
    16:54 - Undo a property
    19:50 - Clear Undo history
    #godot #gamedev #undo

Комментарии • 4

  • @dastanghaedrahmati6977
    @dastanghaedrahmati6977 Месяц назад

    Such great and clear explanation! Thank you for your help.

  • @hi-ef8eh
    @hi-ef8eh Месяц назад

    Thanks for the tutorial!
    Exactly what I needed

  • @AgnisNeZvers
    @AgnisNeZvers Месяц назад

    What? Previously this was accessible only for plugins. I ended up implementing my own version of UndoRedo.

    • @cashewolddew
      @cashewolddew  Месяц назад +1

      Honestly it really sounds like a feature that would only be accessible through plugins, but Godot has many surprises. Hope this helps you from now on! 🥜