Skip to content

Commit

Permalink
Fixed a bug in the Blender model import script. Before when adding mu…
Browse files Browse the repository at this point in the history
…ltiple GWMB models in Blender it would add them all to the first models HIGH, MED and LOW collections.
  • Loading branch information
Jonathan-Greve committed Dec 31, 2023
1 parent 8b87cf2 commit 818727e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Binary file modified blender_addons/model_import_addon.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions blender_addons/model_import_addon/import_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def create_mesh_from_json(context, directory, filename):

# Ensure a collection for the model hash exists under the GWMB_Models collection
model_collection = ensure_collection(context, model_hash, parent_collection=gwmb_collection)
high_collection = ensure_collection(context, "LOD_HIGH", parent_collection=model_collection)
high_collection = ensure_collection(context, f"{model_hash}_LOD_HIGH", parent_collection=model_collection)

# Set the model's hash collection as the active collection
layer_collection = bpy.context.view_layer.layer_collection.children[gwmb_collection.name].children[
Expand All @@ -472,12 +472,12 @@ def create_mesh_from_json(context, directory, filename):
has_low_lod = submodel['has_low_lod']

if (has_low_lod):
low_collection = ensure_collection(context, "LOD_LOW", parent_collection=model_collection)
low_collection = ensure_collection(context, f"{model_hash}_LOD_LOW", parent_collection=model_collection)
indices_low = submodel.get('indices_low', [])
faces_low = [tuple(reversed(indices_low[i:i + 3])) for i in range(0, len(indices_low), 3)]

if (has_med_lod):
med_collection = ensure_collection(context, "LOD_MEDIUM", parent_collection=model_collection)
med_collection = ensure_collection(context, f"{model_hash}_LOD_MEDIUM", parent_collection=model_collection)
indices_med = submodel.get('indices_med', [])
faces_med = [tuple(reversed(indices_med[i:i + 3])) for i in range(0, len(indices_med), 3)]

Expand Down

0 comments on commit 818727e

Please sign in to comment.