From 7b3a3d41c56eb523d5c30efa21d56a12209372ce Mon Sep 17 00:00:00 2001 From: bonjorno7 Date: Fri, 27 Sep 2024 01:55:06 +0200 Subject: [PATCH] Fix "object has no attribute lock" error The lock and results can be used even if we're not using multithreading, so it should be initialized above the if block instead of inside. --- addon/ops/export_auto.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addon/ops/export_auto.py b/addon/ops/export_auto.py index 5fa0a4d..148f1a6 100644 --- a/addon/ops/export_auto.py +++ b/addon/ops/export_auto.py @@ -64,6 +64,9 @@ def execute(self, context): start = time.time() + self._lock = Lock() + self._results = [] + if (not self.ctrl and self.shift) or (self.ctrl and self.all_models): source_models = [Model(game, model) for model in sourceops.model_items] @@ -74,8 +77,6 @@ def execute(self, context): return {'CANCELLED'} threads = [Thread(target=self.compile, args=[m], daemon=True) for m in source_models] - self._lock = Lock() - self._results = [] for thread in threads: thread.start()