diff --git a/06-DCC/Blender/导出PSK_PSA脚本.md b/06-DCC/Blender/导出PSK_PSA脚本.md new file mode 100644 index 0000000..293f38f --- /dev/null +++ b/06-DCC/Blender/导出PSK_PSA脚本.md @@ -0,0 +1,36 @@ +# PSK +```python +import bpy +import os +import math +from io_import_scene_unreal_psa_psk_280 import * + +pskPath = 'C:\\Users\\BlueRose\\Desktop\\BLUEPROTOCOL\\Game\\Character\\Enemy' + +for root, subdirs, files in os.walk(pskPath): + for dirName in subdirs: + print(root + '\\'+ dirName) + for modelroot, modeldirs, modelfiles in os.walk(root + '\\'+ dirName +'\\Model'): + for f in modelfiles: + if f.endswith('.psk'): + psk_file = os.path.join(modelroot, f) + fbx_file = os.path.splitext(psk_file)[0] + ".fbx" + # 清空场景 + bpy.ops.object.select_all(action='SELECT') + bpy.ops.object.delete() + pskimport(psk_file, bReorientBones = False) + + # 使用SmoothShading + for obj in bpy.data.objects: + if obj.type=='MESH': + obj.data.use_auto_smooth = True + obj.data.auto_smooth_angle = math.radians(180) + currentmesh = obj.data + for setting in currentmesh.polygons: + setting.use_smooth = True + bpy.context.object.data.update() + + # 输出骨骼模型 + bpy.ops.object.select_all(action='SELECT') + bpy.ops.export_scene.fbx(filepath=fbx_file) +``` \ No newline at end of file