Browse Source

Merge remote-tracking branch '1vanK/master'

Lasse Öörni 9 years ago
parent
commit
d1deb226d5

BIN
SourceAssets/UITemplate.xcf


+ 29 - 30
bin/Data/Scripts/Editor/AttributeEditor.as

@@ -705,12 +705,12 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
             // Reevaluate each variant in the vector
             for (uint i = 0; i < values.length; ++i)
             {
-                Array<Variant>@ vector = values[i].GetVariantVector();
-                if (subIndex < vector.length)
+                Array<Variant>@ vec = values[i].GetVariantVector();
+                if (subIndex < vec.length)
                 {
-                    Variant value = vector[subIndex];
-                    varValues.Push(value);
-                    if (value != firstValue)
+                    Variant v = vec[subIndex];
+                    varValues.Push(v);
+                    if (v != firstValue)
                         sameVal = false;
                 }
                 else
@@ -718,9 +718,9 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
             }
 
             // The individual variant in the list is not an attribute of the serializable, the structure is reused for convenience
-            AttributeInfo info;
-            info.type = firstValue.type;
-            LoadAttributeEditor(parent, firstValue, info, editable, sameVal, varValues);
+            AttributeInfo ai;
+            ai.type = firstValue.type;
+            LoadAttributeEditor(parent, firstValue, ai, editable, sameVal, varValues);
         }
     }
     else if (type == VAR_VARIANTMAP)
@@ -745,12 +745,12 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
             // Reevaluate each variant in the map
             for (uint i = 0; i < values.length; ++i)
             {
-                VariantMap map = values[i].GetVariantMap();
-                if (map.Contains(keys[subIndex]))
+                VariantMap m = values[i].GetVariantMap();
+                if (m.Contains(keys[subIndex]))
                 {
-                    Variant value = map[keys[subIndex]];
-                    varValues.Push(value);
-                    if (value != firstValue)
+                    Variant v = m[keys[subIndex]];
+                    varValues.Push(v);
+                    if (v != firstValue)
                        sameVal = false;
                 }
                 else
@@ -758,9 +758,9 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
             }
 
             // The individual variant in the map is not an attribute of the serializable, the structure is reused for convenience
-            AttributeInfo info;
-            info.type = firstValue.type;
-            LoadAttributeEditor(parent, firstValue, info, editable, sameVal, varValues);
+            AttributeInfo ai;
+            ai.type = firstValue.type;
+            LoadAttributeEditor(parent, firstValue, ai, editable, sameVal, varValues);
         }
     }
     else
@@ -768,31 +768,31 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
         Array<Array<String> > coordinates;
         for (uint i = 0; i < values.length; ++i)
         {
-            Variant value = values[i];
+            Variant v = values[i];
 
             // Convert Quaternion value to Vector3 value first
             if (type == VAR_QUATERNION)
-                value = value.GetQuaternion().eulerAngles;
+                v = v.GetQuaternion().eulerAngles;
 
-            coordinates.Push(value.ToString().Split(' '));
+            coordinates.Push(v.ToString().Split(' '));
         }
         for (uint i = 0; i < coordinates[0].length; ++i)
         {
-            String value = coordinates[0][i];
+            String str = coordinates[0][i];
             bool coordinateSameValue = true;
             if (!sameValue)
             {
                 // Reevaluate each coordinate
                 for (uint j = 1; j < coordinates.length; ++j)
                 {
-                    if (coordinates[j][i] != value)
+                    if (coordinates[j][i] != str)
                     {
                         coordinateSameValue = false;
                         break;
                     }
                 }
             }
-            SetEditable(SetValue(parent.children[i + 1], value, coordinateSameValue), editable && coordinateSameValue);
+            SetEditable(SetValue(parent.children[i + 1], str, coordinateSameValue), editable && coordinateSameValue);
         }
     }
 }
@@ -827,7 +827,6 @@ void StoreAttributeEditor(UIElement@ parent, Array<Serializable@>@ serializables
     }
     else if (info.type == VAR_VARIANTMAP)
     {
-        VariantMap map = serializables[0].attributes[index].GetVariantMap();
         StringHash key(parent.vars["Key"].GetUInt());
         for (uint i = 0; i < serializables.length; ++i)
         {
@@ -877,8 +876,8 @@ void GetEditorValue(UIElement@ parent, VariantType type, Array<String>@ enumName
         FillValue(values, Variant(attrEdit.text.Trimmed()));
     else if (type == VAR_BOOL)
     {
-        CheckBox@ attrEdit = parent.children[1];
-        FillValue(values, Variant(attrEdit.checked));
+        CheckBox@ cb = parent.children[1];
+        FillValue(values, Variant(cb.checked));
     }
     else if (type == VAR_FLOAT)
         FillValue(values, Variant(attrEdit.text.ToFloat()));
@@ -900,16 +899,16 @@ void GetEditorValue(UIElement@ parent, VariantType type, Array<String>@ enumName
             FillValue(values, Variant(attrEdit.text.ToInt()));
         else
         {
-            DropDownList@ attrEdit = parent.children[1];
-            FillValue(values, Variant(attrEdit.selection));
+            DropDownList@ ddl = parent.children[1];
+            FillValue(values, Variant(ddl.selection));
         }
     }
     else if (type == VAR_RESOURCEREF)
     {
-        LineEdit@ attrEdit = parent.children[0];
+        LineEdit@ le = parent.children[0];
         ResourceRef ref;
-        ref.name = attrEdit.text.Trimmed();
-        ref.type = StringHash(attrEdit.vars[TYPE_VAR].GetUInt());
+        ref.name = le.text.Trimmed();
+        ref.type = StringHash(le.vars[TYPE_VAR].GetUInt());
         FillValue(values, Variant(ref));
     }
     else

+ 29 - 30
bin/Data/Scripts/Editor/EditorColorWheel.as

@@ -43,11 +43,11 @@ float colorHValue = 1;
 float colorSValue = 1;
 float colorVValue = 1;
 float colorAValue = 0.5;
-float high = 0;
+int high = 0;
 float aValue = 1;
 
-const float IMAGE_SIZE = 256;
-const float HALF_IMAGE_SIZE = 128;
+const int IMAGE_SIZE = 256;
+const int HALF_IMAGE_SIZE = 128;
 const float MAX_ANGLE = 360;
 const float ROUND_VALUE_MAX = 0.99f;
 const float ROUND_VALUE_MIN = 0.01f;
@@ -152,25 +152,25 @@ void HandleWheelButtons(StringHash eventType, VariantMap& eventData)
 
     if (edit is cancelButton) 
     {
-        VariantMap eventData;
+        VariantMap vm;
         eventData["Color"] = wheelIncomingColor;
-        SendEvent(eventTypeWheelDiscardColor, eventData);
+        SendEvent(eventTypeWheelDiscardColor, vm);
         HideColorWheel();
     }
 
     if (edit is closeButton)
     {
-        VariantMap eventData;
+        VariantMap vm;
         eventData["Color"] = wheelIncomingColor;
-        SendEvent(eventTypeWheelDiscardColor, eventData);
+        SendEvent(eventTypeWheelDiscardColor, vm);
         HideColorWheel();
     }
 
     if (edit is okButton) 
     {
-        VariantMap eventData;
+        VariantMap vm;
         eventData["Color"] = wheelColor;
-        SendEvent(eventTypeWheelSelectColor, eventData);
+        SendEvent(eventTypeWheelSelectColor, vm);
         HideColorWheel();
     }
 }
@@ -228,13 +228,13 @@ void HandleColorWheelMouseWheel(StringHash eventType, VariantMap& eventData)
         else if (wheelValue < 0)
         {
             high = high + wheelValue;
-            high = Max(high, 0.0f);
+            high = Max(high, 0);
         }
 
-        bwCursor.SetPosition(bwCursor.position.x, high-7);
-        colorVValue = float((IMAGE_SIZE-high) / IMAGE_SIZE);
+        bwCursor.SetPosition(bwCursor.position.x, high - 7);
+        colorVValue = float(IMAGE_SIZE - high) / IMAGE_SIZE;
 
-        wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+        wheelColor.FromHSV(colorHValue, colorSValue, colorVValue, colorAValue);
         SendEventChangeColor();
         UpdateColorInformation(); 
     }
@@ -277,7 +277,7 @@ void HandleColorWheelMouseMove(StringHash eventType, VariantMap& eventData)
         cy = cwy - HALF_IMAGE_SIZE;
 
         // get direction vector of H on circle
-        Vector2 d = Vector2(cx,cy);
+        Vector2 d = Vector2(cx, cy);
 
         // if out  of circle place colorCurcor back to circle
         if (d.length > HALF_IMAGE_SIZE) 
@@ -285,7 +285,7 @@ void HandleColorWheelMouseMove(StringHash eventType, VariantMap& eventData)
             d.Normalize();
             d = d * HALF_IMAGE_SIZE;
 
-            i = IntVector2(d.x, d.y);
+            i = IntVector2(int(d.x), int(d.y));
             inWheel = false;
 
         }
@@ -312,7 +312,7 @@ void HandleColorWheelMouseMove(StringHash eventType, VariantMap& eventData)
             if (colorSValue < ROUND_VALUE_MIN) colorSValue = 0.0;
             if (colorSValue > ROUND_VALUE_MAX) colorSValue = 1.0;
 
-            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            wheelColor.FromHSV(colorHValue, colorSValue, colorVValue, colorAValue);
             SendEventChangeColor();
             UpdateColorInformation();
         }
@@ -322,17 +322,17 @@ void HandleColorWheelMouseMove(StringHash eventType, VariantMap& eventData)
     {
         isBWGradientHovering = true;
         IntVector2 ep = bwGradient.screenPosition; 
-        float high = y - ep.y;
+        int high = y - ep.y;
 
         if (input.mouseButtonDown[MOUSEB_LEFT] || input.mouseButtonDown[MOUSEB_RIGHT])
         {
-            bwCursor.SetPosition(bwCursor.position.x, high-7);
-            colorVValue = float((IMAGE_SIZE-high) / IMAGE_SIZE);
+            bwCursor.SetPosition(bwCursor.position.x, high - 7);
+            colorVValue = float(IMAGE_SIZE - high) / IMAGE_SIZE;
 
             if (colorVValue < 0.01) colorVValue = 0.0;
             if (colorVValue > 0.99) colorVValue = 1.0;
 
-            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            wheelColor.FromHSV(colorHValue, colorSValue, colorVValue, colorAValue);
             SendEventChangeColor();
         }
 
@@ -342,18 +342,18 @@ void HandleColorWheelMouseMove(StringHash eventType, VariantMap& eventData)
     else if (AGradient.IsInside(IntVector2(x,y), true))
     {
         IntVector2 ep = AGradient.screenPosition; 
-        float aValue = x - ep.x;
+        int aValue = x - ep.x;
 
         if (input.mouseButtonDown[MOUSEB_LEFT] || input.mouseButtonDown[MOUSEB_RIGHT])
         {
-            ACursor.SetPosition(aValue-7, ACursor.position.y);
+            ACursor.SetPosition(aValue - 7, ACursor.position.y);
             colorAValue = float((aValue) / 200); // 200pix image
 
             // round values for min or max
             if (colorAValue < 0.01) colorAValue = 0.0;
             if (colorAValue > 0.99) colorAValue = 1.0;
 
-            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            wheelColor.FromHSV(colorHValue, colorSValue, colorVValue, colorAValue);
             SendEventChangeColor();
         }
 
@@ -409,22 +409,21 @@ void EstablishColorWheelUIFromColor(Color c)
     colorAValue = c.a;
 
     // convert color value to BWGradient high
-    high = IMAGE_SIZE - colorVValue * IMAGE_SIZE;
-    bwCursor.SetPosition(bwCursor.position.x, high-7);
+    high = int(IMAGE_SIZE - colorVValue * IMAGE_SIZE);
+    bwCursor.SetPosition(bwCursor.position.x, high - 7);
 
     // convert color alpha to shift on x-axis for ACursor
     aValue = 200 * colorAValue;
-    ACursor.SetPosition(aValue-7 , ACursor.position.y);
+    ACursor.SetPosition(int(aValue - 7), ACursor.position.y);
 
     // rotate vector to H-angle with scale(shifting) by S to calculate final point position
     Quaternion q(colorHValue * -MAX_ANGLE);
-    Vector3 pos = Vector3(1,0,0);
-    pos.Normalize();
+    Vector3 pos = Vector3(1, 0, 0);
     pos = q * pos;
     pos = pos * (colorSValue * HALF_IMAGE_SIZE);
-    pos = pos + Vector3(HALF_IMAGE_SIZE,HALF_IMAGE_SIZE);
+    pos = pos + Vector3(HALF_IMAGE_SIZE, HALF_IMAGE_SIZE);
 
-    colorCursor.position = IntVector2(pos.x-7, pos.y-7);
+    colorCursor.position = IntVector2(int(pos.x) - 7, int(pos.y) - 7);
 
     // Update information on UI about color
     UpdateColorInformation();

+ 1 - 1
bin/Data/Scripts/Editor/EditorSpawn.as

@@ -430,7 +430,7 @@ void SpawnObject()
         Vector3 position, normal;
         bool result = false;
         
-        if (spawnOnSelection && selectedNode != null)
+        if (spawnOnSelection && selectedNode !is null)
             result = GetSpawnPositionOnNode(cameraRay, camera.farClip, position, normal, selectedNode, spawnRadius, false);
         else
             result = GetSpawnPosition(cameraRay, camera.farClip, position, normal, spawnRadius, false);        

+ 6 - 6
bin/Data/Scripts/Editor/EditorUI.as

@@ -10,8 +10,8 @@ Array<QuickMenuItem@> quickMenuItems;
 FileSelector@ uiFileSelector;
 String consoleCommandInterpreter;
 Window@ contextMenu;
-float stepColoringGroupUpdate = 100; // ms
-float timeToNextColoringGroupUpdate = 0;
+uint stepColoringGroupUpdate = 100; // ms
+uint timeToNextColoringGroupUpdate = 0;
 
 const StringHash UI_ELEMENT_TYPE("UIElement");
 const StringHash WINDOW_TYPE("Window");
@@ -462,12 +462,12 @@ void CreateMenuBar()
             if (objectCategories[i] == "UI")
                 continue;
 
-            Menu@ menu = CreateMenuItem(objectCategories[i], null, SHOW_POPUP_INDICATOR);
-            Window@ popup = CreatePopup(menu);
+            Menu@ m = CreateMenuItem(objectCategories[i], null, SHOW_POPUP_INDICATOR);
+            Window@ p = CreatePopup(m);
             String[] componentTypes = GetObjectsByCategory(objectCategories[i]);
             for (uint j = 0; j < componentTypes.length; ++j)
-                popup.AddChild(CreateIconizedMenuItem(componentTypes[j], @PickComponent, 0, 0, "", true, "Create " + componentTypes[j]));
-            childPopup.AddChild(menu);
+                p.AddChild(CreateIconizedMenuItem(componentTypes[j], @PickComponent, 0, 0, "", true, "Create " + componentTypes[j]));
+            childPopup.AddChild(m);
         }
         FinalizedPopupMenu(childPopup);
         popup.AddChild(childMenu);

+ 1 - 2
bin/Data/Scripts/Editor/EditorViewDebugIcons.as

@@ -154,7 +154,6 @@ void UpdateViewDebugIcons()
                     Component@ component = nodes[i].GetComponent(ComponentTypes[iconType]);
                     if (component is null) continue;
 
-                    Billboard@ bb = null;
                     Color finalIconColor = debugIconsColors[ICON_COLOR_DEFAULT];
                     float distance = (camPos - nodes[i].worldPosition).length;
                     if (isOrthographic) distance = debugIconsOrthoDistance;
@@ -202,7 +201,7 @@ void UpdateViewDebugIcons()
                     }
                     else
                     {
-                        bb = debugIconsSet[iconType].billboards[i];
+                        Billboard@ bb = debugIconsSet[iconType].billboards[i];
                         bb.size = ClampToIconMaxSize(Max(debugIconsSize * distance, debugIconsSize));
 
                         if (iconType==ICON_PARTICLE_EMITTER)

BIN
bin/Data/Textures/UI.png


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

@@ -297,7 +297,7 @@
         <attribute name="Max Size" value="2147483647 11" />
     </element>
     <element type="EditorVerticalDivider" style="BorderImage" auto="false">
-        <attribute name="Image Rect" value="144 64 155 80" />
+        <attribute name="Image Rect" value="144 48 155 64" />
         <attribute name="Border" value="4 4 4 4" />
         <attribute name="Min Size" value="11 0" />
         <attribute name="Max Size" value="11 2147483647" />

+ 30 - 17
bin/Data/UI/EditorColorWheel.xml

@@ -21,7 +21,7 @@
 					<attribute name="Name" value="ColorCursor" />
 					<attribute name="Position" value="124 124" />
 					<attribute name="Size" value="16 16" />
-					<attribute name="Image Rect" value="63 84 15 15" />
+					<attribute name="Image Rect" value="62 83 78 99" />
 				</element>
 			</element>
 			<element type="BorderImage">
@@ -34,9 +34,10 @@
 				<attribute name="Blend Mode" value="alpha" />
 				<element type="BorderImage">
 					<attribute name="Name" value="BWCursor" />
-					<attribute name="Size" value="64 13" />
+					<attribute name="Size" value="61 15" />
 					<attribute name="Is Editable" value="false" />
-					<attribute name="Image Rect" value="2 84 59 98" />
+					<attribute name="Image Rect" value="0 84 61 99" />
+					<attribute name="Position" value="1 0" />
 				</element>
 			</element>
 		</element>
@@ -189,16 +190,18 @@
 			<element>
 				<attribute name="Clip Children" value="true" />
 				<element type="BorderImage">
+					<attribute name="Name" value="Chess" />
 					<attribute name="Size" value="200 33" />
-					<attribute name="Image Rect" value="2 102 17 117" />
+					<attribute name="Image Rect" value="2 102 18 118" />
 					<attribute name="Tiled" value="true" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="ColorCheck" />
 					<attribute name="Size" value="200 33" />
 					<attribute name="Priority" value="1" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 			</element>
 		</element>
@@ -240,21 +243,22 @@
 			</element>
 			<element>
 				<element type="BorderImage">
+					<attribute name="Name" value="Chess" />
 					<attribute name="Size" value="200 27" />
 					<attribute name="Is Editable" value="false" />
-					<attribute name="Image Rect" value="2 102 17 117" />
+					<attribute name="Image Rect" value="2 102 18 118" />
 					<attribute name="Tiled" value="true" />
 					<element type="BorderImage">
 						<attribute name="Name" value="AGradient" />
 						<attribute name="Size" value="200 27" />
 						<attribute name="Is Editable" value="false" />
-						<attribute name="Image Rect" value="0 120 199 128" />
+						<attribute name="Image Rect" value="0 120 200 128" />
 						<attribute name="Blend Mode" value="alpha" />
 						<element type="BorderImage">
 							<attribute name="Name" value="ACursor" />
 							<attribute name="Position" value="0 1" />
 							<attribute name="Size" value="14 25" />
-							<attribute name="Image Rect" value="131 87 143 111" />
+							<attribute name="Image Rect" value="131 87 144 112" />
 							<attribute name="Blend Mode" value="alpha" />
 						</element>
 					</element>
@@ -268,72 +272,81 @@
 			<attribute name="Layout Mode" value="Horizontal" />
 			<attribute name="Layout Spacing" value="5" />
 			<element type="BorderImage">
+				<attribute name="Name" value="Chess" />
 				<attribute name="Layout Mode" value="Horizontal" />
-				<attribute name="Image Rect" value="2 102 17 117" />
+				<attribute name="Image Rect" value="2 102 18 118" />
 				<attribute name="Tiled" value="true" />
 				<element type="BorderImage">
 					<attribute name="Name" value="h0" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h1" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h2" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h3" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h4" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h5" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h6" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 				<element type="BorderImage">
 					<attribute name="Name" value="h7" />
 					<attribute name="Is Enabled" value="true" />
 					<attribute name="Is Editable" value="false" />
 					<attribute name="Is Selected" value="true" />
-					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Image Rect" value="83 86 94 98" />
 					<attribute name="Blend Mode" value="alpha" />
+					<attribute name="Image Border" value="1 1 1 1" />
 				</element>
 			</element>
 		</element>