diff --git a/06-DCC/Blender/导出PSK_PSA脚本 & 部分UModel AES Key.md b/06-DCC/Blender/导出PSK_PSA脚本 & 部分UModel AES Key.md index 43107a6..fd8b4f2 100644 --- a/06-DCC/Blender/导出PSK_PSA脚本 & 部分UModel AES Key.md +++ b/06-DCC/Blender/导出PSK_PSA脚本 & 部分UModel AES Key.md @@ -138,6 +138,44 @@ for root, subdirs, files in os.walk(psaDirPath): bpy.ops.object.delete() ``` +**绯红结系批量转换代码**: +```python +import bpy +import os +import math +from io_import_scene_unreal_psa_psk_280 import * +from better_fbx import * + +pskPath = 'C:\\Users\\BlueRose\\Desktop\\ScarletNexus\\Game\\Character\\ch\\ch0100\\04_Mesh\\SM_ch0100.pskx' +psaPath = 'C:\\Users\\BlueRose\\Desktop\\ScarletNexus\\Game\\Character\\ch\\ch0100\\05_Animation\\000_BM_N\\SK_ch0100.psa' +fbxExportPath = 'C:\\Users\\BlueRose\\Desktop\\ScarletNexus\\Game\\Character\\ch\\ch0100\\05_Animation\\000_BM_N\\' + +# 清空并且设置为60fps +bpy.ops.scene.new(type='EMPTY') +bpy.ops.object.select_all(action='SELECT') +bpy.ops.object.delete() +bpy.context.scene.render.fps = 60 + +# 导入骨骼以及动画(所有NLA) +pskimport(pskPath, bReorientBones = False, bImportmesh = False, bImportbone = True) +psaimport(psaPath, bActionsToTrack = True) + +for obj in bpy.data.objects: + print(obj.type) + if obj.type=='ARMATURE': + currentSkeleton = obj + +print(currentSkeleton.animation_data.action) + +for action in bpy.data.actions: + # print(action) + currentSkeleton.animation_data.action = action + bpy.ops.better_export.fbx(filepath= fbxExportPath+ action.name + ".fbx",my_fbx_format="binary",use_selection=False,use_visible=True) + # print(currentSkeleton.animation_data.action) + # print(bpy.data.objects["SM_ch0100.ao"].animation_data.action) +``` + + ## 添加平滑组 ```python import bpy @@ -161,6 +199,7 @@ import math for action in bpy.data.actions: print(action) + action.name bpy.data.actions["AS_ch0100_016_AL_walk"].name = "AS_ch0100_016_AL_walk"