Skip to content

Commit

Permalink
Fix incorrect autocombine props in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lasa01 committed May 14, 2021
1 parent 3c573a2 commit 9605cc3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions io_import_vmf/import_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import bpy
import os
from os.path import splitext, basename, dirname, isfile, isdir, isabs, join, relpath
from shutil import move, Error as ShError
import subprocess
import sys
from contextlib import redirect_stdout
Expand Down Expand Up @@ -346,10 +345,8 @@ def _load(self, name: str, staged: StagedQC) -> None:
qc_dir = dirname(qc_path)
for filename in os.listdir(alternate_qc_dir):
filepath = join(alternate_qc_dir, filename)
try:
move(filepath, qc_dir)
except (FileExistsError, ShError):
os.remove(filepath)
new_filepath = join(qc_dir, filename)
os.replace(filepath, new_filepath)
os.rmdir(alternate_qc_dir)
if result.returncode != 0 or not isfile(qc_path):
print(result.stdout)
Expand All @@ -374,6 +371,9 @@ def _load(self, name: str, staged: StagedQC) -> None:
fake_smd = FakeSmd.from_bst(SmdImporterWrapper.smd)
except Exception as err:
raise Exception(f"Error importing {name}: {err}")
if name.startswith("models/props/autocombine/"):
# cannot cache autocombine props, they have conflicting smd files
os.remove(path)
self._cache[name] = fake_smd
if fake_smd.a.name in bpy.context.scene.collection.objects:
bpy.context.scene.collection.objects.unlink(fake_smd.a)
Expand Down

0 comments on commit 9605cc3

Please sign in to comment.