GetShaderVariantEntries() private method

private GetShaderVariantEntries ( Shader shader, ShaderVariantCollection skipAlreadyInCollection, int &types, string &keywords ) : void
shader UnityEngine.Shader
skipAlreadyInCollection UnityEngine.ShaderVariantCollection
types int
keywords string
return void
Exemplo n.º 1
0
 private void DisplayAddVariantsWindow(Shader shader, ShaderVariantCollection collection)
 {
     AddShaderVariantWindow.PopupData popupData = new AddShaderVariantWindow.PopupData();
     popupData.shader     = shader;
     popupData.collection = collection;
     string[] array;
     ShaderUtil.GetShaderVariantEntries(shader, collection, out popupData.types, out array);
     if (array.Length == 0)
     {
         EditorApplication.Beep();
     }
     else
     {
         popupData.keywords = new string[array.Length][];
         for (int i = 0; i < array.Length; i++)
         {
             popupData.keywords[i] = array[i].Split(new char[]
             {
                 ' '
             });
         }
         AddShaderVariantWindow.ShowAddVariantWindow(popupData);
         GUIUtility.ExitGUI();
     }
 }
Exemplo n.º 2
0
 private void DisplayAddVariantsMenu(Rect rect, Shader shader, ShaderVariantCollection collection)
 {
     ShaderVariantCollectionInspector.AddVariantMenuData addVariantMenuData = new ShaderVariantCollectionInspector.AddVariantMenuData();
     addVariantMenuData.shader     = shader;
     addVariantMenuData.collection = collection;
     ShaderUtil.GetShaderVariantEntries(shader, collection, out addVariantMenuData.types, out addVariantMenuData.keywords);
     if (addVariantMenuData.keywords.Length == 0)
     {
         EditorApplication.Beep();
         return;
     }
     string[] array = new string[addVariantMenuData.keywords.Length];
     for (int i = 0; i < addVariantMenuData.keywords.Length; i++)
     {
         array[i] = (PassType)addVariantMenuData.types[i] + "/" + ((!string.IsNullOrEmpty(addVariantMenuData.keywords[i])) ? addVariantMenuData.keywords[i] : "<no keywords>");
     }
     EditorUtility.DisplayCustomMenu(rect, array, null, new EditorUtility.SelectMenuItemFunction(this.AddVariantMenuSelected), addVariantMenuData);
 }
Exemplo n.º 3
0
 private void DisplayAddVariantsWindow(Shader shader, ShaderVariantCollection collection)
 {
     AddShaderVariantWindow.PopupData data = new AddShaderVariantWindow.PopupData();
     data.shader     = shader;
     data.collection = collection;
     string[] keywords;
     ShaderUtil.GetShaderVariantEntries(shader, collection, out data.types, out keywords);
     if (keywords.Length == 0)
     {
         EditorApplication.Beep();
     }
     else
     {
         data.keywords = new string[keywords.Length][];
         for (int index = 0; index < keywords.Length; ++index)
         {
             data.keywords[index] = keywords[index].Split(' ');
         }
         AddShaderVariantWindow.ShowAddVariantWindow(data);
         GUIUtility.ExitGUI();
     }
 }
        private void DisplayAddVariantsMenu(Rect rect, Shader shader, ShaderVariantCollection collection)
        {
            AddVariantMenuData userData = new AddVariantMenuData {
                shader     = shader,
                collection = collection
            };

            ShaderUtil.GetShaderVariantEntries(shader, collection, out userData.types, out userData.keywords);
            if (userData.keywords.Length == 0)
            {
                EditorApplication.Beep();
            }
            else
            {
                string[] options = new string[userData.keywords.Length];
                for (int i = 0; i < userData.keywords.Length; i++)
                {
                    options[i] = ((PassType)userData.types[i]) + "/" + (!string.IsNullOrEmpty(userData.keywords[i]) ? userData.keywords[i] : "<no keywords>");
                }
                EditorUtility.DisplayCustomMenu(rect, options, null, new EditorUtility.SelectMenuItemFunction(this.AddVariantMenuSelected), userData);
            }
        }
        // Show window to select shader variants
        void DisplayAddVariantsWindow(Shader shader, ShaderVariantCollection collection)
        {
            var data = new AddShaderVariantWindow.PopupData();

            data.shader     = shader;
            data.collection = collection;
            string[] keywordStrings;
            ShaderUtil.GetShaderVariantEntries(shader, collection, out data.types, out keywordStrings);
            if (keywordStrings.Length == 0)
            {
                // nothing available to add
                EditorApplication.Beep();
                return;
            }

            data.keywords = new string[keywordStrings.Length][];
            for (var i = 0; i < keywordStrings.Length; ++i)
            {
                data.keywords[i] = keywordStrings[i].Split(' ');
            }
            AddShaderVariantWindow.ShowAddVariantWindow(data);
            GUIUtility.ExitGUI();
        }
 private void DisplayAddVariantsWindow(Shader shader, ShaderVariantCollection collection)
 {
     string[] strArray;
     AddShaderVariantWindow.PopupData data = new AddShaderVariantWindow.PopupData {
         shader     = shader,
         collection = collection
     };
     ShaderUtil.GetShaderVariantEntries(shader, collection, out data.types, out strArray);
     if (strArray.Length == 0)
     {
         EditorApplication.Beep();
     }
     else
     {
         data.keywords = new string[strArray.Length][];
         for (int i = 0; i < strArray.Length; i++)
         {
             char[] separator = new char[] { ' ' };
             data.keywords[i] = strArray[i].Split(separator);
         }
         AddShaderVariantWindow.ShowAddVariantWindow(data);
         GUIUtility.ExitGUI();
     }
 }