fixed #121

fixed #121

---------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:388
(
	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:176
	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (For Interchange)") selection:3
	checkbox uvCheckbox "UVs" pos:[32,240] width:128 height:15 checked:true
    --checkbox clustersCheckbox "Clusters" pos:[32,200] width:128 height:15 checked:true
	checkbox envelopeCheckbox "Envelope BindPose" pos:[32,256] width:150 height:15 checked:true
	checkbox dynamicTopologyCheckbox "Dynamic Topology" pos:[32,272] width:128 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,288] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,304] width:107 height:14 checked:true
	checkbox exportAsSingleMeshCheckbox "Particle System to Mesh Conversion" pos:[32,320] width:200 height:14 checked:false

	button exportButton "Export" pos:[16,354] width:64 height:24
	button cancelButton "Cancel" pos:[208,354] width:64 height:24
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (
	        result = ExocortexAlembic.export filename inSpinner.value outSpinner.value stepsSpinner.value subStepsSpinner.value meshTopologyDropDown.selection uvCheckbox.checked materialIdsCheckbox.checked envelopeCheckbox.checked dynamicTopologyCheckbox.checked exportSelectedCheckbox.checked flattenHierarchyCheckbox.checked exportAsSingleMeshCheckbox.checked
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)

---------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:388
(
	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:176
	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (For Interchange)") selection:3
	checkbox uvCheckbox "UVs" pos:[32,240] width:128 height:15 checked:true
    --checkbox clustersCheckbox "Clusters" pos:[32,200] width:128 height:15 checked:true
	checkbox envelopeCheckbox "Envelope BindPose" pos:[32,256] width:150 height:15 checked:true
	checkbox dynamicTopologyCheckbox "Dynamic Topology" pos:[32,272] width:128 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,288] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,304] width:107 height:14 checked:true
	checkbox exportAsSingleMeshCheckbox "Particle System to Mesh Conversion" pos:[32,320] width:200 height:14 checked:true

	button exportButton "Export" pos:[16,354] width:64 height:24
	button cancelButton "Cancel" pos:[208,354] width:64 height:24
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (
	        result = ExocortexAlembic.export filename inSpinner.value outSpinner.value stepsSpinner.value subStepsSpinner.value meshTopologyDropDown.selection uvCheckbox.checked materialIdsCheckbox.checked envelopeCheckbox.checked dynamicTopologyCheckbox.checked exportSelectedCheckbox.checked flattenHierarchyCheckbox.checked exportAsSingleMeshCheckbox.checked
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)


fixes #235 - deprecated shape node instancing

--------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:420
(
	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:208

	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (For Interchange)") selection:3

	dropdownList particleSystemExportMethod "Particle System Export Method" pos:[16,240] width:256 height:40 items:#("Automatic Instancing", "Merged Mesh", "Shape Node Instancing (deprecated)") selection:1

	checkbox uvCheckbox "UVs" pos:[32,288] width:128 height:15 checked:true
	checkbox envelopeCheckbox "Envelope BindPose" pos:[32,304] width:150 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,320] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,336] width:107 height:14 checked:true
	checkbox transformCacheCheckbox "Transform Cache" pos:[32,352] width:200 height:14 checked:false

	button exportButton "Export" pos:[16,386] width:64 height:24
	button cancelButton "Cancel" pos:[208,386] width:64 height:24
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (

	    	jobString = "filename=" + (filename as string)
	    	jobString += ";in=" + (inSpinner.value as string)
	    	jobString += ";out=" + (outSpinner.value as string)
	    	jobString += ";step=" + (stepsSpinner.value as string)
	    	jobString += ";substep=" + (subStepsSpinner.value as string)
	    	if(meshTopologyDropDown.selection == 2) do jobString += ";purepointcache=true"
	    	if(meshTopologyDropDown.selection == 3) do jobString += ";normals=true"
	    	jobString += ";uvs="
	    	jobString += (uvCheckbox.checked as string)
	    	jobString += ";materialids="
	    	jobString += (materialIdsCheckbox.checked as string)
	    	jobString += ";bindpose="
	    	jobString += (envelopeCheckbox.checked as string)
	    	jobString += ";exportselected="
	    	jobString += (exportSelectedCheckbox.checked as string)
	    	jobString += ";flattenhierarchy="
	    	jobString += (flattenHierarchyCheckbox.checked as string)
	    	if(particleSystemExportMethod.selection == 1) do jobString += ";automaticinstancing=true"
	    	if(particleSystemExportMethod.selection == 2) do jobString += ";particlesystemtomeshconversion=true"
	    	jobString += ";transformCache="
	    	jobString += (transformCacheCheckbox.checked as string)

	    	result = ExocortexAlembic.createExportJobs(jobString)
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)

--------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:420
(
	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:208

	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (For Interchange)") selection:3

	dropdownList particleSystemExportMethod "Particle System Export Method" pos:[16,240] width:256 height:40 items:#("Shape Node Instancing", "Automatic Instancing", "Merged Mesh") selection:1

	checkbox uvCheckbox "UVs" pos:[32,288] width:128 height:15 checked:true
	checkbox envelopeCheckbox "Envelope BindPose" pos:[32,304] width:150 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,320] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,336] width:107 height:14 checked:true
	checkbox transformCacheCheckbox "Transform Cache" pos:[32,352] width:200 height:14 checked:false

	button exportButton "Export" pos:[16,386] width:64 height:24
	button cancelButton "Cancel" pos:[208,386] width:64 height:24
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (

	    	jobString = "filename=" + (filename as string)
	    	jobString += ";in=" + (inSpinner.value as string)
	    	jobString += ";out=" + (outSpinner.value as string)
	    	jobString += ";step=" + (stepsSpinner.value as string)
	    	jobString += ";substep=" + (subStepsSpinner.value as string)
	    	if(meshTopologyDropDown.selection == 2) do jobString += ";purepointcache=true"
	    	if(meshTopologyDropDown.selection == 3) do jobString += ";normals=true"
	    	jobString += ";uvs="
	    	jobString += (uvCheckbox.checked as string)
	    	jobString += ";materialids="
	    	jobString += (materialIdsCheckbox.checked as string)
	    	jobString += ";bindpose="
	    	jobString += (envelopeCheckbox.checked as string)
	    	jobString += ";exportselected="
	    	jobString += (exportSelectedCheckbox.checked as string)
	    	jobString += ";flattenhierarchy="
	    	jobString += (flattenHierarchyCheckbox.checked as string)
	    	if(particleSystemExportMethod.selection == 2) do jobString += ";automaticinstancing=true"
	    	if(particleSystemExportMethod.selection == 3) do jobString += ";particlesystemtomeshconversion=true"
	    	jobString += ";transformCache="
	    	jobString += (transformCacheCheckbox.checked as string)

	    	result = ExocortexAlembic.createExportJobs(jobString)
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)


fixed #275

fixed #275

--------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:436
(
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:224

	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (Everything)") selection:3

	dropdownList particleSystemExportMethod "Particle System Export Method" pos:[16,240] width:256 height:40 items:#("Automatic Instancing", "Merged Mesh", "Shape Node Instancing (deprecated)") selection:1

	checkbox uvCheckbox "UVs" pos:[32,288] width:128 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,320] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,336] width:107 height:14 checked:true
	checkbox transformCacheCheckbox "Transform Cache" pos:[32,352] width:200 height:14 checked:false
	checkbox validateMeshTopology "Validate Mesh Topology" pos:[32,368]

	button exportButton "Export" pos:[16,402] width:64 height:24
	button cancelButton "Cancel" pos:[208,402] width:64 height:24

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (

	    	jobString = "filename=" + (filename as string)
	    	jobString += ";in=" + (inSpinner.value as string)
	    	jobString += ";out=" + (outSpinner.value as string)
	    	jobString += ";step=" + (stepsSpinner.value as string)
	    	jobString += ";substep=" + (subStepsSpinner.value as string)
	    	if(meshTopologyDropDown.selection == 2) do jobString += ";purepointcache=true"
	    	if(meshTopologyDropDown.selection == 3) do jobString += ";normals=true"
	    	jobString += ";uvs="
	    	jobString += (uvCheckbox.checked as string)
	    	jobString += ";materialids="
	    	jobString += (materialIdsCheckbox.checked as string)
	    	jobString += ";exportselected="
	    	jobString += (exportSelectedCheckbox.checked as string)
	    	jobString += ";flattenhierarchy="
	    	jobString += (flattenHierarchyCheckbox.checked as string)
	    	if(particleSystemExportMethod.selection == 1) do jobString += ";automaticinstancing=true"
	    	if(particleSystemExportMethod.selection == 2) do jobString += ";particlesystemtomeshconversion=true"
	    	jobString += ";transformCache="
	    	jobString += (transformCacheCheckbox.checked as string)
	    	jobString += ";validateMeshTopology="
	    	jobString += (validateMeshTopology.checked as string)

	    	result = ExocortexAlembic.createExportJobs(jobString)
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)

--------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicExportSettings "Alembic Export Settings" width:288 height:436
(
	GroupBox selectGroup "Selection" pos:[8,16] width:272 height:40
	checkbox exportSelectedCheckbox "Export Selected Objects" pos:[32,32] width:232 height:16 checked:true

	GroupBox animGroup "Animation" pos:[8,64] width:272 height:96
	label inLabel "Frame In" pos:[16,88] width:128 height:21
	label outLabel "Frame Out" pos:[16,104] width:128 height:21
	label stepsLabel "Frame Steps" pos:[16,120] width:128 height:21
	label subStepsLabel "Frame Sub-Steps" pos:[16,136] width:128 height:21
	spinner inSpinner "" pos:[112,88] width:160 height:16 range:[0,1e+006,0] type:#integer
	spinner outSpinner "" pos:[112,104] width:160 height:16 range:[1,1e+006,100] type:#integer
	spinner stepsSpinner "" pos:[112,120] width:160 height:16 range:[1,1e+006,1] type:#integer
	spinner subStepsSpinner "" pos:[112,136] width:160 height:16 range:[1,1e+006,1] type:#integer

	GroupBox geoGroup "Geometry" pos:[8,168] width:272 height:224

	dropdownList meshTopologyDropDown "Mesh Topology" pos:[16,192] width:256 height:40 items:#("Just Surfaces (No Normals)", "Point Cache (No Surfaces)", "Surface + Normals (For Interchange)") selection:3

	dropdownList particleSystemExportMethod "Particle System Export Method" pos:[16,240] width:256 height:40 items:#("Automatic Instancing", "Merged Mesh", "Shape Node Instancing (deprecated)") selection:1

	checkbox uvCheckbox "UVs" pos:[32,288] width:128 height:15 checked:true
	checkbox envelopeCheckbox "Envelope BindPose" pos:[32,304] width:150 height:15 checked:true
	checkbox materialIdsCheckbox "Material Ids" pos:[32,320] width:107 height:14 checked:true
	checkbox flattenHierarchyCheckbox "Flatten Hierarchy" pos:[32,336] width:107 height:14 checked:true
	checkbox transformCacheCheckbox "Transform Cache" pos:[32,352] width:200 height:14 checked:false
	checkbox validateMeshTopology "Validate Mesh Topology" pos:[32,368]

	button exportButton "Export" pos:[16,402] width:64 height:24
	button cancelButton "Cancel" pos:[208,402] width:64 height:24

	on exportButton pressed do
	(
	    filename = getSaveFileName caption:"Export to Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
	    if (filename != undefined) do
	    (

	    	jobString = "filename=" + (filename as string)
	    	jobString += ";in=" + (inSpinner.value as string)
	    	jobString += ";out=" + (outSpinner.value as string)
	    	jobString += ";step=" + (stepsSpinner.value as string)
	    	jobString += ";substep=" + (subStepsSpinner.value as string)
	    	if(meshTopologyDropDown.selection == 2) do jobString += ";purepointcache=true"
	    	if(meshTopologyDropDown.selection == 3) do jobString += ";normals=true"
	    	jobString += ";uvs="
	    	jobString += (uvCheckbox.checked as string)
	    	jobString += ";materialids="
	    	jobString += (materialIdsCheckbox.checked as string)
	    	jobString += ";bindpose="
	    	jobString += (envelopeCheckbox.checked as string)
	    	jobString += ";exportselected="
	    	jobString += (exportSelectedCheckbox.checked as string)
	    	jobString += ";flattenhierarchy="
	    	jobString += (flattenHierarchyCheckbox.checked as string)
	    	if(particleSystemExportMethod.selection == 1) do jobString += ";automaticinstancing=true"
	    	if(particleSystemExportMethod.selection == 2) do jobString += ";particlesystemtomeshconversion=true"
	    	jobString += ";transformCache="
	    	jobString += (transformCacheCheckbox.checked as string)
	    	jobString += ";validateMeshTopology="
	    	jobString += (validateMeshTopology.checked as string)

	    	result = ExocortexAlembic.createExportJobs(jobString)
	        if( result != 0 ) do
	        (
	            	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Export"
		    )
	        destroyDialog AlembicExportSettings
	    )
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicExportSettings
	)

	on AlembicExportSettings open do
    (
		inSpinner.value = animationRange.start
		outSpinner.value = animationRange.end
    )
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicExportDialog =
(
    createDialog AlembicExportSettings
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicExportUI
    category:"Alembic"
    buttonText:"Alembic Export..."
    tooltip:"Alembic Export..."
(
    on execute do
    (
        alembicExportDialog()
    )
)


issue #328

issue #328

---------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicImportSettings "Alembic Import Settings" width:288 height:150
(
    local filename

	GroupBox geoGroup "Geometry" pos:[8,8] width:272 height:122
	checkbox normalCheckbox "Normals" pos:[48,32] width:200 height:15 checked:true
	checkbox uvCheckbox "UVs" pos:[48,48] width:200 height:15 checked:true
    --checkbox clustersCheckbox "Clusters" pos:[48,64] width:200 height:15 checked:true
	checkbox attachCheckbox "Attach to existing objects" pos:[48,64] width:200 height:15 checked:false

	button importButton "Import" pos:[16,120] width:64 height:24
	button cancelButton "Cancel" pos:[208,120] width:64 height:24
	--GroupBox grpVisibility "Visibility" pos:[9,121] width:272 height:46
	--dropdownList dropDownVis "" pos:[20,140] width:252 height:21 items:#("Just Import Value", "Connected Controllers") selection:1
	checkbox materialIdsCheckbox "Material Ids" pos:[48,82] width:145 height:16 checked:true
    checkbox geoFromTopoCheckbox "Load Geometry From Topology Modifier" pos:[48,100] width:220 height:16 checked:false

	on importButton pressed do
	(
    	jobString = "filename=" + (filename as string)
    	jobString += ";normals="
    	jobString += (normalCheckbox.checked as string)
    	jobString += ";uvs="
    	jobString += (uvCheckbox.checked as string)
    	jobString += ";attachToExisting="
    	jobString += (attachCheckbox.checked as string)
        jobString += ";loadGeometryInTopologyModifier="
        jobString += (geoFromTopoCheckbox.checked as string)

    	result = ExocortexAlembic.createImportJob(jobString)

	    --result = ExocortexAlembic.import filename normalCheckbox.checked uvCheckbox.checked materialIdsCheckbox.checked attachCheckbox.checked 0
	    if( result != 0 ) do
	    (
	    	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Import"
	    )
		destroyDialog AlembicImportSettings
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicImportSettings
	)
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicImportDialog =
(
    filename = getOpenFileName caption:"Import from Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
    if (filename != undefined) do
    (
        createDialog AlembicImportSettings
        AlembicImportSettings.filename = filename
    )
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicImportUI
    category:"Alembic"
    buttonText:"Alembic Import..."
    tooltip:"Alembic Import..."
(
    on execute do
    (
        alembicImportDialog()
    )
)

---------------------------------------------------------------------------------------------------------
-- Custom import/export dialog with settings

rollout AlembicImportSettings "Alembic Import Settings" width:288 height:150
(
    local filename

	GroupBox geoGroup "Geometry" pos:[8,8] width:272 height:122
	checkbox normalCheckbox "Normals" pos:[48,32] width:200 height:15 checked:true
	checkbox uvCheckbox "UVs" pos:[48,48] width:200 height:15 checked:true
    --checkbox clustersCheckbox "Clusters" pos:[48,64] width:200 height:15 checked:true
	checkbox attachCheckbox "Attach to existing objects" pos:[48,64] width:200 height:15 checked:false

	button importButton "Import" pos:[16,120] width:64 height:24
	button cancelButton "Cancel" pos:[208,120] width:64 height:24
	--GroupBox grpVisibility "Visibility" pos:[9,121] width:272 height:46
	--dropdownList dropDownVis "" pos:[20,140] width:252 height:21 items:#("Just Import Value", "Connected Controllers") selection:1
	checkbox materialIdsCheckbox "Material Ids" pos:[48,82] width:145 height:16 checked:true
    checkbox geoFromTopoCheckbox "Load Geometry From Topology Modifier" pos:[48,100] width:180 height:16 checked:false

	on importButton pressed do
	(
    	jobString = "filename=" + (filename as string)
    	jobString += ";normals="
    	jobString += (normalCheckbox.checked as string)
    	jobString += ";uvs="
    	jobString += (uvCheckbox.checked as string)
    	jobString += ";attachToExisting="
    	jobString += (attachCheckbox.checked as string)
        jobString += ";loadGeometryInTopologyModifier="
        jobString += (geoFromTopoCheckbox.checked as string)

    	result = ExocortexAlembic.createImportJob(jobString)

	    --result = ExocortexAlembic.import filename normalCheckbox.checked uvCheckbox.checked materialIdsCheckbox.checked attachCheckbox.checked 0
	    if( result != 0 ) do
	    (
	    	messageBox "Failure - See Maxscript Listener for details." title:"Exocortex Alembic Import"
	    )
		destroyDialog AlembicImportSettings
	)
	on cancelButton pressed do
	(
	    destroyDialog AlembicImportSettings
	)
)
---------------------------------------------------------------------------------------------------------
-- MAXScript functions to bring up the options dialogs

fn alembicImportDialog =
(
    filename = getOpenFileName caption:"Import from Alembic File:" types:"Alembic(*.abc)|*.abc|All(*.*)|*.*" historyCategory:"Alembic"
    if (filename != undefined) do
    (
        createDialog AlembicImportSettings
        AlembicImportSettings.filename = filename
    )
)

---------------------------------------------------------------------------------------------------------
-- MacroScript to link the menu items to MAXScript functions

macroScript AlembicImportUI
    category:"Alembic"
    buttonText:"Alembic Import..."
    tooltip:"Alembic Import..."
(
    on execute do
    (
        alembicImportDialog()
    )
)


remove debug message as it is now functional.

plugin simpleObject AlembicMesh
	name:"Alembic Mesh"
	category:"Exocortex"
	classID:#(0xe855567c, 0xbcd73b8b)
(

	parameters main rollout:params
	(
		fileName type:#string ui:fileName default:"filename"
		dataPath type:#string ui:dataPath default:"path"
		dataTime type:#float ui:dataTime default:0
		normals type:#boolean ui:normals default:true
		uvs type:#boolean ui:uvs default:true
		clusters type:#boolean ui:clusters default:true
	)

	rollout params "Alembic"
	(
		edittext fileName "File Name"
		edittext dataPath "Data Path"
		spinner dataTime "Time" range:[-1000,1000,0]
		checkbox normals "Normals"
		checkbox uvs "UVs"
		checkbox clusters "Clusters"
	)

	on buildMesh do
	(
		mesh = ExocortexAlembic.importMesh fileName dataPath dataTime normals uvs clusters
	)

	tool create
	(
		on mousePoint click do
		(
			(#stop)
		)
	)
)

plugin simpleObject AlembicMesh
	name:"Alembic Mesh"
	category:"Exocortex"
	classID:#(0xe855567c, 0xbcd73b8b)
(

	parameters main rollout:params
	(
		fileName type:#string ui:fileName default:"filename"
		dataPath type:#string ui:dataPath default:"path"
		dataTime type:#float ui:dataTime default:0
		normals type:#boolean ui:normals default:true
		uvs type:#boolean ui:uvs default:true
		clusters type:#boolean ui:clusters default:true
	)

	rollout params "Alembic"
	(
		edittext fileName "File Name"
		edittext dataPath "Data Path"
		spinner dataTime "Time" range:[-1000,1000,0]
		checkbox normals "Normals"
		checkbox uvs "UVs"
		checkbox clusters "Clusters"
	)

	on buildMesh do
	(
		print "This is only a test, this is not meant to be functional at this point."
		mesh = ExocortexAlembic.importMesh fileName dataPath dataTime normals uvs clusters
	)

	tool create
	(
		on mousePoint click do
		(
			(#stop)
		)
	)
)


default time control loop to off (Issue #447)

plugin Helper AlembicTimeControl
    name:"Alembic Time Control"
    classID:#(0x4eb65d6, 0x7c454597)
    category:"Alembic"
    extends:dummy
(
    local lastSize=0, meshObj = undefined

    parameters pblock rollout:params
    (
        current type:#float ui:current animatable:true default:0
        offset type:#float ui:offset animatable:false default:0
        factor type:#float ui:factor animatable:false default:1

        cacheStart type:#float default:0 ui:uiCacheStart animatable:off
        cacheEnd type:#float default:animationrange.end ui:uiCacheEnd animatable:off
        frameOffset type:#float default:0 ui:uiFrameOffset animatable:off
        loop type:#Boolean default:false ui:uiLoop animatable:off

        time type:#float ui:uiTime animatable:true default:1

        gScale type:#integer ui:gScaleSp animatable:false default:100

        on current set val do this.OffsetCache()
        on offset set val do this.OffsetCache()
        on factor set val do this.OffsetCache()
        on frameOffset set val do this.OffsetCache()
        on cacheStart set val do this.OffsetCache()
        on cacheEnd set val do this.OffsetCache()
        on loop set val do this.OffsetCache()
    )

    rollout params "Alembic"
    (
        spinner current "Current Time: " range:[-10000,10000,0]
        spinner offset "Time Offset: " range:[-10000,10000,0] scale: 0.1
        spinner factor "Time Scale: " range:[-10000,10000,1]

        spinner uiCacheStart "Cache Start: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,8]
        spinner uiCacheEnd "Cache End: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,0]
        spinner uiFrameOffset "Frame Offset: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,8] tooltip:"The frame in-which the cache will begin playing."
        checkbox uiLoop "Loop Cache: " align:#right offset:[2,6]

        spinner uiTime "Final Time: " range:[-10000,10000,0]

        spinner gScaleSp "Gizmo Scale: " range:[10, 1e9, 100] offset:[0,10] type:#integer

        on gScaleSp changed val do
        (
            classInstances = (getClassInstances AlembicTimeControl)
            for i in classInstances do
                for j in (refs.dependents i) do
                    if classOf j ==  AlembicTimeControl do
                        j.scale = [val*.01,val*.01,val*.01]
        )
    )

    fn OffsetCache =
    (
        current.controller = float_expression()
	    current.controller.setExpression "S"

        time.controller = float_expression()

        local frameRange = (cacheEnd - cacheStart) / framerate
        local tScale = factor as string
        local timeOffset = ((frameOffset/framerate as float) + offset) as string

        local cStart = (cacheStart / framerate as float) as string
        if Loop then
        (
            fRange = frameRange as string
            fStart = (frameRange as string) as string

            str = "if(S*" + tScale + "+" + timeOffset + ">=0," + \
                    "mod (S*" + tScale + "+" + timeOffset + "," + fRange + ") + " + cStart + \
                    ",mod (S*" + tScale + "+" + timeOffset + "," + fRange + ") + " + cStart + "+ " + fStart + ")"

        )else(
            str = "(S*" + tScale + "+" + timeOffset + cStart + ")"
        )

        time.controller.SetExpression str
        time.controller.Update()
    )

    on getDisplayMesh do
    (
        if (meshObj == undefined) do
        (
            meshObj =  createInstance AlembicNull
            lastSize = gScale
        )

        meshObj.mesh
    )

    on useWireColor do
    (
        false
    )

    tool create
    (
        on mousePoint click do
        (
            #stop
        )

    )
)

plugin Helper AlembicTimeControl
    name:"Alembic Time Control"
    classID:#(0x4eb65d6, 0x7c454597)
    category:"Alembic"
    extends:dummy
(
    local lastSize=0, meshObj = undefined

    parameters pblock rollout:params
    (
        current type:#float ui:current animatable:true default:0
        offset type:#float ui:offset animatable:false default:0
        factor type:#float ui:factor animatable:false default:1

        cacheStart type:#float default:0 ui:uiCacheStart animatable:off
        cacheEnd type:#float default:animationrange.end ui:uiCacheEnd animatable:off
        frameOffset type:#float default:0 ui:uiFrameOffset animatable:off
        loop type:#Boolean default:true ui:uiLoop animatable:off

        time type:#float ui:uiTime animatable:true default:1

        gScale type:#integer ui:gScaleSp animatable:false default:100

        on current set val do this.OffsetCache()
        on offset set val do this.OffsetCache()
        on factor set val do this.OffsetCache()
        on frameOffset set val do this.OffsetCache()
        on cacheStart set val do this.OffsetCache()
        on cacheEnd set val do this.OffsetCache()
        on loop set val do this.OffsetCache()
    )

    rollout params "Alembic"
    (
        spinner current "Current Time: " range:[-10000,10000,0]
        spinner offset "Time Offset: " range:[-10000,10000,0] scale: 0.1
        spinner factor "Time Scale: " range:[-10000,10000,1]

        spinner uiCacheStart "Cache Start: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,8]
        spinner uiCacheEnd "Cache End: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,0]
        spinner uiFrameOffset "Frame Offset: " fieldwidth:50 range:[-1e9,1e9,0] type:#float align:#right offset:[0,8] tooltip:"The frame in-which the cache will begin playing."
        checkbox uiLoop "Loop Cache: " align:#right offset:[2,6]

        spinner uiTime "Final Time: " range:[-10000,10000,0]

        spinner gScaleSp "Gizmo Scale: " range:[10, 1e9, 100] offset:[0,10] type:#integer

        on gScaleSp changed val do
        (
            classInstances = (getClassInstances AlembicTimeControl)
            for i in classInstances do
                for j in (refs.dependents i) do
                    if classOf j ==  AlembicTimeControl do
                        j.scale = [val*.01,val*.01,val*.01]
        )
    )

    fn OffsetCache =
    (
        current.controller = float_expression()
	    current.controller.setExpression "S"

        time.controller = float_expression()

        local frameRange = (cacheEnd - cacheStart) / framerate
        local tScale = factor as string
        local timeOffset = ((frameOffset/framerate as float) + offset) as string

        local cStart = (cacheStart / framerate as float) as string
        if Loop then
        (
            fRange = frameRange as string
            fStart = (frameRange as string) as string

            str = "if(S*" + tScale + "+" + timeOffset + ">=0," + \
                    "mod (S*" + tScale + "+" + timeOffset + "," + fRange + ") + " + cStart + \
                    ",mod (S*" + tScale + "+" + timeOffset + "," + fRange + ") + " + cStart + "+ " + fStart + ")"

        )else(
            str = "(S*" + tScale + "+" + timeOffset + cStart + ")"
        )

        time.controller.SetExpression str
        time.controller.Update()
    )

    on getDisplayMesh do
    (
        if (meshObj == undefined) do
        (
            meshObj =  createInstance AlembicNull
            lastSize = gScale
        )

        meshObj.mesh
    )

    on useWireColor do
    (
        false
    )

    tool create
    (
        on mousePoint click do
        (
            #stop
        )

    )
)