From bf3def51185247ba9eafe6c838bb0f84861129d4 Mon Sep 17 00:00:00 2001 From: kwek <70169069+kwekmaster@users.noreply.github.com> Date: Tue, 25 Oct 2022 08:47:52 -0500 Subject: [PATCH 1/2] integrating Simarilius changes as-is to restore filepath functionality --- i_scene_cp77_gltf/__init__.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/i_scene_cp77_gltf/__init__.py b/i_scene_cp77_gltf/__init__.py index 0aa6c35..1e00cd3 100644 --- a/i_scene_cp77_gltf/__init__.py +++ b/i_scene_cp77_gltf/__init__.py @@ -101,18 +101,31 @@ def draw(self, context): def execute(self, context): - directory = self.directory - - for f in self.files: - filepath = os.path.join(directory, f.name) + loadfiles=self.files + + + # prevent crash if no directory supplied when using filepath + if len(self.directory)>0: + directory = self.directory + else: + directory = os.path.dirname(self.filepath) - #kwekmaster: modified to reflect user choice - print(filepath + " Loaded; With materials: "+str(self.with_materials)) - + #if no files were supplied and a filepath is populate the files from the filepath + if len(loadfiles)==0 and len(self.filepath)>0: + f={} + f['name']=os.path.basename(self.filepath) + loadfiles=(f,) + + + for f in loadfiles: + filepath = os.path.join(directory, f['name']) + gltf_importer = glTFImporter(filepath, { "files": None, "loglevel": 0, "import_pack_images" :True, "merge_vertices" :False, "import_shading" : 'NORMALS', "bone_heuristic":'TEMPERANCE', "guess_original_bind_pose" : False, "import_user_extensions": ""}) gltf_importer.read() gltf_importer.checks() - + + #kwekmaster: modified to reflect user choice + print(filepath + " Loaded; With materials: "+str(self.with_materials)) existingMeshes = bpy.data.meshes.keys() existingObjects = bpy.data.objects.keys() @@ -170,7 +183,7 @@ def execute(self, context): index = index + 1 - collection = bpy.data.collections.new(os.path.splitext(f.name)[0]) + collection = bpy.data.collections.new(os.path.splitext(f['name'])[0]) bpy.context.scene.collection.children.link(collection) for name in bpy.data.objects.keys(): From dac73b04f1ebdd52af62cc3b64bde125c2f87656 Mon Sep 17 00:00:00 2001 From: ja-to <65016231+ja-to@users.noreply.github.com> Date: Tue, 25 Oct 2022 17:19:53 -0500 Subject: [PATCH 2/2] Bump version number - Title --- i_scene_cp77_gltf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i_scene_cp77_gltf/__init__.py b/i_scene_cp77_gltf/__init__.py index 0aa6c35..12c8210 100644 --- a/i_scene_cp77_gltf/__init__.py +++ b/i_scene_cp77_gltf/__init__.py @@ -1,7 +1,7 @@ bl_info = { "name": "Cyberpunk 2077 glTF Importer", "author": "HitmanHimself, Turk, Jato, dragonzkiller, kwekmaster, glitchered", - "version": (1, 0, 9), + "version": (1, 1, 0), "blender": (3, 1, 0), "location": "File > Import-Export", "description": "Import WolvenKit Cyberpunk2077 glTF Models With Materials",