//***************************************************
// A Digit's Widget - Zbrush Zscript
// Animation Widget
// 3D Animation Functions
// Version 3.1 - 09/12/01 * Fixed Frame Problem and added automatic filename for Export Frame Function
//***************************************************
<zscriptinsert,"Digit_Widgets_Common.txt">
[PD]
[FontSetColor,255,200,0]Animation Functions[FontSetColor,160,160,160]
[PD]
[VarDef,ptr,0]
[VarDef,doSave,0]
[VarDef,Look,0]
//object data
[VarDef,type(10)]
[VarDef,Active(10)]
[VarDef,mat(10)]
[VarDef,mode(10)]
[VarDef,px(10)]
[VarDef,py(10)]
[VarDef,pz(10)]
[VarDef,pxs(10)]
[VarDef,pys(10)]
[VarDef,pzs(10)]
[VarDef,pxr(10)]
[VarDef,pyr(10)]
[VarDef,pzr(10)]
[VarDef,epx(10)]
[VarDef,epy(10)]
[VarDef,epz(10)]
[VarDef,epxs(10)]
[VarDef,epys(10)]
[VarDef,epzs(10)]
[VarDef,epxr(10)]
[VarDef,epyr(10)]
[VarDef,epzr(10)]
[VarDef,pr(10)]
[VarDef,pg(10)]
[VarDef,pb(10)]
[VarDef,timeincr,0]
[VarDef,crecurse,0]
[VarDef,RepeatCount,10]
[VarDef,resultx,0]
[VarDef,resulty,0]
[VarDef,resultz,0]
[VarDef,resultxs,0]
[VarDef,resultys,0]
[VarDef,resultzs,0]
[VarDef,resultxr,0]
[VarDef,resultyr,0]
[VarDef,resultzr,0]
[VarDef,which,0]
[VarDef,Frame,0]
[VarDef,Pick,-1]
[VarDef,swaptmp,0]
//***************************
//Curve Point
//***************************
[VarDef,pointX(5)]
[VarDef,pointY(5)]
[VarDef,pointZ(5)]
[VarDef,pointXS(5)]
[VarDef,pointYS(5)]
[VarDef,pointZS(5)]
[VarDef,pointXR(5)]
[VarDef,pointYR(5)]
[VarDef,pointZR(5)]
[ISlider,"Max Number of Frames           ",10,1,1,360,"Number of Frames",
	[VarSet,RepeatCount,ZScript:MaxNumberofFrames]
	[ISetMax,zscript:SelectFrame,RepeatCount]
,0,[TextCalcWidth,SelectMark12322222233333333333333]]

[ISwitch,"Best Render",0,"Select Best Render"]

[PD]
[ISwitch,"Sel_1",0,"Select"]
[iSwitch,"Curve_1",0,"1 Point Spline Interpolate",
	[VarSet,ptr,0]
	[ISetStatus,zscript:LoadPoint_1,1]
	[IEnable,zscript:Move_1]
	[VarSet,mode(ptr),1]
]
[iButton," LoadPoint_1 ","Load Current Object Position to use as Spline Point in Curve",
	[VarSet,ptr,0]
	[TransformGet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]//End Load Point 1

[iButton," Move_1 ","Load Current Object Position to LoadPoint_1",
	[VarSet,ptr,0]
	[TransformSet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]

[iButton," GetStart1","Get Starting Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,0]
	[VarSet,which,0]
	[if,[IGet,zscript:Curve_1],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_1,0]
		[IDisable,zscript:Move_1]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_1],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_1]
	]
]
[iButton," GetEnd1","Get Ending Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,0]
	[VarSet,which,1]
	[if,[IGet,zscript:Curve_1],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_1,0]
		[IDisable,zscript:Move_1]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_1],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_1]
	]
]
[iButton," Recall Start_1","doodah",
	[VarSet,ptr,0]
	[if,[IGet,zscript:Sel_1],
		//If you don't have an object selected pull the recorded object
		// This allows you to select another object and set it to this objects place
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
		]
		[TransformSet,px(ptr),py(ptr),pz(ptr),pxs(ptr),pys(ptr),pzs(ptr),pxr(ptr),pyr(ptr),pzr(ptr)]
	]
]
[iButton," Recall End_1","doodah",
	[VarSet,ptr,0]
	[if,[IGet,zscript:Sel_1],
		//If you don't have an object selected pull the recorded object
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
		]
		[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		[TransformSet,epx(ptr),epy(ptr),epz(ptr),epxs(ptr),epys(ptr),epzs(ptr),epxr(ptr),epyr(ptr),epzr(ptr)]
	]
]
[iButton," Swap_1","Swap Start and End",
	[note,"Swapping.....",,1]
	[VarSet,ptr,0]
	[VarSet,Swaptmp,px(ptr)]
	[VarSet,px(ptr),epx(ptr)]
	[VarSet,epx(ptr),Swaptmp]

	[VarSet,Swaptmp,py(ptr)]
	[VarSet,py(ptr),epy(ptr)]
	[VarSet,epy(ptr),Swaptmp]

	[VarSet,Swaptmp,pz(ptr)]
	[VarSet,pz(ptr),epz(ptr)]
	[VarSet,epz(ptr),Swaptmp]
]
[PD]
[ISwitch,"Sel_2",0,"Select"]
[iSwitch,"Curve_2",0,"1 Point Spline Interpolate",
	[VarSet,ptr,1]
	[ISetStatus,zscript:LoadPoint_2,1]
	[IEnable,zscript:Move_2]
	[VarSet,mode(ptr),1]
]
[iButton," LoadPoint_2 ","Load Current Object Position to use as Spline Point in Curve",
	[VarSet,ptr,1]
	[TransformGet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]//End Load Point 2

[iButton," Move_2 ","Load Current Object Position to LoadPoint_1",
	[VarSet,ptr,1]
	[TransformSet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]
[iButton," GetStart2","Get Starting Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,1]
	[VarSet,which,0]
	[if,[IGet,zscript:Curve_2],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_2,0]
		[IDisable,zscript:Move_2]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_2],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_2]
	]
]
[iButton," GetEnd2","Get Ending Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,1]
	[VarSet,which,1]
	[if,[IGet,zscript:Curve_2],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_2,0]
		[IDisable,zscript:Move_2]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_2],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_2]
	]
]
[iButton," Recall Start_2","doodah",
	[VarSet,ptr,1]
	[if,[IGet,zscript:Sel_2],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
		]
		[TransformSet,px(ptr),py(ptr),pz(ptr),pxs(ptr),pys(ptr),pzs(ptr),pxr(ptr),pyr(ptr),pzr(ptr)]
	]
]
[iButton," Recall End_2","doodah",
	[VarSet,ptr,1]
	[if,[IGet,zscript:Sel_2],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,epx(ptr),epy(ptr),epz(ptr),epxs(ptr),epys(ptr),epzs(ptr),epxr(ptr),epyr(ptr),epzr(ptr)]
	]
]
[iButton," Swap_2","Swap Start and End",
	[note,"Swapping.....",,1]
	[VarSet,ptr,1]
	[VarSet,Swaptmp,px(ptr)]
	[VarSet,px(ptr),epx(ptr)]
	[VarSet,epx(ptr),Swaptmp]

	[VarSet,Swaptmp,py(ptr)]
	[VarSet,py(ptr),epy(ptr)]
	[VarSet,epy(ptr),Swaptmp]

	[VarSet,Swaptmp,pz(ptr)]
	[VarSet,pz(ptr),epz(ptr)]
	[VarSet,epz(ptr),Swaptmp]
]
[PD]
[ISwitch,"Sel_3",0,"Select"]
[iSwitch,"Curve_3",0,"1 Point Spline Interpolate",
	[Varset,ptr,2]
	[ISetStatus,zscript:LoadPoint_3,1]
	[IEnable,zscript:Move_3]
	[VarSet,mode(ptr),1]
]
[iButton," LoadPoint_3 ","Load Current Object Position to use as Spline Point in Curve",
	[VarSet,ptr,2]
	[TransformGet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]//End Load Point 3

[iButton," Move_3 ","Load Current Object Position to LoadPoint_1",
	[VarSet,ptr,2]
	[TransformSet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]
[iButton," GetStart3","Get Starting Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,2]
	[VarSet,which,0]
	[if,[IGet,zscript:Curve_3],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_3,0]
		[IDisable,zscript:Move_3]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_3],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_3]
	]
]
[iButton," GetEnd3","Get Ending Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,2]
	[VarSet,which,1]
	[RoutineCall,GetObjData,ptr,which]
	[if,[IGet,zscript:Curve_3],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_3,0]
		[IDisable,zscript:Move_3]
	]
	[if,[Iget,zscript:Sel_3],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_3]
	]
]
[iButton," Recall Start_3","doodah",
	[VarSet,ptr,2]
	[if,[IGet,zscript:Sel_3],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,px(ptr),py(ptr),pz(ptr),pxs(ptr),pys(ptr),pzs(ptr),pxr(ptr),pyr(ptr),pzr(ptr)]
	]
]
[iButton," Recall End_3","doodah",
	[VarSet,ptr,2]
	[if,[IGet,zscript:Sel_3],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,epx(ptr),epy(ptr),epz(ptr),epxs(ptr),epys(ptr),epzs(ptr),epxr(ptr),epyr(ptr),epzr(ptr)]
	]
]
[iButton," Swap_3","Swap Start and End",
	[note,"Swapping.....",,1]
	[VarSet,ptr,2]
	[VarSet,Swaptmp,px(ptr)]
	[VarSet,px(ptr),epx(ptr)]
	[VarSet,epx(ptr),Swaptmp]

	[VarSet,Swaptmp,py(ptr)]
	[VarSet,py(ptr),epy(ptr)]
	[VarSet,epy(ptr),Swaptmp]

	[VarSet,Swaptmp,pz(ptr)]
	[VarSet,pz(ptr),epz(ptr)]
	[VarSet,epz(ptr),Swaptmp]
]
[PD]
[ISwitch,"Sel_4",0,"Select"]
[iSwitch,"Curve_4",0,"1 Point Spline Interpolate",
	[VarSet,ptr,3]
	[ISetStatus,zscript:LoadPoint_4,1]
	[IEnable,zscript:Move_4]
	[VarSet,mode(ptr),1]
]
[iButton," LoadPoint_4 ","Load Current Object Position to use as Spline Point in Curve",
	[VarSet,ptr,3]
	[TransformGet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]//End Load Point 4

[iButton," Move_4 ","Load Current Object Position to LoadPoint_4",
	[VarSet,ptr,3]
	[TransformSet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]
[iButton," GetStart4","Get Starting Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,3]
	[VarSet,which,0]
	[if,[IGet,zscript:Curve_4],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_4,0]
		[IDisable,zscript:Move_4]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_4],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_4]
	]
]
[iButton," GetEnd4","Get Ending Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,3]
	[VarSet,which,1]
	[if,[IGet,zscript:Curve_4],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_4,0]
		[IDisable,zscript:Move_4]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_4],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_4]
	]
]
[iButton," Recall Start_4","doodah",
	[VarSet,ptr,3]
	[if,[IGet,zscript:Sel_4],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,px(ptr),py(ptr),pz(ptr),pxs(ptr),pys(ptr),pzs(ptr),pxr(ptr),pyr(ptr),pzr(ptr)]
	]
]
[iButton," Recall End_4","doodah",
	[VarSet,ptr,3]
	[if,[IGet,zscript:Sel_4],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,epx(ptr),epy(ptr),epz(ptr),epxs(ptr),epys(ptr),epzs(ptr),epxr(ptr),epyr(ptr),epzr(ptr)]
	]
]
[iButton," Swap_4","Swap Start and End",
	[note,"Swapping.....",,1]
	[VarSet,ptr,3]
	[VarSet,Swaptmp,px(ptr)]
	[VarSet,px(ptr),epx(ptr)]
	[VarSet,epx(ptr),Swaptmp]

	[VarSet,Swaptmp,py(ptr)]
	[VarSet,py(ptr),epy(ptr)]
	[VarSet,epy(ptr),Swaptmp]

	[VarSet,Swaptmp,pz(ptr)]
	[VarSet,pz(ptr),epz(ptr)]
	[VarSet,epz(ptr),Swaptmp]
]

[PD]
[ISwitch,"Sel_5",0,"Select"]
[iSwitch,"Curve_5",0,"1 Point Spline Interpolate",
	[VarSet,ptr,4]
	[ISetStatus,zscript:LoadPoint_5,1]
	[IEnable,zscript:Move_5]
	[VarSet,mode(ptr),1]
]
[iButton," LoadPoint_5 ","Load Current Object Position to use as Spline Point in Curve",
	[VarSet,ptr,4]
	[TransformGet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]//End Load Point 5

[iButton," Move_5 ","Load Current Object Position to LoadPoint_5",
	[VarSet,ptr,4]
	[TransformSet,pointX(ptr),pointY(ptr),pointZ(ptr),pointXS(ptr),pointYS(ptr),pointZS(ptr),pointXR(ptr),pointYR(ptr),pointZR(ptr)]
,1
]
[iButton," GetStart5","Get Starting Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,4]
	[VarSet,which,0]
	[if,[IGet,zscript:Curve_5],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_5,0]
		[IDisable,zscript:Move_5]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_5],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_5]
	]
]
[iButton," GetEnd5","Get Ending Parameters",
	[note,"getting info",,1]
	[VarSet,ptr,4]
	[VarSet,which,1]
	[if,[IGet,zscript:Curve_5],
		[VarSet,mode(ptr),1]
	,//else
		[VarSet,mode(ptr),0]
		[ISetStatus,zscript:LoadPoint_5,0]
		[IDisable,zscript:Move_5]
	]
	[RoutineCall,GetObjData,ptr,which]
	[if,[Iget,zscript:Sel_5],
		[varset,swaptmp,0],
		[IToggle,zscript:Sel_5]
	]
]
[iButton," Recall Start_5","doodah",
	[VarSet,ptr,4]
	[if,[IGet,zscript:Sel_5],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,px(ptr),py(ptr),pz(ptr),pxs(ptr),pys(ptr),pzs(ptr),pxr(ptr),pyr(ptr),pzr(ptr)]
	]
]
[iButton," Recall End_5","doodah",
	[VarSet,ptr,4]
	[if,[IGet,zscript:Sel_5],
		[if,[IGet,Transform:DrawPointer] > 0,
			[ISet,Tool:ItemInfo,type(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
			[IPress,Transform:Move]
			[ISet,Material:ItemInfo,mat(ptr)]
			[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
			[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
		]
		[TransformSet,epx(ptr),epy(ptr),epz(ptr),epxs(ptr),epys(ptr),epzs(ptr),epxr(ptr),epyr(ptr),epzr(ptr)]
	]
]
[iButton," Swap_5","Swap Start and End",
	[note,"Swapping.....",,1]
	[VarSet,ptr,4]
	[VarSet,Swaptmp,px(ptr)]
	[VarSet,px(ptr),epx(ptr)]
	[VarSet,epx(ptr),Swaptmp]

	[VarSet,Swaptmp,py(ptr)]
	[VarSet,py(ptr),epy(ptr)]
	[VarSet,epy(ptr),Swaptmp]

	[VarSet,Swaptmp,pz(ptr)]
	[VarSet,pz(ptr),epz(ptr)]
	[VarSet,epz(ptr),Swaptmp]
]
[PD]

[IButton,"  Preview without saving  ","Preview",
	//clear area make sure current object isn't active
	[IPress,Transform:DrawPointer]
	[ipress,Layer:Modifiers:Clear]
	[VarSet,ptr,0]
	[RoutineCall,ReadSwitches]
	[VarSet,Look,0]
	[VarSet,doSave,0]
	[VarSet,Frame,0]
	[VarSet,Pick,-1]
	[loop,RepeatCount + 1,
		[RoutineCall,DoIt,Frame,Look,Pick]
		[VarInc,Frame]
	]
	//put Frame back to users selection
	[VarSet,Frame,[IGet,zscript:SelectFrame]]
]
[IButton,"  Execute and export images  ","Execute",
	//clear area
	[IPress,Transform:DrawPointer]
	[ipress,Layer:Modifiers:Clear]
	[VarSet,ptr,0]
	[RoutineCall,ReadSwitches]
	[VarSet,doSave,1]
	[VarSet,Frame,0]
	[VarSet,Look,0]
	[VarSet,Pick,-1]
	//Get Document Ready
	[IPress,document:exportimage]
	[VarSet,name,[FileNameGetLastTyped]]

	[loop,RepeatCount + 1,
		[RoutineCall,DoIt,Frame,Look,Pick]
		[VarInc,Frame]
	]
	//put Frame back to users selection
	[VarSet,Frame,[IGet,zscript:SelectFrame]]
]
[PD]
[iSlider,"SelectFrame",0,1,0,RepeatCount,"Select Frame Index",
	[varSet,Frame,[IGet,zscript:SelectFrame]]
	[Note,Frame,,1]
,0,[TextCalcWidth,SelectMark123]]
[iButton,"F+ ","Increment Frame",
	[VarInc,Frame]
	[if, Frame>(RepeatCount),[VarSet,Frame,0]]
	[ISet,zscript:SelectFrame,Frame]
,0,0,.]
[iButton,"F- ","Decrement Frame",
	[VarDec,Frame]
	[if, Frame<0,[VarSet,Frame,RepeatCount]]
	[ISet,zscript:SelectFrame,Frame]
]
[iButton," PlayFrame ","Load Current Object Frame",
	[RoutineCall,ReadSwitches]
	[IPress,Transform:DrawPointer]
	[IPress,Layer:Modifiers:Clear]
	[VarSet,ptr,0]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,-1]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[iButton," ExportFrame ","Export Current Frame",
	//Get Document Ready
	[if,Frame == 0,
		[if,[MessageYesNo,"New Filename?","Frame 0 Initialization"],
			[IPress,document:exportimage]
			[VarSet,name,[FileNameGetLastTyped]]
			[VarSet,#name,[FileNameAdvance,#name,2]] 
		,
			[FileNameSetNext, #name ] 
			[IPress,document:exportimage]
			[VarSet,#name,[FileNameAdvance,#name,2]] 
		]
	,//else
			[FileNameSetNext, #name ] 
			[IPress,document:exportimage]
			[VarSet,#name,[FileNameAdvance,#name,2]] 
	]
[Note,"Saving...",,1]
]
[iButton,"Put_1 ","Put Object on Canvas",
	[RoutineCall,ReadSwitches]
	[VarSet,ptr,0]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,ptr]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[iButton,"Put_2 ","Put Object on Canvas",
	[RoutineCall,ReadSwitches]
	[VarSet,ptr,1]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,ptr]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[iButton,"Put_3 ","Put Object on Canvas",
	[RoutineCall,ReadSwitches]
	[VarSet,ptr,2]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,ptr]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[iButton,"Put_4 ","Put Object on Canvas",
	[RoutineCall,ReadSwitches]
	[VarSet,ptr,3]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,ptr]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[iButton,"Put_5 ","Put Object on Canvas",
	[RoutineCall,ReadSwitches]
	[VarSet,ptr,4]
	[VarSet,Look,1]
	[VarSet,doSave,0]
	[VarSet,Pick,ptr]
	[RoutineCall,DoIt,Frame,Look,Pick]	
]
[PD]

[RoutineDef,DoIt,
		[VarDef,looper,5]
		[VarSet,looper,5]
		[VarSet,ptr,0]
		[VarSet,timeincr,1.0/(repeatcount)]

		[VarSet,crecurse,timeincr*IFrame]
		//Only want to draw one of the five
		[if,IPick > -1,
			[VarSet,ptr,IPick]
			[VarSet,looper,1]
		]
		[Loop,looper,
			[if,Active(ptr) == 1,
				[ISet,Tool:ItemInfo,type(ptr)]
				[ISet,Material:ItemInfo,mat(ptr)]
				[IColorSet,pr(ptr),pg(ptr),pb(ptr)]
				[CanvasClick,px(ptr),py(ptr),px(ptr)+10,py(ptr)+10]
				[IPress,Transform:Rotate]
				[if,mode(ptr) == 0,
					//Position
					[VarSet,resultx,[Interpolate,crecurse,px(ptr),epx(ptr)]]
					[VarSet,resulty,[Interpolate,crecurse,py(ptr),epy(ptr)]]
					[VarSet,resultz,[Interpolate,crecurse,pz(ptr),epz(ptr)]]
					//Scale
					[VarSet,resultxs,[Interpolate,crecurse,pxs(ptr),epxs(ptr)]]
					[VarSet,resultys,[Interpolate,crecurse,pys(ptr),epys(ptr)]]
					[VarSet,resultzs,[Interpolate,crecurse,pzs(ptr),epzs(ptr)]]
					//Rotation
					[VarSet,resultxr,[Interpolate,crecurse,pxr(ptr),epxr(ptr)]]
					[VarSet,resultyr,[Interpolate,crecurse,pyr(ptr),epyr(ptr)]]
					[VarSet,resultzr,[Interpolate,crecurse,pzr(ptr),epzr(ptr)]]
				,//else Curve
					//position
					[VarSet,resultx,[Interpolate,crecurse,px(ptr),pointX(ptr),epx(ptr)]]
					[VarSet,resulty,[Interpolate,crecurse,py(ptr),pointY(ptr),epy(ptr)]]
					[VarSet,resultz,[Interpolate,crecurse,pz(ptr),pointZ(ptr),epz(ptr)]]
					//Scale
					[VarSet,resultxs,[Interpolate,crecurse,pxs(ptr),pointXS(ptr),epxs(ptr)]]
					[VarSet,resultys,[Interpolate,crecurse,pys(ptr),pointYS(ptr),epys(ptr)]]
					[VarSet,resultzs,[Interpolate,crecurse,pzs(ptr),pointZS(ptr),epzs(ptr)]]
					//Rotation
					[VarSet,resultxr,[Interpolate,crecurse,pxr(ptr),pointXR(ptr),epxr(ptr)]]
					[VarSet,resultyr,[Interpolate,crecurse,pyr(ptr),pointYR(ptr),epyr(ptr)]]
					[VarSet,resultzr,[Interpolate,crecurse,pzr(ptr),pointZR(ptr),epzr(ptr)]]
				]
				[TransformSet,resultx,resulty,resultz,resultxs,resultys,resultzs,resultxr,resultyr,resultzr]
				[IUnpress,Transform:Rotate]
			]
			[VarInc,ptr]
		]
		[VarSet,ptr,0]
		[if,[iget,zscript:bestrender],
			[IPress,Render:BestRenderer]
		]
		[If,doSave==1, 
			[delay,1]
			[FileNameSetNext, #name ] 
			[IPress,document:exportimage]
			[VarSet,#name,[FileNameAdvance,#name,2]] 
		]
		[if,IFrame< RepeatCount,
			[if,ILook == 0,
				[Ipress,Layer:Modifiers:Clear]
			]
		]
		[delay,1]
//***********Parameters**********
,Iframe,ILook,IPick
]


[RoutineDef,GetObjData,
	//Gather pertinent info about the object
	[VarSet,type(iptr),[IGet,TOOL:iteminfo]]
	[VarSet,mat(iptr),[IGet,MATERIAL:iteminfo]]
	[if,iwhich ==0,
		[TransformGet,px(iptr),py(iptr),pz(iptr),pxs(iptr),pys(iptr),pzs(iptr),pxr(iptr),pyr(iptr),pzr(iptr)]
	,//else
		[TransformGet,epx(iptr),epy(iptr),epz(iptr),epxs(iptr),epys(iptr),epzs(iptr),epxr(iptr),epyr(iptr),epzr(iptr)]
	]
	[VarSet,pr(iptr),[IGet,Color:Redcomponent]]
	[VarSet,pg(iptr),[IGet,Color:Greencomponent]]
	[VarSet,pb(iptr),[IGet,Color:Bluecomponent]]


,iptr,iwhich
]
[RoutineDef,ReadSwitches,
	[if,[IGet,zscript:Sel_1],
		[VarSet,Active(0),1]
	,
		[VarSet,Active(0),0]
	]		
	[if,[IGet,zscript:Curve_1],
		[VarSet,Mode(0),1]
	,
		[VarSet,Mode(0),0]
		[ISetStatus,zscript:LoadPoint_1,0]
		[IDisable,zscript:Move_1]
	]		
	[if,[IGet,zscript:Sel_2],
		[VarSet,Active(1),1]
	,
		[VarSet,Active(1),0]
	]		
	[if,[IGet,zscript:Curve_2],
		[VarSet,Mode(1),1]
	,
		[VarSet,Mode(1),0]
		[ISetStatus,zscript:LoadPoint_2,0]
		[IDisable,zscript:Move_2]
	]		
	[if,[IGet,zscript:Sel_3],
		[VarSet,Active(2),1]
	,
		[VarSet,Active(2),0]
	]		
	[if,[IGet,zscript:Curve_3],
		[VarSet,Mode(2),1]
	,
		[VarSet,Mode(2),0]
		[ISetStatus,zscript:LoadPoint_3,0]
		[IDisable,zscript:Move_3]
	]		
	[if,[IGet,zscript:Sel_4],
		[VarSet,Active(3),1]
	,
		[VarSet,Active(3),0]
	]		
	[if,[IGet,zscript:Curve_4],
		[VarSet,Mode(3),1]
	,
		[VarSet,Mode(3),0]
		[ISetStatus,zscript:LoadPoint_4,0]
		[IDisable,zscript:Move_4]
	]		
	[if,[IGet,zscript:Sel_5],
		[VarSet,Active(4),1]
	,
		[VarSet,Active(4),0]
	]		
	[if,[IGet,zscript:Curve_5],
		[VarSet,Mode(4),1]
	,
		[VarSet,Mode(4),0]
		[ISetStatus,zscript:LoadPoint_5,0]
		[IDisable,zscript:Move_5]
	]		
]
[PD]
<zscriptinsert,"Widgets_Index_Include.txt">
[PD]
[PD]
[fontSetSizeSmall]\C00e0e0Digit Widget Animate Standard Revision 3.3, created by Digits\Cc0c0c0
