# Collect materials to be compiled, and temp rename for export
mat_dict = {}
-
+
+ vphys = None
for obj in mdl.objects:
+ if obj.name == F"{mdl.name}_phy":
+ vphys = obj
+ continue
+
obj.select_set(state=True)
for ms in obj.material_slots:
if ms.material != None:
bake_space_transform=False
)
+ bpy.ops.object.select_all(action='DESELECT')
+
+ if vphys != None:
+ vphys.select_set(state=True)
+ bpy.ops.export_scene.fbx( filepath=F'{asset_dir}/{uid}_phy.fbx',\
+ check_existing=False,
+ use_selection=True,
+ apply_unit_scale=False,
+ bake_space_transform=False
+ )
+ bpy.ops.object.select_all(action='DESELECT')
+
# Fix material names back to original
for mat in mat_dict:
mat.name = mat_dict[mat]
o.write(F'$body _ "{uid}_ref.fbx"\n')
o.write(F'$staticprop\n')
o.write(F'$origin {origin[0]} {origin[1]} {origin[2]}\n')
+
+ if vphys != None:
+ o.write(F'$collisionmodel "{uid}_phy.fbx"\n')
+ o.write("{\n")
+ o.write(" $concave\n")
+ o.write("}\n")
- #TODO: vphys
o.write(F'$cdmaterials {project_name}\n')
o.write(F'$sequence idle {uid}_ref.fbx\n')