[CG Pipeline] Refactor

This commit is contained in:
brothermechanic 2023-11-13 13:07:33 +00:00 committed by Igor Brylyov
parent 6538f70d54
commit b3612d8655
23 changed files with 634 additions and 645 deletions

View file

@ -20,7 +20,6 @@ import bpy
import mathutils
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def export_decorator(func):
@ -38,6 +37,7 @@ def export_decorator(func):
bpy.context.view_layer.objects.active = obj
# clean hierarchy and transforms
obj.parent = None
# reset transforms
obj.matrix_world = mathutils.Matrix()
# construct path
filename = bpy.context.active_object.name

View file

@ -13,7 +13,6 @@ import bpy
import os
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def export_col_stl(path, subdir=""):

71
cg/blender/export/fbx.py Normal file
View file

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@gmail.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.
Collada mesh exporter.
Exports all objects in scene.
You can set export path and subdir.
'''
__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

View file

@ -12,7 +12,6 @@ import bpy
import os
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def export_obj(path, subdir="", filename=None):