DialogueNodes icon indicating copy to clipboard operation
DialogueNodes copied to clipboard

Closing and opening a dialogue file in the graph editor results in the loss of recent changes if resource inspector is open

Open callumlawson opened this issue 1 year ago • 5 comments

Godot version: v4.1.3.stable.mono.official [f06b6836a]

OS/device including version: Windows 10 x64

Dialogue Nodes Version 1.0.2

Issue Description: When saving a dialogue changes are immediately saved to disk. However, the corresponding ".tres" file in the editor is cached. This means that opening the ".tres" file in the editor shows the old values before saving. This also means that closing the dialogue in the Dialogue Nodes editor and then opening that same file, will result in seeing the old (cached) version, not the version on disk - meaning you lose your work if you save the newly opened version.

Note: If you save the dialogue and then run the game there are no issues, as the game loads the resource from the disk, avoiding the version that appears to be cached by the editor.

Note: If you open and close the whole editor the inspector updates to show the most recent changes to the ".tres" file (in sync with the on-disk copy). Opening the resource in the Dialogue Nodes editor will also then give the expected result.

Steps to reproduce:

  1. Create or open dialogue file with the Dialogue Nodes graph editor
  2. Change something (e.g. add "Hello world" to a node)
  3. File -> Save
  4. File -> Close
  5. File -> Open [file you just saved]

Expected result: Change is seen in opened file Actual result: Change is not seen in opened file (but is reflected on disk if checked with an external editor)

P.S. I'm really enjoying using Dialogue Nodes - thank you :)

callumlawson avatar Dec 01 '23 18:12 callumlawson

Hi, I'm unable to reproduce the issue both on Windows 10 x64 & Pop!_OS 22.04. The plugin loads the file from disk every time with the last saved changes.

Can you please try a fresh Godot 4.1 project, download the addon from the main branch of this repo and let me know if the issue is still present on your system?

nagidev avatar Dec 02 '23 07:12 nagidev

Thank you for the swift reply! I've done the above (clean project, main branch on 4.1) and realized out the repro requires an additional step: (Sorry for not catching this first time around!)

  1. Open dialogue file with the Dialogue Nodes graph editor
  2. Open the ".tres" file so that it is currently showing in the inspector panel
  3. Change something (e.g. add "Hello world" to a node)
  4. File -> Save
  5. File -> Close
  6. File -> Open [file you just saved]

See this image - File is saved in the dialogue node editor with the text "Test 4" (note lack of *), the inspector for same resource shows value "Test 2" (the old value). Closing the tree in the Dialogue Editor then opening it again from this state will result in the text "Test 2" DialogueNodesRepro

It appears that the value serialized by the inspector is taking preference over the value on disk when the resource is currently showing in the inspector in this situation.

callumlawson avatar Dec 02 '23 11:12 callumlawson

This old Godot bug might be the cause for this behaviour: #62536

I guess the best workaround right now would be to not open the dialogue resource since it was only intended to be edited using the dialogue editor.

nagidev avatar Dec 02 '23 13:12 nagidev

Yup, it's certainly a straightforward workaround - now that I've understood the inspector must be open to reproduce. Thank you for having a look.

callumlawson avatar Dec 04 '23 17:12 callumlawson

I've done a PR that fixes this issue EDIT: It also fixed some other small issues that were present in version 4.2.1, idk if those were issues on older versions

germanbv avatar Jan 13 '24 08:01 germanbv

From @GeminiSquishGames

The save system is still bugged. this is the same problem as https://github.com/nagidev/DialogueNodes/issues/18 but I just wanted to show how very annoying it is and that it's related to the duplication bug I was experiencing only it can happen without the inspector being open as well, but I'm not sure when that happens yet? This is pretty bad if you are used to having your inspector open all the time. Also, if you remove a node when this bug is happening, replace that node and connect it to the tree, this detaches every connection after that node. So if it's the start node of the whole tree, the entire tree's interconnected nodes are disconnected. I just noticed, could really use a redo/undo system. Luckily there is a built-in Godot class for that. I kinda just noticed the C# implementations fix also, may look into that since I am in mono build. I noticed a lot of this stuff after the video so it's not exactly as informative but maybe gives an idea. https://youtu.be/yExDrZrLqY0 bort_dialogue_tree.zip

nagidev avatar Apr 25 '24 06:04 nagidev

@callumlawson @GeminiSquishGames can you guys check out the pull request to verify is the issue are fixed on your end? Thanks!

nagidev avatar Apr 26 '24 22:04 nagidev

Testing, but right off the bat, "res://myDialog.res" seems missing in your example project. Will work around with my own for now.

On Fri, Apr 26, 2024 at 5:39 PM Nagi @.***> wrote:

@callumlawson https://github.com/callumlawson @GeminiSquishGames https://github.com/GeminiSquishGames can you guys check out the pull request to verify is the issue are fixed on your end? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/nagidev/DialogueNodes/issues/18#issuecomment-2080200527, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHE6AFYWOHK77QI62R7V33Y7LJRBAVCNFSM6AAAAABADIKR4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBQGIYDANJSG4 . You are receiving this because you were mentioned.Message ID: @.***>

GeminiSquishGames avatar Apr 27 '24 15:04 GeminiSquishGames

@GeminiSquishGames I don't think I ever pushed a myDialog.res file to the repo. Can you please elaborate? Update: nevermind, I figured it out. Fixing.

Thanks!

Update2: I managed to remove all the duplicates from the bort_dialogue_tree file. However, I couldn't get the connections to return since the original didn't have any data for that. Still I hope reconnecting the nodes is the only thing you'd have to do. Hope this helps! new_bort_dialogue_tree.zip

nagidev avatar Apr 27 '24 17:04 nagidev

Okay, cool beans mans. Actally, I went ahead and put the prototype away for now and started over. Having trouble integrating Rapier2D Godot physics so I'm kinda doing the alpha from scratch, but I'm grateful to you for sticking with it so I can focus on specific mechanics.

On Sat, Apr 27, 2024 at 12:19 PM Nagi @.***> wrote:

@GeminiSquishGames https://github.com/GeminiSquishGames I don't think I ever pushed a myDialog.res file to the repo. Can you please elaborate?

— Reply to this email directly, view it on GitHub https://github.com/nagidev/DialogueNodes/issues/18#issuecomment-2081105045, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHE6AB3QY5BJXEEAFIM2VLY7PM3RAVCNFSM6AAAAABADIKR4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGEYDKMBUGU . You are receiving this because you were mentioned.Message ID: @.***>

GeminiSquishGames avatar Apr 27 '24 21:04 GeminiSquishGames