diff --git a/addons/godotvmf/godotmdl/mdl_combiner.gd b/addons/godotvmf/godotmdl/mdl_combiner.gd index 45a4bc0..c3a6f21 100644 --- a/addons/godotvmf/godotmdl/mdl_combiner.gd +++ b/addons/godotvmf/godotmdl/mdl_combiner.gd @@ -164,13 +164,8 @@ func generate_collision(): var static_body: StaticBody3D = StaticBody3D.new(); var collision: CollisionShape3D = CollisionShape3D.new(); + var shape: ConvexPolygonShape3D = ConvexPolygonShape3D.new(); - # FIXME: Use ConvexPolygonShape3D instead of ConcavePolygonShape3D - # but if it used then for some models it triggers an error - # "Failed to build convex hull godot" - var shape: ConcavePolygonShape3D = ConcavePolygonShape3D.new(); - - collision.shape = shape; collision.name = "collision_" + str(surface_index) + "_" + str(solid_index); static_body.name = "solid_" + str(surface_index) + "_" + str(solid_index); static_body.basis *= additional_basis; @@ -184,7 +179,9 @@ func generate_collision(): vertices.append_array([v1, v2, v3]); - collision.shape.set_faces(PackedVector3Array(vertices)); + shape.points = PackedVector3Array(vertices); + collision.shape = shape; + if skeleton and skeleton.find_bone("static_body") == -1: var bone_attachment: BoneAttachment3D = BoneAttachment3D.new(); bone_attachment.name = "bone_attachment_" + str(surface_index) + "_" + str(solid_index); diff --git a/addons/godotvmf/plugin.cfg b/addons/godotvmf/plugin.cfg index 07ed3f6..dabd243 100644 --- a/addons/godotvmf/plugin.cfg +++ b/addons/godotvmf/plugin.cfg @@ -3,5 +3,5 @@ name="GodotVMF" description="Allows use VMF files in Godot" author="H2xDev" -version="2.2.8" +version="2.2.9" script="godotvmf.gd" diff --git a/addons/godotvmf/src/vmf_config.gd b/addons/godotvmf/src/vmf_config.gd index e51dd3f..ad5ddaa 100644 --- a/addons/godotvmf/src/vmf_config.gd +++ b/addons/godotvmf/src/vmf_config.gd @@ -97,7 +97,11 @@ class ImportConfig: ## If specified, the importer will use this preset for the navigation mesh var navigation_mesh_preset: String = ProjectSettings.get_setting("godot_vmf/import/navigation_mesh_preset", ""); -static var gameinfo_path: String = ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://"); + var gameinfo_path: String = ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://"); + + ## NOTE: Support previous version of this config where this field wasn't a part of ImportConfig +static var gameinfo_path: String: + get: return ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://"); static var models: ModelsConfig: get: diff --git a/addons/godotvmf/src/vmf_resource_manager.gd b/addons/godotvmf/src/vmf_resource_manager.gd index 893cc73..4cc5802 100644 --- a/addons/godotvmf/src/vmf_resource_manager.gd +++ b/addons/godotvmf/src/vmf_resource_manager.gd @@ -31,13 +31,13 @@ static func for_resource_import() -> void: ## Returns true if any resources were imported static func import_models(vmf_structure: VMFStructure) -> bool: if not VMFConfig.models.import: return false; - if not "entity" in vmf_structure: return false; + if vmf_structure.entities.size() == 0: return false; - for entity in vmf_structure.entity: - if not "model" in entity: continue; + for entity in vmf_structure.entities: + if not "model" in entity.data: continue; if entity.classname != "prop_static": continue; - var model_path = entity.get("model", "").to_lower().get_basename(); + var model_path = entity.data.get("model", "").to_lower().get_basename(); if not model_path: continue; var mdl_path = VMFUtils.normalize_path(VMFConfig.gameinfo_path + "/" + model_path + ".mdl");