blender2ogre Options

March 22, 2023 · View on GitHub

Index

Exporter

Exporter Options

OptionNameDescriptionDefault Value
General
EX_SWAP_AXISSwap AxisAxis swapping mode'xyz'
EX_V2_MESH_TOOL_VERSIONMesh Export VersionSpecify Ogre version format to write'v2'
EX_XML_DELETEClean up xml filesRemove the generated xml files after binary conversion.1True
Scene
EX_SCENEExport SceneExport current scene (OgreDotScene xml file)True
EX_SELECTED_ONLYExport Selected OnlyExport only selected objects. Turn on to avoid exporting non-selected stuffTrue
EX_EXPORT_HIDDENExport Hidden AlsoExport hidden meshes in addition to visible ones. Turn off to avoid exporting hidden stuffTrue
EX_EXPORT_USERExport User PropertiesExport user properties such as as physical properties. Turn off to avoid exporting the user dataTrue
EX_FORCE_CAMERAForce CameraExport active cameraTrue
EX_FORCE_LAMPSForce LampsExport all LampsTrue
EX_NODE_ANIMATIONExport Node AnimationsExport Node Animations, these are animations of the objects properties like position, rotation and scaleTrue
Materials
EX_MATERIALSExport MaterialsExports .material scriptsTrue
EX_SEPARATE_MATERIALSSeparate MaterialsExports a .material for each material (rather than putting all materials into a single .material file)True
EX_COPY_SHADER_PROGRAMSCopy Shader ProgramsWhen using script inheritance copy the source shader programs to the output pathTrue
EX_USE_FFP_PARAMETERSFixed Function ParametersConvert material parameters to Blinn-Phong modelFalse
Textures
EX_DDS_MIPSDDS MipsNumber of Mip Maps (DDS)16
EX_FORCE_IMAGE_FORMATConvert ImagesConvert all textures to selected image format'NONE'
Armature
EX_ARMATURE_ANIMATIONArmature AnimationExport armature animations (updates the .skeleton file)True
EX_SHARED_ARMATUREShared ArmatureExport a single .skeleton file for objects that have the same Armature parent2False
EX_ONLY_KEYFRAMESOnly KeyframesOnly export Keyframes.3False
EX_ONLY_DEFORMABLE_BONESOnly Deformable BonesOnly exports bones that are deformable.4False
EX_ONLY_KEYFRAMED_BONESOnly Keyframed BonesOnly exports bones that have been keyframed for a given animation. Useful to limit the set of bones on a per-animation basisFalse
EX_OGRE_INHERIT_SCALEOGRE Inherit ScaleWhether the OGRE bones have the 'inherit scale' flag on.5False
EX_TRIM_BONE_WEIGHTSTrim WeightsIgnore bone weights below this value (Ogre supports 4 bones per vertex)0.01
Mesh Options
EX_MESHExport MeshesExport meshesTrue
EX_MESH_OVERWRITEExport Meshes (overwrite)Export meshes (overwrite existing files)True
EX_ARRAYOptimise ArraysOptimise array modifiers as instances (constant offset only)True
EX_V1_EXTREMITY_POINTSExtremity Points60
EX_Vx_GENERATE_EDGE_LISTSGenerate Edge ListsGenerate Edge Lists (for Stencil Shadows)False
EX_GENERATE_TANGENTSTangentsExport tangents generated by Blender70
EX_Vx_OPTIMISE_ANIMATIONSOptimise AnimationsDON"T optimise out redundant tracks & keyframesTrue
EX_V2_OPTIMISE_VERTEX_BUFFERSOptimise Vertex Buffers For ShadersOptimise vertex buffers for shaders.8True
EX_V2_OPTIMISE_VERTEX_BUFFERS_OPTIONSVertex Buffers OptionsUsed when optimizing vertex buffers for shaders.9'puqs'
LOD
EX_LOD_LEVELSLOD LevelsNumber of LOD levels0
EX_LOD_DISTANCELOD DistanceDistance increment to reduce LOD300
EX_LOD_PERCENTLOD PercentageLOD percentage reduction40
EX_LOD_MESH_TOOLSUse OgreMesh ToolsUse OgreMeshUpgrader/OgreMeshTool instead of Blender to generate the mesh LODs.10False
Pose Animation
EX_SHAPE_ANIMATIONSShape AnimationExport shape animations (updates the .mesh file)True
EX_SHAPE_NORMALSShape NormalsExport normals in shape animations (updates the .mesh file)True
Logging
EX_Vx_ENABLE_LOGGINGWrite Exporter LogsWrite Log file to the output directory (blender2ogre.log)False
EX_Vx_DEBUG_LOGGINGDebug LoggingWhether to show DEBUG log messagesFalse

Exporter Script

This is an example exporting script with all the options and their default values

import bpy

bpy.ops.ogre.export(
filepath="D:\\tmp\\NormalsExport\\blender2ogre.scene", 

# General
EX_SWAP_AXIS='xz-y', 
# - 'xyz': No swapping
# - 'xz-y'OGRE Standard
# - '-xzy': Non standard
EX_V2_MESH_TOOL_VERSION='v2', 
# - 'v1': Export the mesh as a v1 object
# - 'v2': Export the mesh as a v2 object
EX_XML_DELETE=True, 

# Scene
EX_SCENE=True, 
EX_SELECTED_ONLY=True, 
EX_EXPORT_HIDDEN=True, 
EX_FORCE_CAMERA=True, 
EX_FORCE_LAMPS=True, 
EX_NODE_ANIMATION=True, 

# Materials
EX_MATERIALS=True, 
EX_SEPARATE_MATERIALS=True, 
EX_COPY_SHADER_PROGRAMS=True, 

# Textures
EX_DDS_MIPS=16, 
EX_FORCE_IMAGE_FORMAT='NONE', 

# Armature
EX_ARMATURE_ANIMATION=True, 
EX_SHARED_ARMATURE=False, 
EX_ONLY_KEYFRAMES=False, 
EX_ONLY_DEFORMABLE_BONES=False, 
EX_ONLY_KEYFRAMED_BONES=False, 
EX_OGRE_INHERIT_SCALE=False, 
EX_TRIM_BONE_WEIGHTS=0.01, 

# Mesh Options
EX_MESH=True, 
EX_MESH_OVERWRITE=True, 
EX_ARRAY=True,
EX_V1_EXTREMITY_POINTS=0, 
EX_Vx_GENERATE_EDGE_LISTS=False, 
EX_GENERATE_TANGENTS='0', 
# - '0': Do not export
# - '3': Generate
# - '4': Generate with parity
EX_Vx_OPTIMISE_ANIMATIONS=True, 
EX_V2_OPTIMISE_VERTEX_BUFFERS=True, 
EX_V2_OPTIMISE_VERTEX_BUFFERS_OPTIONS="puqs", 

# LOD
EX_LOD_LEVELS=0, 
EX_LOD_DISTANCE=300, 
EX_LOD_PERCENT=40, 
EX_LOD_MESH_TOOLS=False, 

# Pose Animation
EX_SHAPE_ANIMATIONS=True, 
EX_SHAPE_NORMALS=True, 

# Logging
EX_Vx_ENABLE_LOGGING=True,
EX_Vx_DEBUG_LOGGING=True
)

Importer

Importer Options

OptionNameDescriptionDefault Value
General
IM_SWAP_AXISSwap AxisAxis swapping mode'xyz'
IM_V2_MESH_TOOL_VERSIONMesh Import VersionSpecify Ogre version format to read'v2'
IM_XML_DELETEClean up xml filesRemove the generated xml files after binary conversion.11True
Mesh
IM_IMPORT_NORMALSImport NormalsImport custom mesh normalsTrue
IM_MERGE_SUBMESHESMerge SubmeshesWhether to merge submeshes to form a single mesh with different materialsTrue
Armature
IM_IMPORT_ANIMATIONSImport animationImport animations as actionsTrue
IM_ROUND_FRAMESAdjust frame rateAdjust scene frame rate to match imported animationTrue
IM_USE_SELECTED_SKELETONUse selected skeletonLink with selected armature object rather than importing a skeleton.12True
Shape Keys
IM_IMPORT_SHAPEKEYSImport shape keysImport shape keys (morphs)True
Logging
IM_Vx_ENABLE_LOGGINGWrite Importer LogsWrite Log file to the output directory (blender2ogre.log)False

Importer Script

This is an example importing script with all the options and their default values

import bpy

bpy.ops.ogre.import_mesh(
filepath="D:\\tmp\\NormalsExport\\Suzanne.mesh", 

# General
IM_SWAP_AXIS='xz-y',            # Axis swapping mode
IM_V2_MESH_TOOL_VERSION='v2',   # Specify Ogre version format to read
IM_XML_DELETE=True,             # Remove the generated xml files after binary conversion.

# Mesh
IM_IMPORT_NORMALS=True,         # Import custom mesh normals
IM_MERGE_SUBMESHES=True,        # Whether to merge submeshes to form a single mesh with different materials

# Armature
IM_IMPORT_ANIMATIONS=True,      # Import animations as actions
IM_ROUND_FRAMES=True,           # Adjust scene frame rate to match imported animation
IM_USE_SELECTED_SKELETON=True,  # Link with selected armature object rather than importing a skeleton

# Shape Keys
IM_IMPORT_SHAPEKEYS=True,       # Import shape keys (morphs)

# Logging
IM_Vx_ENABLE_LOGGING=True       # Write Log file to the output directory (blender2ogre.log)
)

Footnotes

  1. The removal will only happen if OgreXMLConverter/OgreMeshTool finishes successfully

  2. This is useful for using with: shareSkeletonInstanceWith() NOTE: The name of the.skeleton file will be that of the Armature

  3. Exported animation won't be affected by Inverse Kinematics, Drivers and modified F-Curves

  4. Useful for hiding IK-Bones used in Blender. NOTE: Any bone with deformablechildren/descendants will be output as well

  5. If the animation has scale in it, the exported animation needs to be adjusted to account for the state of the inherit-scale flag in OGRE

  6. Submeshes can have optional "extremity points" stored with them to allow submeshes to be sorted with respect to each other in the case of transparency. For some meshes with transparent materials (partial transparency) this can be useful

  7. Options: '0': Do not export '3': Generate '4': Generate with parity

  8. See Vertex Buffers Options for more settings

  9. Available flags are: p - converts POSITION to 16-bit floats. q - converts normal tangent and bitangent (28-36 bytes) to QTangents (8 bytes). u - converts UVs to 16-bit floats. s - make shadow mapping passes have their own optimised buffers. Overrides existing ones if any. S - strips the buffers for shadow mapping (consumes less space and memory)

  10. OgreMeshUpgrader/OgreMeshTool does LOD by removing edges, which allows only changing the index buffer and re-use the vertex-buffer (storage efficient). Blenders decimate does LOD by collapsing vertices, which can result in a visually better LOD, but needs different vertex-buffers per LOD.

  11. The removal will only happen if OgreXMLConverter/OgreMeshTool finishes successfully

  12. Use this for importing skinned meshes that don't have their own skeleton. Make sure you have the correct skeleton selected or the weight maps may get mixed up.