Store the draw type when exporting empty nodes

Supports using empties as placeholders for collision shapes
This commit is contained in:
Henry Conklin
2021-08-25 21:17:58 -04:00
parent 0fc4d15915
commit eaf80e476a
9 changed files with 36 additions and 0 deletions

View File

@@ -20,6 +20,10 @@ def export_empty_node(escn_file, export_settings, node, parent_gd_node):
return parent_gd_node
empty_node = NodeTemplate(node.name, "Spatial", parent_gd_node)
empty_node['transform'] = node.matrix_local
if node.name.endswith('-colonly') or node.name.endswith('-convcolonly'):
# For empties marked as collision shapes (name ending in -colonly/-convcolonly) Godot uses the draw/display type to pick a
# collision shape
empty_node['__meta__'] = '{{ "empty_draw_type": "{}" }}'.format(node.empty_display_type)
escn_file.add_node(empty_node)
return empty_node

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=1 format=2]
[node type="Spatial" name="Scene"]
[node name="arrow-colonly" type="Spatial" parent="."]
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
__meta__ = { "empty_draw_type": "SINGLE_ARROW" }

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=1 format=2]
[node type="Spatial" name="Scene"]
[node name="cube-colonly" type="Spatial" parent="."]
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
__meta__ = { "empty_draw_type": "CUBE" }

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=1 format=2]
[node type="Spatial" name="Scene"]
[node name="image-colonly" type="Spatial" parent="."]
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
__meta__ = { "empty_draw_type": "IMAGE" }

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=1 format=2]
[node type="Spatial" name="Scene"]
[node name="sphere-colonly" type="Spatial" parent="."]
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
__meta__ = { "empty_draw_type": "SPHERE" }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.