コード例 #1
0
        /// <summary>
        /// Turns on a section, setting it's index to the best number
        /// </summary>
        /// <param name="sectionVariable">The section to turn on</param>
        public void TurnOnSection(object sectionVariable)
        {
            OrderedSection section = (OrderedSection)sectionVariable;

            section.SetIndexNumber(753);
            section.OnAdd();
        }
コード例 #2
0
        /// <summary>
        /// Checks if a section disabled on at least one of the selected materials
        /// </summary>
        /// <param name="section">Section to check</param>
        /// <returns>True if the section is disabled on at least one material</returns>
        private static bool HasMixedIndexZero(OrderedSection section)
        {
            bool zero = false;

            foreach (Material mat in section.getIndexTarget())
            {
                zero = mat.GetFloat(section.getIndexName()) == 0;
                if (zero)
                {
                    break;
                }
            }
            return(zero);
        }
コード例 #3
0
        /// <summary>
        /// Draws the settings GUI
        /// </summary>
        private void DrawSettings()
        {
            EditorGUI.BeginChangeCheck();
            inspectorLevel = (InspectorLevel)EditorGUILayout.EnumPopup(TSConstants.TSWindowLabels.InspectorLevel, inspectorLevel);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetInt(TSConstants.TSEPInspectorLevel, (int)inspectorLevel);
            }

            EditorGUI.BeginChangeCheck();
            updater.updateStream = (UpdateStream)EditorGUILayout.EnumPopup(TSConstants.TSWindowLabels.UpdateStream, updater.updateStream);
            if (EditorGUI.EndChangeCheck())
            {
                LocalVersionJSON local = JsonUtility.FromJson <LocalVersionJSON>(File.ReadAllText(TSConstants.LocalJSONPath));
                local.beta = updater.updateStream == UpdateStream.Beta;
                File.WriteAllText(TSConstants.LocalJSONPath, JsonUtility.ToJson(local));
                updater.Reset();
            }

            EditorGUI.BeginChangeCheck();
            sectionStyle         = (SectionStyle)EditorGUILayout.EnumPopup(TSConstants.TSWindowLabels.SectionStyle, sectionStyle);
            sectionColor         = EditorGUILayout.ColorField(TSConstants.TSWindowLabels.Color, sectionColor);
            isAutoUpdateDisabled = EditorGUILayout.Toggle(TSConstants.TSWindowLabels.DisableAutoUpdates, isAutoUpdateDisabled);
            if (EditorGUI.EndChangeCheck())
            {
                TSSettings settings = JsonUtility.FromJson <TSSettings>(File.ReadAllText(TSConstants.SettingsJSONPath));
                settings.sectionStyle   = (int)sectionStyle;
                settings.sectionColor   = sectionColor;
                settings.disableUpdates = isAutoUpdateDisabled;
                File.WriteAllText(TSConstants.SettingsJSONPath, JsonUtility.ToJson(settings));
                exampleSection = new ExampleSection(new GUIContent("Example Section"), true, true);
            }


            GUILayout.Space(20);
            if (exampleSection == null)
            {
                exampleSection = new ExampleSection(new GUIContent("Example Section"), true, true);
            }
            exampleSection.DrawSection(null, null);
        }
コード例 #4
0
 /// <summary>
 /// Compares 2 ordered section to determine which one is the first one
 /// </summary>
 /// <param name="x">First section to compare</param>
 /// <param name="y">Second section to compare</param>
 /// <returns></returns>
 private static int CompareSectionsOrder(OrderedSection x, OrderedSection y)
 {
     if (x == null)
     {
         if (y == null)
         {
             return(0);
         }
         else
         {
             return(-1);
         }
     }
     else
     {
         if (y == null)
         {
             return(1);
         }
         else
         {
             //
             if (x.getIndexNumber() > y.getIndexNumber())
             {
                 return(1);
             }
             else if (x.getIndexNumber() < y.getIndexNumber())
             {
                 return(-1);
             }
             else
             {
                 return(0);
             }
         }
     }
 }
コード例 #5
0
 /// <summary>
 /// adds a new Section to the list
 /// </summary>
 /// <param name="section"></param>
 public void addSection(OrderedSection section)
 {
     sections.Add(section);
 }