Export Scene Operators¶
-
bpy.ops.export_scene.
fbx
(filepath="", check_existing=True, filter_glob="*.fbx", use_selection=False, use_active_collection=False, global_scale=1.0, apply_unit_scale=True, apply_scale_options='FBX_SCALE_NONE', bake_space_transform=False, object_types={'ARMATURE', 'CAMERA', 'EMPTY', 'LIGHT', 'MESH', 'OTHER'}, use_mesh_modifiers=True, use_mesh_modifiers_render=True, mesh_smooth_type='OFF', use_subsurf=False, use_mesh_edges=False, use_tspace=False, 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=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_step=1.0, bake_anim_simplify_factor=1.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True, axis_forward='-Z', axis_up='Y')¶ Write a FBX file
Parameters: - filepath (string, (optional, never None)) – File Path, Filepath used for exporting the file
- check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files
- filter_glob (string, (optional, never None)) – filter_glob
- use_selection (boolean, (optional)) – Selected Objects, Export selected and visible objects only
- use_active_collection (boolean, (optional)) – Active Collection, Export only objects from the active collection (and its children)
- global_scale (float in [0.001, 1000], (optional)) – Scale, Scale all data (Some importers do not support scaled armatures!)
- apply_unit_scale (boolean, (optional)) – Apply Unit, Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)
- apply_scale_options (enum in ['FBX_SCALE_NONE', 'FBX_SCALE_UNITS', 'FBX_SCALE_CUSTOM', 'FBX_SCALE_ALL'], (optional)) –
Apply Scalings, How to apply custom and units scalings in generated FBX file (Blender uses FBX scale to detect units on import, but many other applications do not handle the same way)
FBX_SCALE_NONE
All Local, Apply custom scaling and units scaling to each object transformation, FBX scale remains at 1.0.FBX_SCALE_UNITS
FBX Units Scale, Apply custom scaling to each object transformation, and units scaling to FBX scale.FBX_SCALE_CUSTOM
FBX Custom Scale, Apply custom scaling to FBX scale, and units scaling to each object transformation.FBX_SCALE_ALL
FBX All, Apply custom scaling and units scaling to FBX scale.
- bake_space_transform (boolean, (optional)) – !EXPERIMENTAL! Apply Transform, Bake space transform into object data, avoids getting unwanted rotations to objects when target space is not aligned with Blender’s space (WARNING! experimental option, use at own risks, known broken with armatures/animations)
- object_types (enum set in {'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'}, (optional)) –
Object Types, Which kind of object to export
EMPTY
Empty.CAMERA
Camera.LIGHT
Lamp.ARMATURE
Armature, WARNING: not supported in dupli/group instances.MESH
Mesh.OTHER
Other, Other geometry types, like curve, metaball, etc. (converted to meshes).
- use_mesh_modifiers (boolean, (optional)) – Apply Modifiers, Apply modifiers to mesh objects (except Armature ones) - WARNING: prevents exporting shape keys
- use_mesh_modifiers_render (boolean, (optional)) – Use Modifiers Render Setting, Use render settings when applying modifiers to mesh objects (DISABLED in Blender 2.8)
- mesh_smooth_type (enum in ['OFF', 'FACE', 'EDGE'], (optional)) –
Smoothing, Export smoothing information (prefer ‘Normals Only’ option if your target importer understand split normals)
OFF
Normals Only, Export only normals instead of writing edge or face smoothing data.FACE
Face, Write face smoothing.EDGE
Edge, Write edge smoothing.
- use_subsurf (boolean, (optional)) – Export Subdivision Surface, Export the last Catmull-Rom subidivion modifier as FBX subdivision (Does not apply the modifier even if ‘Apply Modifiers’ is enabled)
- use_mesh_edges (boolean, (optional)) – Loose Edges, Export loose edges (as two-vertices polygons)
- use_tspace (boolean, (optional)) – Tangent Space, Add binormal and tangent vectors, together with normal they form the tangent space (will only work correctly with tris/quads only meshes!)
- use_custom_props (boolean, (optional)) – Custom Properties, Export custom properties
- add_leaf_bones (boolean, (optional)) – Add Leaf Bones, Append a final bone to the end of each chain to specify last bone length (use this when you intend to edit the armature from exported data)
- primary_bone_axis (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Primary Bone Axis
- secondary_bone_axis (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Secondary Bone Axis
- use_armature_deform_only (boolean, (optional)) – Only Deform Bones, Only write deforming bones (and non-deforming ones when they have deforming children)
- armature_nodetype (enum in ['NULL', 'ROOT', 'LIMBNODE'], (optional)) –
Armature FBXNode Type, FBX type of node (object) used to represent Blender’s armatures (use Null one unless you experience issues with other app, other choices may no import back perfectly in Blender…)
NULL
Null, ‘Null’ FBX node, similar to Blender’s Empty (default).ROOT
Root, ‘Root’ FBX node, supposed to be the root of chains of bones….LIMBNODE
LimbNode, ‘LimbNode’ FBX node, a regular joint between two bones….
- bake_anim (boolean, (optional)) – Baked Animation, Export baked keyframe animation
- bake_anim_use_all_bones (boolean, (optional)) – Key All Bones, Force exporting at least one key of animation for all bones (needed with some target applications, like UE4)
- bake_anim_use_nla_strips (boolean, (optional)) – NLA Strips, Export each non-muted NLA strip as a separated FBX’s AnimStack, if any, instead of global scene animation
- bake_anim_use_all_actions (boolean, (optional)) – All Actions, Export each action as a separated FBX’s AnimStack, instead of global scene animation (note that animated objects will get all actions compatible with them, others will get no animation at all)
- bake_anim_force_startend_keying (boolean, (optional)) – Force Start/End Keying, Always add a keyframe at start and end of actions for animated channels
- bake_anim_step (float in [0.01, 100], (optional)) – Sampling Rate, How often to evaluate animated values (in frames)
- bake_anim_simplify_factor (float in [0, 100], (optional)) – Simplify, How much to simplify baked values (0.0 to disable, the higher the more simplified)
- path_mode (enum in ['AUTO', 'ABSOLUTE', 'RELATIVE', 'MATCH', 'STRIP', 'COPY'], (optional)) –
Path Mode, Method used to reference paths
AUTO
Auto, Use Relative paths with subdirectories only.ABSOLUTE
Absolute, Always write absolute paths.RELATIVE
Relative, Always write relative paths (where possible).MATCH
Match, Match Absolute/Relative setting with input path.STRIP
Strip Path, Filename only.COPY
Copy, Copy the file to the destination path (or subdirectory).
- embed_textures (boolean, (optional)) – Embed Textures, Embed textures in FBX binary file (only for “Copy” path mode!)
- batch_mode (enum in ['OFF', 'SCENE', 'COLLECTION', 'SCENE_COLLECTION', 'ACTIVE_SCENE_COLLECTION'], (optional)) –
Batch Mode
OFF
Off, Active scene to file.SCENE
Scene, Each scene as a file.COLLECTION
Collection, Each collection (data-block ones) as a file, does not include content of children collections.SCENE_COLLECTION
Scene Collections, Each collection (including master, non-data-block ones) of each scene as a file, including content from children collections.ACTIVE_SCENE_COLLECTION
Active Scene Collections, Each collection (including master, non-data-block one) of the active scene as a file, including content from children collections.
- use_batch_own_dir (boolean, (optional)) – Batch Own Dir, Create a dir for each exported file
- use_metadata (boolean, (optional)) – Use Metadata
- axis_forward (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Forward
- axis_up (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Up
File:
-
bpy.ops.export_scene.
gltf
(export_format='GLB', ui_tab='GENERAL', export_copyright="", export_image_format='NAME', export_texture_dir="", export_texcoords=True, export_normals=True, export_draco_mesh_compression_enable=False, export_draco_mesh_compression_level=6, export_draco_position_quantization=14, export_draco_normal_quantization=10, export_draco_texcoord_quantization=12, export_draco_generic_quantization=12, export_tangents=False, export_materials=True, export_colors=True, export_cameras=False, export_selected=False, export_extras=False, export_yup=True, export_apply=False, export_animations=True, export_frame_range=True, export_frame_step=1, export_force_sampling=True, export_nla_strips=True, export_def_bones=False, export_current_frame=False, export_skins=True, export_all_influences=False, export_morph=True, export_morph_normal=True, export_morph_tangent=False, export_lights=False, export_displacement=False, will_save_settings=False, filepath="", check_existing=True, filter_glob="*.glb;*.gltf")¶ Export scene as glTF 2.0 file
Parameters: - export_format (enum in ['GLB', 'GLTF_EMBEDDED', 'GLTF_SEPARATE'], (optional)) –
Format, Output format and embedding options. Binary is most efficient, but JSON (embedded or separate) may be easier to edit later
GLB
glTF Binary (.glb), Exports a single file, with all data packed in binary form. Most efficient and portable, but more difficult to edit later.GLTF_EMBEDDED
glTF Embedded (.gltf), Exports a single file, with all data packed in JSON. Less efficient than binary, but easier to edit later.GLTF_SEPARATE
glTF Separate (.gltf + .bin + textures), Exports multiple files, with separate JSON, binary and texture data. Easiest to edit later.
- ui_tab (enum in ['GENERAL', 'MESHES', 'OBJECTS', 'ANIMATION'], (optional)) –
ui_tab, Export setting categories
GENERAL
General, General settings.MESHES
Meshes, Mesh settings.OBJECTS
Objects, Object settings.ANIMATION
Animation, Animation settings.
- export_copyright (string, (optional, never None)) – Copyright, Legal rights and conditions for the model
- export_image_format (enum in ['NAME', 'JPEG', 'PNG'], (optional)) –
Images, Output format for images. PNG is lossless and generally preferred, but JPEG might be preferable for web applications due to the smaller file size
NAME
Automatic, Determine the image format from the blender image name.JPEG
JPEG Format (.jpg), Encode and save textures as .jpg files. Be aware of a possible loss in quality.PNG
PNG Format (.png), Encode and save textures as .png files.
- export_texture_dir (string, (optional, never None)) – Textures, Folder to place texture files in. Relative to the .gltf file
- export_texcoords (boolean, (optional)) – UVs, Export UVs (texture coordinates) with meshes
- export_normals (boolean, (optional)) – Normals, Export vertex normals with meshes
- export_draco_mesh_compression_enable (boolean, (optional)) – Draco mesh compression, Compress mesh using Draco
- export_draco_mesh_compression_level (int in [0, 6], (optional)) – Compression level, Compression level (0 = most speed, 6 = most compression, higher values currently not supported)
- export_draco_position_quantization (int in [0, 30], (optional)) – Position quantization bits, Quantization bits for position values (0 = no quantization)
- export_draco_normal_quantization (int in [0, 30], (optional)) – Normal quantization bits, Quantization bits for normal values (0 = no quantization)
- export_draco_texcoord_quantization (int in [0, 30], (optional)) – Texcoord quantization bits, Quantization bits for texture coordinate values (0 = no quantization)
- export_draco_generic_quantization (int in [0, 30], (optional)) – Generic quantization bits, Quantization bits for generic coordinate values like weights or joints (0 = no quantization)
- export_tangents (boolean, (optional)) – Tangents, Export vertex tangents with meshes
- export_materials (boolean, (optional)) – Materials, Export materials
- export_colors (boolean, (optional)) – Vertex Colors, Export vertex colors with meshes
- export_cameras (boolean, (optional)) – Cameras, Export cameras
- export_selected (boolean, (optional)) – Selected Objects, Export selected objects only
- export_extras (boolean, (optional)) – Custom Properties, Export custom properties as glTF extras
- export_yup (boolean, (optional)) – +Y Up, Export using glTF convention, +Y up
- export_apply (boolean, (optional)) – Apply Modifiers, Apply modifiers (excluding Armatures) to mesh objects -WARNING: prevents exporting shape keys
- export_animations (boolean, (optional)) – Animations, Exports active actions and NLA tracks as glTF animations
- export_frame_range (boolean, (optional)) – Limit to Playback Range, Clips animations to selected playback range
- export_frame_step (int in [1, 120], (optional)) – Sampling Rate, How often to evaluate animated values (in frames)
- export_force_sampling (boolean, (optional)) – Always Sample Animations, Apply sampling to all animations
- export_nla_strips (boolean, (optional)) – NLA Strips, Export NLA Strip animations
- export_def_bones (boolean, (optional)) – Export Deformation bones only, Export Deformation bones only (and needed bones for hierarchy)
- export_current_frame (boolean, (optional)) – Use Current Frame, Export the scene in the current animation frame
- export_skins (boolean, (optional)) – Skinning, Export skinning (armature) data
- export_all_influences (boolean, (optional)) – Include All Bone Influences, Allow >4 joint vertex influences. Models may appear incorrectly in many viewers
- export_morph (boolean, (optional)) – Shape Keys, Export shape keys (morph targets)
- export_morph_normal (boolean, (optional)) – Shape Key Normals, Export vertex normals with shape keys (morph targets)
- export_morph_tangent (boolean, (optional)) – Shape Key Tangents, Export vertex tangents with shape keys (morph targets)
- export_lights (boolean, (optional)) – Punctual Lights, Export directional, point, and spot lights. Uses “KHR_lights_punctual” glTF extension
- export_displacement (boolean, (optional)) – Displacement Textures (EXPERIMENTAL), EXPERIMENTAL: Export displacement textures. Uses incomplete “KHR_materials_displacement” glTF extension
- will_save_settings (boolean, (optional)) – Remember Export Settings, Store glTF export settings in the Blender project
- filepath (string, (optional, never None)) – File Path, Filepath used for exporting the file
- check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files
- filter_glob (string, (optional, never None)) – filter_glob
File: - export_format (enum in ['GLB', 'GLTF_EMBEDDED', 'GLTF_SEPARATE'], (optional)) –
-
bpy.ops.export_scene.
obj
(filepath="", check_existing=True, filter_glob="*.obj;*.mtl", use_selection=False, use_animation=False, use_mesh_modifiers=True, use_edges=True, use_smooth_groups=False, use_smooth_groups_bitflags=False, use_normals=True, use_uvs=True, use_materials=True, use_triangles=False, use_nurbs=False, use_vertex_groups=False, use_blen_objects=True, group_by_object=False, group_by_material=False, keep_vertex_order=False, global_scale=1.0, path_mode='AUTO', axis_forward='-Z', axis_up='Y')¶ Save a Wavefront OBJ File
Parameters: - filepath (string, (optional, never None)) – File Path, Filepath used for exporting the file
- check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files
- filter_glob (string, (optional, never None)) – filter_glob
- use_selection (boolean, (optional)) – Selection Only, Export selected objects only
- use_animation (boolean, (optional)) – Animation, Write out an OBJ for each frame
- use_mesh_modifiers (boolean, (optional)) – Apply Modifiers, Apply modifiers
- use_edges (boolean, (optional)) – Include Edges
- use_smooth_groups (boolean, (optional)) – Smooth Groups, Write sharp edges as smooth groups
- use_smooth_groups_bitflags (boolean, (optional)) – Bitflag Smooth Groups, Same as ‘Smooth Groups’, but generate smooth groups IDs as bitflags (produces at most 32 different smooth groups, usually much less)
- use_normals (boolean, (optional)) – Write Normals, Export one normal per vertex and per face, to represent flat faces and sharp edges
- use_uvs (boolean, (optional)) – Include UVs, Write out the active UV coordinates
- use_materials (boolean, (optional)) – Write Materials, Write out the MTL file
- use_triangles (boolean, (optional)) – Triangulate Faces, Convert all faces to triangles
- use_nurbs (boolean, (optional)) – Write Nurbs, Write nurbs curves as OBJ nurbs rather than converting to geometry
- use_vertex_groups (boolean, (optional)) – Polygroups
- use_blen_objects (boolean, (optional)) – Objects as OBJ Objects
- group_by_object (boolean, (optional)) – Objects as OBJ Groups
- group_by_material (boolean, (optional)) – Material Groups
- keep_vertex_order (boolean, (optional)) – Keep Vertex Order
- global_scale (float in [0.01, 1000], (optional)) – Scale
- path_mode (enum in ['AUTO', 'ABSOLUTE', 'RELATIVE', 'MATCH', 'STRIP', 'COPY'], (optional)) –
Path Mode, Method used to reference paths
AUTO
Auto, Use Relative paths with subdirectories only.ABSOLUTE
Absolute, Always write absolute paths.RELATIVE
Relative, Always write relative paths (where possible).MATCH
Match, Match Absolute/Relative setting with input path.STRIP
Strip Path, Filename only.COPY
Copy, Copy the file to the destination path (or subdirectory).
- axis_forward (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Forward
- axis_up (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Up
File:
-
bpy.ops.export_scene.
x3d
(filepath="", check_existing=True, filter_glob="*.x3d", use_selection=False, use_mesh_modifiers=True, use_triangulate=False, use_normals=False, use_compress=False, use_hierarchy=True, name_decorations=True, use_h3d=False, global_scale=1.0, path_mode='AUTO', axis_forward='Z', axis_up='Y')¶ Export selection to Extensible 3D file (.x3d)
Parameters: - filepath (string, (optional, never None)) – File Path, Filepath used for exporting the file
- check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files
- filter_glob (string, (optional, never None)) – filter_glob
- use_selection (boolean, (optional)) – Selection Only, Export selected objects only
- use_mesh_modifiers (boolean, (optional)) – Apply Modifiers, Use transformed mesh data from each object
- use_triangulate (boolean, (optional)) – Triangulate, Write quads into ‘IndexedTriangleSet’
- use_normals (boolean, (optional)) – Normals, Write normals with geometry
- use_compress (boolean, (optional)) – Compress, Compress the exported file
- use_hierarchy (boolean, (optional)) – Hierarchy, Export parent child relationships
- name_decorations (boolean, (optional)) – Name decorations, Add prefixes to the names of exported nodes to indicate their type
- use_h3d (boolean, (optional)) – H3D Extensions, Export shaders for H3D
- global_scale (float in [0.01, 1000], (optional)) – Scale
- path_mode (enum in ['AUTO', 'ABSOLUTE', 'RELATIVE', 'MATCH', 'STRIP', 'COPY'], (optional)) –
Path Mode, Method used to reference paths
AUTO
Auto, Use Relative paths with subdirectories only.ABSOLUTE
Absolute, Always write absolute paths.RELATIVE
Relative, Always write relative paths (where possible).MATCH
Match, Match Absolute/Relative setting with input path.STRIP
Strip Path, Filename only.COPY
Copy, Copy the file to the destination path (or subdirectory).
- axis_forward (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Forward
- axis_up (enum in ['X', 'Y', 'Z', '-X', '-Y', '-Z'], (optional)) – Up
File: