Automating the Datasmith Export with MAXScript

Describes the MAXScript interface exposed by Datasmith, and how to use it to export your 3ds Max scene.

Choose your operating system:

Windows

macOS

Linux

The Datasmith Export Plugin for 3ds Max adds a small DatasmithExport interface to the MAXScript environment whenever it is installed and activated. You can use this interface to automate the process of exporting your 3ds Max scene to a .udatasmith file, instead of following the manual process described under Exporting Datasmith Content from 3ds Max .

Example

The following MAXScript code example shows how to export a 3ds Max scene with all scene objects and animations included.

DatasmithExport.IncludeTarget = #VisibleObjects               -- or #SelectedObjects
DatasmithExport.AnimatedTransforms = #ActiveTimeSegment       -- or #CurrentFrame
DatasmithExport.Export "D:\path\filename.udatasmith" false    -- set your own path and filename

The `DatasmithExport` MAXScript Interface

The following sections describe the properties and methods exposed by the DatasmithExport interface.

`IncludeTarget`

  • Type: enum

  • Access: Read, write

Determines which objects in the scene are included in the exported file.

  • #VisibleObjects - The exported file will contain all of the objects in your scene that are currently visible in 3ds Max. This is the default value.

  • #SelectedObjects - The exported file will contain only the visible objects that you currently have selected.

`AnimatedTransforms`

  • Type: enum

  • Access: Read, write

Determines how the exporter handles objects with animated 3D transforms. Accepts either of the following values:

  • #CurrentFrame - The exported file will include only the objects in the scene as they appear in the current frame, without any animation data. This is the default value.

  • #ActiveTimeSegment - The exported file will include animation data for any objects whose 3D transforms are animated within the time segment that is currently active in the 3ds Max timeline. The importer converts this animation data into a Level Sequence, which you can use to play back the animations inside the Unreal Engine.

Regardless of the value you choose for this setting, the Datasmith exporter always bases its exported data on the state of the scene objects in the current frame in 3ds Max. If you have animated mesh deformations or other sub-object animations, the Assets and Actors you'll see in the Unreal Engine after import will reflect the state of those objects at the frame that you have selected when you export the scene.

`Version`

  • Type: int

  • Access: Read-only

Returns the version number of the Unreal Engine that this version of the Datasmith Exporter for 3ds Max was compiled against, expressed as an integer.

`Export(strFilename, boolSuppressWarnings)`

  • Type: method

Starts the export process. This method requires the following parameters:

Parameter

Type

Description

strFilename

string

The absolute path and filename of the .udatasmith file that the exporter should create.

boolSuppresWarnings

Boolean

Determines whether the automated export should hide the window that normally shows notes and warnings about how the content in your scene was exported. Set this to true if you want your script to run unattended or unobtrusively without requiring the user to close a window when the export completes.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss