From fc9bb51e2c70b1b4a4e7c1d3137ab19e29c8a01c Mon Sep 17 00:00:00 2001 From: DoctorPresto <111536029+DoctorPresto@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:39:15 -0400 Subject: [PATCH 1/3] 4.2 importer options change --- i_scene_cp77_gltf/importers/import_with_materials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i_scene_cp77_gltf/importers/import_with_materials.py b/i_scene_cp77_gltf/importers/import_with_materials.py index 1213f0a..79a1196 100644 --- a/i_scene_cp77_gltf/importers/import_with_materials.py +++ b/i_scene_cp77_gltf/importers/import_with_materials.py @@ -87,7 +87,7 @@ def CP77GLBimport(self, exclude_unused_mats=True, image_format='png', with_mater filename=os.path.splitext(f['name'])[0] 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":'BLENDER', "guess_original_bind_pose" : False, "import_user_extensions": "",'disable_bone_shape':False}) + gltf_importer = glTFImporter(filepath, { "files": None, "loglevel": 0, "import_pack_images" :True, "merge_vertices" :False, "import_shading" : 'NORMALS', "bone_heuristic":'BLENDER', "guess_original_bind_pose" : False, "import_user_extensions": "",'disable_bone_shape':False, 'bone_shape_scale_factor':1.0}) gltf_importer.read() gltf_importer.checks() existingMeshes = bpy.data.meshes.keys() From f40286ee2945625fcb0bdc4bf7baf9c62fd14b18 Mon Sep 17 00:00:00 2001 From: DoctorPresto <111536029+DoctorPresto@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:39:37 -0400 Subject: [PATCH 2/3] add root motion property --- i_scene_cp77_gltf/cyber_props.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i_scene_cp77_gltf/cyber_props.py b/i_scene_cp77_gltf/cyber_props.py index 5439485..4704905 100644 --- a/i_scene_cp77_gltf/cyber_props.py +++ b/i_scene_cp77_gltf/cyber_props.py @@ -258,6 +258,7 @@ def add_anim_props(animation, action): # Extract properties from animation schema = extras.get("schema", "") animation_type = extras.get("animationType", "") + rootMotion_type = extras.get("rootMotionType"),"") frame_clamping = extras.get("frameClamping", False) frame_clamping_start_frame = extras.get("frameClampingStartFrame", -1) frame_clamping_end_frame = extras.get("frameClampingEndFrame", -1) @@ -272,6 +273,7 @@ def add_anim_props(animation, action): action["schema"] = schema # action["schemaVersion"] = schema['version'] action["animationType"] = animation_type + action["rootMotionType"] = rootMotion_type action["frameClamping"] = frame_clamping action["frameClampingStartFrame"] = frame_clamping_start_frame action["frameClampingEndFrame"] = frame_clamping_end_frame From ae6345b11fc386fc759cd377889cfbc2c13c89fb Mon Sep 17 00:00:00 2001 From: DoctorPresto <111536029+DoctorPresto@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:44:29 -0400 Subject: [PATCH 3/3] check for blender version for 4.2 setting changes --- .../importers/import_with_materials.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/i_scene_cp77_gltf/importers/import_with_materials.py b/i_scene_cp77_gltf/importers/import_with_materials.py index 79a1196..b3eed17 100644 --- a/i_scene_cp77_gltf/importers/import_with_materials.py +++ b/i_scene_cp77_gltf/importers/import_with_materials.py @@ -86,8 +86,11 @@ def CP77GLBimport(self, exclude_unused_mats=True, image_format='png', with_mater for f in loadfiles: filename=os.path.splitext(f['name'])[0] 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":'BLENDER', "guess_original_bind_pose" : False, "import_user_extensions": "",'disable_bone_shape':False, 'bone_shape_scale_factor':1.0}) + vers = bpy.app.version + if vers[0] >= 4.2: + gltf_importer = glTFImporter(filepath, { "files": None, "loglevel": 0, "import_pack_images" :True, "merge_vertices" :False, "import_shading" : 'NORMALS', "bone_heuristic":'BLENDER', "guess_original_bind_pose" : False, "import_user_extensions": "",'disable_bone_shape':False, 'bone_shape_scale_factor':1.0}) + else: + gltf_importer = glTFImporter(filepath, { "files": None, "loglevel": 0, "import_pack_images" :True, "merge_vertices" :False, "import_shading" : 'NORMALS', "bone_heuristic":'BLENDER', "guess_original_bind_pose" : False, "import_user_extensions": "",'disable_bone_shape':False,}) gltf_importer.read() gltf_importer.checks() existingMeshes = bpy.data.meshes.keys() @@ -173,8 +176,8 @@ def CP77GLBimport(self, exclude_unused_mats=True, image_format='png', with_mater import_mats(current_file_base_path, DepotPath, exclude_unused_mats, existingMeshes, gltf_importer, image_format, obj, validmats) - if not cp77_addon_prefs.non_verbose: - print(f"GLB Import Time: {(time.time() - start_time)} Seconds") + if not cp77_addon_prefs.non_verbose: + print(f"GLB Import Time: {(time.time() - start_time)} Seconds") print('') print('-------------------- Finished importing Cyberpunk 2077 Model --------------------') @@ -263,13 +266,13 @@ def import_mats(BasePath, DepotPath, exclude_unused_mats, existingMeshes, gltf_i index = index + 1 counter = counter + 1 - if not cp77_addon_prefs.non_verbose: + if not cp77_addon_prefs.non_verbose: if len(failedon) == 0: print(f"Shader Setup Completed Succesfully in {(time.time() - start_time)} Seconds") else: print(f"Material Setup Failed on: {', '.join(failedon)}") print(f"Attempted Setup for {(time.time() - start_time)} seconds") - + if exclude_unused_mats: return @@ -279,7 +282,7 @@ def import_mats(BasePath, DepotPath, exclude_unused_mats, existingMeshes, gltf_i (rawmat["Name"] in MatImportList) or len(MatImportList) < 1): Builder.create(index) index = index + 1 - + def blender_4_scale_armature_bones(): vers = bpy.app.version if vers[0] >= 4: @@ -308,10 +311,10 @@ def import_meshes_and_anims(collection, gltf_importer, hide_armatures, o): if meshes and "Icosphere" not in mesh.name: if 'Armature' in o.name: o.hide_set(hide_armatures) - else: + else: if 'Armature' in o.name: pass - + else: if 'Armature' in o.name: - o.hide_set(hide_armatures) \ No newline at end of file + o.hide_set(hide_armatures) \ No newline at end of file