IsLoadingAssetPreviews() public static méthode

Loading previews is asynchronous so it is useful to know if any requested previews are in the process of being loaded so client code e.g can repaint while waiting.

public static IsLoadingAssetPreviews ( ) : bool
Résultat bool
Exemple #1
0
        private void OnGUI()
        {
            this.HandleContextMenu();
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            float pixels = ((float)Screen.width / EditorGUIUtility.pixelsPerPoint - GridPaintPaletteWindow.Styles.toolbarWidth) * 0.5f;

            GUILayout.Space(pixels);
            EditMode.DoInspectorToolbar(GridPaintPaletteWindow.Styles.sceneViewEditModes, GridPaintPaletteWindow.Styles.toolContents, ScriptableSingleton <GridPaintingState> .instance);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(pixels);
            this.DoActiveTargetsGUI();
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(6f);
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            Rect rect = EditorGUILayout.BeginHorizontal(GUIContent.none, "Toolbar", new GUILayoutOption[0]);

            this.DoClipboardHeader();
            EditorGUILayout.EndHorizontal();
            Rect  dragRect = new Rect(210f, 0f, base.position.width - 200f - 10f, 17f);
            float num      = this.m_PreviewResizer.ResizeHandle(base.position, 50f, 200f, 17f, dragRect);
            float height   = base.position.height - num - 95f;
            Rect  position = new Rect(0f, rect.yMax, base.position.width, height);

            this.OnClipboardGUI(position);
            EditorGUILayout.EndVertical();
            GUILayout.Space(position.height);
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            EditorGUILayout.BeginHorizontal(GUIContent.none, "Toolbar", new GUILayoutOption[0]);
            this.DoBrushesDropdown();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            this.m_BrushScroll = GUILayout.BeginScrollView(this.m_BrushScroll, false, false, new GUILayoutOption[0]);
            GUILayout.Space(5f);
            this.OnBrushInspectorGUI();
            GUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
            Color color = Handles.color;

            Handles.color = Color.black;
            Handles.DrawLine(new Vector3(0f, position.yMax + 0.5f, 0f), new Vector3((float)Screen.width, position.yMax + 0.5f, 0f));
            Handles.color = Color.black.AlphaMultiplied(0.33f);
            Handles.DrawLine(new Vector3(0f, GUILayoutUtility.GetLastRect().yMax + 0.5f, 0f), new Vector3((float)Screen.width, GUILayoutUtility.GetLastRect().yMax + 0.5f, 0f));
            Handles.color = color;
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(2f);
            EditorGUILayout.EndVertical();
            if (AssetPreview.IsLoadingAssetPreviews(base.GetInstanceID()))
            {
                base.Repaint();
            }
            if (Event.current.type == EventType.MouseDown)
            {
                GUIUtility.keyboardControl = 0;
            }
        }
Exemple #2
0
        private void OnGUI()
        {
            HandleContextMenu();

            EditorGUILayout.BeginVertical();
            GUILayout.Space(10f);
            EditorGUILayout.BeginHorizontal();
            float leftMargin = (Screen.width / EditorGUIUtility.pixelsPerPoint - Styles.toolbarWidth) * 0.5f;

            GUILayout.Space(leftMargin);
            EditMode.DoInspectorToolbar(k_SceneViewEditModes, Styles.toolContents, GridPaintingState.instance);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(leftMargin);
            DoActiveTargetsGUI();
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(6f);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            Rect clipboardToolbarRect = EditorGUILayout.BeginHorizontal(GUIContent.none, "Toolbar");

            DoClipboardHeader();
            EditorGUILayout.EndHorizontal();
            Rect  dragRect           = new Rect(k_DropdownWidth + k_ResizerDragRectPadding, 0, position.width - k_DropdownWidth - k_ResizerDragRectPadding, k_ToolbarHeight);
            float brushInspectorSize = m_PreviewResizer.ResizeHandle(position, k_MinBrushInspectorHeight, k_MinClipboardHeight, k_ToolbarHeight, dragRect);
            float clipboardHeight    = position.height - brushInspectorSize - k_TopAreaHeight;
            Rect  clipboardRect      = new Rect(0f, clipboardToolbarRect.yMax, position.width, clipboardHeight);

            OnClipboardGUI(clipboardRect);
            EditorGUILayout.EndVertical();

            GUILayout.Space(clipboardRect.height);

            EditorGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal(GUIContent.none, "Toolbar");
            DoBrushesDropdown();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            m_BrushScroll = GUILayout.BeginScrollView(m_BrushScroll, false, false);
            GUILayout.Space(5f);
            OnBrushInspectorGUI();
            GUILayout.EndScrollView();
            EditorGUILayout.EndVertical();

            Color oldColor = Handles.color;

            Handles.color = Color.black;
            Handles.DrawLine(new Vector3(0, clipboardRect.yMax + 0.5f, 0), new Vector3(Screen.width, clipboardRect.yMax + 0.5f, 0));
            Handles.color = Color.black.AlphaMultiplied(0.33f);
            Handles.DrawLine(new Vector3(0, GUILayoutUtility.GetLastRect().yMax + 0.5f, 0), new Vector3(Screen.width, GUILayoutUtility.GetLastRect().yMax + 0.5f, 0));
            Handles.color = oldColor;

            EditorGUILayout.BeginVertical();

            GUILayout.Space(2f);

            EditorGUILayout.EndVertical();

            // Keep repainting until all previews are loaded
            if (AssetPreview.IsLoadingAssetPreviews(GetInstanceID()))
            {
                Repaint();
            }

            // Release keyboard focus on click to empty space
            if (Event.current.type == EventType.MouseDown)
            {
                GUIUtility.keyboardControl = 0;
            }
        }
 /// <summary>
 ///   <para>Loading previews is asynchronous so it is useful to know if any requested previews are in the process of being loaded so client code e.g can repaint while waiting.</para>
 /// </summary>
 public static bool IsLoadingAssetPreviews()
 {
     return(AssetPreview.IsLoadingAssetPreviews(0));
 }