When exporting cylinder primitives, do not test for exact match in x,y dimensions since cylinders created in xsi often have so few polys that their widths and lengths don't match (e.g. p_collision of tat3_bldg_reservoir). Taking the larger dimension gives the correct result for cylinders that originated in both XSI and Blender.
This commit is contained in:
parent
13a92e46c6
commit
f88b62c986
|
@ -41,11 +41,10 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str,
|
||||||
vertex_uvs = []
|
vertex_uvs = []
|
||||||
vertex_normals = []
|
vertex_normals = []
|
||||||
|
|
||||||
|
# Keeps track of which vertices each group of weights affects
|
||||||
|
# i.e. maps offset of vertices -> weights that affect them
|
||||||
vertex_weights_offsets = {}
|
vertex_weights_offsets = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Since polygons in a msh segment index into the segment's verts,
|
# Since polygons in a msh segment index into the segment's verts,
|
||||||
# we must keep an offset to index them into the verts of the whole mesh
|
# we must keep an offset to index them into the verts of the whole mesh
|
||||||
polygon_index_offset = 0
|
polygon_index_offset = 0
|
||||||
|
@ -188,15 +187,3 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str,
|
||||||
|
|
||||||
return blender_mesh_object
|
return blender_mesh_object
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -280,10 +280,7 @@ def get_collision_primitive(obj: bpy.types.Object) -> CollisionPrimitive:
|
||||||
|
|
||||||
primitive.radius = max(obj.dimensions[0], obj.dimensions[1], obj.dimensions[2]) * 0.5
|
primitive.radius = max(obj.dimensions[0], obj.dimensions[1], obj.dimensions[2]) * 0.5
|
||||||
elif primitive.shape == CollisionPrimitiveShape.CYLINDER:
|
elif primitive.shape == CollisionPrimitiveShape.CYLINDER:
|
||||||
if not math.isclose(obj.dimensions[0], obj.dimensions[1], rel_tol=0.001):
|
primitive.radius = max(obj.dimensions[0], obj.dimensions[1]) * 0.5
|
||||||
raise RuntimeError(f"Object '{obj.name}' is being used as a cylinder collision "
|
|
||||||
f"primitive but it's X and Y dimensions are not uniform!")
|
|
||||||
primitive.radius = obj.dimensions[0] * 0.5
|
|
||||||
primitive.height = obj.dimensions[2]
|
primitive.height = obj.dimensions[2]
|
||||||
elif primitive.shape == CollisionPrimitiveShape.BOX:
|
elif primitive.shape == CollisionPrimitiveShape.BOX:
|
||||||
primitive.radius = obj.dimensions[0] * 0.5
|
primitive.radius = obj.dimensions[0] * 0.5
|
||||||
|
|
Loading…
Reference in New Issue