framework/cg/blender/export/fbx.py
2023-12-01 11:34:37 +03:00

69 lines
2.1 KiB
Python

# coding: utf-8
# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@yandex.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
'''
DESCRIPTION.
FBX mesh exporter.
'''
__version__ = "0.1"
import bpy
from blender.export import export_decorator
@export_decorator
def export_fbx(**kwargs):
outpath = ('{}.fbx'.format(kwargs['outpath']))
bpy.ops.export_scene.fbx(
filepath=outpath,
check_existing=False,
filter_glob="*.fbx",
use_selection=True,
use_visible=False,
use_active_collection=False,
global_scale=1,
apply_unit_scale=True,
apply_scale_options='FBX_SCALE_NONE',
use_space_transform=True,
bake_space_transform=False,
object_types={'MESH'},
use_mesh_modifiers=True,
use_mesh_modifiers_render=True,
mesh_smooth_type='FACE',
colors_type='SRGB',
use_subsurf=False,
use_mesh_edges=False,
use_tspace=False,
use_triangles=True,
use_custom_props=False,
add_leaf_bones=True,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_armature_deform_only=False,
armature_nodetype='NULL',
bake_anim=False,
bake_anim_use_all_bones=True,
bake_anim_use_nla_strips=True,
bake_anim_use_all_actions=True,
bake_anim_force_startend_keying=True,
bake_anim_step=1,
bake_anim_simplify_factor=1,
path_mode='AUTO',
embed_textures=False,
batch_mode='OFF',
use_batch_own_dir=True,
use_metadata=True,
axis_forward='-Z',
axis_up='Y')
return outpath