Просмотр исходного кода

Fixes for list/dictionary field refactor (WIP)

BearishSun 10 лет назад
Родитель
Сommit
f25457ae8e

+ 2 - 2
MBansheeEditor/GUI/GUIDictionaryField.cs

@@ -532,7 +532,7 @@ namespace BansheeEditor
                     }
                 }
 
-                for (int i = oldNumRows; i >= newNumRows; i--)
+                for (int i = oldNumRows - 1; i >= newNumRows; i--)
                 {
                     rows[i].Destroy();
                     rows.Remove(i);
@@ -740,7 +740,7 @@ namespace BansheeEditor
                     }
                 }
 
-                for (int i = oldNumRows; i >= newNumRows; i--)
+                for (int i = oldNumRows - 1; i >= newNumRows; i--)
                 {
                     rows[i].Destroy();
                     rows.Remove(i);

+ 0 - 3
MBansheeEditor/GUI/GUIListField.cs

@@ -184,10 +184,7 @@ namespace BansheeEditor
         private void UpdateRows()
         {
             for (int i = 0; i < rows.Count; i++)
-            {
                 rows[i].SetIndex(i);
-                rows[i].BuildGUI();
-            }
         }
 
         /// <summary>

+ 3 - 1
MBansheeEditor/Inspector/InspectableArray.cs

@@ -285,6 +285,8 @@ namespace BansheeEditor
                     field = CreateInspectable(SeqIndex + ".", 0, Depth + 1,
                         new InspectableFieldLayout(layout), property);
                 }
+                else
+                    field.Refresh(0);
 
                 return field.GetTitleLayout();
             }
@@ -294,7 +296,7 @@ namespace BansheeEditor
             {
                 //InspectableState state = field.Refresh(0);
                 InspectableState state = InspectableState.NotModified;
-                if (field.Refresh(0))
+                if (field.IsModified())
                     state = InspectableState.Modified;
 
                 if(state.HasFlag(InspectableState.Modified))

+ 15 - 4
MBansheeEditor/Inspector/InspectableDictionary.cs

@@ -280,6 +280,8 @@ namespace BansheeEditor
                     fieldKey = CreateInspectable("Key", 0, Depth + 1,
                         new InspectableFieldLayout(layout), property);
                 }
+                else
+                    fieldKey.Refresh(0);
 
                 return fieldKey.GetTitleLayout();
             }
@@ -294,6 +296,8 @@ namespace BansheeEditor
                     fieldValue = CreateInspectable("Value", 0, Depth + 1,
                         new InspectableFieldLayout(layout), property);
                 }
+                else
+                    fieldValue.Refresh(0);
             }
 
             /// <inheritdoc/>
@@ -301,13 +305,20 @@ namespace BansheeEditor
             {
                 //InspectableState state = fieldKey.Refresh(0) | fieldValue.Refresh(0);
                 InspectableState state = InspectableState.NotModified;
-                if (fieldKey.Refresh(0) || fieldValue.Refresh(0))
+                if (fieldKey.IsModified())
                     state = InspectableState.Modified;
 
-                if (state.HasFlag(InspectableState.Modified))
+                if (state.HasFlag(InspectableState.Modified) && fieldKey.ShouldRebuildOnModify())
                 {
-                    if (fieldKey.ShouldRebuildOnModify())
-                        BuildGUI();
+                    if (fieldValue.IsModified())
+                        state |= InspectableState.Modified;
+
+                    BuildGUI();
+                }
+                else
+                {
+                    if (fieldValue.Refresh(0))
+                        state |= InspectableState.Modified;
                 }
 
                 return state;

+ 3 - 1
MBansheeEditor/Inspector/InspectableList.cs

@@ -264,6 +264,8 @@ namespace BansheeEditor
                     field = CreateInspectable(SeqIndex + ".", 0, Depth + 1,
                         new InspectableFieldLayout(layout), property);
                 }
+                else
+                    field.Refresh(0);
 
                 return field.GetTitleLayout();
             }
@@ -273,7 +275,7 @@ namespace BansheeEditor
             {
                 //InspectableState state = field.Refresh(0);
                 InspectableState state = InspectableState.NotModified;
-                if (field.Refresh(0))
+                if (field.IsModified())
                     state = InspectableState.Modified;
 
                 if (state.HasFlag(InspectableState.Modified))

+ 4 - 0
MBansheeEditor/Inspectors/GUISkinInspector.cs

@@ -67,11 +67,15 @@ namespace BansheeEditor
                         if (!x.ContainsKey(styleName))
                             guiSkin.RemoveStyle(styleName);
                     }
+
+                    styles = x;
                 }
                 else
                 {
                     foreach (var KVP in styles)
                         guiSkin.RemoveStyle(KVP.Key);
+
+                    styles.Clear();
                 }
 
                 EditorApplication.SetDirty(guiSkin);

+ 4 - 0
MBansheeEditor/Inspectors/StringTableInspector.cs

@@ -85,11 +85,15 @@ namespace BansheeEditor
                         if (!x.ContainsKey(identifier))
                             stringTable.RemoveString(identifier);
                     }
+
+                    strings = x;
                 }
                 else
                 {
                     foreach (var KVP in strings)
                         stringTable.RemoveString(KVP.Key);
+
+                    strings.Clear();
                 }
 
                 EditorApplication.SetDirty(stringTable);