/// <summary>
 /// Inspector GUI shown in the Editor window.
 /// </summary>
 /// <param name="brushSettings"></param>
 internal virtual void DrawGUI(BrushSettings brushSettings)
 {
     if (PolyGUILayout.HeaderWithDocsLink(PolyGUI.TempContent(ModeSettingsHeader, "")))
     {
         Application.OpenURL(DocsLink);
     }
 }
        internal void OnGUI()
        {
            using (new GUILayout.VerticalScope("box"))
            {
                if (PolyGUILayout.HeaderWithDocsLink(Styles.headerLabel))
                {
                    Application.OpenURL(PrefUtility.documentationBrushMirroringLink);
                }

                using (new GUILayout.HorizontalScope())
                {
                    EditorGUI.BeginChangeCheck();
                    s_MirrorAxes.value  = (BrushMirror)PolyGUILayout.BitMaskField((uint)s_MirrorAxes.value, Styles.axesNameArray, Styles.axesFieldTooltip);
                    s_MirrorSpace.value = (MirrorCoordinateSpace)GUILayout.Toolbar((int)s_MirrorSpace.value, Styles.mirrorSpaces);
                    if (EditorGUI.EndChangeCheck())
                    {
                        PolybrushSettings.Save();
                        RefreshSettings();
                    }
                }
            }
        }
Esempio n. 3
0
        void DrawBrushSettings()
        {
            // Brush preset selector
            using (new GUILayout.VerticalScope("box"))
            {
                // Show the settings header in PolyEditor so that the preset selector can be included in the block.
                // Can't move preset selector to BrushSettingsEditor because it's a CustomEditor for BrushSettings,
                // along with other issues.
                if (PolyGUILayout.HeaderWithDocsLink(PolyGUI.TempContent("Brush Settings")))
                {
                    Application.OpenURL(PrefUtility.documentationBrushSettingsLink);
                }

                using (new GUILayout.HorizontalScope())
                {
                    EditorGUI.BeginChangeCheck();

                    m_CurrentBrushIndex = EditorGUILayout.Popup(m_CurrentBrushIndex, m_AvailableBrushesStrings, "Popup");

                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_CurrentBrushIndex >= m_AvailableBrushes.Count)
                        {
                            SetBrushSettings(BrushSettingsEditor.AddNew(brushSettings));
                        }
                        else
                        {
                            SetBrushSettings(m_AvailableBrushes[m_CurrentBrushIndex]);
                        }
                    }

                    if (GUILayout.Button(m_GCSaveBrushSettings, GUILayout.Width(40)))
                    {
                        if (brushSettings != null && brushSettingsAsset != null)
                        {
                            // integer 0, 1 or 2 corresponding to ok, cancel and alt buttons
                            int res = EditorUtility.DisplayDialogComplex("Save Brush Settings", "Overwrite brush preset, or Create a New brush preset? ", "Overwrite", "Create New", "Cancel");

                            if (res == 0)
                            {
                                brushSettings.CopyTo(brushSettingsAsset);
                                EditorGUIUtility.PingObject(brushSettingsAsset);
                            }
                            else if (res == 1)
                            {
                                BrushSettings dup = BrushSettingsEditor.AddNew(brushSettings);
                                SetBrushSettings(dup);
                                EditorGUIUtility.PingObject(brushSettingsAsset);
                            }
                        }
                        else
                        {
                            Debug.LogWarning("Something went wrong saving brush settings.");
                        }
                    }
                }
                EditorGUI.BeginChangeCheck();

                brushEditor.OnInspectorGUI();
            }
        }