#  ***** 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.
obj object exporter.
'''

__version__ = "0.1"

import bpy
from . import export_decorator


@export_decorator
def export(**kwargs):
    file_path = ('{}.obj'.format(kwargs['outpath']))

    bpy.ops.wm.obj_export(
        filepath=file_path,
        check_existing=False,
        export_animation=False,
        forward_axis='NEGATIVE_Z',
        up_axis='Y',
        global_scale=1,
        apply_modifiers=True,
        export_selected_objects=True,
        export_uv=True,
        export_normals=True,
        export_colors=True,
        export_materials=True,
        export_pbr_extensions=False,
        path_mode='AUTO',
        export_triangulated_mesh=True,
        export_smooth_groups=True)

    return file_path
