mirror of
https://gitlab.com/ProcyonLotor/vrchat-template.git
synced 2026-08-25 10:43:53 +05:00
More stuff
This commit is contained in:
Binary file not shown.
@@ -40,9 +40,7 @@ def fbx_export(context: Context) -> None:
|
||||
"""
|
||||
print("[%s] Batch FBX export begin" % datetime.now())
|
||||
|
||||
def exporter_ascii(context: Context, filepath: str):
|
||||
bpy.ops.export_scene.fbx(
|
||||
context,
|
||||
settings_ascii = dict(
|
||||
version='ASCII6100',
|
||||
use_selection=True,
|
||||
global_scale=1.0,
|
||||
@@ -58,55 +56,53 @@ def fbx_export(context: Context) -> None:
|
||||
primary_bone_axis='Y',
|
||||
secondary_bone_axis='X',
|
||||
armature_nodetype='NULL',
|
||||
use_anim=True,
|
||||
use_anim=context.scene.fbx_use_anim,
|
||||
use_default_take=False,
|
||||
path_mode='RELATIVE',
|
||||
batch_mode='OFF',
|
||||
use_batch_own_dir=False,
|
||||
filepath=filepath,
|
||||
)
|
||||
|
||||
def exporter_binary(context: Context, filepath: str):
|
||||
bpy.ops.export_scene.fbx(
|
||||
context,
|
||||
settings_binary = dict(
|
||||
# Common
|
||||
version = 'BIN7400',
|
||||
axis_forward = '-Z',
|
||||
axis_up = 'Y',
|
||||
apply_scale_options = 'FBX_SCALE_ALL',
|
||||
apply_unit_scale = True,
|
||||
bake_space_transform = True,
|
||||
global_scale = 1.0,
|
||||
object_types = context.scene.fbx_object_types,
|
||||
use_custom_props = False,
|
||||
use_selection = True,
|
||||
version='BIN7400',
|
||||
axis_forward='-Z',
|
||||
axis_up='Y',
|
||||
apply_scale_options='FBX_SCALE_ALL',
|
||||
apply_unit_scale=True,
|
||||
bake_space_transform=True,
|
||||
global_scale=1.0,
|
||||
object_types=context.scene.fbx_object_types,
|
||||
use_custom_props=False,
|
||||
use_selection=True,
|
||||
# Mesh
|
||||
mesh_smooth_type = 'FACE',
|
||||
use_mesh_modifiers = False,
|
||||
use_mesh_edges = False,
|
||||
use_tspace = False,
|
||||
mesh_smooth_type='FACE',
|
||||
use_mesh_modifiers=False,
|
||||
use_mesh_edges=False,
|
||||
use_tspace=False,
|
||||
# Armature
|
||||
add_leaf_bones = False,
|
||||
primary_bone_axis = 'Y',
|
||||
secondary_bone_axis = 'X',
|
||||
use_armature_deform_only = False,
|
||||
armature_nodetype = 'NULL',
|
||||
add_leaf_bones=False,
|
||||
primary_bone_axis='Y',
|
||||
secondary_bone_axis='X',
|
||||
use_armature_deform_only=False,
|
||||
armature_nodetype='NULL',
|
||||
# Animation
|
||||
bake_anim = False,
|
||||
bake_anim_use_all_bones = True,
|
||||
bake_anim_use_all_actions = True,
|
||||
bake_anim_use_nla_strips = True,
|
||||
bake_anim_force_startend_keying = True,
|
||||
bake_anim_step = 1.0,
|
||||
bake_anim_simplify_factor = 1.0,
|
||||
bake_anim=context.scene.fbx_use_anim,
|
||||
bake_anim_use_all_bones=True,
|
||||
bake_anim_use_all_actions=True,
|
||||
bake_anim_use_nla_strips=True,
|
||||
bake_anim_force_startend_keying=True,
|
||||
bake_anim_step=1.0,
|
||||
bake_anim_simplify_factor=1.0,
|
||||
# File
|
||||
filepath=filepath,
|
||||
path_mode = 'RELATIVE',
|
||||
embed_textures = False,
|
||||
batch_mode = 'OFF',
|
||||
path_mode='RELATIVE',
|
||||
embed_textures=False,
|
||||
batch_mode='OFF',
|
||||
)
|
||||
|
||||
exporter = exporter_binary if _FUTURE else exporter_ascii
|
||||
settings = settings_binary if _FUTURE or context.scene.fbx_force_binary else settings_ascii
|
||||
if _FUTURE:
|
||||
settings.pop('version')
|
||||
rootpath = os.path.normpath(bpy.path.abspath(context.scene.fbx_export_dir))
|
||||
groups = bpy.data.collections if _FUTURE else bpy.data.groups
|
||||
override = context.copy()
|
||||
@@ -123,8 +119,13 @@ def fbx_export(context: Context) -> None:
|
||||
"selected_objects": group.objects
|
||||
}
|
||||
)
|
||||
settings.update(
|
||||
{
|
||||
"filepath": filepath
|
||||
}
|
||||
)
|
||||
|
||||
exporter(override, filepath)
|
||||
bpy.ops.export_scene.fbx(override, **settings)
|
||||
|
||||
print("\n[%s] Batch FBX export end." % datetime.now())
|
||||
|
||||
@@ -174,10 +175,15 @@ class SCENE_PT_fbx_autoexport(Panel):
|
||||
|
||||
col.separator()
|
||||
|
||||
sub = col.row()
|
||||
sub.alignment = 'CENTER'
|
||||
sub.prop(scene, "fbx_on_save")
|
||||
sub.prop(scene, "fbx_force_binary")
|
||||
if _FUTURE:
|
||||
col.use_property_split = True
|
||||
col.use_property_decorate = False
|
||||
col.prop(scene, "fbx_on_save")
|
||||
col.prop(scene, "fbx_use_anim")
|
||||
if not _FUTURE:
|
||||
col.prop(scene, "fbx_force_binary")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.prop(scene, "fbx_export_dir")
|
||||
col.operator(FBX_OT_ManualExport.bl_idname)
|
||||
@@ -233,10 +239,15 @@ def register() -> None:
|
||||
)
|
||||
Scene.fbx_group_index = IntProperty(default=0)
|
||||
Scene.fbx_force_binary = BoolProperty(
|
||||
name="Binary format",
|
||||
name="Binary Format",
|
||||
description="Force export FBX file as binary",
|
||||
default=False
|
||||
)
|
||||
Scene.fbx_use_anim = BoolProperty(
|
||||
name="Include Animation",
|
||||
description="Export baked keyframe animation",
|
||||
default=False
|
||||
)
|
||||
Group.fbx_exportable = BoolProperty(
|
||||
name="Export Group",
|
||||
description="Mark group as FBX exportable",
|
||||
|
||||
Reference in New Issue
Block a user