---------------------------------------------------------------
--
-- PteroTools
--
-- by Pan Collette
--
-- Create: 13.01.2003
-- Modified: 29.12.2003
--
-- MODIFY THIS AT YOUR OWN RISK 
--
---------------------------------------------------------------

-----------------------------------------------
-- PteroProps MacroScript
-----------------------------------------------
macroScript PteroProps
            category:"PteroTools" 
            tooltip:"Open PteroProps Panel" 
            buttontext:"PteroProps Panel"
			icon:#("pteroTools", 2)
(
	on execute do fnCreatePteroProps()
	on isChecked return _isPteroPropsOpen
)

-----------------------------------------------
-- FindSpikeFaces MacroScript
-----------------------------------------------
macroScript FindSpikeFaces
            category:"PteroTools" 
            tooltip:"Find Spike Faces" 
            buttontext:"Find Spike Faces"
			icon:#("pteroTools", 3)
(
	fnFindSpikeFaces()
)

-----------------------------------------------
-- PteroColMatList MacroScript
-----------------------------------------------
macroScript PteroColMatList
            category:"PteroTools" 
            tooltip:"Show Surface Materials List" 
            buttontext:"Surface Materials List"
			icon:#("pteroTools", 4)
(
	on execute do fnColMatList()
	on isChecked return _isColMatListOpen
)

-----------------------------------------------
-- PrintMappingToBitmap MacroScript
-----------------------------------------------
macroScript PrintMappingToBitmap
            category:"PteroTools" 
            tooltip:"Print Mapping To Bitmap" 
            buttontext:"Print Mapping"
			icon:#("pteroTools", 6)
(
	on execute do fnPrintMappingToBitmap()
	on isChecked return PrintMappingToBitmap
)

-----------------------------------------------
-- CreateBBox MacroScript
-----------------------------------------------
macroScript PteroColMatList
            category:"PteroTools" 
            tooltip:"Create Bounding Box for Selection" 
            buttontext:"Create BBox"
			icon:#("pteroTools", 7)
(
	on execute do fnOpenCreateBBoxDialog()
	on isChecked return createBBoxDialog
)

-----------------------------------------------
-- BES Info MacroScript
-----------------------------------------------
macroScript PteroBesInfo
            category:"PteroTools" 
            tooltip:"BES Info Dialog" 
            buttontext:"BES Info"
			icon:#("pteroTools", 8)
(
	rollout besInfoDialog "BES Info Dialog" width:260 height:500
	(
		editText edt1 "" pos:[0,4] width:254 height:492
		
		on besInfoDialog open do (
			edt1.text = fnCreateBesInfo()
		)
	)
	createDialog besInfoDialog modal:true
)

-----------------------------------------------
-- ShowLODs MacroScript
-----------------------------------------------
macroScript ShowLODs
            category:"PteroTools" 
            tooltip:"Show LODs in Viewport" 
            buttontext:"Show LODs"
			icon:#("pteroTools", 9)
(
	on execute do
		if lodNodesVis == undefined then (
			global lodNodesVis = fnGetNodesVisibility()
			callbacks.addScript #viewportChange "fnDoLod()" id:#pteroChangeLOD
			registerRedrawViewsCallback fnLodText
			completeRedraw()
		) else (
			fnSetNodesVisibility lodNodesVis
			lodNodesVis = undefined
			callbacks.removeScripts id:#pteroChangeLOD
			unregisterRedrawViewsCallback fnLodText
			completeRedraw()
		)
	on isChecked return if lodNodesVis == undefined then false else true
)

-----------------------------------------------
-- MeasureDistance MacroScript
-----------------------------------------------
macroScript MeasureDistance
            category:"PteroTools" 
            tooltip:"Measure Distance" 
            buttontext:"Measure Distance"
			icon:#("pteroTools", 10)
(
	on execute do (
		if isMeasureActive != true then (
			isMeasureActive = true
			format "Distance = %\n" (startTool mtMeasureDistance)
			isMeasureActive = false
		) else (
			stopTool mtMeasureDistance
			isMeasureActive = false
		)
		updateToolbarButtons()
	)
	on isChecked return isMeasureActive
)

-----------------------------------------------
-- Unassign Material From Selection MacroScript
-----------------------------------------------
macroScript UnassignMaterial
            category:"PteroTools" 
            tooltip:"Unassign Material From Selection" 
            buttontext:"Unassign Material"
			icon:#("pteroTools", 11)
(
	if selection.count > 0 do $.material = undefined
)

-----------------------------------------------
-- MeasureDistance MacroScript
-----------------------------------------------
macroScript ReplaceSelection
            category:"PteroTools" 
            tooltip:"Clone Tool: Replace Selection" 
            buttontext:"Replace Selection"
			icon:#("pteroTools", 12)
(
	on execute do fnReplaceSelectionByObject()
	on isChecked return isReplaceSelectionActive
)

-- EOF