BlueRoseNote/06-DCC/Blender/转换NinjaRipper Blender Scene To FBX.md

31 lines
881 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

使用方法使用Blender打开NinjaRipper截取的文件并保存成blend文件后执行该脚本。注意运行完之后需要手动导出fbx。
```python
import bpy
def convert_image_tga(sourceImagePath):
    image = bpy.data.images.load(sourceImagePath)
    image.file_format = "TARGA"
    image.save_render(sourceImagePath.replace(".dds",".tga"))
# Unpack
blendPath=bpy.data.filepath
fbxPath=blendPath.replace(".blend",".fbx")
print(fbxPath)
bpy.ops.file.unpack_all()
bpy.ops.wm.save_as_mainfile()
for i in bpy.data.images:
    if i.filepath == '':
        continue
    currentFilePath=bpy.path.abspath(i.filepath)
    print(currentFilePath)
    convert_image_tga(currentFilePath)
    i.filepath = i.filepath.replace('.dds', '.tga')
# Save Blender Project
bpy.ops.wm.save_as_mainfile()
# Export FBX
# bpy.ops.export_scene.fbx(fbxPath)
```