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
The Tiled-editor allows object layers with separate independend images instead of an single tileset image (see attached tmx file).
The TCastleTiledMapData.TImage.DetermineSize function then crashes, because the URL is empty.
It's called in CastleTiledMapData.TTileset.Load function, because this tileset doesn't have any width/height settings
and the code tries to get them via the image - which isn't there as well.
That does mean a tileset won't need an image object at all times.
There is an easy fix (if the image object is created in the tileset constructor as of now) but not filled in an object layer:
TCastleTiledMapData.TTileset.Load
...
finally FreeAndNil(I) end;
{ Object tilesets may have independend object image files, thus the URL is empty. }
if Image.URL <> '' then
begin
{ In case tileset doesn't specify image size,
testcase: examples/tiled/map_viewer/data/maps/perspective_walls.tmx }
Image.DetermineSize;
{ Fix Columns if necessary, testcase: examples/tiled/map_viewer/data/maps/desert.tmx }
if Columns = 0 then
Columns := Image.Width div TileWidth;
{ Fix TileCount, if it is not found in (old) tsx-files prior to version 0.13 (Aug 2015). }
if TileCount = 0 then
TileCount := (Image.Height div TileHeight) * Columns;
end;
Of course it would much better if the TImage isn't created in the construtor at all.
Now it loads without crashing, but as the object-renderer doesn't know about the tileset image it just draws an rectangle - but at a wrong y-position (bottom-up/vertically flipped):
The Tiled-editor allows object layers with separate independend images instead of an single tileset image (see attached tmx file).
The TCastleTiledMapData.TImage.DetermineSize function then crashes, because the URL is empty.
It's called in CastleTiledMapData.TTileset.Load function, because this tileset doesn't have any width/height settings
and the code tries to get them via the image - which isn't there as well.
That does mean a tileset won't need an image object at all times.
There is an easy fix (if the image object is created in the tileset constructor as of now) but not filled in an object layer:
TCastleTiledMapData.TTileset.Load
Of course it would much better if the TImage isn't created in the construtor at all.
Now it loads without crashing, but as the object-renderer doesn't know about the tileset image it just draws an rectangle - but at a wrong y-position (bottom-up/vertically flipped):
This is the correct y-position as shown in Tiled:
Here are the tmx files:
tiled-object-test1.zip
The text was updated successfully, but these errors were encountered: