When exporting collision primitives, check the swbf_msh_coll_prim primitive property before the name to catch primitives which have incorrect names. Previously the property would only be checked if the primitive was missing a name indicator, but it should be checked first and always because some primitives from XSI have name-type mismatch (cis_hover_aat)
This commit is contained in:
parent
0a1866295c
commit
84a910f747
|
@ -354,6 +354,14 @@ def get_collision_primitive_shape(obj: bpy.types.Object) -> CollisionPrimitiveSh
|
|||
""" Gets the CollisionPrimitiveShape of an object or raises an error if
|
||||
it can't. """
|
||||
|
||||
# arc170 fighter has examples of box colliders without proper naming
|
||||
# and cis_hover_aat has a cylinder which is named p_vehiclesphere.
|
||||
# To export these properly we must check the collision_prim property
|
||||
# that was assigned on import BEFORE looking at the name.
|
||||
prim_type = obj.swbf_msh_coll_prim.prim_type
|
||||
if prim_type in [item.value for item in CollisionPrimitiveShape]:
|
||||
return CollisionPrimitiveShape(prim_type)
|
||||
|
||||
name = obj.name.lower()
|
||||
|
||||
if "sphere" in name or "sphr" in name or "spr" in name:
|
||||
|
@ -363,11 +371,6 @@ def get_collision_primitive_shape(obj: bpy.types.Object) -> CollisionPrimitiveSh
|
|||
if "box" in name or "cube" in name or "cuboid" in name:
|
||||
return CollisionPrimitiveShape.BOX
|
||||
|
||||
# arc170 fighter has examples of box colliders without proper naming
|
||||
prim_type = obj.swbf_msh_coll_prim.prim_type
|
||||
if prim_type in [item.value for item in CollisionPrimitiveShape]:
|
||||
return CollisionPrimitiveShape(prim_type)
|
||||
|
||||
raise RuntimeError(f"Object '{obj.name}' has no primitive type specified in it's name!")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue