From 4b34dee255efed9b6ca37dce24d1e4d67eca988a Mon Sep 17 00:00:00 2001 From: Daniel Konar Date: Thu, 13 Feb 2025 21:00:55 +0100 Subject: [PATCH] Fix monster loading on export --- src/scripts/Resources.gd | 20 ++++++++++--- .../Bestiary/textureAtlas.png.import | 28 +++---------------- .../items/textureAtlas.png.import | 28 +++---------------- 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/src/scripts/Resources.gd b/src/scripts/Resources.gd index 4d271f1..66c77c7 100644 --- a/src/scripts/Resources.gd +++ b/src/scripts/Resources.gd @@ -221,7 +221,13 @@ func load_bestiary_resources( path : String ) -> void: var n_crea_img_pack : Dictionary = {} n_crea_img_pack = Utils.FileHandler.read_json_dictionary_from_txt(Utils.FileHandler.read_txt_from_file(path + "img_pack.json")) - var texture_atlas: Image = load(path+"textureAtlas.png") + var texture_atlas_path : String = path+"textureAtlas.png" + var texture_atlas : Image + if (texture_atlas_path.begins_with("res://")) : + texture_atlas = load(texture_atlas_path) + else : + texture_atlas = Image.new() + var _err = texture_atlas.load(texture_atlas_path) #load images to images_book for i in n_crea_img_pack : @@ -784,9 +790,15 @@ func load_creature_ai_resources(path : String) : # var n_creascripts_book = Utils.FileHandler.read_json_dic_from_file(path +"spells_book.json") # print("n_spells_book : ", n_spells_book) for sn in scriptfilenames : -# print("adding " +sn) - var newcreascript = load(path+sn) - creascripts_book[sn] = newcreascript + if sn.ends_with(".gd") : + print("adding " +sn) + var newcreascript : GDScript + if path.begins_with("res://") : + newcreascript = load(path+sn) + else : + newcreascript = GDScript.new() + var _err = newcreascript.load(path+sn) + """ Accessible resources """ diff --git a/src/shared_assets/Bestiary/textureAtlas.png.import b/src/shared_assets/Bestiary/textureAtlas.png.import index d7b3c94..dac3421 100644 --- a/src/shared_assets/Bestiary/textureAtlas.png.import +++ b/src/shared_assets/Bestiary/textureAtlas.png.import @@ -1,34 +1,14 @@ [remap] -importer="texture" -type="CompressedTexture2D" +importer="image" +type="Image" uid="uid://dhxhyf20guprq" -path="res://.godot/imported/textureAtlas.png-8c3834379c2fff2d4215c85382b85638.ctex" -metadata={ -"vram_texture": false -} +path="res://.godot/imported/textureAtlas.png-8c3834379c2fff2d4215c85382b85638.image" [deps] source_file="res://shared_assets/Bestiary/textureAtlas.png" -dest_files=["res://.godot/imported/textureAtlas.png-8c3834379c2fff2d4215c85382b85638.ctex"] +dest_files=["res://.godot/imported/textureAtlas.png-8c3834379c2fff2d4215c85382b85638.image"] [params] -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/src/shared_assets/items/textureAtlas.png.import b/src/shared_assets/items/textureAtlas.png.import index 96fa4c7..3465035 100644 --- a/src/shared_assets/items/textureAtlas.png.import +++ b/src/shared_assets/items/textureAtlas.png.import @@ -1,34 +1,14 @@ [remap] -importer="texture" -type="CompressedTexture2D" +importer="image" +type="Image" uid="uid://brcbpvryivkpp" -path="res://.godot/imported/textureAtlas.png-5ea3a5cff70597b59f6eaeb63dfc9a35.ctex" -metadata={ -"vram_texture": false -} +path="res://.godot/imported/textureAtlas.png-5ea3a5cff70597b59f6eaeb63dfc9a35.image" [deps] source_file="res://shared_assets/items/textureAtlas.png" -dest_files=["res://.godot/imported/textureAtlas.png-5ea3a5cff70597b59f6eaeb63dfc9a35.ctex"] +dest_files=["res://.godot/imported/textureAtlas.png-5ea3a5cff70597b59f6eaeb63dfc9a35.image"] [params] -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1