vault backup: 2024-02-09 18:27:03

This commit is contained in:
BlueRose 2024-02-09 18:27:03 +08:00
parent 61ed2e7462
commit ef745a6a0a

View File

@ -70,6 +70,39 @@ for modelroot, modeldirs, modelfiles in os.walk(pskPath):
bpy.ops.object.select_all(action='SELECT')
bpy.ops.export_scene.fbx(filepath=fbx_file,add_leaf_bones=False)
```
使用BetterExport的版本
```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\\wp\\wp0100\\04_Mesh'
for modelroot, modeldirs, modelfiles in os.walk(pskPath):
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.ops.object.select_all(action='SELECT')
bpy.ops.better_export.fbx(filepath=fbx_file,my_fbx_format="binary",use_selection=True,use_visible=True,use_only_root_empty_node=False)
```
# PSA
注意该脚本因为Blender运行bug会导致输出的FBX文件越来越大越来越慢。一次转换的量不建议超过50个。建议分几个文件夹同时开多个Blender一起转换。
```python