/// <summary>
/// Lets the Editor handle an event in the scene view
/// http://docs.unity3d.com/ScriptReference/Editor.OnSceneGUI.html
/// </summary>
public void OnSceneGUI()
{
Initialize();
//
tp_ComponentBaseEditor target = null;
string undoMsg = string.Empty;
switch (component.EditingTool)
{ // Update the current menu
case EditingTool.Height:
m_heightmapEditor.OnSceneGUI(component);
undoMsg = TP.UndoMessages.HEIGHTMAP;
target = m_heightmapEditor;
break;
case EditingTool.Texture:
m_splatmapEditor.OnSceneGUI(component);
undoMsg = TP.UndoMessages.TEXTURE;
target = m_splatmapEditor;
break;
case EditingTool.Foliage:
m_foliageEditor.OnSceneGUI(component);
undoMsg = TP.UndoMessages.FOLIAGE;
target = m_foliageEditor;
break;
case EditingTool.Object: break;
case EditingTool.Settings: m_settings.OnSceneGUI(component); break;
}
// Update projector
if (Event.current.type == EventType.Repaint)
{
m_projector.Update(component.IsPainting);
}
if (target == null || !component.Alpha.Enabled)
{
return;
}
component.brushPosition = Vector3.zero;
bool wasPainting = component.IsPainting;
tp_Input.Update(component, target, ref component.brushPosition, ref wasPainting, undoMsg);
component.IsPainting = wasPainting;
}