Skip to content

Commit

Permalink
QC: fix LOD skip of non-LOD models suffixed "_lod"
Browse files Browse the repository at this point in the history
Some qc files end in _lod and their smd files ended up getting skipped. Now it never skips the model if it has the same name as the qc file.
  • Loading branch information
lasa01 committed Sep 27, 2020
1 parent 486d820 commit 1db3e99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion io_import_vmf/import_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class SmdImporterWrapper(import_smd.SmdImporter):
collection: bpy.types.Collection
root: str
name: str
full_name: str

def execute(self, context: bpy.types.Context) -> set:
self.existingBones = [] # type: ignore
Expand Down Expand Up @@ -98,7 +99,9 @@ def readSMD(self, filepath: str, upAxis: str, rotMode: str,
newscene: bool = False, smd_type: Any = None, target_layer: int = 0) -> int:
if self.skip_collision and smd_type == utils.PHYS: # skip collision meshes
return 0
if self.skip_lod and splitext(basename(filepath))[0].rstrip("123456789").endswith("_lod"): # skip lod meshes
filepath_without_ext = splitext(filepath)[0].replace("\\", "/")
if self.skip_lod and (filepath_without_ext.rstrip("123456789").endswith("_lod")
and not filepath_without_ext.endswith(SmdImporterWrapper.full_name)): # skip lod meshes
return 0
result = super().readSMD(filepath, upAxis, rotMode, newscene, smd_type, target_layer)
if self.smd.g and self.smd.g != self.collection:
Expand Down Expand Up @@ -271,6 +274,7 @@ def _load(self, name: str, staged: StagedQC) -> None:
print(f"[VERBOSE] Importing model {name}...")
SmdImporterWrapper.collection = staged.context.scene.collection
SmdImporterWrapper.name = truncated_name
SmdImporterWrapper.full_name = name
if path.endswith(".mdl"):
qc_path = join(self.dec_models_path, name + ".qc")
if not isfile(qc_path):
Expand Down

0 comments on commit 1db3e99

Please sign in to comment.