예제 #1
0
 //draws presets if exists
 public void drawPresets(MaterialProperty[] props, Material[] materials)
 {
     if (hasPresets && presetsLoaded)
     {
         int pressetPreset = EditorGUILayout.Popup(selectedPreset, presetOptions, GUILayout.MaxWidth(100));
         if (pressetPreset != selectedPreset)
         {
             ;
             if (pressetPreset < presetOptions.Length - 2)
             {
                 applyPreset(presetOptions[pressetPreset], props, materials);
             }
             if (pressetPreset == presetOptions.Length - 2)
             {
                 PresetEditor.open();
             }
         }
         if (pressetPreset == presetOptions.Length - 1)
         {
             selectedPreset = pressetPreset;
         }
         else
         {
             selectedPreset = 0;
         }
         if (pressetPreset == presetOptions.Length - 1)
         {
             drawNewPreset(props, materials);
         }
     }
     else if (hasPresets && !presetsLoaded)
     {
         GUILayout.Label("Presets File Missing");
     }
 }
예제 #2
0
            void OnGUI()
            {
                GUILayout.Label(Locale.editor.Get("presets"), EditorStyles.boldLabel);

                if (GUILayout.Button(Locale.editor.Get("manage_presets")))
                {
                    PresetEditor.open();
                }
                presetHandler.drawNewPreset();

                float listMaxHeight = this.position.height - 30;

                scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.MaxHeight(listMaxHeight));
                for (int i = 0; i < presetHandler.presetOptions.Length; i++)
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(Locale.editor.Get("apply_preset")))
                    {
                        presetHandler.applyPreset(presetHandler.presetOptions[i], presetHandler.props, presetHandler.materials);
                    }
                    EditorGUILayout.LabelField(presetHandler.presetOptions[i]);
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
                if (GUI.Button(new Rect(0, this.position.height - 30, this.position.width, 30), "Close"))
                {
                    this.Close();
                }
            }
예제 #3
0
        static void Init()
        {
            setupStyle();
            // Get existing open window or if none, make a new one:
            PresetEditor window = (PresetEditor)EditorWindow.GetWindow(typeof(PresetEditor));

            window.Show();
            window.loadActiveShader();
        }
예제 #4
0
 public static void open()
 {
     PresetEditor.Init();
 }