Closed Jeremi360 closed 5 years ago
Today I got an idea - there is simpler and easier way to fix it- just inst2dict()
to save state of nodes that was add do ren's global variables by node_link()
(now there is only save path to node) and then use get_property_list()
and set()
to set it after load.
What you think @ivandardi?
I need to use PackedScene
with ResourceSaver
and ResourceLoader
as dict - unfortunately inst2dict()
only give vars define in script
It is not a bug, it properly save/load data, but it just don't save scene state - it will be hard to do and have many disadvantages. Just use build rakugo_vars mechanics to save what you need I also added on "loaded" signal to help with it.
Yes this solution is good enough. Here are examples:
This solution for some reason stop to work - save don't save all values of variables for some reason :(
To replicate the bug:
Hello, the error is with the persistence node ... when loading the data is erased. I did a test in beta11.
....
Well, I fixed that, but it only happened when you didn't use profiles.
I will try to do several tests for the persistence node to see if everything is working correctly.
@MatiasVME Thanks for your help. How you discover that "when loading the data is erased" ? I don't know why bug is happening - I didn't change anything in side save/load methods for months.
Ups!
Let me explain... My english is bad..
I found a bug in PersistenceNode, but this only affects projects that don't use this:
Persistence.get_data("blabla") # No error
They're using this:
$Persistence.get_data() # Error
The PersistenceNode in the Rakugo project should not have problems. (I think)
Yesterday I was trying to see the error and I don't know what's going on.
@MatiasVME I use $Persistence.get_data()
, so I have an error
and I should make PersistenceNode as singleton yes?
Also I see that you did update then addon should I update it?
Just change the following line:
To:
if profile_name == "":
But I don't think that solves the rakugo error.
In a while I'm going to do some tests with PersistenceNode to see if everything is working correctly.
Edit: And singleton is for the range, there is no other effect with it.
Also so I saw you're not using get_data() without arguments.
matias@matias-Lenovo-ideapad-110-14ISK:/media/disco/git/Ren$ grep -rni 'get_data()'
gui/Screens/Screens.gd:159: return get_viewport().get_texture().get_data()
@MatiasVME I will fix this and update to 1.4.0 version of PersistenceNode. Next time when you update PersistenceNode tell me.
This is the last version and the tests are correct.
https://github.com/MatiasVME/Persistence/releases/tag/v1.4.0-Godot.3.1
@MatiasVME "Also so I saw you're not using get_data() without arguments" ?
gui/Screens/Screens.gd:159: return get_viewport().get_texture().get_data()
- This is correct code it is not connected with yours PersistenceNode.
Bug continues to occur - it seems that for some reason not, all vars are saved.
I will try to make some code in main.gd
less clutter - maybe it will fix it or make it easy to fix.
That's all I was saying, since the grep command shows all the strings in which 'get_data()' is used in the project.
The line: gui/Screens/Screens.gd:159: return get_viewport().get_texture().get_data()
It is not related to persistence node.
If you run it with beta7 or 8, does it work?
for me this line worked in every beta, also it is impossible to use this 'get_data()` with any arguments.
I update to PersistenceNode 1.4.0 , and made code of rakugo simpler, cleaner and less clutter. Switched PersistenceNode to Text mode to check if it fix any thing with save/load. And now when I try to load I get this:
[PersistenceNode] El archivo no existe: user://saves/default.save
[PersistenceNode] retorna false.
[PersistenceNode] El archivo no existe: user://saves/default.save
[PersistenceNode] load_profile_default retorna false.
I've been watching, and I don't know what's gonna happen. S:
I fixed PersistenceNode profile name checking, and it save, but for some reason characters after load are null, and some variables was saved with starting value - but it all is saved in the same way :( I will try write better RakugoVar types - maybe it will fix some thing.
I try check some older version of rakugo, but all of theme has this bug :/ It seams that it was only working because of some bug in godot, which was fixed in 3.1
But do you think it's the PersistenceNode?
The tests are fine, if you think a test is missing you can add it to the repo de persistence node.
Is there test for dictionary and array? I save big dictionary with alot of dictionaries in it - maybe I should do it easier - saves these dictionaries with as data with out this one extra dictionary that's keep them together
I've previously tested with giant dictionaries (in my game Spaceship Shooter RPG Deluxe). But I haven't tested the PeristenceNode version for 3.1 with giant dictionaries.
I'll try to see what happens in Rakugo later.
I will compare current main.gd with main.gd from 1.0 - maybe this way I will find what is wrong.
It didn't help. But I got idea to add saved nodes to "save" group and use it to update its var base before save. I also need to check all ifs in jump()
Fixed jump()
now after load you can go further :D #131
It fixed in resource-save
branch :D ,
but bug with that you can't go further is back
https://youtu.be/8amzuitYWtI
but bug with that you can't go further is back
:arrow_up: fixed :D
But this save system/load need few tweaks
Fixed an merged #135
Solutions is to use PackedScene with ResourceSaver and ResourceLoader here is example of this: https://godotengine.org/qa/31138/saving-a-dictionary-of-scene-states