Use alternate method to retrieve normals.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4098 542714f4-19e9-0310-aa3c-eee0fc999fb1

--
-- $Id$
--
-- Narya library - tools for developing networked games
-- Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
-- http://www.threerings.net/code/narya/
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

macroScript TRModelExporter category:"File" \
    buttonText:"Export Model as XML..." toolTip:"Export Model as XML" (

    -- Writes a point3-valued attribute to the file
    fn writePoint3Attr attr p outFile =
    (
        format "%=\"%, %, %\"" attr p.x p.y p.z to:outFile
    )

    -- Writes a quat-valued attribute to the file
    fn writeQuatAttr attr q outFile =
    (
        format "%=\"%, %, %, %\"" attr q.x q.y q.z q.w to:outFile
    )

    -- Writes a skinned vertex's bone weights to the file
    fn writeSkinBoneWeights skin vidx outFile =
    (
        weightCount = skinOps.getVertexWeightCount skin vidx
        for i = 1 to weightCount do (
            bone = skinOps.getBoneName skin (skinOps.getVertexWeightBoneID \
                skin vidx i) 0
            weight = skinOps.getVertexWeight skin vidx i
            format "      <boneWeight bone=\"%\" weight=\"%\"/>\n" bone \
                weight to:outFile
        )
    )

    -- Writes a physiqued vertex's bone weights to the file
    fn writePhysiqueBoneWeights node vidx outFile =
    (
        boneCount = physiqueOps.getVertexBoneCount node vidx
        for i = 1 to boneCount do (
            bone = physiqueOps.getVertexBone node vidx i
            weight = physiqueOps.getVertexWeight node vidx i
            format "      <boneWeight bone=\"%\" weight=\"%\"/>\n" bone.name \
                weight to:outFile
        )
    )

    -- Writes a mesh's vertices to the file
    fn writeVertices mesh outFile =
    (
        for i = 1 to mesh.numfaces do (
            face = getFace mesh i
            normals = meshop.getFaceRNormals mesh i
            local tvface
            if mesh.numtverts > 0 do (
                tvface = getTVFace mesh i
            )
            for j = 1 to 3 do (
                format "    <vertex" to:outFile
                writePoint3Attr " location" (getVert mesh face[j]) outFile
				local normal
				if normals[j] != undefined then (
					normal = normals[j]
				) else (
					normal = getNormal mesh face[j]
				)
	            writePoint3Attr " normal" normal outFile
                if tvface != undefined do (
                    tvert = getTVert mesh tvface[j]
                    format " tcoords=\"%, %\"" tvert[1] tvert[2] to:outFile
                )
                if isProperty mesh #skin or isProperty mesh #physique then (
                    format ">\n" to:outFile
                    if isProperty mesh #skin then (
                        writeSkinBoneWeights mesh.skin face[j] outFile
                    ) else (
                        writePhysiqueBoneWeights mesh face[j] outFile
                    )
                    format "    </vertex>\n" to:outFile
                ) else (
                    format "/>\n" to:outFile
                )
            )
        )
    )

    -- Writes a node to the file
    fn writeNode node outFile =
    (
        local kind
        isMesh = false
        if isKindOf node Editable_Mesh and not node.boneEnable then (
            isMesh = true
            if isProperty node #skin or isProperty node #physique then (
                kind = "skinMesh"
            ) else (
                kind = "triMesh"
            )
        ) else (
            kind = "node"
        )
        format "  <% name=\"%\"" kind node.name to:outFile
        xform = node.transform
        if node.parent != undefined do (
            xform = xform * (inverse node.parent.transform)
            format " parent=\"%\"" node.parent.name to:outFile
        )
        writePoint3Attr " translation" xform.translationPart \
            outFile
        writeQuatAttr " rotation" (inverse xform.rotationPart) \
            outFile
        writePoint3Attr " scale" xform.scalePart outFile
        if isMesh then in coordsys local (
            writePoint3Attr " offsetTranslation" node.objectOffsetPos outFile
            writeQuatAttr " offsetRotation" node.objectOffsetRot outFile
            writePoint3Attr " offsetScale" node.objectOffsetScale outFile
            format " solid=\"%\"" node.backFaceCull to:outFile
            if node.material != undefined and
                isKindOf node.material.diffuseMap BitmapTexture do (
                format " texture=\"%\"" (filenameFromPath \
                    node.material.diffuseMap.filename) to:outFile
                format " transparent=\"%\"" \
                    (node.material.diffuseMap.bitmap.hasAlpha or \
                        node.material.opacityMap != undefined) to:outFile
            )
            format ">\n" to:outFile
            if isProperty node #skin do (
                setCommandPanelTaskMode mode:#modify
                modPanel.setCurrentObject node.skin node:node
            )
            writeVertices node outFile
            format "  </%>\n\n" kind to:outFile

        ) else (
            format "/>\n\n" to:outFile
        )
    )

    -- Writes the model to the named file
    fn writeModel fileName =
    (
        outFile = createfile fileName
        format "<?xml version=\"1.0\" standalone=\"yes\"?>\n\n" to:outFile
        format "<model>\n\n" to:outFile
        for node in objects do in coordsys world (
            writeNode node outFile
        )
        format "</model>\n" to:outFile
        close outFile
    )

    --
    -- Main entry point
    --

    -- Get the target filename
    persistent global xmlModelFileName
    local fileName
    if (xmlModelFileName == undefined) then (
        fileName = maxFilePath + (getFilenameFile maxFileName) + ".xml"
    ) else (
        fileName = xmlModelFileName
    )
    fileName = getSaveFileName caption:"Select File to Export" \
        filename:fileName types:"XML Models (*.XML)|*.xml|All|*.*"
    if fileName != undefined do (
        xmlModelFileName = fileName
        writeModel fileName
    )
)

--
-- $Id$
--
-- Narya library - tools for developing networked games
-- Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
-- http://www.threerings.net/code/narya/
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

macroScript TRModelExporter category:"File" \
    buttonText:"Export Model as XML..." toolTip:"Export Model as XML" (

    -- Writes a point3-valued attribute to the file
    fn writePoint3Attr attr p outFile =
    (
        format "%=\"%, %, %\"" attr p.x p.y p.z to:outFile
    )

    -- Writes a quat-valued attribute to the file
    fn writeQuatAttr attr q outFile =
    (
        format "%=\"%, %, %, %\"" attr q.x q.y q.z q.w to:outFile
    )

    -- Writes a skinned vertex's bone weights to the file
    fn writeSkinBoneWeights skin vidx outFile =
    (
        weightCount = skinOps.getVertexWeightCount skin vidx
        for i = 1 to weightCount do (
            bone = skinOps.getBoneName skin (skinOps.getVertexWeightBoneID \
                skin vidx i) 0
            weight = skinOps.getVertexWeight skin vidx i
            format "      <boneWeight bone=\"%\" weight=\"%\"/>\n" bone \
                weight to:outFile
        )
    )

    -- Writes a physiqued vertex's bone weights to the file
    fn writePhysiqueBoneWeights node vidx outFile =
    (
        boneCount = physiqueOps.getVertexBoneCount node vidx
        for i = 1 to boneCount do (
            bone = physiqueOps.getVertexBone node vidx i
            weight = physiqueOps.getVertexWeight node vidx i
            format "      <boneWeight bone=\"%\" weight=\"%\"/>\n" bone.name \
                weight to:outFile
        )
    )

    -- Writes a mesh's vertices to the file
    fn writeVertices mesh outFile =
    (
        for i = 1 to mesh.numfaces do (
            face = getFace mesh i
            local tvface
            if mesh.numtverts > 0 do (
                tvface = getTVFace mesh i
            )
            for i = 1 to 3 do (
                format "    <vertex" to:outFile
                writePoint3Attr " location" (getVert mesh face[i]) outFile
                writePoint3Attr " normal" (getNormal mesh face[i]) outFile
                if tvface != undefined do (
                    tvert = getTVert mesh tvface[i]
                    format " tcoords=\"%, %\"" tvert[1] tvert[2] to:outFile
                )
                if isProperty mesh #skin or isProperty mesh #physique then (
                    format ">\n" to:outFile
                    if isProperty mesh #skin then (
                        writeSkinBoneWeights mesh.skin face[i] outFile
                    ) else (
                        writePhysiqueBoneWeights mesh face[i] outFile
                    )
                    format "    </vertex>\n" to:outFile
                ) else (
                    format "/>\n" to:outFile
                )
            )
        )
    )

    -- Writes a node to the file
    fn writeNode node outFile =
    (
        local kind
        isMesh = false
        if isKindOf node Editable_Mesh and not node.boneEnable then (
            isMesh = true
            if isProperty node #skin or isProperty node #physique then (
                kind = "skinMesh"
            ) else (
                kind = "triMesh"
            )
        ) else (
            kind = "node"
        )
        format "  <% name=\"%\"" kind node.name to:outFile
        xform = node.transform
        if node.parent != undefined do (
            xform = xform * (inverse node.parent.transform)
            format " parent=\"%\"" node.parent.name to:outFile
        )
        writePoint3Attr " translation" xform.translationPart \
            outFile
        writeQuatAttr " rotation" (inverse xform.rotationPart) \
            outFile
        writePoint3Attr " scale" xform.scalePart outFile
        if isMesh then in coordsys local (
            writePoint3Attr " offsetTranslation" node.objectOffsetPos outFile
            writeQuatAttr " offsetRotation" node.objectOffsetRot outFile
            writePoint3Attr " offsetScale" node.objectOffsetScale outFile
            format " solid=\"%\"" node.backFaceCull to:outFile
            if node.material != undefined and
                isKindOf node.material.diffuseMap BitmapTexture do (
                format " texture=\"%\"" (filenameFromPath \
                    node.material.diffuseMap.filename) to:outFile
                format " transparent=\"%\"" \
                    (node.material.diffuseMap.bitmap.hasAlpha or \
                        node.material.opacityMap != undefined) to:outFile
            )
            format ">\n" to:outFile
            if isProperty node #skin do (
                setCommandPanelTaskMode mode:#modify
                modPanel.setCurrentObject node.skin node:node
            )
            writeVertices node outFile
            format "  </%>\n\n" kind to:outFile

        ) else (
            format "/>\n\n" to:outFile
        )
    )

    -- Writes the model to the named file
    fn writeModel fileName =
    (
        outFile = createfile fileName
        format "<?xml version=\"1.0\" standalone=\"yes\"?>\n\n" to:outFile
        format "<model>\n\n" to:outFile
        for node in objects do in coordsys world (
            writeNode node outFile
        )
        format "</model>\n" to:outFile
        close outFile
    )

    --
    -- Main entry point
    --

    -- Get the target filename
    persistent global xmlModelFileName
    local fileName
    if (xmlModelFileName == undefined) then (
        fileName = maxFilePath + (getFilenameFile maxFileName) + ".xml"
    ) else (
        fileName = xmlModelFileName
    )
    fileName = getSaveFileName caption:"Select File to Export" \
        filename:fileName types:"XML Models (*.XML)|*.xml|All|*.*"
    if fileName != undefined do (
        xmlModelFileName = fileName
        writeModel fileName
    )
)


fix scripted geometry plugin, erroneously remove create tool.

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"
		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"
		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 0 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"
		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"
		checkbox normals "Normals"
		checkbox uvs "UVs"
		checkbox clusters "Clusters"
	)

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

)


minor test.

minor test.

plugin modifier AlembicMeshModifier
	name:"Alembic Mesh Modifier"
	classID:#(0x20730623, 0x5d650bdb)	-- keep in sync with AlembicNames.h
	category:"Alembic"
	version:1
	extends:AlembicMeshBaseModifier
	replaceUI:false
	invisible:false
(
		parameters main rollout:params
	(
		path type:#string ui:path default:""
		identifier type:#string ui:identifier default:""
		time type:#float ui:time animatable:true default:0
		topology type:#boolean ui:topology default:true
		geometry type:#boolean ui:geometry default:true
		normals type:#boolean ui:normals default:true
		uvs type:#boolean ui:uvs default:true
		muted type:#boolean ui:muted animatable:true default:false

		on path set val do delegate.path = val
		on identifier set val do delegate.identifier = val
		on time set val do delegate.time = val
		on topology set val do delegate.topology = val
		on geometry set val do delegate.geometry = val
		on normals set val do delegate.normals = val
		on uvs set val do delegate.uvs = val
		on muted set val do delegate.muted = val
	)

	rollout params "Alembic"
	(
		edittext path "Path"
		edittext identifier "Identifier"
		spinner time "Time" range:[-10000,10000,0]
		checkbox topology "Topology"
		checkbox geometry "Geometry"
		checkbox normals "Normals"
		checkbox uvs "UVs"
		checkbox muted "Muted"
	)
)

plugin modifier AlembicMeshModifier
	name:"Alembic Mesh Modifier"
	classID:#(0x20730623, 0x5d650bdb)	-- keep in sync with AlembicNames.h
	category:"Alembic"
	version:1
	extends:AlembicMeshBaseModifier
	replaceUI:true
	invisible:false
(
		parameters main rollout:params
	(
		path type:#string ui:path default:""
		identifier type:#string ui:identifier default:""
		time type:#float ui:time animatable:true default:0
		topology type:#boolean ui:topology default:true
		geometry type:#boolean ui:geometry default:true
		normals type:#boolean ui:normals default:true
		uvs type:#boolean ui:uvs default:true
		muted type:#boolean ui:muted animatable:true default:false

		on path set val do delegate.path = val
		on identifier set val do delegate.identifier = val
		on time set val do delegate.time = val
		on topology set val do delegate.topology = val
		on geometry set val do delegate.geometry = val
		on normals set val do delegate.normals = val
		on uvs set val do delegate.uvs = val
		on muted set val do delegate.muted = val
	)

	rollout params "Alembic"
	(
		edittext path "Path"
		edittext identifier "Identifier"
		spinner time "Time" range:[-10000,10000,0]
		checkbox topology "Topology"
		checkbox geometry "Geometry"
		checkbox normals "Normals"
		checkbox uvs "UVs"
		checkbox muted "Muted"
	)
)


- Mike Gist committed fixes to the 3ds max level exporters and a 3ds max genmesh sprite exporter; both from Luca Pancallo.

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@29092 8cc4aa7f-3514-0410-904f-f2cc9021211c

------------------------------------------------------------
-- Author: Luca Pancallo <pancallo@netscape.net>
--
-- Copyright (C) 2002 PlaneShift Team (info@planeshift.it,
-- http://www.planeshift.it)
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation (version 2 of the License)
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
--
------------------------------------------------------------
-- Version 07

macroScript Export_Sprite_CS
category:"PlaneShift"
internalcategory:"PlaneShift"
ButtonText:"Export Sprite CS"
tooltip:"Export Sprite CS" Icon:#("Maxscript",1)
(

rollout Test1 "Export Sprite to CS" width:238 height:345
(
	edittext edt3 "" pos:[17,32] width:192 height:21
	label lbl1 "Export Sprite To:" pos:[21,7] width:142 height:20
	button btn2 "Export!" pos:[42,310] width:152 height:24

	radiobuttons rdo1 "" pos:[15,67] width:218 height:16 labels:#("All Frames", "One Frame")

	edittext edtScale "" pos:[173,98] width:50 height:27
	label lbl2 "Scale:" pos:[131,100] width:40 height:22

	edittext edtVert1 "" pos:[146,187] width:67 height:27
	label lbl15 "Vertex on Foot 1" pos:[24,192] width:103 height:22
	edittext edtVert2 "" pos:[146,220] width:67 height:27
	label lbl16 "Vertex on Foot 2" pos:[26,221] width:113 height:22
	edittext edtFrame "" pos:[146,260] width:67 height:27
	label lbl17 "Frame with Foot2 on ground" pos:[26,259] width:114 height:35

	checkbox chkDispl "Use Displacement" pos:[23,160] width:194 height:22
	GroupBox grp1 "Displacement" pos:[5,134] width:219 height:169

	edittext edtAction "" pos:[53,96] width:67 height:27
	label lbl28 "Action:" pos:[11,100] width:40 height:22

	on Test1 open do
	(
	   name = selection[1].name
	   edt3.text = "d:\\Luca\\"+name+".spr"

	   edtScale.text = "1"

	   edtAction.text = "stand"
	)

	on btn2 pressed do
	(

		-- ////////////////////////
		-- Variables used in the program
		-- ////////////////////////

		-- get filename
		filename = edt3.text

		-- output file
		outFile = createFile filename

		-- set debug output
		debug=false

		-- Define verbose output (that takes more space and memory)
		verboseMode = true

		-- parameters for scaling and relocation
		xscale = edtScale.text as Float
		yscale = edtScale.text as Float
		zscale = edtScale.text as Float

		xrelocate = 0
		yrelocate = 0
		zrelocate = 0

		animationName = edtAction.text

		-- functions declaration
		global tokenize

		-- Tokenize utility function
		fn tokenize instring sep =
		(
		   outarray = #()
		   temp=copy instring
		   i = 1
		   while (true) do (
		   	index = findstring temp sep
			if (index==undefined) then
			(
				outarray[i]=temp
				exit
			) else (
				outarray[i] = substring temp 1 (index-1)
				temp = substring temp (index+1) -1
			)
			i = i +1
		   )
		   outarray
		)

		-- ////////////////////////
		-- Main: program starts here
		-- ////////////////////////

			-- identify main sprite object
			obj=selection[1]
			objectname = obj.name
			image = obj.material.maps[2].filename
			indx = tokenize image "\\"
			materialname = indx[indx.count]

		    -- output name of object and some info
			format "\n\nFound Object Name: % Faces: %\n" objectname obj.numfaces

		    --format "    ;Object Name: % Faces: %\n" objectname obj.numfaces to:outFile

			-- write header

		    format "<meshfact name=\"%\">\n" objectname to:outFile
		    format "   <plugin>crystalspace.mesh.loader.factory.sprite.3d</plugin>\n" to:outFile
		    format "  <params>\n" to:outFile
		    format "    <material>%</material>\n" materialname to:outFile

			frames = #()

			redefineFaces=#()

			-- check if model has left-oriented system or not
			face = getface obj 1
			v1= getvert obj face[1]
			v2 = getvert obj face[2]
			v3 = getvert obj face[3]

			vect1 = v1-v2
			vect2 = v3-v2
			normal1 = cross vect1 vect2
			normal2 = normal1/(length normal1)
			maxnorm = getfacenormal obj 1
			flipModel = false

			for j=1 to 3 do (
				if (maxnorm[j]>0 and normal2[j]>0) then (
					flipModel =true
				)
				if (maxnorm[j]<0 and normal2[j]<0) then (
					flipModel =true
				)
			)

			--// end check model orientation

			-- get vertex information for displacement
			displDist = #()
			if (chkDispl.checked) then
			(
				vertex1 = edtVert1.text as Integer
				vertex2 = edtVert2.text as Integer
				middleFrame = edtFrame.text as Integer
			)
			posV1 = undefined
			posV2 = undefined
			firstPosV1 = undefined
			firstPosV2 = undefined

			---------------------------------------
			-- cycle on all frames of the animation
			---------------------------------------
			maxframes = animationrange.end

			if (animationrange.end==100f) then
				maxframes = 0;

			if (rdo1.state==2) then
				maxframes=0

			format "maxframes: %" maxframes

			for curFrame=0 to maxframes do (
				-- move to right frame
				slidertime=curFrame

				-- get frame name
				framename = animationName + curFrame as String
				append frames framename
			    format "    <frame name=\"%\">\n" framename to:outFile

				-- attach sockets
				-- todo

			    -- skip bones
				-- todo

				-- check texture
				if (getNumTVerts obj==0) then
				(
					format "No UV maps assigned to object: %\n" obj.name
				)

				vertTInfo = #(getNumTVerts obj)
				vertTInfo[1] = undefined

				-- cycle on all Faces of the object to get Tverts x,y,z positions
				for i=1 to obj.numfaces do
				(
					-- get face
					Tface = getTVFace obj i
					face = getFace obj i

					-- get its 3 vertices
					for h=1 to 3 do (
				    	curVert=getVert obj face[h]
						if (curVert==undefined) then
							format "\n\nUNDEF: %\n\n" Tface[h]
						if (debug) then
							format " Tface[%]: % curVert: %\n" i Tface[h] curVert

						if (debug and vertTInfo[Tface[h]]==undefined) then
							format "Got one undefined \n"

						-- if the value is different we have a problem on Welded UV
						if (vertTInfo[Tface[h]]!=undefined and vertTInfo[Tface[h]]!=curVert) then (
							if (debug) then
								format "PROBLEM: REDEFINITION\n"
							append redefineFaces i
						)
						vertTInfo[Tface[h]]=curVert
					)
				)

				--for h in vertTInfo do
				--(
				--	format "vertTInfo Elem: % " h
				--)

				-- cycle on all TVerts of the object
				for i =1 to (getNumTVerts obj) do
				(
					-- skips undefined UV, is that an error?????
					-- the vert seems not used because is welded to another one
					if (vertTInfo[i]==undefined) then
					(
						format "      <v x=\"0\" y=\"0\" z=\"0\" u=\"0\" v=\"0\" /> ; vert not used \n" to:outFile
						continue;
					)

					-- get its 3 vertices as a point3
					-- export in XZY format
				    vert=vertTInfo[i]
					xvert = (vert.x * xscale) + xrelocate
					yvert = (vert.y * yscale) + yrelocate
					zvert = (vert.z * zscale) + zrelocate

					Tvert = getTVert obj i

					format "      <v x=\"%\" y=\"%\" z=\"%\" u=\"%\" v=\"%\" /> \n" xvert zvert yvert Tvert[1] (1-Tvert[2]) to:outFile
				)

				-- calculate displacement
				if (chkDispl.checked) then
				(
					-- after first frame
					if (curFrame>0) then
					(
						-- first foot
						if (curFrame<=middleFrame) then
						(
							format " frame: % posV1: %\n" curFrame posV1
							prevV1 = posV1
							posV1 = getVert obj vertex1
						    dist1 = distance posV1 prevV1
							format " dist: % \n" dist1

							append displDist dist1
						)
						-- second foot
						else if (curFrame>=(middleFrame+1)) then (
						  format " frame: % posV2: %\n" curFrame posV2
							prevV2 = posV2
							posV2 = getVert obj vertex2
						    dist2 = distance posV2 prevV2
							format " dist: % \n" dist2

							append displDist dist2
						)

					-- first frame
					) else (
						firstPosV1 = getVert obj vertex1
						posV1 = getVert obj vertex1
					)

					-- on last frame calc displ for first one
					if (curFrame==maxframes) then
					(
						posV1 = getVert obj vertex1
						dist1 = distance firstPosV1 posV1
						insertItem dist1 displDist 1
					)

					-- on middle frame store info for middle-next one
					if (curFrame==middleFrame) then
					(
						posV2 = getVert obj vertex2
					)
				)

				format "    </frame>\n\n" to:outFile
			)

			-- export action
			format "    <action name=\"%\">" animationName to:outFile
			countF=1
			for f in frames do (
				if (chkDispl.checked) then
				(
					format" <f name=\"%\" displacement=\"%\" /> " f displDist[countF] to:outFile
				) else
					format" <f name=\"%\" delay=\"100\" /> " f to:outFile
				countF = countF + 1
			)
			format " </action> \n\n" to:outFile

			-- if action is walk then export backwalk also
			if (animationName == "walk") then
			(
				format "    <action name=\"backwalk\">" to:outFile
				countF = frames.count
				-- for with "by -1" crashes for unknown reasons, so we use a workaround
				for f=1 to countF do (
					if (chkDispl.checked) then
					(
						revIter = countF-f+1
						format " <f name=\"%\" displacement=\"%\" /> " frames[revIter] displDist[revIter]  to:outFile
					) else
						format " <f name=\"%\" delay=\"100\" /> " f to:outFile
				)
				format " </action> \n\n" to:outFile
			)

			-- cycle on all faces of object
			for i =1 to obj.numFaces do
			(
				faceVerts=getTVface obj i
				a = (faceVerts[1]-1) as Integer
				b = (faceVerts[3]-1) as Integer
				c = (faceVerts[2]-1) as Integer

				if (flipModel) then
					format "    <t v1=\"%\" v2=\"%\" v3=\"%\" />\n" a c b to:outFile
				else
					format "    <t v1=\"%\" v2=\"%\" v3=\"%\" />\n" a b c to:outFile

		    )

		format "      <smooth>yes</smooth>\n" to:outFile
		format "    </params>\n" to:outFile
		format "</meshfact>\n" to:outFile

		close outFile

		if (redefinefaces.count!=0) then (
			format "\n\nFaces that need UV Unwield: %" redefinefaces
			message = "Some faces need UV Unwield, look at MaxScript Listener Window for faces #\n";
			message = message + "MODEL NEEDS FIXING!"
		) else
			message = "ALL DONE!"

		messageBox message

	)
)

gw = newRolloutFloater "Export Sprite" 300 410
addRollout Test1 gw

)

---------------------------------------------------------------------------------------
--  Documentation
--
--
-- Faces that need UV Unwield:
-- This means that some UV coords are shared on multiple vetexes
-- Go in the UVUnwrap function and Unweld all the vertexes of the face found
-------------------


added Cross Surface

added Cross Surface

-------------------------------------------------------------------------------
-- PixGrinder.mcr
-- MacroScripts File
-- By Philippe DASSONVILLE ( pixgrinder@gmail.com )
-- 31/05/2016
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(

	macroScript HideByClick
	category:"-- PixGrinder --"
	toolTip:"Hide by Click"
	buttonText:"Hide by Click"
	-- icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Hide_by_click.ms"
	)

	macroScript AutoSavePixGrinder
	category:"-- PixGrinder --"
	toolTip:"AutoSave - PixGrinder"
	buttonText:"AutoSave - PixGrinder"
	icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/AutoSave_PixGrinder.ms"
	)

	macroScript BboxTrueMaker
	category:"-- PixGrinder --"
	toolTip:"Bbox True Maker"
	buttonText:"Bbox True Maker"
	--icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Bbox_TrueMaker.ms"
	)

	macroScript NamesTransfer
	category:"-- PixGrinder --"
	toolTip:"Names Transfert"
	buttonText:"NamesTransfer"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/NamesTransfer.ms"
	)

	macroScript MaterialTransfer
	category:"-- PixGrinder --"
	toolTip:"Material Transfert"
	buttonText:"Material Transfert"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialTransfert.ms"
	)

	macroScript Collapse_Selected
	category:"-- PixGrinder --"
	toolTip:"Collapse Hierarchy on Selection"
	buttonText:"Collapse Selected"
	icon:#("PixGrinder",1)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Collapse.mse"
	)

	macroScript ResetXFormPixGrinder
	category:"-- PixGrinder --"
	toolTip:"ResetXForm on Selection"
	buttonText:"ResetXForm"
	icon:#("PixGrinder",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/ResetXform.mse"
	)

	macroScript Select_Previous_Object
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object"
	buttonText:"Select Previous Object"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Prev.ms"
	)

	macroScript Select_Next_Object
	category:"-- PixGrinder --"
	toolTip:"Select Next Object"
	buttonText:"Select Next Object"
	icon:#("PixGrinder",2)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Next.ms"
	)

	macroScript Duplicator
	category:"-- PixGrinder --"
	toolTip:"Duplicator"
	buttonText:"Duplicator"
	icon:#("PixGrinder",15)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Duplicator_v2.mse"
	)

	macroScript CleanLayers
	category:"-- PixGrinder --"
	toolTip:"Clean Layers"
	buttonText:"Clean Layers"
	icon:#("PixGrinder",8)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CleanLayers_v2.ms"
	)

	macroScript AssignCurrentMaterial
	category:"-- PixGrinder --"
	toolTip:"Assign Current Material"
	buttonText:"Assign Current Material"
	icon:#("PixGrinder",19)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/AssignCurrentMaterial.ms"
	)

	macroScript FaceMode
	category:"-- PixGrinder --"
	toolTip:"FaceMode - PixGrinder"
	buttonText:"FaceMode"
	icon:#("EditMesh",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/FaceMode_v2.ms"
	)

	macroScript ShapeSelectOptimizer
	category:"-- PixGrinder --"
	toolTip:"ShapeSelectOptimizer - PixGrinder"
	buttonText:"ShapeSelectOptimizer"
	icon:#("bip_curve",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ShapeSelectOptimizer_v1.ms"
	)

	macroScript LayersViewToggle
	category:"-- PixGrinder --"
	toolTip:"Layers View Toggle - PixGrinder"
	buttonText:"Layers View Toggle"
	icon:#("AnimLayerToolbar",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_view_Toggle_v2.ms"
	)

	macroScript LayersFreezeToggle
	category:"-- PixGrinder --"
	toolTip:"Layers Freeze Toggle - PixGrinder"
	buttonText:"Layers Freeze Toggle"
	icon:#("TrackViewTools",115)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_freeze_Toggle_v2.ms"
	)

	macroScript CableRetopology
	category:"-- PixGrinder --"
	toolTip:"Cable Retopology - PixGrinder"
	buttonText:"CableRetopology"
	icon:#("Splines",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_Retopology.ms"
	)

	macroScript LocksToggler
	category:"-- PixGrinder --"
	toolTip:"Toggles Transforms locks"
	buttonText:"Animation Locks Toggler"
	icon:#("SnapsControls",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LocksToggler_V1.ms"
	)

	macroScript TrisToQuad
	category:"-- PixGrinder --"
	toolTip:"Triangle To Quads"
	buttonText:"TrisToQuad"
	icon:#("EditMesh",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/polyquad2.ms"
	)

	macroScript PivotCenterPixGrinder
	category:"-- PixGrinder --"
	toolTip:"PivotCenter"
	buttonText:"PivotCenter"
	icon:#("Maintoolbar",33)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Center.ms"
	)

	macroScript PivotPerObject
	category:"-- PixGrinder --"
	toolTip:"PivotPerObject"
	buttonText:"PivotPerObject"
	icon:#("Maintoolbar",31)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_PerObject.ms"
	)

	macroScript PivotExternal
	category:"-- PixGrinder --"
	toolTip:"PivotExternal"
	buttonText:"PivotExternal"
	icon:#("Maintoolbar",35)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_External.ms"
	)

	macroScript WireColorChanger
	category:"-- PixGrinder --"
	toolTip:"Wire Color Changer"
	buttonText:"Wire Color Changer"
	icon:#("Material_Modifiers",3)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/WireColorChanger_v2.ms"
	)

	macroScript PivotAlignator
	category:"-- PixGrinder --"
	toolTip:"Pivot Alignator"
	buttonText:"PivotAlignator"
	icon:#("Helpers",1)
	silentErrors:false
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Alignator.ms"
	)

	macroScript MaterialRemove
	category:"-- PixGrinder --"
	toolTip:"Material Remove"
	buttonText:"Material Remove"
	icon:#("UVWUnwrapOption",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialRemove.ms"
	)

	macroScript SearchByName
	category:"-- PixGrinder --"
	toolTip:"SearchByName"
	buttonText:"Srch"
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/search_by_Name.ms"
	)

	macroScript LayerFromSelection
	category:"-- PixGrinder --"
	toolTip:"Layer Isolate Objects's layer"
	buttonText:"Layer Isolate Objects's layer"
	icon:#("AnimLayerToolbar",4)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LayerShowFromSelec.ms"
	)

	macroScript SymY
	category:"-- PixGrinder --"
	toolTip:"Symmetry on Y"
	buttonText:"Symmetry on Y"
	icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Symmetry_Y.ms"
	)

	macroScript XRefMulti
	category:"-- PixGrinder --"
	toolTip:"Xref multiple max files on the fly !"
	buttonText:"XRefMulti"
	-- icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/XrefScene_multi.ms"
	)

	macroScript BS_CollapseMultiMaterial
	category:"-- PixGrinder --"
	toolTip:"Collapse MultiSubObjects Material"
	buttonText:"Collapse MultiMat"
	icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Blur_CollapseSubObjectMaterial_v1.ms"
	)

	macroScript Reveal_MaxFile
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene in Windows Explorer"
	buttonText:"Reveal Scene..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_Maxfile_In_Explorer.ms"
	)

	macroScript Reveal_BakFolder
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene Backup Folder "
	buttonText:"Reveal Bak Folder..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_BackupFolder_In_Explorer.ms"
	)

	macroScript MaxScript_Help
	category:"-- PixGrinder --"
	toolTip:"MaxScript Help Offline"
	buttonText:"MaxScript Help Offline"
	icon:#("MaxScript",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/MaxScript_Offline_Help.ms"
	)

	macroScript AssetsFinder
	category:"-- PixGrinder --"
	toolTip:"AssetsFinder"
	buttonText:"Search..."
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Assets_Finder.ms"
	)

	macroScript CustAttribTransfer
	category:"-- PixGrinder --"
	toolTip:"Transfer Custom Attribs"
	buttonText:"AttribTransfer"
	--icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CustAttribTransfer.ms"
	)

	macroScript BitmapFuckingUpdate
	category:"-- PixGrinder --"
	toolTip:"Bitmap Force Update !!"
	buttonText:"Bitmap Force Update"
	icon:#("PixGrinder",20)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/BitmapFuckingUpdate.ms"
	)

	macroScript SplineSelectMiddlePoints
	category:"-- PixGrinder --"
	toolTip:"Selects Middle points on a Spline"
	buttonText:"SplinePoints"
	icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/SplineSelectMiddlePoints.ms"
	)

	macroScript RefPlaneAutoRatio
	category:"-- PixGrinder --"
	toolTip:"Adjust Reference plane to its bitmap"
	buttonText:"Ref Plane AutoRatio"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Ref_Plane_AutoRatio.ms"
	)

	macroScript CornerVertex
	category:"-- PixGrinder --"
	toolTip:"Corner"
	buttonText:"Corner"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Corner_Vertex.ms"
	)

	macroScript DoublonFinder
	category:"-- PixGrinder --"
	toolTip:"DoublonFinder"
	buttonText:"DoublonFinder"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Doublon_Finder.ms"
	)

	macroScript UV1Detector
	category:"-- PixGrinder --"
	toolTip:"UV 1 Detector"
	buttonText:"UV 1 Detector"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/UV1_Detector.ms"
	)

	macroScript FullNameDisplay
	category:"-- PixGrinder --"
	toolTip:"Full Name Display"
	buttonText:"Full Name Display"
	icon:#("Splines",5)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/FullNameDisplay.ms"
	)

	macroScript Attach100
	category:"-- PixGrinder --"
	toolTip:"Attach100"
	buttonText:"Attach100"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Attach100.ms"
	)

	macroScript listSelected
	category:"-- PixGrinder --"
	toolTip:"List Selected"
	buttonText:"List Selected"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/listSelected.ms"
	)

	macroScript listHierarchy
	category:"-- PixGrinder --"
	toolTip:"List Hierarchy"
	buttonText:"List Hierarchy"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/List_Hierarchy.ms"
	)

	macroScript listToFile
	category:"-- PixGrinder --"
	toolTip:"List To File"
	buttonText:"ListToFile"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ListSelectedToFile.ms"
	)

	macroScript selectSmallObjects
	category:"-- PixGrinder --"
	toolTip:"Select Small Objects"
	buttonText:"Select Small Objects"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Small_Objects_Select.ms"
	)

	macroScript FindMatFromSlot
	category:"-- PixGrinder --"
	toolTip:"Find Material From Slot"
	buttonText:"FindMatFromSlot"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Material_SlotFinder.ms"
	)

	macroScript SelectByList
	category:"-- PixGrinder --"
	toolTip:"Select by List"
	buttonText:"SelectByList"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_by_List.ms"
	)

	macroScript NormalFlip
	category:"-- PixGrinder --"
	toolTip:"Normals - Quick Flip"
	buttonText:"QuickFlip"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Normals_QuickFlip.ms"
	)

	macroScript CableSplinePreset
	category:"-- PixGrinder --"
	toolTip:"CableSplinePreset"
	buttonText:"CableSplinePreset"
	icon:#("Splines",10)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_SplinePreset.ms"
	)

	macroScript Select_Previous_Object_Zoom
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object Zoom"
	buttonText:"Select Previous Object Zoom"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Prev_Zoomed.ms"
	)

	macroScript Select_Next_Object_Zoom
	category:"-- PixGrinder --"
	toolTip:"Select Next Object Zoom"
	buttonText:"Select Next Object Zoom"
	icon:#("PixGrinder",2)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Next_Zoomed.ms"
	)

	macroScript CrossSurface
	category:"-- PixGrinder --"
	toolTip:"CrossSurface"
	buttonText:"CrossSurface"
	icon:#("Surface_tools",2)
	silentErrors:false
	autoUndoEnabled:true
	(
		FileIn "$userScripts/PixGrinder/CrossSurface.ms"
	)

)

-------------------------------------------------------------------------------
-- PixGrinder.mcr
-- MacroScripts File
-- By Philippe DASSONVILLE ( pixgrinder@gmail.com )
-- 31/05/2016
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(

	macroScript HideByClick
	category:"-- PixGrinder --"
	toolTip:"Hide by Click"
	buttonText:"Hide by Click"
	-- icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Hide_by_click.ms"
	)

	macroScript AutoSavePixGrinder
	category:"-- PixGrinder --"
	toolTip:"AutoSave - PixGrinder"
	buttonText:"AutoSave - PixGrinder"
	icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/AutoSave_PixGrinder.ms"
	)

	macroScript BboxTrueMaker
	category:"-- PixGrinder --"
	toolTip:"Bbox True Maker"
	buttonText:"Bbox True Maker"
	--icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Bbox_TrueMaker.ms"
	)

	macroScript NamesTransfer
	category:"-- PixGrinder --"
	toolTip:"Names Transfert"
	buttonText:"NamesTransfer"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/NamesTransfer.ms"
	)

	macroScript MaterialTransfer
	category:"-- PixGrinder --"
	toolTip:"Material Transfert"
	buttonText:"Material Transfert"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialTransfert.ms"
	)

	macroScript Collapse_Selected
	category:"-- PixGrinder --"
	toolTip:"Collapse Hierarchy on Selection"
	buttonText:"Collapse Selected"
	icon:#("PixGrinder",1)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Collapse.mse"
	)

	macroScript ResetXFormPixGrinder
	category:"-- PixGrinder --"
	toolTip:"ResetXForm on Selection"
	buttonText:"ResetXForm"
	icon:#("PixGrinder",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/ResetXform.mse"
	)

	macroScript Select_Previous_Object
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object"
	buttonText:"Select Previous Object"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Prev.ms"
	)

	macroScript Select_Next_Object
	category:"-- PixGrinder --"
	toolTip:"Select Next Object"
	buttonText:"Select Next Object"
	icon:#("PixGrinder",2)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Next.ms"
	)

	macroScript Duplicator
	category:"-- PixGrinder --"
	toolTip:"Duplicator"
	buttonText:"Duplicator"
	icon:#("PixGrinder",15)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Duplicator_v2.mse"
	)

	macroScript CleanLayers
	category:"-- PixGrinder --"
	toolTip:"Clean Layers"
	buttonText:"Clean Layers"
	icon:#("PixGrinder",8)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CleanLayers_v2.ms"
	)

	macroScript AssignCurrentMaterial
	category:"-- PixGrinder --"
	toolTip:"Assign Current Material"
	buttonText:"Assign Current Material"
	icon:#("PixGrinder",19)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/AssignCurrentMaterial.ms"
	)

	macroScript FaceMode
	category:"-- PixGrinder --"
	toolTip:"FaceMode - PixGrinder"
	buttonText:"FaceMode"
	icon:#("EditMesh",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/FaceMode_v2.ms"
	)

	macroScript ShapeSelectOptimizer
	category:"-- PixGrinder --"
	toolTip:"ShapeSelectOptimizer - PixGrinder"
	buttonText:"ShapeSelectOptimizer"
	icon:#("bip_curve",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ShapeSelectOptimizer_v1.ms"
	)

	macroScript LayersViewToggle
	category:"-- PixGrinder --"
	toolTip:"Layers View Toggle - PixGrinder"
	buttonText:"Layers View Toggle"
	icon:#("AnimLayerToolbar",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_view_Toggle_v2.ms"
	)

	macroScript LayersFreezeToggle
	category:"-- PixGrinder --"
	toolTip:"Layers Freeze Toggle - PixGrinder"
	buttonText:"Layers Freeze Toggle"
	icon:#("TrackViewTools",115)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_freeze_Toggle_v2.ms"
	)

	macroScript CableRetopology
	category:"-- PixGrinder --"
	toolTip:"Cable Retopology - PixGrinder"
	buttonText:"CableRetopology"
	icon:#("Splines",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_Retopology.ms"
	)

	macroScript LocksToggler
	category:"-- PixGrinder --"
	toolTip:"Toggles Transforms locks"
	buttonText:"Animation Locks Toggler"
	icon:#("SnapsControls",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LocksToggler_V1.ms"
	)

	macroScript TrisToQuad
	category:"-- PixGrinder --"
	toolTip:"Triangle To Quads"
	buttonText:"TrisToQuad"
	icon:#("EditMesh",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/polyquad2.ms"
	)

	macroScript PivotCenterPixGrinder
	category:"-- PixGrinder --"
	toolTip:"PivotCenter"
	buttonText:"PivotCenter"
	icon:#("Maintoolbar",33)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Center.ms"
	)

	macroScript PivotPerObject
	category:"-- PixGrinder --"
	toolTip:"PivotPerObject"
	buttonText:"PivotPerObject"
	icon:#("Maintoolbar",31)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_PerObject.ms"
	)

	macroScript PivotExternal
	category:"-- PixGrinder --"
	toolTip:"PivotExternal"
	buttonText:"PivotExternal"
	icon:#("Maintoolbar",35)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_External.ms"
	)

	macroScript WireColorChanger
	category:"-- PixGrinder --"
	toolTip:"Wire Color Changer"
	buttonText:"Wire Color Changer"
	icon:#("Material_Modifiers",3)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/WireColorChanger_v2.ms"
	)

	macroScript PivotAlignator
	category:"-- PixGrinder --"
	toolTip:"Pivot Alignator"
	buttonText:"PivotAlignator"
	icon:#("Helpers",1)
	silentErrors:false
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Alignator.ms"
	)

	macroScript MaterialRemove
	category:"-- PixGrinder --"
	toolTip:"Material Remove"
	buttonText:"Material Remove"
	icon:#("UVWUnwrapOption",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialRemove.ms"
	)

	macroScript SearchByName
	category:"-- PixGrinder --"
	toolTip:"SearchByName"
	buttonText:"Srch"
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/search_by_Name.ms"
	)

	macroScript LayerFromSelection
	category:"-- PixGrinder --"
	toolTip:"Layer Isolate Objects's layer"
	buttonText:"Layer Isolate Objects's layer"
	icon:#("AnimLayerToolbar",4)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LayerShowFromSelec.ms"
	)

	macroScript SymY
	category:"-- PixGrinder --"
	toolTip:"Symmetry on Y"
	buttonText:"Symmetry on Y"
	icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Symmetry_Y.ms"
	)

	macroScript XRefMulti
	category:"-- PixGrinder --"
	toolTip:"Xref multiple max files on the fly !"
	buttonText:"XRefMulti"
	-- icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/XrefScene_multi.ms"
	)

	macroScript BS_CollapseMultiMaterial
	category:"-- PixGrinder --"
	toolTip:"Collapse MultiSubObjects Material"
	buttonText:"Collapse MultiMat"
	icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Blur_CollapseSubObjectMaterial_v1.ms"
	)

	macroScript Reveal_MaxFile
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene in Windows Explorer"
	buttonText:"Reveal Scene..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_Maxfile_In_Explorer.ms"
	)

	macroScript Reveal_BakFolder
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene Backup Folder "
	buttonText:"Reveal Bak Folder..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_BackupFolder_In_Explorer.ms"
	)

	macroScript MaxScript_Help
	category:"-- PixGrinder --"
	toolTip:"MaxScript Help Offline"
	buttonText:"MaxScript Help Offline"
	icon:#("MaxScript",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/MaxScript_Offline_Help.ms"
	)

	macroScript AssetsFinder
	category:"-- PixGrinder --"
	toolTip:"AssetsFinder"
	buttonText:"Search..."
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Assets_Finder.ms"
	)

	macroScript CustAttribTransfer
	category:"-- PixGrinder --"
	toolTip:"Transfer Custom Attribs"
	buttonText:"AttribTransfer"
	--icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CustAttribTransfer.ms"
	)

	macroScript BitmapFuckingUpdate
	category:"-- PixGrinder --"
	toolTip:"Bitmap Force Update !!"
	buttonText:"Bitmap Force Update"
	icon:#("PixGrinder",20)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/BitmapFuckingUpdate.ms"
	)

	macroScript SplineSelectMiddlePoints
	category:"-- PixGrinder --"
	toolTip:"Selects Middle points on a Spline"
	buttonText:"SplinePoints"
	icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/SplineSelectMiddlePoints.ms"
	)

	macroScript RefPlaneAutoRatio
	category:"-- PixGrinder --"
	toolTip:"Adjust Reference plane to its bitmap"
	buttonText:"Ref Plane AutoRatio"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Ref_Plane_AutoRatio.ms"
	)

	macroScript CornerVertex
	category:"-- PixGrinder --"
	toolTip:"Corner"
	buttonText:"Corner"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Corner_Vertex.ms"
	)

	macroScript DoublonFinder
	category:"-- PixGrinder --"
	toolTip:"DoublonFinder"
	buttonText:"DoublonFinder"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Doublon_Finder.ms"
	)

	macroScript UV1Detector
	category:"-- PixGrinder --"
	toolTip:"UV 1 Detector"
	buttonText:"UV 1 Detector"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/UV1_Detector.ms"
	)

	macroScript FullNameDisplay
	category:"-- PixGrinder --"
	toolTip:"Full Name Display"
	buttonText:"Full Name Display"
	icon:#("Splines",5)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/FullNameDisplay.ms"
	)

	macroScript Attach100
	category:"-- PixGrinder --"
	toolTip:"Attach100"
	buttonText:"Attach100"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Attach100.ms"
	)

	macroScript listSelected
	category:"-- PixGrinder --"
	toolTip:"List Selected"
	buttonText:"List Selected"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/listSelected.ms"
	)

	macroScript listHierarchy
	category:"-- PixGrinder --"
	toolTip:"List Hierarchy"
	buttonText:"List Hierarchy"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/List_Hierarchy.ms"
	)

	macroScript listToFile
	category:"-- PixGrinder --"
	toolTip:"List To File"
	buttonText:"ListToFile"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ListSelectedToFile.ms"
	)

	macroScript selectSmallObjects
	category:"-- PixGrinder --"
	toolTip:"Select Small Objects"
	buttonText:"Select Small Objects"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Small_Objects_Select.ms"
	)

	macroScript FindMatFromSlot
	category:"-- PixGrinder --"
	toolTip:"Find Material From Slot"
	buttonText:"FindMatFromSlot"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Material_SlotFinder.ms"
	)

	macroScript SelectByList
	category:"-- PixGrinder --"
	toolTip:"Select by List"
	buttonText:"SelectByList"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_by_List.ms"
	)

	macroScript NormalFlip
	category:"-- PixGrinder --"
	toolTip:"Normals - Quick Flip"
	buttonText:"QuickFlip"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Normals_QuickFlip.ms"
	)

	macroScript CableSplinePreset
	category:"-- PixGrinder --"
	toolTip:"CableSplinePreset"
	buttonText:"CableSplinePreset"
	icon:#("Splines",10)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_SplinePreset.ms"
	)

	macroScript Select_Previous_Object_Zoom
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object Zoom"
	buttonText:"Select Previous Object Zoom"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Prev_Zoomed.ms"
	)

	macroScript Select_Next_Object_Zoom
	category:"-- PixGrinder --"
	toolTip:"Select Next Object Zoom"
	buttonText:"Select Next Object Zoom"
	icon:#("PixGrinder",2)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/Select_Next_Zoomed.ms"
	)

)


remove unused AlembicCamera Maxscript modifier.

plugin modifier AlembicCameraModifier
	name:"Alembic Camera Modifier"
	classID:#(0x20730624, 0x3d650bdb)	-- keep in sync with AlembicNames.h
	category:"Alembic"
	version:1
	extends:AlembicCameraBaseModifier
	replaceUI:true
	invisible:false
(
	parameters pblock rollout:params
	(
		path type:#filename ui:path default:""
		identifier type:#string ui:identifier default:""
		currentTimeHidden type:#float default:0
		timeOffset type:#float ui:timeOffset animatable:true default:0
		timeScale type:#float ui:timeScale animatable:true default:1
		--muted type:#boolean ui:muted animatable:true default:false

		on path set val do delegate.path = val
		on identifier set val do delegate.identifier = val
		on currentTimeHidden set val do delegate.currentTimeHidden = val
		on timeOffset set val do delegate.timeOffset = val
		on timeScale set val do delegate.timeScale = val
		--on muted set val do delegate.muted = val
	)

	rollout params "Alembic"
	(
		edittext path "Path"
		edittext identifier "Identifier"
		spinner timeOffset "Time Offset" range:[-10000,10000,0]
		spinner timeScale "Time Scale" range:[-10000,10000,0]
		-- checkbox muted "Muted"
	)

	local update_currentTimeHidden_registered = false

	fn update_currentTimeHidden =
	(
		if( not update_currentTimeHidden_registered ) do
		(
			registerTimeCallback update_currentTimeHidden
			update_currentTimeHidden_registered = true
		)
		currentTimeHidden = currentTime / frameRate
		delegate.currentTimeHidden = currentTimeHidden
	)

	on create do
	(
		update_currentTimeHidden()
	)
	on load do
	(
		update_currentTimeHidden()
	)
	on update do
	(
		update_currentTimeHidden()
	)
)


forgotten commit.

forgotten commit.

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

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

	GroupBox geoGroup "Geometry" pos:[8,8] width:272 height:104
	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:true

	button importButton "Import" pos:[16,200] width:64 height:24
	button cancelButton "Cancel" pos:[208,200] 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

	on importButton pressed do
	(
	    result = ExocortexAlembic.import filename normalCheckbox.checked uvCheckbox.checked false attachCheckbox.checked dropDownVis.selection
        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:"Exocortex"
    buttonText:"Alembic Import..."
    tooltip:"Alembic Import..."
(
    on execute do
    (
        alembicImportDialog()
    )
)

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

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

	GroupBox geoGroup "Geometry" pos:[8,8] width:272 height:104
	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:true

	button importButton "Import" pos:[16,200] width:64 height:24
	button cancelButton "Cancel" pos:[208,200] 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

	on importButton pressed do
	(
	    result = ExocortexAlembic.import filename normalCheckbox.checked uvCheckbox.checked false attachCheckbox.checked dropDownVis.selection
        if( result != 0 ) do
        (
        	messageBox "See Maxscript Listener for Details of Failure" title:"Exocortex Alembic Export Failed"
        )
		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:"Exocortex"
    buttonText:"Alembic Import..."
    tooltip:"Alembic Import..."
(
    on execute do
    (
        alembicImportDialog()
    )
)


connected up the new time control parameters, not tested much yet (Issue #429)

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

        timeOut type:#float ui:uiTimeOut 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]
        spinner factor "Time Scale" range:[-10000,10000,1]

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

        spinner uiTimeOut "Time Out" 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"

        timeOut.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 + ")"
        )

        timeOut.controller.SetExpression str
        timeOut.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

        timeOut type:#float ui:uiTimeOut 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]
        spinner factor "Time Scale" range:[-10000,10000,1]

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

        spinner uiTimeOut "Time Out" 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"

        timeOut.controller = float_expression()
        ctrl = timeOut.controller

        str = "S * " + (factor as string) + " + " + (offset as string)

        ctrl.SetExpression str
        ctrl.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
        )

    )
)


Run writeTransform on each node, not on the node set itself.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4030 542714f4-19e9-0310-aa3c-eee0fc999fb1

--
-- $Id$
--
-- Narya library - tools for developing networked games
-- Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
-- http://www.threerings.net/code/narya/
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

macroScript TRAnimationExporter category:"File" \
    buttonText:"Export Animation as XML..." toolTip:"Export Animation as XML" (

    -- Writes a point3-valued attribute to the file
	fn writePoint3Attr attr p outFile =
	(
		format "%=\"%, %, %\"" attr p.x p.y p.z to:outFile
	)

	-- Writes a quat-valued attribute to the file
	fn writeQuatAttr attr q outFile =
	(
		format "%=\"%, %, %, %\"" attr q.x q.y q.z q.w to:outFile
	)

    -- Writes a single node transform
    fn writeTransform node outFile = (
        format "    <transform name=\"%\"" node.name to:outFile
        xform = node.transform
        if node.parent != undefined do (
            xform = xform * (inverse node.parent.transform)
        )
        writePoint3Attr " translation" xform.translationPart outFile
        writeQuatAttr " rotation" (inverse xform.rotationPart) outFile
        writePoint3Attr " scale" xform.scalePart outFile
        format "/>\n" to:outFile
    )

    -- Writes a single animation frame
    fn writeFrame nodes outFile = (
        format "  <frame>\n" to:outFile
        for node in nodes do (
            writeTransform node outFile
        )
	    format "  </frame>\n\n" to:outFile
    )

    -- Writes animation to the named file
	fn writeAnimation fileName =
	(
		outFile = createfile fileName
		format "<?xml version=\"1.0\" standalone=\"yes\"?>\n\n" to:outFile
    	format "<animation frameRate=\"%\">\n\n" frameRate to:outFile
	    local nodes
    	if selection.count > 0 then (
        	nodes = selection
	    ) else (
    	    nodes = objects
	    )
	    for i = animationRange.start to animationRange.end do at time i (
	        writeFrame nodes outFile
	    )
	    format "</animation>\n" to:outFile
	    close outFile
	)

    --
    -- Main entry point
    --

    -- Get the target filename
    persistent global xmlAnimFileName
	local fileName
	if (xmlAnimFileName == undefined) then (
		fileName = maxFilePath + (getFilenameFile maxFileName) + ".xml"
	) else (
		fileName = xmlAnimFileName
	)
    fileName = getSaveFileName caption:"Select File to Export" \
		filename:fileName types:"XML Animations (*.XML)|*.xml|All|*.*"
    if fileName != undefined do (
		xmlAnimFileName = fileName
		writeAnimation fileName
	)
)

--
-- $Id$
--
-- Narya library - tools for developing networked games
-- Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
-- http://www.threerings.net/code/narya/
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

macroScript TRAnimationExporter category:"File" \
    buttonText:"Export Animation as XML..." toolTip:"Export Animation as XML" (

    -- Writes a point3-valued attribute to the file
	fn writePoint3Attr attr p outFile =
	(
		format "%=\"%, %, %\"" attr p.x p.y p.z to:outFile
	)

	-- Writes a quat-valued attribute to the file
	fn writeQuatAttr attr q outFile =
	(
		format "%=\"%, %, %, %\"" attr q.x q.y q.z q.w to:outFile
	)

    -- Writes a single node transform
    fn writeTransform node outFile = (
        format "    <transform name=\"%\"" node.name to:outFile
        xform = node.transform
        if node.parent != undefined do (
            xform = xform * (inverse node.parent.transform)
        )
        writePoint3Attr " translation" xform.translationPart outFile
        writeQuatAttr " rotation" (inverse xform.rotationPart) outFile
        writePoint3Attr " scale" xform.scalePart outFile
        format "/>\n" to:outFile
    )

    -- Writes a single animation frame
    fn writeFrame nodes outFile = (
        format "  <frame>\n" to:outFile
        writeTransform node outFile
	    format "  </frame>\n\n" to:outFile
    )

    -- Writes animation to the named file
	fn writeAnimation fileName =
	(
		outFile = createfile fileName
		format "<?xml version=\"1.0\" standalone=\"yes\"?>\n\n" to:outFile
    	format "<animation frameRate=\"%\">\n\n" frameRate to:outFile
	    local nodes
    	if selection.count > 0 then (
        	nodes = selection
	    ) else (
    	    nodes = objects
	    )
	    for i = animationRange.start to animationRange.end do at time i (
	        writeFrame nodes outFile
	    )
	    format "</animation>\n" to:outFile
	    close outFile
	)

    --
    -- Main entry point
    --

    -- Get the target filename
    persistent global xmlAnimFileName
	local fileName
	if (xmlAnimFileName == undefined) then (
		fileName = maxFilePath + (getFilenameFile maxFileName) + ".xml"
	) else (
		fileName = xmlAnimFileName
	)
    fileName = getSaveFileName caption:"Select File to Export" \
		filename:fileName types:"XML Animations (*.XML)|*.xml|All|*.*"
    if fileName != undefined do (
		xmlAnimFileName = fileName
		writeAnimation fileName
	)
)


"Include" replaced by "FileIn" for AutoSave Script

-------------------------------------------------------------------------------
-- PixGrinder.mcr
-- MacroScripts File
-- By Philippe DASSONVILLE ( pixgrinder@gmail.com )
-- 05/04/2016
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(

	macroScript AutoSavePixGrinder
	category:"-- PixGrinder --"
	toolTip:"AutoSave - PixGrinder"
	buttonText:"AutoSave - PixGrinder"
	icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		FileIn "$userScripts/PixGrinder/AutoSave_PixGrinder.ms"
	)

	macroScript BboxTrueMaker
	category:"-- PixGrinder --"
	toolTip:"Bbox True Maker"
	buttonText:"Bbox True Maker"
	--icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Bbox_TrueMaker.ms"
	)

	macroScript NamesTransfer
	category:"-- PixGrinder --"
	toolTip:"Names Transfert"
	buttonText:"NamesTransfer"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/NamesTransfer.ms"
	)

	macroScript Collapse_Selected
	category:"-- PixGrinder --"
	toolTip:"Collapse Hierarchy on Selection"
	buttonText:"Collapse Selected"
	icon:#("PixGrinder",1)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Collapse.mse"
	)

	macroScript ResetXForm
	category:"-- PixGrinder --"
	toolTip:"ResetXForm on Selection"
	buttonText:"ResetXForm"
	icon:#("PixGrinder",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/ResetXform.mse"
	)

	macroScript Select_Previous_Object
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object"
	buttonText:"Select Previous Object"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_Prev_v6.ms"
	)

	macroScript Select_Next_Object
	category:"-- PixGrinder --"
	toolTip:"Select Next Object"
	buttonText:"Select Next Object"
	icon:#("PixGrinder",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_Next_v6.ms"
	)

	macroScript Duplicator
	category:"-- PixGrinder --"
	toolTip:"Duplicator"
	buttonText:"Duplicator"
	icon:#("PixGrinder",15)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Duplicator_v2.mse"
	)

	macroScript Select_Hierarcy
	category:"-- PixGrinder --"
	toolTip:"Select Hierarchy"
	buttonText:"Select Hierarchy"
	icon:#("PixGrinder",16)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Select_Hierarchy.mse"
	)

	macroScript Rotation_Activator
	category:"-- PixGrinder --"
	toolTip:"Rotation_Activator"
	buttonText:"Rotation_Activator"
	icon:#("FileLinkActionItems",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Rotation_Activator.mse"
	)

	macroScript CleanLayers
	category:"-- PixGrinder --"
	toolTip:"Clean Layers"
	buttonText:"Clean Layers"
	icon:#("PixGrinder",8)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CleanLayers_v2.ms"
	)

	macroScript AssignCurrentMaterial
	category:"-- PixGrinder --"
	toolTip:"Assign Current Material"
	buttonText:"Assign Current Material"
	icon:#("PixGrinder",19)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/AssignCurrentMaterial.ms"
	)

	macroScript FaceMode
	category:"-- PixGrinder --"
	toolTip:"FaceMode - PixGrinder"
	buttonText:"FaceMode"
	icon:#("EditMesh",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/FaceMode_v2.ms"
	)

	macroScript ShapeSelectOptimizer
	category:"-- PixGrinder --"
	toolTip:"ShapeSelectOptimizer - PixGrinder"
	buttonText:"ShapeSelectOptimizer"
	icon:#("bip_curve",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ShapeSelectOptimizer_v1.ms"
	)

	macroScript LayersViewToggle
	category:"-- PixGrinder --"
	toolTip:"Layers View Toggle - PixGrinder"
	buttonText:"Layers View Toggle"
	icon:#("AnimLayerToolbar",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_view_Toggle_v2.ms"
	)

	macroScript LayersFreezeToggle
	category:"-- PixGrinder --"
	toolTip:"Layers Freeze Toggle - PixGrinder"
	buttonText:"Layers Freeze Toggle"
	icon:#("TrackViewTools",115)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_freeze_Toggle_v2.ms"
	)

	macroScript CableRetopology
	category:"-- PixGrinder --"
	toolTip:"Cable Retopology - PixGrinder"
	buttonText:"CableRetopology"
	icon:#("Splines",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_Retopology.ms"
	)

	macroScript LocksToggler
	category:"-- PixGrinder --"
	toolTip:"Toggles Transforms locks"
	buttonText:"Animation Locks Toggler"
	icon:#("SnapsControls",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LocksToggler_V1.ms"
	)

	macroScript TrisToQuad
	category:"-- PixGrinder --"
	toolTip:"Triangle To Quads"
	buttonText:"TrisToQuad"
	icon:#("EditMesh",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/polyquad2.ms"
	)

	macroScript PivotCenter
	category:"-- PixGrinder --"
	toolTip:"PivotCenter"
	buttonText:"PivotCenter"
	icon:#("Maintoolbar",33)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Center.ms"
	)

	macroScript PivotPerObject
	category:"-- PixGrinder --"
	toolTip:"PivotPerObject"
	buttonText:"PivotPerObject"
	icon:#("Maintoolbar",31)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_PerObject.ms"
	)

	macroScript PivotExternal
	category:"-- PixGrinder --"
	toolTip:"PivotExternal"
	buttonText:"PivotExternal"
	icon:#("Maintoolbar",35)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_External.ms"
	)

	macroScript WireColorChanger
	category:"-- PixGrinder --"
	toolTip:"Wire Color Changer"
	buttonText:"Wire Color Changer"
	icon:#("Material_Modifiers",3)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/WireColorChanger_v2.ms"
	)

	macroScript PivotAlignator
	category:"-- PixGrinder --"
	toolTip:"Pivot Alignator"
	buttonText:"PivotAlignator"
	icon:#("Helpers",1)
	silentErrors:false
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Alignator_V3.ms"
	)

	macroScript MaterialRemove
	category:"-- PixGrinder --"
	toolTip:"Material Remove"
	buttonText:"Material Remove"
	icon:#("UVWUnwrapOption",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialRemove.ms"
	)

	macroScript SearchByName
	category:"-- PixGrinder --"
	toolTip:"SearchByName"
	buttonText:"Srch"
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/search_by_Name.ms"
	)

	macroScript LayerFromSelection
	category:"-- PixGrinder --"
	toolTip:"Layer Isolate Objects's layer"
	buttonText:"Layer Isolate Objects's layer"
	icon:#("AnimLayerToolbar",4)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LayerShowFromSelec.ms"
	)

	macroScript SymY
	category:"-- PixGrinder --"
	toolTip:"Symmetry on Y"
	buttonText:"Symmetry on Y"
	icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Symmetry_Y.ms"
	)

	macroScript XRefMulti
	category:"-- PixGrinder --"
	toolTip:"Xref multiple max files on the fly !"
	buttonText:"XRefMulti"
	-- icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/XrefScene_multi.ms"
	)

	macroScript BS_CollapseMultiMaterial
	category:"-- PixGrinder --"
	toolTip:"Collapse MultiSubObjects Material"
	buttonText:"Collapse MultiMat"
	icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Blur_CollapseSubObjectMaterial_v1.ms"
	)

	macroScript Reveal_MaxFile
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene in Windows Explorer"
	buttonText:"Reveal Scene..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_Maxfile_In_Explorer.ms"
	)

	macroScript MaxScript_Help
	category:"-- PixGrinder --"
	toolTip:"MaxScript Help Offline"
	buttonText:"MaxScript Help Offline"
	icon:#("MaxScript",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/MaxScript_Offline_Help.ms"
	)

	macroScript AssetsFinder
	category:"-- PixGrinder --"
	toolTip:"AssetsFinder"
	buttonText:"Search..."
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Assets_Finder.ms"
	)

	macroScript CustAttribTransfer
	category:"-- PixGrinder --"
	toolTip:"Transfer Custom Attribs"
	buttonText:"AttribTransfer"
	--icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CustAttribTransfer.ms"
	)

	macroScript BitmapFuckingUpdate
	category:"-- PixGrinder --"
	toolTip:"Bitmap Force Update !!"
	buttonText:"Bitmap Force Update"
	icon:#("PixGrinder",20)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/BitmapFuckingUpdate.ms"
	)

	macroScript SplineSelectMiddlePoints
	category:"-- PixGrinder --"
	toolTip:"Selects Middle points on a Spline"
	buttonText:"SplinePoints"
	icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/SplineSelectMiddlePoints.ms"
	)

	macroScript RefPlaneAutoRatio
	category:"-- PixGrinder --"
	toolTip:"Adjust Reference plane to its bitmap"
	buttonText:"Ref Plane AutoRatio"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Ref_Plane_AutoRatio.ms"
	)

	macroScript SelectSmallObjects
	category:"-- PixGrinder --"
	toolTip:"Select small objects"
	buttonText:"Select small objects"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Select_Small_Objects.ms"
	)

	macroScript CornerVertex
	category:"-- PixGrinder --"
	toolTip:"Corner"
	buttonText:"Corner"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Corner_Vertex.ms"
	)

	macroScript DoublonFinder
	category:"-- PixGrinder --"
	toolTip:"DoublonFinder"
	buttonText:"DoublonFinder"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Doublon_Finder.ms"
	)

	macroScript UV1Detector
	category:"-- PixGrinder --"
	toolTip:"UV 1 Detector"
	buttonText:"UV 1 Detector"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/UV1_Detector.ms"
	)

	macroScript FullNameDisplay
	category:"-- PixGrinder --"
	toolTip:"Full Name Display"
	buttonText:"Full Name Display"
	icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/FullNameDisplay.ms"
	)

	macroScript Attach100
	category:"-- PixGrinder --"
	toolTip:"Attach100"
	buttonText:"Attach100"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Attach100.ms"
	)

	macroScript listSelected
	category:"-- PixGrinder --"
	toolTip:"List Selected"
	buttonText:"List Selected"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/listSelected.ms"
	)

)

-------------------------------------------------------------------------------
-- PixGrinder.mcr
-- MacroScripts File
-- By Philippe DASSONVILLE ( pixgrinder@gmail.com )
-- 05/04/2016
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(

	macroScript AutoSavePixGrinder
	category:"-- PixGrinder --"
	toolTip:"AutoSave - PixGrinder"
	buttonText:"AutoSave - PixGrinder"
	icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/AutoSave_PixGrinder.ms"
	)

	macroScript BboxTrueMaker
	category:"-- PixGrinder --"
	toolTip:"Bbox True Maker"
	buttonText:"Bbox True Maker"
	--icon:#("FileLinkActionItems",9)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Bbox_TrueMaker.ms"
	)

	macroScript NamesTransfer
	category:"-- PixGrinder --"
	toolTip:"Names Transfert"
	buttonText:"NamesTransfer"
	--icon:#("FileLinkActionItems",9)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/NamesTransfer.ms"
	)

	macroScript Collapse_Selected
	category:"-- PixGrinder --"
	toolTip:"Collapse Hierarchy on Selection"
	buttonText:"Collapse Selected"
	icon:#("PixGrinder",1)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Collapse.mse"
	)

	macroScript ResetXForm
	category:"-- PixGrinder --"
	toolTip:"ResetXForm on Selection"
	buttonText:"ResetXForm"
	icon:#("PixGrinder",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/ResetXform.mse"
	)

	macroScript Select_Previous_Object
	category:"-- PixGrinder --"
	toolTip:"Select Previous Object"
	buttonText:"Select Previous Object"
	icon:#("PixGrinder",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_Prev_v6.ms"
	)

	macroScript Select_Next_Object
	category:"-- PixGrinder --"
	toolTip:"Select Next Object"
	buttonText:"Select Next Object"
	icon:#("PixGrinder",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Select_Next_v6.ms"
	)

	macroScript Duplicator
	category:"-- PixGrinder --"
	toolTip:"Duplicator"
	buttonText:"Duplicator"
	icon:#("PixGrinder",15)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Duplicator_v2.mse"
	)

	macroScript Select_Hierarcy
	category:"-- PixGrinder --"
	toolTip:"Select Hierarchy"
	buttonText:"Select Hierarchy"
	icon:#("PixGrinder",16)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Select_Hierarchy.mse"
	)

	macroScript Rotation_Activator
	category:"-- PixGrinder --"
	toolTip:"Rotation_Activator"
	buttonText:"Rotation_Activator"
	icon:#("FileLinkActionItems",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Rotation_Activator.mse"
	)

	macroScript CleanLayers
	category:"-- PixGrinder --"
	toolTip:"Clean Layers"
	buttonText:"Clean Layers"
	icon:#("PixGrinder",8)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CleanLayers_v2.ms"
	)

	macroScript AssignCurrentMaterial
	category:"-- PixGrinder --"
	toolTip:"Assign Current Material"
	buttonText:"Assign Current Material"
	icon:#("PixGrinder",19)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/AssignCurrentMaterial.ms"
	)

	macroScript FaceMode
	category:"-- PixGrinder --"
	toolTip:"FaceMode - PixGrinder"
	buttonText:"FaceMode"
	icon:#("EditMesh",4)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/FaceMode_v2.ms"
	)

	macroScript ShapeSelectOptimizer
	category:"-- PixGrinder --"
	toolTip:"ShapeSelectOptimizer - PixGrinder"
	buttonText:"ShapeSelectOptimizer"
	icon:#("bip_curve",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/ShapeSelectOptimizer_v1.ms"
	)

	macroScript LayersViewToggle
	category:"-- PixGrinder --"
	toolTip:"Layers View Toggle - PixGrinder"
	buttonText:"Layers View Toggle"
	icon:#("AnimLayerToolbar",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_view_Toggle_v2.ms"
	)

	macroScript LayersFreezeToggle
	category:"-- PixGrinder --"
	toolTip:"Layers Freeze Toggle - PixGrinder"
	buttonText:"Layers Freeze Toggle"
	icon:#("TrackViewTools",115)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Layers_freeze_Toggle_v2.ms"
	)

	macroScript CableRetopology
	category:"-- PixGrinder --"
	toolTip:"Cable Retopology - PixGrinder"
	buttonText:"CableRetopology"
	icon:#("Splines",11)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Cable_Retopology.ms"
	)

	macroScript LocksToggler
	category:"-- PixGrinder --"
	toolTip:"Toggles Transforms locks"
	buttonText:"Animation Locks Toggler"
	icon:#("SnapsControls",1)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LocksToggler_V1.ms"
	)

	macroScript TrisToQuad
	category:"-- PixGrinder --"
	toolTip:"Triangle To Quads"
	buttonText:"TrisToQuad"
	icon:#("EditMesh",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/polyquad2.ms"
	)

	macroScript PivotCenter
	category:"-- PixGrinder --"
	toolTip:"PivotCenter"
	buttonText:"PivotCenter"
	icon:#("Maintoolbar",33)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Center.ms"
	)

	macroScript PivotPerObject
	category:"-- PixGrinder --"
	toolTip:"PivotPerObject"
	buttonText:"PivotPerObject"
	icon:#("Maintoolbar",31)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_PerObject.ms"
	)

	macroScript PivotExternal
	category:"-- PixGrinder --"
	toolTip:"PivotExternal"
	buttonText:"PivotExternal"
	icon:#("Maintoolbar",35)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_External.ms"
	)

	macroScript WireColorChanger
	category:"-- PixGrinder --"
	toolTip:"Wire Color Changer"
	buttonText:"Wire Color Changer"
	icon:#("Material_Modifiers",3)
	silentErrors:false
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/WireColorChanger_v2.ms"
	)

	macroScript PivotAlignator
	category:"-- PixGrinder --"
	toolTip:"Pivot Alignator"
	buttonText:"PivotAlignator"
	icon:#("Helpers",1)
	silentErrors:false
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Pivot_Alignator_V3.ms"
	)

	macroScript MaterialRemove
	category:"-- PixGrinder --"
	toolTip:"Material Remove"
	buttonText:"Material Remove"
	icon:#("UVWUnwrapOption",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/MaterialRemove.ms"
	)

	macroScript SearchByName
	category:"-- PixGrinder --"
	toolTip:"SearchByName"
	buttonText:"Srch"
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/search_by_Name.ms"
	)

	macroScript LayerFromSelection
	category:"-- PixGrinder --"
	toolTip:"Layer Isolate Objects's layer"
	buttonText:"Layer Isolate Objects's layer"
	icon:#("AnimLayerToolbar",4)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/LayerShowFromSelec.ms"
	)

	macroScript SymY
	category:"-- PixGrinder --"
	toolTip:"Symmetry on Y"
	buttonText:"Symmetry on Y"
	icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Symmetry_Y.ms"
	)

	macroScript XRefMulti
	category:"-- PixGrinder --"
	toolTip:"Xref multiple max files on the fly !"
	buttonText:"XRefMulti"
	-- icon:#("UVWUnwrapTools",42)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/XrefScene_multi.ms"
	)

	macroScript BS_CollapseMultiMaterial
	category:"-- PixGrinder --"
	toolTip:"Collapse MultiSubObjects Material"
	buttonText:"Collapse MultiMat"
	icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Blur_CollapseSubObjectMaterial_v1.ms"
	)

	macroScript Reveal_MaxFile
	category:"-- PixGrinder --"
	toolTip:"Reveal Current Scene in Windows Explorer"
	buttonText:"Reveal Scene..."
	--icon:#("BlurScripts",51)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Reveal_Maxfile_In_Explorer.ms"
	)

	macroScript MaxScript_Help
	category:"-- PixGrinder --"
	toolTip:"MaxScript Help Offline"
	buttonText:"MaxScript Help Offline"
	icon:#("MaxScript",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/MaxScript_Offline_Help.ms"
	)

	macroScript AssetsFinder
	category:"-- PixGrinder --"
	toolTip:"AssetsFinder"
	buttonText:"Search..."
	icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Assets_Finder.ms"
	)

	macroScript CustAttribTransfer
	category:"-- PixGrinder --"
	toolTip:"Transfer Custom Attribs"
	buttonText:"AttribTransfer"
	--icon:#("Maxscript",2)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/CustAttribTransfer.ms"
	)

	macroScript BitmapFuckingUpdate
	category:"-- PixGrinder --"
	toolTip:"Bitmap Force Update !!"
	buttonText:"Bitmap Force Update"
	icon:#("PixGrinder",20)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/BitmapFuckingUpdate.ms"
	)

	macroScript SplineSelectMiddlePoints
	category:"-- PixGrinder --"
	toolTip:"Selects Middle points on a Spline"
	buttonText:"SplinePoints"
	icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/SplineSelectMiddlePoints.ms"
	)

	macroScript RefPlaneAutoRatio
	category:"-- PixGrinder --"
	toolTip:"Adjust Reference plane to its bitmap"
	buttonText:"Ref Plane AutoRatio"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Ref_Plane_AutoRatio.ms"
	)

	macroScript SelectSmallObjects
	category:"-- PixGrinder --"
	toolTip:"Select small objects"
	buttonText:"Select small objects"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Select_Small_Objects.ms"
	)

	macroScript CornerVertex
	category:"-- PixGrinder --"
	toolTip:"Corner"
	buttonText:"Corner"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:true
	(
		Include "$userScripts/PixGrinder/Corner_Vertex.ms"
	)

	macroScript DoublonFinder
	category:"-- PixGrinder --"
	toolTip:"DoublonFinder"
	buttonText:"DoublonFinder"
	-- icon:#("Splines",3)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Doublon_Finder.ms"
	)

	macroScript UV1Detector
	category:"-- PixGrinder --"
	toolTip:"UV 1 Detector"
	buttonText:"UV 1 Detector"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/UV1_Detector.ms"
	)

	macroScript FullNameDisplay
	category:"-- PixGrinder --"
	toolTip:"Full Name Display"
	buttonText:"Full Name Display"
	icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/FullNameDisplay.ms"
	)

	macroScript Attach100
	category:"-- PixGrinder --"
	toolTip:"Attach100"
	buttonText:"Attach100"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/Attach100.ms"
	)

	macroScript listSelected
	category:"-- PixGrinder --"
	toolTip:"List Selected"
	buttonText:"List Selected"
	-- icon:#("Splines",5)
	silentErrors:true
	autoUndoEnabled:false
	(
		Include "$userScripts/PixGrinder/listSelected.ms"
	)

)