private void OverlapPreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p) { float num = 5f; Rect position = new Rect(num, this.m_TopSize + num, base.position.width - num * 2f, actualSize - num * 2f); if (p != null && p.HasPreviewGUI()) { p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground); } else { if (o != null) { this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon); } } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(position, s, this.m_Styles.largeStatus); } else { EditorGUI.DoDropShadowLabel(position, EditorGUIUtility.TempContent(s), this.m_Styles.largeStatus, 0.3f); } }
void WidePreview(float actualSize, string s, UnityObject o, EditorWrapper p) { float margin = kPreviewMargin; Rect previewRect = new Rect(margin, m_TopSize + margin, actualSize - margin * 2, actualSize - margin * 2); Rect labelRect = new Rect(m_PreviewSize + 3, m_TopSize + (m_PreviewSize - kPreviewExpandedAreaHeight) * 0.5f, m_Parent.window.position.width - m_PreviewSize - 3 - margin, kPreviewExpandedAreaHeight); if (p != null && p.HasPreviewGUI()) { p.OnPreviewGUI(previewRect, Styles.previewTextureBackground); } else if (o != null) { DrawObjectIcon(previewRect, m_ListArea.m_SelectedObjectIcon); } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(labelRect, s, Styles.smallStatus); } else { GUI.Label(labelRect, s, Styles.smallStatus); } }
private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p) { float num = 5f; Rect position = new Rect(num, this.m_TopSize + num, actualSize - num * 2f, actualSize - num * 2f); Rect position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (this.m_PreviewSize - 75f) * 0.5f, this.m_Parent.window.position.width - this.m_PreviewSize - 3f - num, 75f); if (p != null && p.HasPreviewGUI()) { p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground); } else { if (o != null) { this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon); } } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus); } else { GUI.Label(position2, s, this.m_Styles.smallStatus); } }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (!(this.m_PreviewObject == null)) { EditorWrapper previewEditor = this.previewEditor; if (previewEditor != null && this.m_PreviewObject is AnimationClip) { previewEditor.OnPreviewGUI(r, background); } else { this.OnInteractivePreviewGUI(r, background); } } }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (m_PreviewObject == null) { return; } EditorWrapper editor = previewEditor; // Special handling for animation clips because they only have // an interactive preview available which shows play button etc. // The OnPreviewGUI is also used for the small icons in the top // of the inspectors where buttons should not be rendered. if (editor != null && m_PreviewObject is AnimationClip) { editor.OnPreviewGUI(r, background); // currently renders nothing for animation clips } else { OnInteractivePreviewGUI(r, background); } }
void OverlapPreview(float actualSize, string s, UnityObject o, EditorWrapper p) { float margin = kPreviewMargin; Rect previewRect = new Rect(margin, m_TopSize + margin, position.width - margin * 2, actualSize - margin * 2); if (p != null && p.HasPreviewGUI()) { p.OnPreviewGUI(previewRect, Styles.previewTextureBackground); } else if (o != null) { DrawObjectIcon(previewRect, m_ListArea.m_SelectedObjectIcon); } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(previewRect, s, Styles.largeStatus); } else { EditorGUI.DoDropShadowLabel(previewRect, EditorGUIUtility.TempContent(s), Styles.largeStatus, .3f); } }
private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p) { float x = 5f; Rect position = new Rect(x, this.m_TopSize + x, actualSize - (x * 2f), actualSize - (x * 2f)); Rect rect2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + ((this.m_PreviewSize - 75f) * 0.5f), ((base.m_Parent.window.position.width - this.m_PreviewSize) - 3f) - x, 75f); if ((p != null) && p.HasPreviewGUI()) { p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground); } else if (o != null) { this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon); } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(rect2, s, this.m_Styles.smallStatus); } else { GUI.Label(rect2, s, this.m_Styles.smallStatus); } }
private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p) { float x = 5f; Rect position1 = new Rect(x, this.m_TopSize + x, actualSize - x * 2f, actualSize - x * 2f); Rect position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (float)(((double)this.m_PreviewSize - 75.0) * 0.5), (float)((double)this.m_Parent.window.position.width - (double)this.m_PreviewSize - 3.0) - x, 75f); if (p != null && p.HasPreviewGUI()) { p.OnPreviewGUI(position1, this.m_Styles.previewTextureBackground); } else if (o != (UnityEngine.Object)null) { this.DrawObjectIcon(position1, this.m_ListArea.m_SelectedObjectIcon); } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus); } else { GUI.Label(position2, s, this.m_Styles.smallStatus); } }
private void MaterialListing() { ProceduralMaterial[] sortedMaterials = this.GetSortedMaterials(); ProceduralMaterial[] array = sortedMaterials; for (int i = 0; i < array.Length; i++) { ProceduralMaterial proceduralMaterial = array[i]; if (proceduralMaterial.isProcessing) { base.Repaint(); SceneView.RepaintAll(); GameView.RepaintAll(); break; } } int num = sortedMaterials.Length; float num2 = GUIView.current.position.width - 16f - 18f - 2f; if (num2 * 2f < (float)num * 60f) { num2 -= 16f; } int num3 = Mathf.Max(1, Mathf.FloorToInt(num2 / 60f)); int num4 = Mathf.CeilToInt((float)num / (float)num3); Rect viewRect = new Rect(0f, 0f, (float)num3 * 60f, (float)num4 * 76f); Rect rect = GUILayoutUtility.GetRect(viewRect.width, Mathf.Clamp(viewRect.height, 76f, 152f) + 1f); Rect position = new Rect(rect.x + 1f, rect.y + 1f, rect.width - 2f, rect.height - 1f); GUI.Box(rect, GUIContent.none, this.m_SubstanceStyles.gridBackground); GUI.Box(position, GUIContent.none, this.m_SubstanceStyles.background); this.m_ListScroll = GUI.BeginScrollView(position, this.m_ListScroll, viewRect, false, false); if (this.m_EditorCache == null) { this.m_EditorCache = new EditorCache(EditorFeatures.PreviewGUI); } for (int j = 0; j < sortedMaterials.Length; j++) { ProceduralMaterial proceduralMaterial2 = sortedMaterials[j]; if (!(proceduralMaterial2 == null)) { float x = (float)(j % num3) * 60f; float y = (float)(j / num3) * 76f; Rect rect2 = new Rect(x, y, 60f, 76f); bool flag = proceduralMaterial2.name == this.m_SelectedMaterialInstanceName; Event current = Event.current; int controlID = GUIUtility.GetControlID(SubstanceImporterInspector.previewNoDragDropHash, FocusType.Passive, rect2); EventType typeForControl = current.GetTypeForControl(controlID); if (typeForControl != EventType.Repaint) { if (typeForControl == EventType.MouseDown) { if (current.button == 0) { if (rect2.Contains(current.mousePosition)) { if (current.clickCount == 1) { this.m_SelectedMaterialInstanceName = proceduralMaterial2.name; current.Use(); } else if (current.clickCount == 2) { AssetDatabase.OpenAsset(proceduralMaterial2); GUIUtility.ExitGUI(); current.Use(); } } } } } else { Rect position2 = rect2; position2.y = rect2.yMax - 16f; position2.height = 16f; this.m_SubstanceStyles.resultsGridLabel.Draw(position2, EditorGUIUtility.TempContent(proceduralMaterial2.name), false, false, flag, flag); } rect2.height -= 16f; EditorWrapper editorWrapper = this.m_EditorCache[proceduralMaterial2]; editorWrapper.OnPreviewGUI(rect2, this.m_SubstanceStyles.background); } } GUI.EndScrollView(); }
private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p) { float x = 5f; Rect position1 = new Rect(x, this.m_TopSize + x, actualSize - x * 2f, actualSize - x * 2f); Rect position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (float) (((double) this.m_PreviewSize - 75.0) * 0.5), (float) ((double) this.m_Parent.window.position.width - (double) this.m_PreviewSize - 3.0) - x, 75f); if (p != null && p.HasPreviewGUI()) p.OnPreviewGUI(position1, this.m_Styles.previewTextureBackground); else if (o != (UnityEngine.Object) null) this.DrawObjectIcon(position1, this.m_ListArea.m_SelectedObjectIcon); if (EditorGUIUtility.isProSkin) EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus); else GUI.Label(position2, s, this.m_Styles.smallStatus); }
private void WidePreview(float actualSize, string s, Object o, EditorWrapper p) { float x = 5f; Rect position = new Rect(x, this.m_TopSize + x, actualSize - (x * 2f), actualSize - (x * 2f)); Rect rect2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + ((this.m_PreviewSize - 75f) * 0.5f), ((base.m_Parent.window.position.width - this.m_PreviewSize) - 3f) - x, 75f); if ((p != null) && p.HasPreviewGUI()) { p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground); } else if (o != null) { this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon); } if (EditorGUIUtility.isProSkin) { EditorGUI.DropShadowLabel(rect2, s, this.m_Styles.smallStatus); } else { GUI.Label(rect2, s, this.m_Styles.smallStatus); } }