rcg-pipeline/rcg_pipeline/export/glb.py

85 lines
2.5 KiB
Python
Raw Normal View History

# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2024 Ilia Kurochkin <brothermechanic@yandex.com>
#
# Created by Ilia Kurochkin (brothermechanic)
# contact: brothermechanic@yandex.com
#
# This 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# ***** END GPL LICENSE BLOCK *****
#
# coding: utf-8
'''
DESCRIPTION.
glTF object exporter.
'''
__version__ = "0.3"
import bpy
from . import export_decorator
@export_decorator
def export(**kwargs):
file_path = ('{}.glb'.format(kwargs['outpath']))
bpy.ops.export_scene.gltf(
filepath=file_path,
check_existing=False,
gltf_export_id="",
export_use_gltfpack=False,
export_format='GLB',
export_copyright="glTF object exporter",
export_image_format='AUTO',
export_image_add_webp=False,
export_image_webp_fallback=False,
export_texture_dir="",
export_jpeg_quality=75,
export_image_quality=75,
export_keep_originals=False,
export_texcoords=True,
export_normals=True,
# no custom
export_draco_mesh_compression_enable=False,
export_tangents=False,
export_materials='EXPORT',
export_unused_images=False,
export_unused_textures=False,
export_attributes=False,
# custom
use_selection=True,
use_visible=False,
use_renderable=False,
use_active_collection_with_nested=True,
use_active_collection=False,
use_active_scene=False,
export_extras=False,
# no custom
export_yup=True,
export_apply=False,
# custom
export_animations=False,
# custom
export_morph=False,
export_skins=False,
export_hierarchy_flatten_bones=False,
export_original_specular=False,
will_save_settings=False,
export_hierarchy_full_collections=False)
return file_path