Jelajahi Sumber

Adjusted attribute editor count when the editor is being removed.

Wei Tjong Yao 12 tahun lalu
induk
melakukan
3bb6fd5f40
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      Bin/Data/Scripts/Editor/AttributeEditor.as

+ 6 - 1
Bin/Data/Scripts/Editor/AttributeEditor.as

@@ -13,6 +13,7 @@ const StringHash TEXT_CHANGED_EVENT_TYPE("TextChanged");
 
 bool inLoadAttributeEditor = false;
 bool showNonEditableAttribute = false;
+uint attributeCountAdjustment = 0;
 
 Color normalTextColor(1.0f, 1.0f, 1.0f);
 Color modifiedTextColor(1.0f, 0.8f, 0.5f);
@@ -360,7 +361,7 @@ uint GetAttributeEditorCount(Array<Serializable@>@ serializables)
         }
     }
 
-    return count;
+    return count - attributeCountAdjustment;
 }
 
 UIElement@ GetAttributeEditorParent(UIElement@ parent, uint index, uint subIndex)
@@ -400,7 +401,10 @@ void LoadAttributeEditor(ListView@ list, Array<Serializable@>@ serializables, co
     if (sameName)
         LoadAttributeEditor(parent, value, info, editable, sameValue, values);
     else
+    {
         parent.Remove();
+        ++attributeCountAdjustment;
+    }
 
     inLoadAttributeEditor = false;
 }
@@ -702,6 +706,7 @@ void UpdateAttributes(Array<Serializable@>@ serializables, ListView@ list, bool
     if (fullUpdate)
     {
         list.RemoveAllItems();
+        attributeCountAdjustment = 0;
         Array<UIElement@> children = list.GetChildren();
         for (uint i = 0; i < children.length; ++i)
         {