Files
Blender-Fange-Pipeline/Fange_Pipeline/utils.py
T
stilobique 44b0781b94 Setup thumbnail param
Update export to find export path without the operator
2024-06-07 10:49:41 +02:00

47 lines
1.2 KiB
Python

import bpy
from .properties.models import FangeProject
from pathlib import Path
def get_export_preset():
"""
Select a FBX preset you want use.
"""
# TODO Subdir need to be exposed
fbx_preset_paths = bpy.utils.preset_paths(r"operator\export_scene.fbx")
# TODO Preset name need to be exposed
fbx_preset = Path(fbx_preset_paths[0], "sm-unity-building.py")
if fbx_preset_paths:
print(f'[Pipeline] Get the preset path "{fbx_preset}"')
return fbx_preset
else:
print(f'[Pipeline] Preset folder not found')
def get_export_path():
"""Look the file path, to understand if the asset are a Character, Buildings or Props"""
abs_blend_path = Path(bpy.data.filepath)
game_path = FangeProject()
if 'Buildings' in abs_blend_path.parts:
return game_path.buildings
elif 'Props' in abs_blend_path.parts:
return game_path.props
elif 'Characters' in abs_blend_path.parts:
return game_path.characters
else:
return Path()
def get_asset_name() -> str:
"""From the .blend file, return the blend name."""
abs_blend_path = Path(bpy.data.filepath)
return abs_blend_path.stem