
var Outlook, OutlookItem ;

try{
	objList = GetValue( "SelectionList" ) ;

	mySceneRoot = EnumElements("Project", true) ;
	mySceneRoot = SIFilter(mySceneRoot, "Scene", true)(0) ;
	mySceneRoot = EnumElements( mySceneRoot , true) ;
	mySceneRoot = SIFilter(mySceneRoot, "SceneObject", true)(0) ;

	SIAddProp( "Custom_parameter_list", mySceneRoot, siDefaultPropagation, "Highlight") ;
	
	SIAddCustomParameter( "Highlight", "Surface", siString, 0.000, 0.000, 1.000, null, siReadOnly, 0.000, 1.000, null, null) ;
	SIAddCustomParameter( "Highlight", "light_LightBox", siBool, 0.000, 0.000, 1.000, null, 0, 0.000, 1.000, null, null) ;
	SIAddCustomParameter( "Highlight", "light_Neon", siBool, 0.000, 0.000, 1.000, null, 0, 0.000, 1.000, null, null) ;
	SIAddCustomParameter( "Highlight", "light_Point", siBool, 0.000, 0.000, 1.000, null, 0, 0.000, 1.000, null, null) ;
	SIAddCustomParameter( "Highlight", "light_Spot", siBool, 0.000, 0.000, 1.000, null, 0, 0.000, 1.000, null, null) ;

	if( objList.Count == 1 )
	{
		if( objList.Items(0).Type == "surfmsh" )
		{
			objName = objList.Items(0).Name ;
			//
			SetValue("Highlight.Surface", objName, null) ;
			InspectObj( "Highlight", "","Highlight", siModal ) ;
			//
			hl = objName + "_highlight" ;
			hl = GetPrim("Null", hl, null) ;
			CopyPaste( hl, null, objName, 1) ;
			ApplyCns("Surface", hl, objName, null) ;
			SetValue(hl+".kine.surfcns.tangent", true, null) ;
			SetValue(hl+".kine.surfcns.upvct_active", true, null) ;
			SetValue(hl+".kine.surfcns.posu", 0.500, null) ;
			SetValue(hl+".kine.surfcns.posv", 0.500, null) ;
			//
			hlcam = hl + "_camCNS" ;
			hlcam = GetPrim("Null", hlcam, null) ;
			SetValue( hlcam+".visibility.viewvis", false, null) ;
			CopyPaste( hlcam, null, hl, 1) ;
			ApplyCns("Position", hlcam, "Camera", null) ;
			//
			hllight = hl + "_lightCNS" ;
			hllight = GetPrim("Null", hllight, null) ;
			SetValue( hllight+".visibility.viewvis", false, null) ;
			CopyPaste( hllight, null, hl, 1) ;
			//
			AddExpr(hllight+".kine.local.posx", "- "+hlcam+".kine.local.posx") ;
			AddExpr(hllight+".kine.local.posy",      hlcam+".kine.local.posy") ;
			AddExpr(hllight+".kine.local.posz", "- "+hlcam+".kine.local.posz") ;
			//
			if( GetValue("Highlight.light_Spot") )
			{ 
				hlspot     = hl + "_spot" ;
				hlspotRoot = GetPrimLight("Spot.Preset",hlspot) ;
				SetValue( hlspotRoot+".visibility.viewvis", false, null) ;
				SetValue( hlspot+"_Interest.visibility.viewvis", false, null) ;
				//
				CopyPaste( hlspotRoot, null, hl, 1) ;
				//
				ApplyCns("Position", hlspot+"_Interest", hl, null) ;
				ApplyCns("Position", hlspot, hllight, null) ;
			}
			//
			if( GetValue("Highlight.light_LightBox") )
			{ 
				hlbox     = hl + "_lbox" ;
				hlboxRoot = GetPrimLight("Light_Box.Preset",hlbox) ;
				SetValue( hlboxRoot+".visibility.viewvis", false, null) ;
				SetValue( hlbox+"_Interest.visibility.viewvis", false, null) ;
				//
				CopyPaste( hlboxRoot, null, hl, 1) ;
				//
				ApplyCns("Position", hlbox+"_Interest", hl, null) ;
				ApplyCns("Position", hlbox, hllight, null) ;
			}
			//
			if( GetValue("Highlight.light_Point") )
			{ 
				hlpnt = hl + "_point" ;
				hlpnt = GetPrimLight("Point.Preset", hlpnt) ;
				//
				CopyPaste( hlpnt, null, hl, 1) ;
				//
				ApplyCns("Position", hlpnt, hllight, null) ;
			}
			//
			if( GetValue("Highlight.light_Neon") )
			{ 
				hlneon = hl + "_neon" ;
				hlneon = GetPrimLight("Neon.Preset", hlneon) ;
				//
				CopyPaste( hlneon, null, hl, 1) ;
				//
				ApplyCns( "Position", hlneon, hllight, null) ;
				ApplyCns( "Direction", hlneon, hl, null) ;
				SetValue( hlneon+".kine.dircns.dirz", 1.000, null) ;
				SetValue( hlneon+".kine.dircns.dirx", 0.000, null) ;
				SetValue( hlneon+".kine.dircns.upvct_active", true, null) ;
			}
			//
			SelectObj(hl, null, null) ;
			//
			LogMessage( objName + " Highlighted :-)") ;
			//
		} else {
			LogMessage( "Select a Surface Mesh ( Nurbs )", siError ) ;
		}
	} else if( objList.Count == 0 ) {
		LogMessage( "Select 1 Surface Mesh ( Nurbs )", siError ) ;
	} else {
		LogMessage( "Select only 1 Surface Mesh ( Nurbs )", siError ) ;
	}

	DeleteObj( "Highlight" ) ;

}

catch(e)
{
	DeleteObj( "Highlight" ) ;
}