From 818727eb026f7e32db8ad64509bd682e960f0902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Bj=C3=B8rn=20Greve?= Date: Mon, 1 Jan 2024 02:43:33 +0800 Subject: [PATCH] Fixed a bug in the Blender model import script. Before when adding multiple GWMB models in Blender it would add them all to the first models HIGH, MED and LOW collections. --- blender_addons/model_import_addon.zip | Bin 6742 -> 6747 bytes .../model_import_addon/import_model.py | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blender_addons/model_import_addon.zip b/blender_addons/model_import_addon.zip index 5acc0276b15e7f04d4949e99795c39bbaf8cc108..743503d2169967fb1700ea4f6bfb930107f32180 100644 GIT binary patch delta 6070 zcmV;n7fI;WG}|<=A_5JR6d_nf`NITJ7XSc~Af4u9X*GG3UE*FcIAd6{<)Do1B z>FWPJ?>ztn2!Il0C#jvCa3+b3Ciox@Wo%7MM z6xltWe?2k5({eOrlcHqRl(TtSjiybfD&MTIJ ze_?R=2hBO1&DbcN^Afxh+us~8EjAG&1PN*m-ic5E|Mr$@N*{I8n=O1~GXi}m%1%QkzY9-Wpv#j$ckjK8|W@BxFtuDE(yaCEHb!_nc# zuZE;6^@lx<4FUDNdo~HYCs~m^F zB^9WReiCNbE3{Jz-iA($0T|H>c2}lP3^kuWLHHI~$yKL==Q`S}XGb@2mM@kSe>Cpn zQ1~6BlP+hK^b(+{zZHKsWaeMngKqFHfCKc!0LZQQd!q@k&$QwRq$6Ht=_~;YOL9=f z9AM8xKL@WHvTUB-amYK%dlBuH1 z$^l$uA(neo<&zT%Kt5AG`hctY8b;#ub$gu znkLh^J6lZCUMND+IM;+dbg$SMP+C4@0?ZZ3D)3i1TY$d`&>AFmXw1M{!A6_Y!PI#G z`78DoNR=+GKs`(|sN(qJe*$tin8>%^R7=niJAb#g8w~G~{yO&JxVFF>W)%X!7W%&a z7qCtiyeq_Vj_LBLSh9ySuh?WshLMi4>Zy&Fdmy`&nKz1=pMUuqst9QH!SI>S)Q7|U z%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fw z;4!{M?$u-Ji>Hp{UkRf3;3P46`DzA^xfqq%LTxka;c3g7(*nWzgmPd&>F=O-fYbBC zH%Awjhv(6dMOUW>XZDu{xO6_%_>|poU2$Md_dgP;J7UX0Yt_cF}*;9s`>%^a1hgd&3rq&*=Ka7yrT1tLGQF3&-{-@~h{QT@Z z`V5$QuhVQMzhqH=1?(`@GVHZB!?>V)HPYZ0-`SCC;kzm$-Y&x?EBMhI9_LJ2iV=*UI_ zApsTo)e8itow`jw5POcwwE PU6T$PM+T%B00000YLJhZ diff --git a/blender_addons/model_import_addon/import_model.py b/blender_addons/model_import_addon/import_model.py index 146ae11..5873520 100644 --- a/blender_addons/model_import_addon/import_model.py +++ b/blender_addons/model_import_addon/import_model.py @@ -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[ @@ -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)]