///Created by Neodrop neodrop@unity3d.ru
// Required TakeYoorHandOFF.js
@MenuItem ("Antares/Hide or Freez/Freez Object &f")
static function Freez ()
{
	if(Selection.activeGameObject != null) 
	{
		if(!Selection.activeGameObject.GetComponent(TakeYourHandOFF))
		Selection.activeGameObject.AddComponent(TakeYourHandOFF);
		else 
		{
			var tk : TakeYourHandOFF = Selection.activeGameObject.GetComponent(TakeYourHandOFF);
			if(Selection.activeGameObject.hideFlags == HideFlags.NotEditable)
			{
				tk.RestoreEditing();
			} else tk.Reset();
		}
	}
}

@MenuItem ("CONTEXT/Transform/Freez")
static function FreezFromContext () {
	if(Selection.activeGameObject != null) 
	{
		if(!Selection.activeGameObject.GetComponent(TakeYourHandOFF))
		Selection.activeGameObject.AddComponent(TakeYourHandOFF);
		else 
		{
			var tk : TakeYourHandOFF = Selection.activeGameObject.GetComponent(TakeYourHandOFF);
			if(Selection.activeGameObject.hideFlags == HideFlags.NotEditable)
			{
				tk.RestoreEditing();
			} else tk.Reset();
		}
	}
}

@MenuItem ("Antares/Hide or Freez/UnFreez all freezed")
@MenuItem ("CONTEXT/Transform/UnFreez all freezed")
static function UnFreezAll()
{
	var tk : TakeYourHandOFF[] = GameObject.FindObjectsOfType(TakeYourHandOFF);
	for(var t : TakeYourHandOFF in tk) t.RestoreEditing();
}

@MenuItem ("Antares/Hide or Freez/Freez all unfreezed")
@MenuItem ("CONTEXT/Transform/Freez all unfreezed")
static function FreezAll()
{
	var tk : TakeYourHandOFF[] = GameObject.FindObjectsOfType(TakeYourHandOFF);
	for(var t : TakeYourHandOFF in tk) t.Reset();
}