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,73 +40,69 @@ def fbx_export(context: Context) -> None:
|
|||||||
"""
|
"""
|
||||||
print("[%s] Batch FBX export begin" % datetime.now())
|
print("[%s] Batch FBX export begin" % datetime.now())
|
||||||
|
|
||||||
def exporter_ascii(context: Context, filepath: str):
|
settings_ascii = dict(
|
||||||
bpy.ops.export_scene.fbx(
|
version='ASCII6100',
|
||||||
context,
|
use_selection=True,
|
||||||
version='ASCII6100',
|
global_scale=1.0,
|
||||||
use_selection=True,
|
axis_forward='-Z',
|
||||||
global_scale=1.0,
|
axis_up='Y',
|
||||||
axis_forward='-Z',
|
object_types=context.scene.fbx_object_types,
|
||||||
axis_up='Y',
|
use_mesh_modifiers=True,
|
||||||
object_types=context.scene.fbx_object_types,
|
mesh_smooth_type='OFF',
|
||||||
use_mesh_modifiers=True,
|
use_mesh_edges=False,
|
||||||
mesh_smooth_type='OFF',
|
use_tspace=False,
|
||||||
use_mesh_edges=False,
|
use_armature_deform_only=False,
|
||||||
use_tspace=False,
|
add_leaf_bones=False,
|
||||||
use_armature_deform_only=False,
|
primary_bone_axis='Y',
|
||||||
add_leaf_bones=False,
|
secondary_bone_axis='X',
|
||||||
primary_bone_axis='Y',
|
armature_nodetype='NULL',
|
||||||
secondary_bone_axis='X',
|
use_anim=context.scene.fbx_use_anim,
|
||||||
armature_nodetype='NULL',
|
use_default_take=False,
|
||||||
use_anim=True,
|
path_mode='RELATIVE',
|
||||||
use_default_take=False,
|
batch_mode='OFF',
|
||||||
path_mode='RELATIVE',
|
use_batch_own_dir=False,
|
||||||
batch_mode='OFF',
|
)
|
||||||
use_batch_own_dir=False,
|
|
||||||
filepath=filepath,
|
|
||||||
)
|
|
||||||
|
|
||||||
def exporter_binary(context: Context, filepath: str):
|
settings_binary = dict(
|
||||||
bpy.ops.export_scene.fbx(
|
# Common
|
||||||
context,
|
version='BIN7400',
|
||||||
# Common
|
axis_forward='-Z',
|
||||||
version = 'BIN7400',
|
axis_up='Y',
|
||||||
axis_forward = '-Z',
|
apply_scale_options='FBX_SCALE_ALL',
|
||||||
axis_up = 'Y',
|
apply_unit_scale=True,
|
||||||
apply_scale_options = 'FBX_SCALE_ALL',
|
bake_space_transform=True,
|
||||||
apply_unit_scale = True,
|
global_scale=1.0,
|
||||||
bake_space_transform = True,
|
object_types=context.scene.fbx_object_types,
|
||||||
global_scale = 1.0,
|
use_custom_props=False,
|
||||||
object_types = context.scene.fbx_object_types,
|
use_selection=True,
|
||||||
use_custom_props = False,
|
# Mesh
|
||||||
use_selection = True,
|
mesh_smooth_type='FACE',
|
||||||
# Mesh
|
use_mesh_modifiers=False,
|
||||||
mesh_smooth_type = 'FACE',
|
use_mesh_edges=False,
|
||||||
use_mesh_modifiers = False,
|
use_tspace=False,
|
||||||
use_mesh_edges = False,
|
# Armature
|
||||||
use_tspace = False,
|
add_leaf_bones=False,
|
||||||
# Armature
|
primary_bone_axis='Y',
|
||||||
add_leaf_bones = False,
|
secondary_bone_axis='X',
|
||||||
primary_bone_axis = 'Y',
|
use_armature_deform_only=False,
|
||||||
secondary_bone_axis = 'X',
|
armature_nodetype='NULL',
|
||||||
use_armature_deform_only = False,
|
# Animation
|
||||||
armature_nodetype = 'NULL',
|
bake_anim=context.scene.fbx_use_anim,
|
||||||
# Animation
|
bake_anim_use_all_bones=True,
|
||||||
bake_anim = False,
|
bake_anim_use_all_actions=True,
|
||||||
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_use_nla_strips = True,
|
bake_anim_step=1.0,
|
||||||
bake_anim_force_startend_keying = True,
|
bake_anim_simplify_factor=1.0,
|
||||||
bake_anim_step = 1.0,
|
# File
|
||||||
bake_anim_simplify_factor = 1.0,
|
path_mode='RELATIVE',
|
||||||
# File
|
embed_textures=False,
|
||||||
filepath=filepath,
|
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))
|
rootpath = os.path.normpath(bpy.path.abspath(context.scene.fbx_export_dir))
|
||||||
groups = bpy.data.collections if _FUTURE else bpy.data.groups
|
groups = bpy.data.collections if _FUTURE else bpy.data.groups
|
||||||
override = context.copy()
|
override = context.copy()
|
||||||
@@ -123,8 +119,13 @@ def fbx_export(context: Context) -> None:
|
|||||||
"selected_objects": group.objects
|
"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())
|
print("\n[%s] Batch FBX export end." % datetime.now())
|
||||||
|
|
||||||
@@ -174,10 +175,15 @@ class SCENE_PT_fbx_autoexport(Panel):
|
|||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
sub = col.row()
|
if _FUTURE:
|
||||||
sub.alignment = 'CENTER'
|
col.use_property_split = True
|
||||||
sub.prop(scene, "fbx_on_save")
|
col.use_property_decorate = False
|
||||||
sub.prop(scene, "fbx_force_binary")
|
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.prop(scene, "fbx_export_dir")
|
||||||
col.operator(FBX_OT_ManualExport.bl_idname)
|
col.operator(FBX_OT_ManualExport.bl_idname)
|
||||||
@@ -233,10 +239,15 @@ def register() -> None:
|
|||||||
)
|
)
|
||||||
Scene.fbx_group_index = IntProperty(default=0)
|
Scene.fbx_group_index = IntProperty(default=0)
|
||||||
Scene.fbx_force_binary = BoolProperty(
|
Scene.fbx_force_binary = BoolProperty(
|
||||||
name="Binary format",
|
name="Binary Format",
|
||||||
description="Force export FBX file as binary",
|
description="Force export FBX file as binary",
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
|
Scene.fbx_use_anim = BoolProperty(
|
||||||
|
name="Include Animation",
|
||||||
|
description="Export baked keyframe animation",
|
||||||
|
default=False
|
||||||
|
)
|
||||||
Group.fbx_exportable = BoolProperty(
|
Group.fbx_exportable = BoolProperty(
|
||||||
name="Export Group",
|
name="Export Group",
|
||||||
description="Mark group as FBX exportable",
|
description="Mark group as FBX exportable",
|
||||||
|
|||||||
Reference in New Issue
Block a user