Interface: SceneConverter

NEW in 3ds Max 2017: This Core Interface exposes properties and methods for setting up the scene converter system and its rules.

Properties:

SceneConverter.visible : bool : Read|Write

Get/set the visible state of the Scene Converter dialog.

Setting the property to True will open the dialog, setting it to False will close it.

Getting the property will indicate whether the dialog is open (True) or closed (False).

See also the Scene_Converter: GlobalUtilityPlugin class and its Actions MixinInterface which exposes a .show() method that can be used to open the dialog.

SceneConverter.OpenWhenNeededOnFileOpen : bool : Read|Write

Get/set the state of the "Open Scene Converter on file open when missing plugins" checkbox.

When set to False (default), the Scene Converter will not be opened automatically when loading a scene with missing plugins.

When set to True, the Scene Converter will be opened automatically if missing plugins are detected.

SceneConverter.BackupOriginalFiles : bool : Read|Write

Get/set whether to back up the original files when performing batch conversion.

When set to True, a backup copy with the suffix "_backup" will be created.

SceneConverter.ConvertOnlySelectedObjects : bool : Read|Write

Get/set the state of the "Apply only to selected objects" checkbox.

When set to False (default), the conversion will be applied to the whole scene.

When set to True, the conversion will only be applied to the selected objects.

SceneConverter.ApplyOnlySelectedRules : bool : Read|Write

Get/set whether to apply all rules (False) or only the selected rules (True).

Default is False.

SceneConverter.FilterConversionTypesFromScene : bool : Read|Write

Get/set the state of the "Only display types in the current scene" checkbox.

When set to False (default), all object types that can be converted will be listed in the Source list of the dialog.

When set to True, only the object types found in the current scene that can be converted will be listed in the Source list of the dialog.

SceneConverter.ScriptFolder : string : Read|Write

Get/set the Scene Converter Script Folder.

Default is "C:\Program Files\Autodesk\3ds Max 2017\SceneConverter\".

This folder has two sub-folders:

"\ConversionScripts" containing the MAXScript files describing the conversion rules for individual object types,and

"\ConversionPresets" containing the MAXScript files describing the conversion presets for one renderer to another.

SceneConverter.BatchMode : enum : Read|Write

BatchMode enums: {#XRefs|#File|#Folder}

Get/set the state of the "Batch Conversions" radio buttons under the "Options" tab of the dialog.

Possible values are:

The integers 0, 1 and 2 can be used in place of the enums, but getting the property will always return the enum names.

Methods:

<integer>SceneConverter.UpdateStatus()

Updates the status of the Scene Converter by parsing the scene again. for example after scene objects have been added or deleted.

Returns the number of missing plugin stand-ins.

<bool>SceneConverter.ConvertScene()

Equivalent to pressing the "Convert Scene" button in the dialog.

Performs the conversion of the current scene according to the set rules.

Returns True on success, False on failure.

<void>SceneConverter.CancelConversion()

Equivalent to pressing the "Cancel" button in the dialog.

Cancels an ongoing scene conversion process.

Applies to all possible conversion processes, including current scene, othr MAX file, XRefs, or Batch conversion.

<void>SceneConverter.SaveSceneMaterialLibrary <filename>LibraryFullPathFilename

Saves a .MAT Material Library with the scene materials.

The argument is the full filename and path of the Material Library.

<void>SceneConverter.OverwriteFromMaterialLibrary <filename>LibraryFullPathFilename

Replaces the scene materials and maps with material and maps with the same names from the specified .MAT Material Library.

The argument is the full filename and path of the Material Library.

<bool>SceneConverter.ConvertAllReferencedFiles()

Performs conversion of all XRef files without converting the current scene.

Returns True on success, False on failure.

<bool>SceneConverter.ConvertMaxFile <filename>MaxFullpathFilename

Performs conversion of the specified .MAX file.

Returns True on success, False on failure.

<bool>SceneConverter.ConvertFolder <string>Folder

Performs conversion of the .MAX files in the specified folder and its sub-folders.

Returns True on success, False on failure.

<bool>SceneConverter.LoadConversionPreset <filename>presetFilename

Loads the specified conversion preset.

The argument is the fully qualified file name and path of the preset script file.

Existing presets can be found by looking in the ConversionPresets subfolder of the SceneConverter.ScriptFolder folder and getting all .MS files using getFiles().

FOR EXAMPLE

thePresets = getFiles (SceneConverter.ScriptFolder + @"ConversionPresets\*.ms") --get all preset files
if thePresets.count > 0 then
  SceneConverter.LoadConversionPreset thePresets[1] --load the first preset found, if any
else
  format “--No Presets Found!\n”

The following methods expose functionality that is meant for internal use only:

<void>SceneConverter.ClearInvalidClassIDs()

Clears the invalid classID counts.

After this call, the method SceneConverter.GetNumInvalidClassIDs() (see below) will return no Invalid Class IDs.

For Internal use only.

<integer>SceneConverter.GetNumInvalidClassIDs <enum>classIDType

classIDType enums: {#eLight|#eMaterial|#eMap|#eGeometry|#eCamera|#eExposureControl|#eRenderEffect|#eRenderElement|#eOther}

Returns the number of missing plug-in classs of the specified type.

For Internal use only.

<int by value array>SceneConverter.GetInvalidClassIDs <enum>classIDType <integer>index

classIDType enums: {#eLight|#eMaterial|#eMap|#eGeometry|#eCamera|#eExposureControl|#eRenderEffect|#eRenderElement|#eOther}

Returns the classIDs of the indexed missing plug-in class of the specified type.

For Internal use only.

FOR EXAMPLE

--Load a scene containing a FumeFX grid into a 3ds Max without FumeFX installed...
--The evaluate the following code:
(
enums= #(#eLight, #eMaterial, #eMap, #eGeometry, #eCamera, #eExposureControl, #eRenderEffect, #eRenderElement, #eOther)
for i in enums do
(
    count = (SceneConverter.GetNumInvalidClassIDs i)
    format "%: %\n" (i as string) count
    for j = 1 to count do
    (
   	 id = SceneConverter.GetInvalidClassIDs i j
   	 format "\t%: %\n" j id
    )
)
)

OUTPUT

eLight: 3
    1: #(112233, 554434)
    2: #(112233, 554433)
    3: #(861693276, 941707697)
eMaterial: 1
    1: #(1890604853, 1242969684)
eMap: 2
    1: #(2004031007, -1720943339)
    2: #(1653483166, 1916299967)
eGeometry: 3
    1: #(771832789, 331352827)
    2: #(1897859757, 471341833)
    3: #(1689326601, 511318125)
eCamera: 0
eExposureControl: -1
eRenderEffect: -1
eRenderElement: -1
eOther: 1
    1: #(1932620593, 1226131043)
OK

<bool>SceneConverter.AddInvalidClassID <enum>classIDType <INT64 array>classIDAs2IntegersInATab

classIDType enums: {#eLight|#eMaterial|#eMap|#eGeometry|#eCamera|#eExposureControl|#eRenderEffect|#eRenderElement|#eOther}

For Internal use only.

<bool>SceneConverter.RemoveInvalidClassID <enum>classIDType <integer>index

classIDType enums: {#eLight|#eMaterial|#eMap|#eGeometry|#eCamera|#eExposureControl|#eRenderEffect|#eRenderElement|#eOther}

For Internal use only.

<void>SceneConverter.AddLoadedStandinRef <maxObject>standin <string>name <integer>isMentalRay

For Internal use only.

<bool>SceneConverter.AddConversionRule <INT64 array>sourceClassID <INT64 array>destinationClassID scriptID:<string> sourceAutodeskMaterialBaseType:<string> destinationAutodeskMaterialBaseType:<string>

scriptID default value: ""

sourceAutodeskMaterialBaseType default value: ""

destinationAutodeskMaterialBaseType default value: ""

For Internal use only.

<bool>SceneConverter.RemoveFromScene <INT64 array>sourceClassID sourceAutodeskMaterialBaseType:<string>

sourceAutodeskMaterialBaseType default value: ""

For Internal use only.

<bool>SceneConverter.DoNotConvert <INT64 array>sourceClassID sourceAutodeskMaterialBaseType:<string>

sourceAutodeskMaterialBaseType default value: ""

For Internal use only.

Actions: