public DefaultPreviewGUI ( |
||
r | ||
background | ||
return | void |
public void DefaultPreviewGUI(Rect r, GUIStyle background)
{
if (!ShaderUtil.hardwareSupportsRectRenderTexture)
{
if (Event.current.type == EventType.Repaint)
{
EditorGUI.DropShadowLabel(new Rect(r.x, r.y, r.width, 40f), "Material preview \nnot available");
}
}
else
{
this.Init();
Material target = this.target as Material;
if (DoesPreviewAllowRotation(GetPreviewType(target)))
{
this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, r);
}
if (Event.current.type == EventType.Repaint)
{
this.m_PreviewUtility.BeginPreview(r, background);
this.DoRenderPreview();
this.m_PreviewUtility.EndAndDrawPreview(r);
}
}
}
/// <summary> /// <para>Override for extending the rendering of the Preview area or completly replace the preview (by not calling base.OnMaterialPreviewGUI).</para> /// </summary> /// <param name="materialEditor">The MaterialEditor that are calling this method (the 'owner').</param> /// <param name="r">Preview rect.</param> /// <param name="background">Style for the background.</param> public virtual void OnMaterialPreviewGUI(MaterialEditor materialEditor, Rect r, GUIStyle background) { materialEditor.DefaultPreviewGUI(r, background); }