add obj export format support
This commit is contained in:
parent
8d9f913cbc
commit
045e157266
2 changed files with 62 additions and 1 deletions
58
rcg_pipeline/rcg_pipeline/export/obj.py
Normal file
58
rcg_pipeline/rcg_pipeline/export/obj.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
# ***** 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
|
|
@ -46,7 +46,7 @@ from .utils.object_transforms import apply_transforms
|
|||
from .material_generators import material_generator, black_material
|
||||
from .utils.object_converter import mesh_to_mesh
|
||||
from .export import dae, fbx, glb, ply
|
||||
|
||||
import .export.obj as obj_export
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -188,6 +188,9 @@ def generate_libs_database(project_dir):
|
|||
'ply': os.path.relpath(
|
||||
ply.export(obj_name=part['name'], file_dir=objects_dir),
|
||||
project_dir),
|
||||
'obj': os.path.relpath(
|
||||
obj_export.export(obj_name=part['name'], file_dir=objects_dir),
|
||||
project_dir),
|
||||
'thumbnail': os.path.relpath(img_path, project_dir),
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue