Skip to content

Commit

Permalink
Updated level exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
willcassella committed Apr 16, 2016
1 parent 5fdcd6b commit 272e739
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Scripts/Editor/LevelExporter.py
Expand Up @@ -101,7 +101,7 @@ def export_mesh(data, path):

# Special case for Character physics objects: CharacterController
elif obj.game.physics_type == 'CHARACTER':
XML.SubElement(entity, "physics_mode").set("value"), "Ghost")
XML.SubElement(entity, "physics_mode").set("value", "Ghost")

# Create a node for the CharacterControllerComponent
characterControllerID = nextID
Expand All @@ -110,13 +110,13 @@ def export_mesh(data, path):
characterController.set("ref_id", str(characterControllerID))

# Serialize its ID and entity reference
XML.SubElement(characterController, "id").set("value", str(characterControllerID)
XML.SubElement(characterController, "id").set("value", str(characterControllerID))

# If the object is a mesh
if obj.type == 'MESH':

# Create a path for the mesh
meshPath = "Meshes/" + obj.data.name + ".wmesh"
meshPath = "ExportedContent/Meshes/" + obj.data.name + ".wmesh"

# If we haven't exported its mesh yet
if meshPath not in exportedMeshes:
Expand Down Expand Up @@ -147,7 +147,9 @@ def export_mesh(data, path):
valueNode = XML.SubElement(itemNode, "value")

if obj.active_material is not None and obj.active_material.active_texture is not None:
XML.SubElement(valueNode, "willow::ResourceHandle").set("value", obj.active_material.active_texture.image.filepath[2:])
texPath = obj.active_material.active_texture.image.filepath
texPath = "Content\\Textures\\" + texPath.split("Textures\\")[1]
XML.SubElement(valueNode, "willow::ResourceHandle").set("value", texPath)

# If the object is a Camera
if obj.type == 'CAMERA':
Expand All @@ -162,7 +164,7 @@ def export_mesh(data, path):
XML.SubElement(camera, "id").set("value", str(cameraID))
XML.SubElement(camera, "entity").set("ref", str(entityID))

if obj. # Create a node for the StaticMeshColliderComponent
# Create a node for the StaticMeshColliderComponent
staticMeshColliderID = nextID
nextID += 1
staticMeshCollider = XML.SubElement(gameObjects, "willow::StaticMeshColliderComponent")
Expand All @@ -180,4 +182,4 @@ def export_mesh(data, path):

# Output result
tree = XML.ElementTree(root)
tree.write(bpy.context.scene.world.name + ".xml")
tree.write("ExportedContent/" + bpy.context.scene.world.name + ".xml")

0 comments on commit 272e739

Please sign in to comment.