Alembic_Import : ImporterPlugin

Exposes the Alembic Importer plugin to MAXScript. Available in 3ds Max 2016 and higher.

NEW in 3ds Max 2019: Several properties have been added, removed, or changed in 2019.

2019 2018
AnimTimeRange CacheTimeRange
CustomAttributes new in 2019
EndFrame EndFrameTime
ExtraChannels new in 2019
gone in 2019 StepFrameTime
Hidden new in 2019
LayerName new in 2019
MaterialIDs new in 2019
MaterialName new in 2019
Normals new in 2019
ObjectID new in 2019
SamplesPerFrame new in 2019
ShapeSuffix ShapeName
StartFrame StartFrameTime
UVs new in 2019
Velocity new in 2019
VertexColors new in 2019
Visibility new in 2019

Constructor

Class instances not creatable by MAXScript.

Aliases:

Alembic_Import
AlembicImport

Alembic_Import interfaces:

Interface: AlembicImport

Properties:

AlembicImport.CoordinateSystem : enum : Read|Write
CoordinateSystem enums: {#Max|#Maya|#ZUp|#YUp}

Set the coordinate system of the imported Alembic file.

AlembicImport.ImportToRoot : boolean : Read|Write

Controls the state of the "Import To Root" option of the Alembic Importer.

When set to False (default), the imported Alembic objects will be parented to an Alembic Container. This is useful if you want to transform or select all imported Alembic objects as one.

When set to True, the imported Alembic objects will become Children Of The World without a parent.

AlembicImport.FitTimeRange : bool : Read|Write

When true, update the scene time range to match the imported Alembic animation time range.

AlembicImport.SetStartTime : bool : Read|Write

When true, set the current scene time to match the imported Alembic animation start time.

AlembicImport.UVs : bool : Read|Write

When true, import the mesh UV map channel. This global import option is copied locally into the created Alembic node.

AlembicImport.Normals : bool : Read|Write

When true, import the mesh normals. This global import option is copied locally into the created Alembic node.

AlembicImport.VertexColors : bool : Read|Write

When true, import the mesh vertex color map 0. This global import option is copied locally into the created Alembic node.

AlembicImport.ExtraChannels : bool : Read|Write

When true, import the mesh extra map channels. This global import option is copied locally into the created Alembic node.

AlembicImport.Velocity : bool : Read|Write

When true, import the mesh vertex velocity data. This global import option is copied locally into the created Alembic node.

AlembicImport.MaterialIDs : bool : Read|Write

When true, import the mesh material IDs from Alembic face sets. This global import option is copied locally into the created Alembic node.

AlembicImport.Visibility : bool : Read|Write

When true, import the node visibility data. This global import option is copied locally into the created Alembic node.

AlembicImport.ShapeSuffix : boolean : Read|Write

When set to true, the "Shape" suffix is stripped from the name of the imported objects. This property is set to false by default.

Methods:

<void>setDefaults()

Reset all AlembicImport properties to their default values.

Alembic File Inspection Methods

These methods are NEW in 3ds Max 2019.1 Update.

<TSTR by value> AlembicImport.Inspect <TSTR by value>alembicFile

Loads the specified almembicFile for inspection, and returns the "root" path of the Alembic file hierarchy. This method exposes the Inspect Alembic File option on the Alembic Import Options dialog.

<integer> AlembicImport.GetNumChildren <TSTR by value>pathToNode

Returns the number of children for the specified node path.

<TSTR by value> AlembicImport.GetParent <TSTR by value>pathToNode

Returns the path of the parent node of the specified node.

<TSTR by value> AlembicImport.GetChild <TSTR by value>pathToNode <integer>index

Returns the path of the child node for the specified node, at the specified index.

Note: Index is 0-based.

<TSTR by value> AlembicImport.GetABCNodeName <TSTR by value>pathToNode

Returns the name of the specified node. This is the string displayed in the tree view in the Inspect Alembic File dialog.

<boolean> AlembicImport.IsPropertyNode <TSTR by value>pathToNode

Removed in 3ds Max 2019.2 Update: Returns true if the specified node defines a property.

<enum> AlembicImport.GetABCNodeType <TSTR by value>pathToNode
       GetABCNodeType enums: {#Compound|#Scalar|#Array

Removed in 3ds Max 2019.2 Update: Returns the property type of the specified node.

<enum> AlembicImport.GetABCNodeDataType <TSTR by value>pathToNode
       GetABCNodeDataType enums: {#Bool|#Int8|#UInt8|#Int16|#UInt16|#Int32|#UInt32|#Int64|#UInt64|#Float16|#Float32|#Float64|#String|#WString|#Unknown

Removed in 3ds Max 2019.2 Update: Returns the data type of the specified node.

<integer> AlembicImport.GetABCNodeExtent <TSTR by value>pathToNode

Removed in 3ds Max 2019.2 Update: Returns the extent of the specified node.

These methods are NEW in 3ds Max 2019.2 Update:

<TSTR by value>  AlembicImport.GetABCNodeProperties <TSTR by value>pathToNode

Returns the object properties node for the specified node, where pathToNode is a string in the form of "path/to/alembic/object".

<integer> AlembicImport.GetNumProperties <TSTR by value>pathToNode 
  <TSTR by value>pathToProperty

Returns the number of properties held in the specified property node.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

<TSTR by value>  AlembicImport.GetChildPropertyFromIndex <TSTR by value>pathToNode
  <TSTR by value>pathToProperty <integer> index

Returns the path to the child property node at the specified index. The index is 0-based.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

<TSTR by value>  AlembicImport.GetChildPropertyFromName <TSTR by value>pathToNode
  <TSTR by value>pathToProperty <TSTR by value>name);

Gets the property node path for the first property with the specified name. The named property can be a grandchild, since this function is recursive.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

<enum> AlembicImport.GetPropertyType <TSTR by value>pathToNode 
  <TSTR by value>pathToProperty
  GetPropertyType enums: {#Compound|#Scalar|#Array

Gets the type of the specified property node.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

<enum> AlembicImport.GetPropertyDataType <TSTR by value>pathToNode 
  <TSTR by value>pathToProperty
  GetPropertyDataType enums: {#Bool|#Int8|#UInt8|#Int16|#UInt16|#Int32|#UInt32|#Int64|#UInt64|#Float16|#Float32|#Float64|#String|#WString|#Unknown

Gets the data type of the specified property node.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

<integer> AlembicImport.GetPropertyExtent <TSTR by value>pathToNode 
  <TSTR by value>pathToProperty

Gets the extent of the specified property node.

The pathToNode argument is a string in the form "path/to/alembic/object".

The pathToProperty argument is a string in the form "path/to/parent/property". Note: only compounded properties can have children.

Custom Attribute and Object Attribute Methods

    <void> AlembicImport.CA_AddProperty <enum>location <TSTR by value>alembicObjectPath <TSTR by value>propertyPath
       CA_AddProperty - no automatic redraw after invoked
       location enums: {#Modifier|#BaseObject}

Adds a custom attribute to the list to be added to a base object or modifier.

location indicates where the custom attribute will be stored, either #Modifier or #BaseObject.

alembicObjectPath is the path alembic object that owns the custom attribute.

propertyPath is the path to the property of the custom attribute.

    <void> AlembicImport.CA_Build()
       CA_Build - no automatic redraw after invoked 

Builds the script that writes out the custom attributes and connects them to the alembic file.

<void> AlembicImport.CA_SetNode <node>node <TSTR by value>alembicFile

Associates a node with an alembic file. This method needs to be called before adding properties to a node.

    <bool> AlembicImport.OA_SetBool <node>node <TSTR by value>name <bool>val
    <bool> AlembicImport.OA_SetInt <node>node <TSTR by value>name <integer>val
    <bool> AlembicImport.OA_SetFloat <node>node <TSTR by value>name <float>val
    <bool> AlembicImport.OA_SetPoint3 <node>node <TSTR by value>name <point3>val
    <bool> AlembicImport.OA_SetString <node>node <TSTR by value>name <TSTR by value>val

These methods set object attributes on the specified node, and return true if the attribute was successfully set.

Actions:

No actions exposed.

EXAMPLE

--This example uses the files created in the 
--AlembicExport:ExporterPlugin topic:  
resetMaxFile #noprompt --reset the scene
AlembicImport.ZUp = true --tell the importer to expect Z up (Max mode)
AlembicImport.ImportToRoot = false --parent to an Alembic Container
importFile (GetDir #export +"\\alembictest_hdm5_max.abc") #noPrompt using:AlembicImport
--RESULT: The loaded Cone matches the original animation

resetMaxFile #noprompt --reset the scene
--note that the importer is still in Max Z up mode
importFile (GetDir #export +"\\alembictest_ogawa_maya.abc") #noPrompt 
--RESULT: The Cone will be imported with the wrong orientation 
--because the file contains Y up data.

resetMaxFile #noprompt --reset the scene
AlembicImport.ZUp = false --tell the importer the file is not Z-up
AlembicImport.ImportToRoot = true --import as Child Of The World
--import the Maya file with Z up disabled:
importFile (GetDir #export +"\\alembictest_ogawa_maya.abc") #noPrompt 
--RESULT: The Cone will now be oriented correctly

INSPECTION EXAMPLE

mypath = @"C:\My Documents\3ds Max\export\helicopter.ABC"

pathToParent = AlembicImport.Inspect mypath

fn getAllChildren pathToParent =
(
    numChildren = AlembicImport.GetNumChildren pathToParent

    for i = 1 to numChildren do
    (
        pathToChild = AlembicImport.GetChild pathToParent (i-1)
        
        -- Also possible to get the parent by calling
        -- pathToParent = AlembicImport.GetParent pathToChild 
        
        nodeName = AlembicImport.GetABCNodeName pathToChild

		format "Name: %\n" nodeName
		
		propPath = AlembicImport.GetABCNodeProperties pathToChild
		
        if propPath != undefined then
        (
			numProps = AlembicImport.GetNumProperties pathToChild propPath
            nodeType = AlembicImport.GetPropertyType pathToChild propPath
            dataType = AlembicImport.GetPropertyDataType pathToChild propPath
            extent = AlembicImport.GetPropertyExtent pathToChild propPath
			
			format "%, %, %, %\n" numProps nodeType dataType extent
        )

      getAllChildren pathToChild
   )
)

getAllChildren pathToParent