示例#1
0
        /// <summary>
        /// Builds the portion of the GUI that displays details about individual materials.
        /// </summary>
        private void BuildMaterialsGUI()
        {
            materialsLayout.Clear();

            materialParams.Clear();
            materialVariations.Clear();
            if (materials != null && materials.Length > 0)
            {
                for (int i = 0; i < materials.Length; i++)
                {
                    string suffix = "";
                    if (materials.Length > 1)
                    {
                        suffix = " (" + i + ")";
                    }

                    materialsLayout.AddSpace(10);
                    GUIToggle foldout = new GUIToggle(new LocEdString("Material parameters" + suffix), EditorStyles.Foldout);

                    materialsLayout.AddElement(foldout);
                    GUILayoutY materialLayout = materialsLayout.AddLayoutY();

                    string tag = "Material" + i + "_Expanded";
                    foldout.OnToggled += x =>
                    {
                        materialLayout.Active = x;
                        Persistent.SetBool(tag, x);
                    };

                    materialLayout.Active = Persistent.GetBool(tag);

                    Material material = materials[i].Value;
                    if (material == null)
                    {
                        materialParams.Add(new MaterialParamGUI[0]);
                        continue;
                    }

                    MaterialVariationGUI variationGUI = new MaterialVariationGUI(material, materialLayout);
                    materialVariations.Add(variationGUI);

                    MaterialParamGUI[] matParams = MaterialInspector.CreateMaterialGUI(material,
                                                                                       "materialParams[" + i + "]", null, materialLayout);
                    materialParams.Add(matParams);
                }
            }
        }
        /// <summary>
        /// Builds the portion of the GUI that displays details about individual materials.
        /// </summary>
        private void BuildMaterialsGUI()
        {
            materialsLayout.Clear();

            materialParams.Clear();
            if (materials != null)
            {
                for (int i = 0; i < materials.Length; i++)
                {
                    Material material = materials[i].Value;
                    if (material == null)
                    {
                        materialParams.Add(new MaterialParamGUI[0]);
                        continue;
                    }

                    materialsLayout.AddSpace(10);

                    MaterialParamGUI[] matParams = MaterialInspector.CreateMaterialGUI(material, materialsLayout);
                    materialParams.Add(matParams);
                }
            }
        }