From f88b62c986fd7723529df45d643fdaa0ae070ed3 Mon Sep 17 00:00:00 2001 From: William Herald Snyder Date: Tue, 27 Sep 2022 07:56:25 -0400 Subject: [PATCH] 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. --- addons/io_scene_swbf_msh/msh_mesh_to_blend.py | 17 ++--------------- addons/io_scene_swbf_msh/msh_model_gather.py | 5 +---- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/addons/io_scene_swbf_msh/msh_mesh_to_blend.py b/addons/io_scene_swbf_msh/msh_mesh_to_blend.py index 9843b74..fefd371 100644 --- a/addons/io_scene_swbf_msh/msh_mesh_to_blend.py +++ b/addons/io_scene_swbf_msh/msh_mesh_to_blend.py @@ -41,11 +41,10 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, vertex_uvs = [] 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 = {} - - # 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 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 - - - - - - - - - - - - diff --git a/addons/io_scene_swbf_msh/msh_model_gather.py b/addons/io_scene_swbf_msh/msh_model_gather.py index e4298ec..c98833b 100644 --- a/addons/io_scene_swbf_msh/msh_model_gather.py +++ b/addons/io_scene_swbf_msh/msh_model_gather.py @@ -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 elif primitive.shape == CollisionPrimitiveShape.CYLINDER: - if not math.isclose(obj.dimensions[0], obj.dimensions[1], rel_tol=0.001): - 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.radius = max(obj.dimensions[0], obj.dimensions[1]) * 0.5 primitive.height = obj.dimensions[2] elif primitive.shape == CollisionPrimitiveShape.BOX: primitive.radius = obj.dimensions[0] * 0.5