IsVisible() 공개 정적인 메소드

public static IsVisible ( ) : bool
리턴 bool
예제 #1
0
 public void OnWindowResized()
 {
     if (PopupWindowWithoutFocus.IsVisible())
     {
         PopupWindowWithoutFocus.Hide();
     }
 }
        void DoPreviewPopup()
        {
            if (state.selectedIDs.Count != 1)
            {
                PopupWindowWithoutFocus.Hide();
                return;
            }

            var item = FindItem(state.selectedIDs[0], rootItem) as PrefabOverridesTreeViewItem;

            if (item == null || item.obj == null)
            {
                return;
            }

            if (PopupWindowWithoutFocus.IsVisible())
            {
                if (item.id == m_LastShownPreviewWindowRowID)
                {
                    return;
                }
            }

            int row = FindRowOfItem(item);

            if (row == -1)
            {
                return;
            }

            Rect buttonRect = GetRowRect(row);

            buttonRect.width = EditorGUIUtility.currentViewWidth;
            Object rowObject = item.obj;

            Object instance, source;

            if (item.type == ItemType.REMOVED_OBJECT)
            {
                instance = null;
                source   = rowObject;
            }
            else if (item.type == ItemType.ADDED_OBJECT)
            {
                instance = rowObject;
                source   = null;
            }
            else
            {
                instance = rowObject;
                source   = PrefabUtility.GetCorrespondingObjectFromSource(rowObject);
            }

            m_LastShownPreviewWindowRowID = item.id;
            PopupWindowWithoutFocus.Show(
                buttonRect,
                new ComparisonViewPopup(source, instance, item.singleModification, this),
                new[] { PopupLocation.Right, PopupLocation.Left, PopupLocation.Below });
        }
예제 #3
0
        internal override void OnResized()
        {
            if (PopupWindowWithoutFocus.IsVisible())
            {
                PopupWindowWithoutFocus.Hide();
            }

            base.OnResized();
        }
        public void CullNonExistingItemsFromSelection()
        {
            for (int i = state.selectedIDs.Count - 1; i >= 0; i--)
            {
                if (TreeViewUtility.FindItem(state.selectedIDs[i], rootItem) == null)
                {
                    state.selectedIDs.RemoveAt(i);
                }
            }

            if (state.selectedIDs.Count != 1 && PopupWindowWithoutFocus.IsVisible())
            {
                PopupWindowWithoutFocus.Hide();
            }
        }
        void DoPreviewPopup(PrefabOverridesTreeViewItem item, Rect rowRect)
        {
            if (item == null || item.obj == null)
            {
                return;
            }

            if (PopupWindowWithoutFocus.IsVisible())
            {
                if (item.id == m_LastShownPreviewWindowRowID)
                {
                    return;
                }
            }

            Rect buttonRect = rowRect;

            buttonRect.width = EditorGUIUtility.currentViewWidth;
            Object rowObject = item.obj;

            Object instance, source;

            if (item.type == ItemType.REMOVED_OBJECT)
            {
                instance = null;
                source   = rowObject;
            }
            else if (item.type == ItemType.ADDED_OBJECT)
            {
                instance = rowObject;
                source   = null;
            }
            else
            {
                instance = rowObject;
                source   = PrefabUtility.GetCorrespondingObjectFromSource(rowObject);
            }

            m_LastShownPreviewWindowRowID = item.id;
            PopupWindowWithoutFocus.Show(
                buttonRect,
                new ComparisonViewPopup(source, instance, item.singleModification, this),
                new[] { PopupLocation.Right, PopupLocation.Left, PopupLocation.Below });
        }
            private void DoPreviewPopup(PackageImportTreeView.PackageImportTreeViewItem pitem, Rect rowRect)
            {
                ImportPackageItem item = pitem.item;

                if (item != null)
                {
                    if (((Event.current.type == EventType.MouseDown) && rowRect.Contains(Event.current.mousePosition)) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = pitem.id;
                    }
                    if ((pitem.id == this.showPreviewForID) && (Event.current.type != EventType.Layout))
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(item.previewPath))
                        {
                            Texture2D preview       = PackageImport.GetPreview(item.previewPath);
                            Rect      activatorRect = rowRect;
                            activatorRect.width = EditorGUIUtility.currentViewWidth;
                            PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[3];
                            locationPriorityOrder[0] = PopupLocationHelper.PopupLocation.Right;
                            locationPriorityOrder[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(activatorRect, new PackageImportTreeView.PreviewPopup(preview), locationPriorityOrder);
                        }
                    }
                }
            }
            void DoPreviewPopup(PackageImportTreeViewItem pitem, Rect rowRect)
            {
                var item = pitem.item;

                if (item != null)
                {
                    // Ensure preview is shown when clicking on an already selected item (the preview might have been closed)
                    if (Event.current.type == EventType.MouseDown && rowRect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        showPreviewForID = pitem.id;
                    }

                    // Show preview
                    if (pitem.id == showPreviewForID && Event.current.type != EventType.Layout)
                    {
                        showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(item.previewPath))
                        {
                            Texture2D preview    = PackageImport.GetPreview(item.previewPath);
                            Rect      buttonRect = rowRect;
                            buttonRect.width = EditorGUIUtility.currentViewWidth;
                            PopupWindowWithoutFocus.Show(buttonRect, new PreviewPopup(preview), new[] { PopupLocationHelper.PopupLocation.Right, PopupLocationHelper.PopupLocation.Left, PopupLocationHelper.PopupLocation.Below });
                        }
                    }
                }
            }
예제 #8
0
            private void DoPreviewPopup(PackageImportTreeView.PackageImportTreeViewItem pitem, Rect rowRect)
            {
                ImportPackageItem importPackageItem = pitem.item;

                if (importPackageItem == null)
                {
                    return;
                }
                if (Event.current.type == EventType.MouseDown && rowRect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                {
                    this.showPreviewForID = pitem.id;
                }
                if (pitem.id != this.showPreviewForID || Event.current.type == EventType.Layout)
                {
                    return;
                }
                this.showPreviewForID = 0;
                if (string.IsNullOrEmpty(importPackageItem.previewPath))
                {
                    return;
                }
                Texture2D preview       = PackageImport.GetPreview(importPackageItem.previewPath);
                Rect      activatorRect = rowRect;

                activatorRect.width = EditorGUIUtility.currentViewWidth;
                PopupWindowWithoutFocus.Show(activatorRect, (PopupWindowContent) new PackageImportTreeView.PreviewPopup(preview), new PopupLocationHelper.PopupLocation[3]
                {
                    PopupLocationHelper.PopupLocation.Right,
                    PopupLocationHelper.PopupLocation.Left,
                    PopupLocationHelper.PopupLocation.Below
                });
            }
            public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused)
            {
                Rect rect = new Rect(0f, (float)row * this.k_LineHeight, rowWidth, this.k_LineHeight);

                this.DoNodeGUI(rect, node, selected, focused, false);
                PackageImportTreeView.PackageImportTreeViewItem packageImportTreeViewItem = node as PackageImportTreeView.PackageImportTreeViewItem;
                if (packageImportTreeViewItem != null)
                {
                    Rect toggleRect = new Rect(2f, rect.y, rect.height, rect.height);
                    EditorGUI.BeginChangeCheck();
                    PackageImportTreeView.PackageImportTreeViewGUI.Toggle(packageImportTreeViewItem, toggleRect);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (this.m_TreeView.GetSelection().Length <= 1 || !this.m_TreeView.GetSelection().Contains(packageImportTreeViewItem.id))
                        {
                            this.m_TreeView.SetSelection(new int[]
                            {
                                packageImportTreeViewItem.id
                            }, false);
                            this.m_TreeView.NotifyListenersThatSelectionChanged();
                        }
                        if (this.itemWasToggled != null)
                        {
                            this.itemWasToggled(packageImportTreeViewItem);
                        }
                        Event.current.Use();
                    }
                    if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = packageImportTreeViewItem.id;
                    }
                    if (packageImportTreeViewItem.id == this.showPreviewForID && Event.current.type != EventType.Layout)
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(packageImportTreeViewItem.item.previewPath))
                        {
                            Texture2D preview = PackageImport.GetPreview(packageImportTreeViewItem.item.previewPath);
                            Rect      rect2   = rect;
                            rect2.width = EditorGUIUtility.currentViewWidth;
                            Rect arg_190_0 = rect2;
                            PopupWindowContent arg_190_1 = new PackageImportTreeView.PreviewPopup(preview);
                            PopupLocationHelper.PopupLocation[] expr_188 = new PopupLocationHelper.PopupLocation[3];
                            expr_188[0] = PopupLocationHelper.PopupLocation.Right;
                            expr_188[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(arg_190_0, arg_190_1, expr_188);
                        }
                    }
                    if (packageImportTreeViewItem.item.exists == 0)
                    {
                        Texture image = this.constants.badgeNew.image;
                        GUI.DrawTexture(new Rect(rect.xMax - (float)image.width - 6f, rect.y + (rect.height - (float)image.height) / 2f, (float)image.width, (float)image.height), image);
                    }
                }
                return(rect);
            }
예제 #10
0
            private void DoPreviewPopup(PackageImportTreeView.PackageImportTreeViewItem pitem, Rect rowRect)
            {
                ImportPackageItem item = pitem.item;

                if (item != null)
                {
                    if (Event.current.type == EventType.MouseDown && rowRect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = pitem.id;
                    }
                    if (pitem.id == this.showPreviewForID && Event.current.type != EventType.Layout)
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(item.previewPath))
                        {
                            Texture2D preview = PackageImport.GetPreview(item.previewPath);
                            Rect      rect    = rowRect;
                            rect.width = EditorGUIUtility.currentViewWidth;
                            Rect arg_AF_0 = rect;
                            PopupWindowContent arg_AF_1 = new PackageImportTreeView.PreviewPopup(preview);
                            PopupLocationHelper.PopupLocation[] expr_A7 = new PopupLocationHelper.PopupLocation[3];
                            expr_A7[0] = PopupLocationHelper.PopupLocation.Right;
                            expr_A7[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(arg_AF_0, arg_AF_1, expr_A7);
                        }
                    }
                }
            }
        void DoPreviewPopup(PrefabOverridesTreeViewItem item, Rect rowRect)
        {
            if (item != null)
            {
                // Ensure preview is shown when clicking on an already selected item (the preview might have been closed)
                if (Event.current.type == EventType.MouseDown && rowRect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                {
                    m_ShowPreviewForID = item.id;
                }

                // Show preview
                if (item.id == m_ShowPreviewForID && Event.current.type != EventType.Layout)
                {
                    m_ShowPreviewForID = -1;
                    if (item.obj != null)
                    {
                        Rect buttonRect = rowRect;
                        buttonRect.width = EditorGUIUtility.currentViewWidth;
                        Object rowObject = item.obj;

                        Object instance, source;
                        if (item.type == ItemType.REMOVED_OBJECT)
                        {
                            instance = null;
                            source   = rowObject;
                        }
                        else if (item.type == ItemType.ADDED_OBJECT)
                        {
                            instance = rowObject;
                            source   = null;
                        }
                        else
                        {
                            instance = rowObject;
                            source   = PrefabUtility.GetCorrespondingObjectFromSource(rowObject);
                        }

                        PopupWindowWithoutFocus.Show(
                            buttonRect,
                            new ComparisonViewPopup(source, instance, item.singleModification, this),
                            new[] { PopupLocation.Right, PopupLocation.Left, PopupLocation.Below });
                    }
                }
            }
        }