Skip to content

Commit

Permalink
Fix "object has no attribute lock" error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bonjorno7 committed Sep 26, 2024
1 parent bc75ca5 commit 7b3a3d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addon/ops/export_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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()
Expand Down

0 comments on commit 7b3a3d4

Please sign in to comment.