Hello, developers! I’m trying to export fbx file by my script, but export window appears with picked blend file folder instead of last recent one. I can’t handle how to tell script to select recent folder. If somebody can help me I will be happy)
My script
class Retarget_OT_Export_Operator(bpy.types.Operator):
"""Export character to fbx"""
bl_idname = "retarget.export_operator"
bl_label = "EXPORT"
def execute(self, context):
#Define fbx name
filename = ""
if animtrack.mute == 0:
filename = rig.animation_data.nla_tracks["ANIM"].strips["ANIMATION"].action.name
if animtrack.mute == 1:
if rig.animation_data.action:
filename = rig.animation_data.action.name
else: filename = "!NO ANIM DATA!"
char_mesh = bpy.data.collections['RETOP']
for obj in char_mesh.objects:
obj.select_set(True)
bpy.ops.export_scene.fbx('INVOKE_DEFAULT', filepath=filename, use_selection=True, object_types={'ARMATURE', 'MESH'}, mesh_smooth_type= 'FACE', add_leaf_bones = False, use_armature_deform_only = True, bake_anim = True, bake_anim_use_all_bones = True, bake_anim_use_nla_strips = False, bake_anim_use_all_actions = False, bake_anim_force_startend_keying = False, bake_anim_step = 1.0, bake_anim_simplify_factor = 0.009999999776482582, path_mode = 'AUTO', embed_textures = False, batch_mode = 'OFF', use_batch_own_dir = True, axis_forward = '-Z', axis_up = 'Y')
return {'FINISHED'}
def register():
bpy.utils.register_class(Retarget_OT_Export_Operator)
def unregister():
bpy.utils.unregister_class(VIEW3D_PT_export)
if __name__ == "__main__":
register()