added post import to handle LDtk layers correctly
This commit is contained in:
parent
b0e4a8db60
commit
9f1a7f5235
4 changed files with 23 additions and 3 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
<Compile Remove="script_templates/**" />
|
<Compile Remove="script_templates/**" />
|
||||||
<None Include="script_templates/**" />
|
<None Include="script_templates/**" />
|
||||||
<None Include="src/**" />
|
<None Include="src/**" />
|
||||||
|
<None Include="addons/**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- Root the assemblies to avoid trimming. -->
|
<!-- Root the assemblies to avoid trimming. -->
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -32,7 +32,7 @@ use_entity_placeholders=false
|
||||||
Post Import=""
|
Post Import=""
|
||||||
tileset_post_import=""
|
tileset_post_import=""
|
||||||
entities_post_import=""
|
entities_post_import=""
|
||||||
level_post_import=""
|
level_post_import="uid://40yv73g8vqs6"
|
||||||
world_post_import=""
|
world_post_import=""
|
||||||
Debug=""
|
Debug=""
|
||||||
force_tileset_reimport=false
|
force_tileset_reimport=false
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,25 @@
|
||||||
@tool
|
@tool
|
||||||
|
|
||||||
func post_import(level: LDTKLevel) -> LDTKLevel:
|
func post_import(level: LDTKLevel) -> LDTKLevel:
|
||||||
# Behaviour goes here
|
recurse_node(level, update_layer)
|
||||||
|
|
||||||
return level
|
return level
|
||||||
|
|
||||||
|
func recurse_node(node: Node, action: Callable) -> void:
|
||||||
|
action.call(node)
|
||||||
|
for child in node.get_children():
|
||||||
|
recurse_node(child, action)
|
||||||
|
|
||||||
|
func update_layer(layer: Node) -> void:
|
||||||
|
if layer is not TileMapLayer:
|
||||||
|
return
|
||||||
|
if RegEx.create_from_string("water\\d*").search(layer.name):
|
||||||
|
layer.z_index = 30
|
||||||
|
elif RegEx.create_from_string("overlay\\d*").search(layer.name):
|
||||||
|
layer.z_index = 20
|
||||||
|
elif RegEx.create_from_string("special\\d*").search(layer.name):
|
||||||
|
layer.physics_quadrant_size = 1
|
||||||
|
layer.z_index = 2
|
||||||
|
elif RegEx.create_from_string("foreground\\d*").search(layer.name):
|
||||||
|
layer.z_index = 1
|
||||||
|
elif RegEx.create_from_string("background\\d*").search(layer.name):
|
||||||
|
layer.z_index = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue