public void DoAvatarPreview(Rect rect, GUIStyle background)
{
this.Init();
Rect position = new Rect(rect.xMax - 16f, rect.yMax - 16f, 16f, 16f);
if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
{
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Auto"), false, new GenericMenu.MenuFunction2(this.SetPreviewAvatarOption), PreviewPopupOptions.Auto);
menu.AddItem(new GUIContent("Unity Model"), false, new GenericMenu.MenuFunction2(this.SetPreviewAvatarOption), PreviewPopupOptions.DefaultModel);
menu.AddItem(new GUIContent("Other..."), false, new GenericMenu.MenuFunction2(this.SetPreviewAvatarOption), PreviewPopupOptions.Other);
menu.ShowAsContext();
}
Rect rect3 = rect;
rect3.yMin += 21f;
rect3.height = Mathf.Max(rect3.height, 64f);
int controlID = GUIUtility.GetControlID(this.m_PreviewHint, FocusType.Passive, rect3);
Event current = Event.current;
if ((current.GetTypeForControl(controlID) == EventType.Repaint) && this.m_IsValid)
{
this.DoRenderPreview(rect3, background);
this.m_PreviewUtility.EndAndDrawPreview(rect3);
}
this.AvatarTimeControlGUI(rect);
GUI.DrawTexture(position, s_Styles.avatarIcon.image);
int num2 = GUIUtility.GetControlID(this.m_PreviewSceneHint, FocusType.Passive);
EventType typeForControl = current.GetTypeForControl(num2);
this.DoAvatarPreviewDrag(typeForControl);
this.HandleViewTool(current, typeForControl, num2, rect3);
this.DoAvatarPreviewFrame(current, typeForControl, rect3);
if (!this.m_IsValid)
{
Rect rect4 = rect3;
rect4.yMax -= (rect4.height / 2f) - 16f;
EditorGUI.DropShadowLabel(rect4, "No model is available for preview.\nPlease drag a model into this Preview Area.");
}
if ((current.type == EventType.ExecuteCommand) && ((current.commandName == "ObjectSelectorUpdated") && (ObjectSelector.get.objectSelectorID == this.m_ModelSelectorId)))
{
this.SetPreview(ObjectSelector.GetCurrentObject() as GameObject);
current.Use();
}
if (current.type == EventType.Repaint)
{
EditorGUIUtility.AddCursorRect(rect3, this.currentCursor);
}
}