0
$\begingroup$

When I want to export a file, is there a way to create a folder and export it?

Currently the script I have created exports the FBX to the same location where the blender files are.

import bpy
import os

bpy.ops.object.duplicate()

bpy.ops.object.modifier_apply(modifier="GeometryNodes")


obj = bpy.context.object
obj_name = obj.name
blend_file_path = bpy.data.filepath
directory = os.path.dirname(blend_file_path)
file = os.path.join(directory,'a/',obj_name + '.fbx')


bpy.ops.export_scene.fbx(
    filepath=file,
    use_selection=True,
    use_active_collection=False,
      path_mode='COPY',
    embed_textures=True,
    )
bpy.ops.object.delete(use_global=False)

Here it is.

1, Create a folder one level above where the blender file is located.

2, Export the FBX file to that location.

I would like to create a script to do this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.