Преглед изворни кода

Fixed multi-selection of mixed UIElement type.

Wei Tjong Yao пре 12 година
родитељ
комит
c999748cea

+ 12 - 2
Bin/Data/Scripts/Editor/AttributeEditor.as

@@ -378,11 +378,18 @@ void LoadAttributeEditor(ListView@ list, Array<Serializable@>@ serializables, co
 
     inLoadAttributeEditor = true;
 
+    bool sameName = true;
     bool sameValue = true;
     Variant value = serializables[0].attributes[index];
     Array<Variant> values;
     for (uint i = 0; i < serializables.length; ++i)
     {
+        if (index >= serializables[i].numAttributes || serializables[i].attributeInfos[index].name != info.name)
+        {
+            sameName = false;
+            break;
+        }
+        
         Variant val = serializables[i].attributes[index];
         if (val != value)
             sameValue = false;
@@ -390,7 +397,10 @@ void LoadAttributeEditor(ListView@ list, Array<Serializable@>@ serializables, co
     }
 
     // Attribute with different values from multiple-select is loaded with default/empty value and non-editable
-    LoadAttributeEditor(parent, value, info, editable, sameValue, values);
+    if (sameName)
+        LoadAttributeEditor(parent, value, info, editable, sameValue, values);
+    else
+        parent.Remove();
 
     inLoadAttributeEditor = false;
 }
@@ -703,7 +713,7 @@ void UpdateAttributes(Array<Serializable@>@ serializables, ListView@ list, bool
     if (serializables.empty)
         return;
 
-    // If there are many serializables, they must share same attribute structure
+    // If there are many serializables, they must share same attribute structure (up to certain number if not all)
     for (uint i = 0; i < serializables[0].numAttributes; ++i)
     {
         AttributeInfo info = serializables[0].attributeInfos[i];

+ 13 - 1
Bin/Data/Scripts/Editor/EditorNodeWindow.as

@@ -209,7 +209,19 @@ void UpdateAttributeInspector(bool fullUpdate = true)
         else
         {
             elementType = editUIElements[0].typeName;
-            titleText.text = elementType + " ID " + STRIKED_OUT + " (" + editUIElements.length + "x)";
+            
+            bool sameType = true;
+            for (uint i = 1; i < editUIElements.length; ++i)
+            {
+                if (editUIElements[i].typeName != elementType)
+                {
+                    sameType = false;
+                    break;
+                }
+            }
+            titleText.text = (sameType ? elementType : "Mixed type") + " ID " + STRIKED_OUT + " (" + editUIElements.length + "x)";
+            if (!sameType)
+                elementType = "";   // No icon
         }
         IconizeUIElement(titleText, elementType);
 

+ 1 - 1
Bin/Data/UI/DefaultStyle.xml

@@ -428,7 +428,7 @@
         <attribute name="Layout Spacing" value="4" />
         <attribute name="Layout Border" value="6 6 6 6" />
         <attribute name="Is Modal" value="true" />
-        <attribute name="Modal Shade Color" value="0.45 0.70 0.45 0.1" />
+        <attribute name="Modal Shade Color" value="0.45 0.70 0.45 0.05" />
         <attribute name="Modal Frame Color" value="0.45 0.70 0.45" />
         <attribute name="Modal Frame Size" value="2 2" />
     </element>