Comments (7)
This raises an interesting question: How to differentiate between the CanvasItem's property 'z_index' and the same named Layers' property.
My proposal is to add a property with names 'layer_z_index' in Tiled to clarify that the according Layer property in Godot and not the Canvas property is targeted.
This way there would be no uncertainty left which Godot property is to be set.
With 'y_sort_enabled' there's seems to be no uncertainty cause if 'y_sort_enabled' is true on any layer it should be also set to true on the CanvasItem, otherwise there's a warning in Godot.
Would you agree to that proposal?
from yati.
This raises an interesting question: How to differentiate between the CanvasItem's property
z_index
and the same named Layers' property.
Based on my limited understanding of Godot and Tiled, It seems that the CanvasItem's property z_index
should come from the "map Properties" in Tiled, rather than from "Layer Properties".
That means:
Tiled "map property" --> TileMap(CanvasItem's) property z_index
Tiled "Layer property" --> TileMap Layer's property z_index
If I am correct, there is no need to prefix "layer_" for the property z_index
because it is possible to set a z_index
in the "Map Properties" and another z_index
in the "Layer Properties" without conflicting their names.
I hope I am expressing myself clearly because I am using Google Translator _
from yati.
Unfortunately it's not not as easy as you might think.
A Tiled map is not neccessarily equivalent to a Godot TileMap.
The Tiled map is equivalent to a complete Godot scene which might well be only a simple TileMap (in your case) but in various other cases not.
E.g. if 'use_tilemap_layers' is not set or the Tiled map additionally contains objects the base node in Godot will become a Node2D instead of a (Godot-)TileMap.
Thus Tiled's map properties as having no clear equivalent in Godot are currently not mapped at all.
It's probably possible to account for your case as "special case" and handle it like you proposed, but frankly I don't like special solutions as they are prone to unforeseeable side effects.
The proposal with the 'layer_' prefix would be unambigous and thus clean and additionally quite simple to implement.
Please note that in Godot the z_index property is fully qualified as 'layer_0/z_index' (or 'layer_1/z_index' and so on) which is at least a bit similar to 'layer_z_index'. (You can see that if you hover the mouse over the propery name).
from yati.
A Tiled map is not neccessarily equivalent to a Godot TileMap.
The Tiled map is equivalent to a complete Godot scene which might well be only a simple TileMap (in your case) but in various other cases not.
I did some tests, the results are just as you said.
I still have a question that haven't been clarified yet: When use_tilemap_layers
is toggled, and there are some layers in Tiled, with each layer has a z_index
property. Which z_index
property should TileMap(CanvasItem's) ues?
It seems due to the use_tilemap_layers
option, the Tilemap properties and the layer properties become complicated and ambiguous. We cannot intuitively determine whether the properties of the Tiled layer are mapped onto the TileMap or the layer of the TileMap.
from yati.
I've thought about all that and slept over it and I think now the best solution would be that if use_tilemap_layers is enabled the z_index property should go to the layer's z_index and if it's not enabled it's going to the canvas item (like now).
Probably the z_index on the canvas is not needed at all, if the TileMap has multiple layers, but I'm not sure.
Additionally to this heueristicaI determination I will add the possibility to be explicit by naming it either 'layer_z_index' or 'canvas_z_index'.
-> A simple 'z_index' without prefix will go either to the canvas item (if 'use_tilemap_layers' is off) or to the layer (if it's on).
If that's not wished it's possible to be explicit.
from yati.
Ah, this plan looks very sensible to me.
from yati.
Fixed in v1.2.5
I even implemented your proposal with the map attribute 'z_index'. If found it would be placed on the canvas item.
(But I don't know if you ever need that...)
from yati.
Related Issues (20)
- Custom Tile data is confusing HOT 3
- Error in TiledImport.cs blocks enabling plugin HOT 5
- Trouble setting up plugin HOT 9
- I can't get to tile animations to animate HOT 2
- godot_node_type and/or res_path are not loaded from property types file. HOT 12
- Godot 4.2 - `TileMap.CellQuadrantSize` got renamed HOT 2
- AstarGrid2D (get_cell_tile_data) does not detect "custom data layer" in Tilset HOT 1
- How do I access raw tile id data? HOT 4
- Error `Can't find file 'uid://byk7emqeyttmh::::res://assets/mytilemap.png'.` HOT 3
- Reimporting multiple maps at once with same tileset results in hundreds to thousands of errors HOT 2
- Please add Object IDs to the imported nodes HOT 6
- Add a way to set the TileSet Texture NormalMap Texture and Specular Texture HOT 5
- Maps in projects exported on macOS are lacking collision data HOT 7
- Can't add multiple Tiles Collision Shapes with different physics_layer HOT 3
- Tile Collision Polygons not updating in Godot. HOT 3
- Make runtime loading compatible with threads ? HOT 1
- Need some help for the c# version HOT 1
- Support TileMapLayer nodes from Godot 4.3 HOT 1
- Error when enabling HOT 5
- GDScript Installation fails with Class "CustomTypes" hides a global script class HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yati.