コード例 #1
0
        public void OpenHierarchy(ToolControl control)
        {
            activatorControl = control;
            var activatorPosition = activatorControl.activatorScreenPosition;

            activatorPosition.width = 300;
            PopupWatcher.Release(window);
            window = HierarchyPopup.Show(targets, activatorPosition);
            PopupWatcher.Watch(window);
        }
コード例 #2
0
 public override void Open(ToolControl control)
 {
     if (creatorShortcut)
     {
         activatorControl = control;
         PopupWatcher.Release(window);
         window = Replacer.Open(targets, activatorControl.activatorScreenPosition);
         PopupWatcher.Watch(window);
     }
     else
     {
         base.Open(control);
     }
 }
コード例 #3
0
        public override void Open(ToolControl control)
        {
            PopupWatcher.Release(window);

            activatorControl = control;
            var activatorPosition = control.activatorGuiPosition;

            activatorPosition.width = 330;
            UnityEditorDynamic.AddComponentWindow.Show(activatorPosition, targets);

#if UNITY_2019_1_OR_NEWER
            window = EditorWindow.focusedWindow;
#else
            window = UnityEditorDynamic.AddComponentWindow.s_AddComponentWindow;
#endif

            PopupWatcher.Watch(window);
        }
コード例 #4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (PeekPlugin.Configuration.enableReferenceInspector && !property.hasMultipleDifferentValues && property.objectReferenceValue != null)
            {
                Rect buttonPosition, fieldPosition;

                if (label != GUIContent.none)
                {
                    buttonPosition = new Rect
                                     (
                        position.x + EditorGUIUtility.labelWidth - IconSize.Small - 1,
                        position.y,
                        IconSize.Small,
                        IconSize.Small
                                     );

                    fieldPosition = position;
                }
                else
                {
                    buttonPosition = new Rect
                                     (
                        position.xMax - IconSize.Small,
                        position.y + 1,
                        IconSize.Small,
                        IconSize.Small
                                     );

                    fieldPosition = new Rect
                                    (
                        position.x,
                        position.y,
                        position.width - buttonPosition.width - 2,
                        position.height
                                    );
                }

                DefaultField(property, label, fieldPosition);

                var isActive = PopupWatcher.IsOpenOrJustClosed(lastPopup);

                var activatedButton = LudiqGUI.DropdownToggle(buttonPosition, isActive, LudiqGUIUtility.TempContent(PeekPlugin.Icons.propertyDrawer?[IconSize.Small]), GUIStyle.none);

                if (activatedButton && !isActive)
                {
                    PopupWatcher.Release(lastPopup);
                    lastPopup = null;

                    var targets = new[] { property.objectReferenceValue };
                    var activatorGuiPosition    = buttonPosition;
                    var activatorScreenPosition = LudiqGUIUtility.GUIToScreenRect(activatorGuiPosition);

                    if (e.IsContextMouseButton())
                    {
                        if (property.objectReferenceValue is GameObject go)
                        {
                            GameObjectContextMenu.Open(new[] { go }, activatorScreenPosition);
                        }
                        else
                        {
                            UnityObjectContextMenu.Open(targets, activatorGuiPosition);
                        }
                    }
                    else
                    {
                        lastPopup = EditorPopup.Open(targets, activatorScreenPosition);
                        PopupWatcher.Watch(lastPopup);
                    }
                }
            }
            else
            {
                DefaultField(property, label, position);
            }
        }
 public override void Open(ToolControl control)
 {
     PopupWatcher.Release(window);
     window = WarningWindow.Show(control.activatorScreenPosition);
     PopupWatcher.Watch(window);
 }