diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/blender_export.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/blender_export.py b/tools/blender_export.py index da7b986..c4a45ff 100644 --- a/tools/blender_export.py +++ b/tools/blender_export.py @@ -16,6 +16,7 @@ import os # quat rotation (x, y, z, w) # vec3 scale # vec4 color +# float plane_distance (if type == PLANE) # uint32_t mesh_name_len # char[] mesh_name (if type == MESH) # float mass @@ -25,7 +26,13 @@ import os def export_scene(filepath): print(f"Exporting scene to {filepath}...") - objects = [obj for obj in bpy.context.scene.objects if obj.visible_get() and obj.type == 'MESH'] + objects = [] + for obj in bpy.context.scene.objects: + if obj.visible_get(): + if obj.type == 'MESH': + objects.append(obj) + elif obj.type == 'EMPTY' and obj.name.lower().startswith('plane_'): + objects.append(obj) with open(filepath, 'wb') as f: # Header @@ -84,6 +91,12 @@ def export_scene(filepath): c = obj.active_material.diffuse_color color = (c[0], c[1], c[2], c[3]) f.write(struct.pack('<4f', *color)) + + # Plane Distance (if type == PLANE) + plane_distance = 0.0 + if obj_type == 2: # PLANE + plane_distance = obj.get('plane_distance', 0.0) + f.write(struct.pack('<f', plane_distance)) # Mesh Asset Name mesh_asset_name = "" |
