You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugin version
2.4 with Godot 3.5 stable. The Plugin was downloaded from github. Level was made using Tiled 1.4.3
Loading maps at runtime when running from the editor works, but maps cannot be imported at runtime from an exported build:
871 total_path ../../tilesets/cave.png
874 total_path tiled/levels/../tileset/../../tilesets/cave.png
876 total_path tilesets/cave.png
Tiled Importer: Image not found: tilesets/cave.png
Error when building Tiled scene: File: Not found error.
With the following bit of code modified in tiled_map_reader.gd:
# Loads an image from a given path
# Returns a Texture
func load_image(rel_path, source_path, options):
print("Load image %s, %s, %s" % [rel_path, source_path, options])
flags = options.image_flags if "image_flags" in options else Texture.FLAGS_DEFAULT
var embed = options.embed_internal_images if "embed_internal_images" in options else false
var ext = rel_path.get_extension().to_lower()
if ext != "png" and ext != "jpg":
print_error("Unsupported image format: %s. Use PNG or JPG instead." % [ext])
return ERR_FILE_UNRECOGNIZED
var total_path = rel_path
print("871 total_path %s" % total_path)
if rel_path.is_rel_path():
total_path = ProjectSettings.globalize_path(source_path.get_base_dir()).plus_file(rel_path)
print("874 total_path %s" % total_path)
total_path = ProjectSettings.localize_path(total_path)
print("876 total_path %s" % total_path)
var dir = Directory.new()
if not dir.file_exists(total_path):
print_error("Image not found: %s" % [total_path])
return ERR_FILE_NOT_FOUND
Part of my level loading code:
var levelPath = "res://tiled/levels/" + levelName + ".tmx"
# create instance from vnen's Tiled importer to import the map
var tiledMapReader = load("addons/vnen.tiled_importer/tiled_map_reader.gd").new()
var optionsDict = {
"add_background":true,
"collision_layer":8,
"custom_properties":true,
"embed_internal_images":false,
"image_flags":0,
"post_import_script":null,
"save_tiled_properties":true,
"tile_metadata":false,
"uv_clip":true
}
# build the level
var result = tiledMapReader.build(levelPath, optionsDict)
if typeof(result) == TYPE_INT:
Logger.print_err(result, "Error when building Tiled scene: ")
get_tree().quit()
var scn : Node2D = result
# procede to run custom code to handle spawning objects and such
It seems tilesets/cave.png cannot be found, even though it is in the project folder.
Plugin version
2.4 with Godot 3.5 stable. The Plugin was downloaded from github. Level was made using Tiled 1.4.3
Loading maps at runtime when running from the editor works, but maps cannot be imported at runtime from an exported build:
With the following bit of code modified in
tiled_map_reader.gd
:Part of my level loading code:
It seems
tilesets/cave.png
cannot be found, even though it is in the project folder.Tiled files
files.zip
The text was updated successfully, but these errors were encountered: