hello,
I am having an error in converting a project to godot 4,
the problem seems to be in 3.5 i needed to save the file has a var.
In godot 4 when i open the file and try to get this var, the log seems to be wrong

this is the function I am using to save the file in 3.5

func _saveAnim():
	if ( saveFileName == "" ):
		saveFileName = "noName";
	
	var file = File.new()
	file.open(saveFileName, File.WRITE)
	file.store_var(root1);
	file.close()
	saveLock = false;

the function to load the file var in godot 4

func _loadAnim( loadFileName ):
	var file = FileAccess.open(loadFileName, FileAccess.READ)
	var animFile  = file.get_var();
	file = null # File is closed.
	return( animFile );

this is the root1 print log in 3.5

--- Debugging process started ---
Godot Engine v3.5.rc5.official.ae6059793 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
Async. shader compilation: ON (full native support)
Shader cache: ON
 
{Fnum:[{hEx:{fm:0, pa:0, pos:(0, -82), pz:9, scl:(1, 1), vs:False}, pt1:{dn1:(-3, 3), dn2:(0, 3), dn3:(3, 3), fm:0, md1:(-3, 0), md2:(0, 0), md3:(3, 0), pa:0, pos:(-1.5, -49.5), pz:0, up1:(-3, -3), up2:(0, -3), up3:(3, -3)}, pt10:{dn1:(-5, 2), dn2:(0, 2), dn3:(5, 2), fm:0, md1:(-5, -1), md2:(0, -1), md3:(5, -1), pa:0, pos:(-4.5, -3), pz:9, up1:(-5, -4), up2:(0, -4), up3:(5, -4)}, pt11:{dn1:(-5, 9), dn2:(0, 9), dn3:(5, 9), fm:0, md1:(-5, 1), md2:(0, 1), md3:(5, 1), pa:0, pos:(-3.5, -14), pz:10, up1:(-5, -8), up2:(0, -8), up3:(5, -8)}, pt12:{dn1:(-5, 11), dn2:(0, 11), dn3:(5, 11), fm:0, md1:(-5, 1), md2:(0, 1), md3:(5, 1), pa:0, pos:(-2.5, -36), pz:11, up1:(-5, -10), up2:(0, -10), up3:(5, -10)}, pt13:{dn1:(-3, 3), dn2:(0, 3), dn3:(3, 3), fm:0, md1:(-3, 0), md2:(0, 0), md3:(3, 0), pa:0, pos:(-3, -42.5), pz:12, up1:(-3, -3), up2:(0, -3), up3:(3, -3)}, pt14:{dn1:(-5, 7.5), dn2:(0, 7.5), dn3:(5, 7.5), fm:0, md1:(-5, 0), md2:(0, 0), md3:(5, 0), pa:-12, pos:(-5.5, -52), pz:13, up1:(-5, -7.5), up2:(0, -7.5), up3:(5, -7.5)}, pt15:{dn1:(-5, 7), dn2:(0, 7), dn3:(5, 7), fm:0, md1:(-5, 0), md2:(0, 0), md3:(5, 0), pa:9, pos:(-5.5, -66.5), pz:14, up1:(-5, -7), up2:(0, -7), up3:(5, -7)}, pt2:{dn1:(-3.75, 0.25), dn2:(0, 0.25), dn3:(3.75, 0.25), fm:0, md1:(-3.75, 0), md2:(0, 0), md3:(3.75, 0), pa:0, pos:(-1, -57.5), pz:1, up1:(-3.75, -0.25), up2:(0, -0.25), up3:(3.75, -0.25)}, pt3:{dn1:(-3.5, 4.75), dn2:(0, 4.75), dn3:(3.5, 4.75), fm:0, md1:(-3.5, 1), md2:(0, 1), md3:(3.5, 1), pa:10, pos:(-1.5, -67.5), pz:2, up1:(-3.5, -3.75), up2:(0, -3.75), up3:(3.5, -3.75)}, pt4:{dn1:(-5, 2), dn2:(0, 2), dn3:(5, 2), fm:0, md1:(-5, -1), md2:(0, -1), md3:(5, -1), pa:0, pos:(-2.5, -3), pz:3, up1:(-5, -4), up2:(0, -4), up3:(5, -4)}, pt5:{dn1:(-5, 9), dn2:(0, 9), dn3:(5, 9), fm:0, md1:(-5, 1), md2:(0, 1), md3:(5, 1), pa:0, pos:(-1.5, -14), pz:4, up1:(-5, -8), up2:(0, -8), up3:(5, -8)}, pt6:{dn1:(-5, 11), dn2:(0, 11), dn3:(5, 11), fm:0, md1:(-5, 1), md2:(0, 1), md3:(5, 1), pa:0, pos:(-0.5, -36.5), pz:5, up1:(-5, -10), up2:(0, -10), up3:(5, -10)}, pt7:[...]

the root1 print log in godot 4, shows diferent values without the vars names.

[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]
[X: (0, 4747321238252559500000000000, 0), Y: (0, 0, 0), Z: (0, 0, 0), O: (0, 0, 0)]

in 3.5 the file is right root1 contains the Fnum[]
in 4 i get an error saying Fnum doesnt exist

I assumed that you posted the issue. I placed the link here so that people who see this topic know that the issue has been reported, and can view the issue for more information.

DaveTheCoder It has to be the cause, i think the store_var() files are identical. You found it, its the numeric type codes.

DaveTheCoder do you know if there's a way to change the file to TYPE_DICTIONARY = 27 ?
from the little i was able to found this ( enum Variant ) can only be changed outside of godot, and read when godot is starting.

I was going to experiment with that using a binary file editor. But it's not a simple one-level Dictionary. It's a complex Dictionary that contains other Dictionaries, so fixing it manually would be difficult.

You could re-write the file using Godot 4.

A workaround for this issue is to use a different way of saving the data, such as ConfigFile.

    DaveTheCoder It would be easier if i could reSave it in 3.5. Is is possible to save it in ConfigFile using the node FileDialog ?
    i have this save function

    func _saveAnim():
    	if ( saveFileName == "" ):
    		saveFileName = "noName";
    	
    	var file = File.new()
    	file.open(saveFileName, File.WRITE)
    	file.store_var(root1);
    	file.close()
    	saveLock = false;

      jonSS Is is possible to save it in ConfigFile using the node FileDialog ?

      FileDialog simply provides the file name, so you can use ConfigFile in place of File.

      The documentation has an example:
      https://docs.godotengine.org/en/stable/classes/class_configfile.html#configfile

      Since you're saving one variable, you only need to call set_value() once. And to load the file, call get_value() once.

      The file will be plain text (unless you use save_encrypted), so you can view it easily outside of Godot.

        DaveTheCoder Yeah but i dont think i can do it... I tried to save to jSon the 1st i rebember something wasnt working... I think it was converting the root1 to String.
        The config usess .set_value for each field, i think i would need to change the fields one by one ?
        If it was something like changing the --- file.store_var(root1); --- to --- config.set_value(root1); --- it would be easy, i just dont think it will work... i would have to run a loop, i might need to change the entire program ?

        An example of ( root1 ) can be easly created for testing...

        var saveFileName = "";
        
        var root1 = {
        	'Fnum': [0]
        }
        
        func _createAnim():
        	root1.Fnum.resize(1);
        	for n in range(1):
        		root1.Fnum[n] = {
        	"pt1": { "fm": dt1_Fm, "pos":dt1_Po, "pz": dt1_Z, "pa": dt1_A, "up1": dt1_Up1, "up2": dt1_Up2, "up3": dt1_Up3, "md1": dt1_Md1, "md2": dt1_Md2, "md3": dt1_Md3, "dn1": dt1_Dn1, "dn2": dt1_Dn2, "dn3": dt1_Dn3 }
        		}

        convert all to string or save it has config... then in gd4 convert it back to a var ?

          jonSS The config usess .set_value for each field, i think i would need to change the fields one by one ?

          Do you mean that ConfigFile also depends on the Variant numeric type codes? I haven't tested that, but it makes the incompatibility more serious. I'll try to verify that, and add a comment to the github issue if it's true.

            DaveTheCoder no, config is fine... this seems work

            in 3.5 save var(dictionary) root1 to config

            var convertName = "res://convertAnims/1Jump.cfg";
            
            	if ( b_buttonCFG.is_pressed() ):
            		var config1 = ConfigFile.new();#------------------------ok
            		config1.set_value("Player1", "best_score", root1); #----ok
            		config1.save(convertName);

            in 4.0

            var convertPathLoad = "res://animConvert/1Jump.cfg";
            var convertPathSave = "res://fileSaveInHere/dummy.anim";
            
            # ------------ in fileDialog to save *.anim ------------
            
            func _loadAnim(): #---loads-the-file-from-3.5
            	
            	var config = ConfigFile.new();
            	var _err = config.load(convertPathLoad);
            	var animFile = config.get_value("Player1", "best_score"); #----ok
            	
            	root1 = animFile;
            	
            	return( animFile );
            
            func _saveAnim():
            	var file = FileAccess.open(convertPathSave, FileAccess.WRITE);
            	file.store_var(root1);
            
            func _on_file_dialog_file_selected(path):
            	convertPathSave = path; #---write the *.anim name in fileDialog save
            	_saveAnim();

            it shows 27( dictionary ) not 18 anymore

            var checkVarPath = "res://fileSaveInHere/1Jump.anim";
            
            	if ( buttonTypeOF.is_hovered() ):
            		if ( Input.is_action_just_pressed('mouse_button') ):
            			var file = FileAccess.open(checkVarPath, FileAccess.READ);
            			var content = file.get_var();
            			
            			bbox.visible = ! bbox.visible;
            			
            			if ( bbox.visible == true ):
            				$Label.text = (str(typeof(content))); #--shows-27------------
            			else:
            				$Label.text = ("");

            had to convert the files 1 by 1
            the rotation in degrees doesnt work anymore... it uses radians
            this doesnt seem to work rad_to_deg

            had to use this instead * (PI/180);
            pt11_spr.rotation = root1.Fnum[animFrame].pt11.pa * (PI/180);

            *.pa ( angle )

              jonSS * (PI/180)

              That converts degrees to radians. To convert radians to degrees, multiply by 180.0 / PI.

                3 months later