Show() public static method

Show a popup with the given PopupWindowContent.

public static Show ( Rect activatorRect, PopupWindowContent windowContent ) : void
activatorRect UnityEngine.Rect The rect of the button that opens the popup.
windowContent PopupWindowContent The content to show in the popup window.
return void
示例#1
0
        void ShowSettingsWindow()
        {
            var rect = EditorWindow.focusedWindow.position;

            rect.xMin = rect.width - SettingsMixturePopupWindow.width;
            rect.yMin = 21;
            rect.size = Vector2.zero;
            PopupWindow.Show(rect, new SettingsMixturePopupWindow(graphView));
        }
        internal static void DoPickProxyPresetButton(MARSEntity childEntity, Rect rect)
        {
            PopupWindow.Show(rect, new ChangeProxyWindow(childEntity));

            EditorEvents.RulesUiUsed.Send(new RuleUiArgs
            {
                label = k_PickProxyPresetButtonAnalyticsLabel
            });
        }
示例#3
0
        void ShowImproveMixtureWindow()
        {
            var rect = EditorWindow.focusedWindow.position;

            rect.xMin = rect.width - ImproveMixturePopupWindow.width;
            rect.yMin = 21;
            rect.size = Vector2.zero;
            PopupWindow.Show(rect, new ImproveMixturePopupWindow());
        }
            public void Show(Rect rect, string currentValue, IEnumerable <Item> items)
            {
                m_CurrentActiveValue = currentValue;

                m_Items.Clear();
                m_Items.AddRange(items);

                m_Size = new Vector2(rect.width, 225);
                PopupWindow.Show(rect, this);
            }
示例#5
0
        void PrefabFamilyButton()
        {
            if (EditorGUILayout.DropdownButton(GUIContent.none, FocusType.Passive, GUILayout.MaxWidth(Styles.kHierarchyIconWidth)))
            {
                if (!PrefabFamilyPopup.isOpen)
                {
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), new PrefabFamilyPopup((GameObject)assetTarget));
                }
                GUIUtility.ExitGUI();
            }
            var rect = new Rect(GUILayoutUtility.topLevel.GetLast());

            rect.x += 6;
            EditorGUI.LabelField(rect, Styles.hierarchyIcon);
        }
示例#6
0
 private void EditExistingItem(Rect itemRect, int index)
 {
     if (this.m_ModifyItemUI != null)
     {
         itemRect.y -= itemRect.height;
         itemRect.x += itemRect.width;
         this.m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Edit, this.m_ItemProvider.GetItem(index), delegate(object obj)
         {
             this.ClearCachedWidth();
             this.m_ItemProvider.Replace(index, obj);
             EditorApplication.RequestRepaintAllViews();
         });
         PopupWindow.Show(itemRect, this.m_ModifyItemUI, null, ShowMode.PopupMenuWithKeyboardFocus);
     }
 }
        public void DrawDropdown()
        {
            var dropdownRect        = new Rect(130, 0, 40, 22);
            var hasConnectedDevices = m_LinkConnections.Any(c => c.Status == LiveLinkConnectionStatus.Connected);
            var icon = hasConnectedDevices ? Icons.LiveLinkOn : Icons.LiveLink;

            icon.tooltip = hasConnectedDevices
                ? "View linked devices."
                : "No devices currently linked. Create a Live Link build to connect a device.";

            if (EditorGUI.DropdownButton(dropdownRect, icon, FocusType.Keyboard, LiveLinkStyles.Dropdown))
            {
                PopupWindow.Show(dropdownRect, this);
            }
        }
        private void ShowCompiledCodeButton(Shader s)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PrefixLabel("Compiled code", EditorStyles.miniButton);
            bool flag = (bool)sutilHasShaderSnippets.Invoke(null, new object[] { s }) ||
                        (bool)sutilHasSurfaceShaders.Invoke(null, new object[] { s });

            if (flag)
            {
                GUIContent showCurrent = Styles.showCurrent;
                Rect       rect        = GUILayoutUtility.GetRect(showCurrent, EditorStyles.miniButton, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(false)
                });
                Rect position = new Rect(rect.xMax - 16f, rect.y, 16f, rect.height);
                bool mDown    = false;
                if (editorGUIMouseButtonDown != null)
                {
                    mDown =
                        (bool)
                        editorGUIMouseButtonDown.Invoke(null,
                                                        new object[] { position, GUIContent.none, FocusType.Passive, GUIStyle.none });
                }
                if (mDown /*EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none)*/)
                {
                    Rect last = (Rect)guilayoutgroupGetLast.Invoke(guiLayoutUtilityTopLevel.GetValue(null, null), null);
                    //GUILayoutUtility.topLevel.GetLast();
                    PopupWindow.Show(last, (PopupWindowContent)newSipp.Invoke(null, new object[] { s }));
                    GUIUtility.ExitGUI();
                }
                if (GUI.Button(rect, showCurrent, EditorStyles.miniButton))
                {
                    sutilOpenCompiledShader.Invoke(null,
                                                   new object[]
                    {
                        s, sippCurrentMode.GetValue(null, null), sippCurrentPlatformMask.GetValue(null, null),
                        (int)sippCurrentVariantStripping.GetValue(null, null) == 0
                    });
                    //ShaderUtil.OpenCompiledShader( s, sippCurrentMode.GetValue( null, null ), sippCurrentPlatformMask.GetValue( null, null ), (int)sippCurrentVariantStripping.GetValue( null, null ) == 0 );
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                GUILayout.Button("none (fixed function shader)", GUI.skin.label, new GUILayoutOption[0]);
            }
            EditorGUILayout.EndHorizontal();
        }
        public void OnGUI(float x, float y)
        {
            using (new EditorGUI.DisabledScope(!ManagedDebugger.isEnabled))
            {
                var codeOptimization = CompilationPipeline.codeOptimization;
                var debuggerAttached = ManagedDebugger.isAttached;
                var debuggerContent  = GetDebuggerContent(debuggerAttached, codeOptimization);
                var buttonArea       = new Rect(x + k_MarginX, y + k_MarginY, k_Width, k_Height);

                if (EditorGUI.DropdownButton(buttonArea, debuggerContent, FocusType.Passive, EditorStyles.toolbarDropDown))
                {
                    PopupWindow.Show(buttonArea, new ManagedDebuggerWindow(codeOptimization), m_PopupLocation);
                    GUIUtility.ExitGUI();
                }
            }
        }
示例#10
0
        public void DrawDropdown()
        {
            var dropdownRect = new Rect(130, 0, 40, 22);

            var target = LiveLinkBuildSettings.CurrentLiveLinkBuildSettings?.GetComponent <ClassicBuildProfile>().Target ?? BuildTarget.NoTarget;
            var icon   = Icons.Platform.GetIcon(target) ?? Icons.BuildSettingsDropdownDefaultIcon;

            icon.tooltip = LiveLinkBuildSettings.CurrentLiveLinkBuildSettings != null
                    ? $"Current Live Link build settings: {Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(LiveLinkBuildSettings.CurrentLiveLinkBuildSettings))}."
                    : "Set current Live Link build settings.";

            if (EditorGUI.DropdownButton(dropdownRect, icon, FocusType.Keyboard, LiveLinkStyles.Dropdown))
            {
                PopupWindow.Show(dropdownRect, this);
            }
        }
示例#11
0
        public void OnLabelGUI(Object[] assets)
        {
            InitLabelCache(assets);

            // For the label list as a whole
            // The previous layouting means we've already lost a pixel to the left and couple at the top, so it is an attempt at horizontal padding: 3, verical padding: 5
            // (the rounded sides of labels makes this look like the horizontal and vertical padding is the same)
            float leftPadding   = 1.0f;
            float rightPadding  = 2.0f;
            float topPadding    = 3.0f;
            float bottomPadding = 5.0f;

            GUIStyle labelButton = EditorStyles.assetLabelIcon;

            float buttonWidth = labelButton.margin.left + labelButton.fixedWidth + rightPadding;

            // Assumes we are already in a vertical layout
            GUILayout.Space(topPadding);

            // Create a rect to test how wide the label list can be
            Rect widthProbeRect = GUILayoutUtility.GetRect(0, 10240, 0, 0);

            widthProbeRect.width -= buttonWidth; // reserve some width for the button

            EditorGUILayout.BeginHorizontal();

            // Left padding
            GUILayoutUtility.GetRect(leftPadding, leftPadding, 0, 0);

            // Draw labels (fully selected)
            DrawLabelList(false, widthProbeRect.xMax);

            // Draw labels (partially selected)
            DrawLabelList(true, widthProbeRect.xMax);

            GUILayout.FlexibleSpace();

            Rect r = GUILayoutUtility.GetRect(labelButton.fixedWidth, labelButton.fixedWidth, labelButton.fixedHeight + bottomPadding, labelButton.fixedHeight + bottomPadding);

            r.x = widthProbeRect.xMax + labelButton.margin.left;
            if (EditorGUI.DropdownButton(r, GUIContent.none, FocusType.Passive, labelButton))
            {
                PopupWindow.Show(r, new PopupList(m_AssetLabels), null, ShowMode.PopupMenuWithKeyboardFocus);
            }

            EditorGUILayout.EndHorizontal();
        }
示例#12
0
        public void OnGUI()
        {
            using (new EditorGUI.DisabledScope(!ManagedDebugger.isEnabled))
            {
                var codeOptimization = CompilationPipeline.codeOptimization;
                var debuggerAttached = ManagedDebugger.isAttached;
                var content          = GetDebuggerContent(debuggerAttached, codeOptimization);

                var style = AppStatusBar.Styles.statusIcon;
                var rect  = GUILayoutUtility.GetRect(content, style);
                if (GUI.Button(rect, content, style))
                {
                    PopupWindow.Show(rect, new ManagedDebuggerWindow(codeOptimization), m_PopupLocation);
                    GUIUtility.ExitGUI();
                }
            }
        }
示例#13
0
        // Compiled shader code button+dropdown
        private void ShowCompiledCodeButton(Shader s)
        {
            EditorGUILayout.BeginVertical();
            ShaderImporter importer             = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(s.GetInstanceID())) as ShaderImporter;
            bool           enablePreprocessOnly = EditorSettings.cachingShaderPreprocessor;

            if (importer && importer.preprocessorOverride == PreprocessorOverride.ForceCachingPreprocessor)
            {
                enablePreprocessOnly = true;
            }
            using (new EditorGUI.DisabledScope(!enablePreprocessOnly))
                s_PreprocessOnly = EditorGUILayout.Toggle(Styles.togglePreprocess, s_PreprocessOnly);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Compiled code", EditorStyles.miniButton);

            var hasCode = ShaderUtil.HasShaderSnippets(s) || ShaderUtil.HasSurfaceShaders(s) || ShaderUtil.HasFixedFunctionShaders(s);

            if (hasCode)
            {
                // button with a drop-down part on the right
                var modeContent  = Styles.showCurrent;
                var modeRect     = GUILayoutUtility.GetRect(modeContent, EditorStyles.miniButton, GUILayout.ExpandWidth(false));
                var modeDropRect = new Rect(modeRect.xMax - 16, modeRect.y, 16, modeRect.height);
                if (EditorGUI.DropdownButton(modeDropRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    PopupWindow.Show(rect, new ShaderInspectorPlatformsPopup(s));
                    GUIUtility.ExitGUI();
                }
                if (GUI.Button(modeRect, modeContent, EditorStyles.miniButton))
                {
                    ShaderUtil.OpenCompiledShader(s, ShaderInspectorPlatformsPopup.currentMode, ShaderInspectorPlatformsPopup.currentPlatformMask, ShaderInspectorPlatformsPopup.currentVariantStripping == 0, enablePreprocessOnly && s_PreprocessOnly);
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                // Note: PrefixLabel is sometimes buggy if followed by a non-control (like Label).
                // We just want to show a label here, but have to pretend it's a button so it is treated like
                // a control.
                GUILayout.Button("none (precompiled shader)", GUI.skin.label);
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
示例#14
0
        public void OnGUI(float x, float y)
        {
            GUILayout.BeginVertical();
            EditorGUILayout.Space();

            var statusContent = GetStatusContent();
            var buttonArea    = new Rect(x + k_MarginX, y + k_MarginY, k_Width, k_Height);

            if (EditorGUI.DropdownButton(buttonArea, statusContent, FocusType.Passive, EditorStyles.toolbarDropDown))
            {
                PopupWindow.Show(buttonArea, new CacheServerWindow(), m_PopupLocation);
                GUIUtility.ExitGUI();
            }

            EditorGUILayout.Space();
            GUILayout.EndVertical();
        }
        private void ShowKeywords(Shader s)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Keywords", EditorStyles.miniButton);

            Rect buttonRect = GUILayoutUtility.GetRect(Styles.arrayValuePopupButton, GUI.skin.button, GUILayout.MinWidth(kValueFieldWidth));

            buttonRect.width = kArrayValuePopupBtnWidth;
            if (GUI.Button(buttonRect, Styles.arrayValuePopupButton, EditorStyles.miniButton))
            {
                var globalKeywords = ShaderUtilEx.GetShaderGlobalKeywords(s);
                var localKeywords  = ShaderUtilEx.GetShaderLocalKeywords(s);
                PopupWindow.Show(buttonRect, new KeywordsPopup(globalKeywords, localKeywords, 150.0f));
            }

            EditorGUILayout.EndHorizontal();
        }
示例#16
0
        internal static void GameViewSizePopup(Rect buttonRect, GameViewSizeGroupType groupType, int selectedIndex, IGameViewSizeMenuUser gameView, GUIStyle guiStyle)
        {
            var group = GameViewSizes.instance.GetGroup(groupType);
            var text  = "";

            if (selectedIndex >= 0 && selectedIndex < group.GetTotalCount())
            {
                text = group.GetGameViewSize(selectedIndex).displayText;
            }

            if (EditorGUI.DropdownButton(buttonRect, GUIContent.Temp(text), FocusType.Passive, guiStyle))
            {
                var menuData     = new GameViewSizesMenuItemProvider(groupType);
                var flexibleMenu = new GameViewSizeMenu(menuData, selectedIndex, new GameViewSizesMenuModifyItemUI(), gameView);
                PopupWindow.Show(buttonRect, flexibleMenu);
            }
        }
示例#17
0
        private void DoActiveTargetsGUI()
        {
            bool hasPaintTarget = GridPaintingState.scenePaintTarget != null;

            using (new EditorGUI.DisabledScope(!hasPaintTarget || GridPaintingState.validTargets == null))
            {
                GUILayout.Label(Styles.activeTargetLabel, GUILayout.Width(k_ActiveTargetLabelWidth));
                GUIContent content = GUIContent.Temp(hasPaintTarget ? GridPaintingState.scenePaintTarget.name : "Nothing");
                if (EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.popup, GUILayout.Width(k_ActiveTargetDropdownWidth)))
                {
                    int index        = hasPaintTarget ? Array.IndexOf(GridPaintingState.validTargets, GridPaintingState.scenePaintTarget) : 0;
                    var menuData     = new GridPaintTargetsDropdown.MenuItemProvider();
                    var flexibleMenu = new GridPaintTargetsDropdown(menuData, index, null, SelectTarget, k_ActiveTargetDropdownWidth);
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), flexibleMenu);
                }
            }
        }
示例#18
0
 private void CreateNewItemButton(Rect itemRect)
 {
     if (this.m_ModifyItemUI != null)
     {
         Rect position = new Rect(itemRect.x + 25f, itemRect.y, 15f, 15f);
         if (GUI.Button(position, s_Styles.plusButtonText, "OL Plus"))
         {
             position.y -= 15f;
             this.m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Add, this.m_ItemProvider.Create(), delegate(object obj) {
                 this.ClearCachedWidth();
                 int index = this.m_ItemProvider.Add(obj);
                 this.SelectItem(index);
                 EditorApplication.RequestRepaintAllViews();
             });
             PopupWindow.Show(position, this.m_ModifyItemUI);
         }
     }
 }
示例#19
0
        void EditExistingItem(Rect itemRect, int index)
        {
            if (m_ModifyItemUI == null)
            {
                return;
            }

            itemRect.y -= itemRect.height;
            itemRect.x += itemRect.width;
            m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Edit, m_ItemProvider.GetItem(index),
                                delegate(object obj)
            {
                ClearCachedWidth();
                m_ItemProvider.Replace(index, obj);
                EditorApplication.RequestRepaintAllViews();     // We want to repaint the flexible menu (currently in modifyItemUI)
            });
            PopupWindow.Show(itemRect, m_ModifyItemUI, null, ShowMode.PopupMenuWithKeyboardFocus);
        }
示例#20
0
        // Compiled shader code button+dropdown
        private void ShowCompiledCodeButton(Shader s)
        {
            if (!m_PreprocessOnlyAvailableInitialized)
            {
                UpdatePreprocessOnlyAvailability();
            }

            EditorGUILayout.BeginVertical();
            using (new EditorGUI.DisabledScope(!m_PreprocessOnlyAvailable))
                m_PreprocessOnly = EditorGUILayout.Toggle(Styles.togglePreprocess, m_PreprocessOnly);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Compiled code", EditorStyles.miniButton);

            var hasCode = ShaderUtil.HasShaderSnippets(s) || ShaderUtil.HasSurfaceShaders(s) || ShaderUtil.HasFixedFunctionShaders(s);

            if (hasCode)
            {
                // button with a drop-down part on the right
                var modeContent  = Styles.showCurrent;
                var modeRect     = GUILayoutUtility.GetRect(modeContent, EditorStyles.miniButton, GUILayout.ExpandWidth(false));
                var modeDropRect = new Rect(modeRect.xMax - 16, modeRect.y, 16, modeRect.height);
                if (EditorGUI.DropdownButton(modeDropRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    PopupWindow.Show(rect, new ShaderInspectorPlatformsPopup(s));
                    GUIUtility.ExitGUI();
                }
                if (GUI.Button(modeRect, modeContent, EditorStyles.miniButton))
                {
                    ShaderUtil.OpenCompiledShader(s, ShaderInspectorPlatformsPopup.currentMode, ShaderInspectorPlatformsPopup.currentPlatformMask, ShaderInspectorPlatformsPopup.currentVariantStripping == 0, m_PreprocessOnly);
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                // Note: PrefixLabel is sometimes buggy if followed by a non-control (like Label).
                // We just want to show a label here, but have to pretend it's a button so it is treated like
                // a control.
                GUILayout.Button("none (precompiled shader)", GUI.skin.label);
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
示例#21
0
 private void EditExistingItem(Rect itemRect, int index)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     FlexibleMenu.\u003CEditExistingItem\u003Ec__AnonStorey78 itemCAnonStorey78 = new FlexibleMenu.\u003CEditExistingItem\u003Ec__AnonStorey78();
     // ISSUE: reference to a compiler-generated field
     itemCAnonStorey78.index = index;
     // ISSUE: reference to a compiler-generated field
     itemCAnonStorey78.\u003C\u003Ef__this = this;
     if (this.m_ModifyItemUI == null)
     {
         return;
     }
     itemRect.y -= itemRect.height;
     itemRect.x += itemRect.width;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     this.m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Edit, this.m_ItemProvider.GetItem(itemCAnonStorey78.index), new System.Action <object>(itemCAnonStorey78.\u003C\u003Em__114));
     PopupWindow.Show(itemRect, (PopupWindowContent)this.m_ModifyItemUI);
 }
示例#22
0
        private void CreateNewItemButton(Rect itemRect)
        {
            if (this.m_ModifyItemUI == null)
            {
                return;
            }
            Rect rect = new Rect(itemRect.x + 25f, itemRect.y, 15f, 15f);

            if (!GUI.Button(rect, FlexibleMenu.s_Styles.plusButtonText, (GUIStyle)"OL Plus"))
            {
                return;
            }
            rect.y -= 15f;
            this.m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Add, this.m_ItemProvider.Create(), (System.Action <object>)(obj =>
            {
                this.ClearCachedWidth();
                this.SelectItem(this.m_ItemProvider.Add(obj));
                EditorApplication.RequestRepaintAllViews();
            }));
            PopupWindow.Show(rect, (PopupWindowContent)this.m_ModifyItemUI);
        }
示例#23
0
        private void DrawLabelList(bool partiallySelected, float xMax)
        {
            GUIStyle labelStyle = partiallySelected ? EditorStyles.assetLabelPartial : EditorStyles.assetLabel;
            Event    evt        = Event.current;

            foreach (GUIContent content in (from i in m_AssetLabels.m_ListElements where (partiallySelected ? i.partiallySelected : i.selected) orderby i.text.ToLower() select i.m_Content).Take(s_MaxShownLabels))
            {
                Rect rt = GUILayoutUtility.GetRect(content, labelStyle);
                if (Event.current.type == EventType.Repaint && rt.xMax >= xMax)
                {
                    break;
                }
                GUI.Label(rt, content, labelStyle);
                if (rt.xMax <= xMax && evt.type == EventType.MouseDown && rt.Contains(evt.mousePosition) && evt.button == 0 && GUI.enabled)
                {
                    evt.Use();
                    rt.x = xMax;
                    PopupWindow.Show(rt, new PopupList(m_AssetLabels, content.text), null, ShowMode.PopupMenuWithKeyboardFocus);
                }
            }
        }
示例#24
0
 private void PresetDropDown(Rect rect)
 {
     if (EditorGUI.DropdownButton(rect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText))
     {
         if (this.m_Curve != null)
         {
             if (this.m_CurvePresets == null)
             {
                 Debug.LogError("Curve presets error");
             }
             else
             {
                 this.ValidateCurveLibraryTypeAndScale();
                 AnimationCurve animationCurve = new AnimationCurve(this.GetNormalizedKeys(this.m_Curve.keys));
                 animationCurve.postWrapMode             = this.m_Curve.postWrapMode;
                 animationCurve.preWrapMode              = this.m_Curve.preWrapMode;
                 this.m_CurvePresets.curveToSaveAsPreset = animationCurve;
                 PopupWindow.Show(rect, this.m_CurvePresets);
             }
         }
     }
 }
        private void ShowCompiledCodeButton(Shader s)
        {
#if UNITY_2020_1_OR_NEWER
            using (new EditorGUI.DisabledScope(!EditorSettings.cachingShaderPreprocessor))
                s_PreprocessOnly = EditorGUILayout.Toggle(Styles.togglePreprocess, s_PreprocessOnly);
#endif
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PrefixLabel("Compiled code", EditorStyles.miniButton);
            bool hasCode = ShaderUtilEx.HasShaderSnippets(s) || ShaderUtilEx.HasSurfaceShaders(s) || ShaderUtilEx.HasFixedFunctionShaders(s);
            if (hasCode)
            {
                GUIContent showCurrent = Styles.showCurrent;
                Rect       rect        = GUILayoutUtility.GetRect(showCurrent, EditorStyles.miniButton, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(false)
                });
                Rect position = new Rect(rect.xMax - 16f, rect.y, 16f, rect.height);
                if (EditorGUIEx.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
                {
                    Rect last = GUILayoutUtilityEx.TopLevel_GetLast();
                    PopupWindow.Show(last, (PopupWindowContent)Activator.CreateInstance(System.Type.GetType("UnityEditor.ShaderInspectorPlatformsPopup, UnityEditor"), new object[] { s }));
                    GUIUtility.ExitGUI();
                }
                if (GUI.Button(rect, showCurrent, EditorStyles.miniButton))
                {
#if UNITY_2020_1_OR_NEWER
                    ShaderUtilEx.OpenCompiledShader(s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0, s_PreprocessOnly);
#else
                    ShaderUtilEx.OpenCompiledShader(s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0);
#endif
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                GUILayout.Button("none (precompiled shader)", GUI.skin.label, new GUILayoutOption[0]);
            }
            EditorGUILayout.EndHorizontal();
        }
示例#26
0
        private void DoActiveTargetsGUI()
        {
            bool flag = GridPaintingState.scenePaintTarget != null;

            using (new EditorGUI.DisabledScope(!flag || GridPaintingState.validTargets == null))
            {
                GUILayout.Label(GridPaintPaletteWindow.Styles.activeTargetLabel, new GUILayoutOption[]
                {
                    GUILayout.Width(90f)
                });
                GUIContent content = GUIContent.Temp((!flag) ? "Nothing" : GridPaintingState.scenePaintTarget.name);
                if (EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.popup, new GUILayoutOption[]
                {
                    GUILayout.Width(130f)
                }))
                {
                    int selectionIndex = (!flag) ? 0 : Array.IndexOf <GameObject>(GridPaintingState.validTargets, GridPaintingState.scenePaintTarget);
                    GridPaintTargetsDropdown.MenuItemProvider itemProvider = new GridPaintTargetsDropdown.MenuItemProvider();
                    GridPaintTargetsDropdown windowContent = new GridPaintTargetsDropdown(itemProvider, selectionIndex, null, new Action <int, object>(this.SelectTarget), 130f);
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), windowContent);
                }
            }
        }
示例#27
0
        void CreateNewItemButton(Rect itemRect)
        {
            if (m_ModifyItemUI == null)
            {
                return;
            }

            Rect plusRect = new Rect(itemRect.x + leftMargin, itemRect.y, 15, 15);

            if (GUI.Button(plusRect, s_Styles.plusButtonText, "OL Plus"))
            {
                plusRect.y -= 15f;
                m_ModifyItemUI.Init(FlexibleMenuModifyItemUI.MenuType.Add, m_ItemProvider.Create(),
                                    delegate(object obj)
                {
                    ClearCachedWidth();
                    int newIndex = m_ItemProvider.Add(obj);
                    SelectItem(newIndex);
                    EditorApplication.RequestRepaintAllViews();     // We want to repaint the flexible menu (currently in modifyItemUI)
                });
                PopupWindow.Show(plusRect, m_ModifyItemUI, null, ShowMode.PopupMenuWithKeyboardFocus);
            }
        }
示例#28
0
        private void DoPalettesDropdown()
        {
            string name = palette != null ? palette.name : Styles.createNewPalette.text;
            Rect   rect = GUILayoutUtility.GetRect(GUIContent.Temp(name), EditorStyles.toolbarDropDown, GUILayout.Width(k_DropdownWidth));

            if (GridPalettes.palettes.Count == 0)
            {
                if (EditorGUI.DropdownButton(rect, GUIContent.Temp(name), FocusType.Passive, EditorStyles.toolbarDropDown))
                {
                    OpenAddPalettePopup(rect);
                }
            }
            else
            {
                GUIContent content = GUIContent.Temp(GridPalettes.palettes.Count > 0 && palette != null ? palette.name : Styles.createNewPalette.text);
                if (EditorGUI.DropdownButton(rect, content, FocusType.Passive, EditorStyles.toolbarPopup))
                {
                    var menuData = new GridPalettesDropdown.MenuItemProvider();
                    m_PaletteDropdown = new GridPalettesDropdown(menuData, GridPalettes.palettes.IndexOf(palette), null, SelectPalette, k_DropdownWidth);
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), m_PaletteDropdown);
                }
            }
        }
        void PresetDropDown(Rect rect)
        {
            if (EditorGUI.DropdownButton(rect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText))
            {
                if (m_Curve != null)
                {
                    if (m_CurvePresets == null)
                    {
                        Debug.LogError("Curve presets error");
                        return;
                    }

                    ValidateCurveLibraryTypeAndScale();

                    AnimationCurve copy = new AnimationCurve(GetNormalizedKeys(m_Curve.keys));
                    copy.postWrapMode = m_Curve.postWrapMode;
                    copy.preWrapMode  = m_Curve.preWrapMode;

                    m_CurvePresets.curveToSaveAsPreset = copy;
                    PopupWindow.Show(rect, m_CurvePresets);
                }
            }
        }
示例#30
0
        private void DrawLabelList(bool partiallySelected, float xMax)
        {
            GUIStyle style   = (!partiallySelected) ? EditorStyles.assetLabel : EditorStyles.assetLabelPartial;
            Event    current = Event.current;

            foreach (GUIContent current2 in (from i in this.m_AssetLabels.m_ListElements
                                             where (!partiallySelected) ? i.selected : i.partiallySelected
                                             orderby i.text.ToLower()
                                             select i.m_Content).Take(LabelGUI.s_MaxShownLabels))
            {
                Rect rect = GUILayoutUtility.GetRect(current2, style);
                if (Event.current.type == EventType.Repaint && rect.xMax >= xMax)
                {
                    break;
                }
                GUI.Label(rect, current2, style);
                if (rect.xMax <= xMax && current.type == EventType.MouseDown && rect.Contains(current.mousePosition) && current.button == 0 && GUI.enabled)
                {
                    current.Use();
                    rect.x = xMax;
                    PopupWindow.Show(rect, new PopupList(this.m_AssetLabels, current2.text));
                }
            }
        }