generated from stilobique/BlenderTemplate
44b0781b94
Update export to find export path without the operator
47 lines
1.2 KiB
Python
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
|