Ver código fonte

Editor: fix some warnings

Ivan K 9 anos atrás
pai
commit
3d9ea8eece

+ 3 - 0
Source/Urho3D/AngelScript/Addons.cpp

@@ -2435,8 +2435,11 @@ static void StringSetUTF8FromLatin1(const String& src, String& str)
     str.SetUTF8FromLatin1(src.CString());
 }
 
+static const unsigned NPOS = String::NPOS; // workaround for GCC
+
 void RegisterString(asIScriptEngine *engine)
 {
+    engine->RegisterGlobalProperty("const uint NPOS", (void*)&NPOS);
     engine->RegisterObjectType("String", sizeof(String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
     engine->RegisterStringFactory("String", asFUNCTION(StringFactory), asCALL_CDECL);
     engine->RegisterObjectBehaviour("String", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST);

+ 11 - 11
bin/Data/Scripts/Editor/AttributeEditor.as

@@ -314,7 +314,7 @@ UIElement@ CreateIntAttributeEditor(ListView@ list, Array<Serializable@>@ serial
         LineEdit@ attrEdit = CreateAttributeLineEdit(parent, serializables, index, subIndex);
         CreateDragSlider(attrEdit);
         // If the attribute is a counter for things like billboards or animation states, disable apply at each change
-        if (info.name.Find(" Count", 0, false) == -1)
+        if (info.name.Find(" Count", 0, false) == NPOS)
             SubscribeToEvent(attrEdit, "TextChanged", "EditAttribute");
         SubscribeToEvent(attrEdit, "TextFinished", "EditAttribute");
         // If the attribute is a node ID, make it a drag/drop target
@@ -677,8 +677,8 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
                 // Reevaluate each name in the list
                 for (uint i = 0; i < values.length; ++i)
                 {
-                    ResourceRefList refList = values[i].GetResourceRefList();
-                    if (subIndex >= refList.length || refList.names[subIndex] != firstName)
+                    ResourceRefList rList = values[i].GetResourceRefList();
+                    if (subIndex >= rList.length || rList.names[subIndex] != firstName)
                     {
                         nameSameValue = false;
                         break;
@@ -699,7 +699,7 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
                 break;
 
             Variant firstValue = vector[subIndex];
-            bool sameValue = true;
+            bool sameVal = true;
             Array<Variant> varValues;
 
             // Reevaluate each variant in the vector
@@ -711,16 +711,16 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
                     Variant value = vector[subIndex];
                     varValues.Push(value);
                     if (value != firstValue)
-                        sameValue = false;
+                        sameVal = false;
                 }
                 else
-                    sameValue = false;
+                    sameVal = false;
             }
 
             // 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, sameValue, varValues);
+            LoadAttributeEditor(parent, firstValue, info, editable, sameVal, varValues);
         }
     }
     else if (type == VAR_VARIANTMAP)
@@ -739,7 +739,7 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
                 varName = keys[subIndex].ToString(); // Use hexadecimal if nothing else is available
 
             Variant firstValue = map[keys[subIndex]];
-            bool sameValue = true;
+            bool sameVal = true;
             Array<Variant> varValues;
 
             // Reevaluate each variant in the map
@@ -751,16 +751,16 @@ void LoadAttributeEditor(UIElement@ parent, const Variant&in value, const Attrib
                     Variant value = map[keys[subIndex]];
                     varValues.Push(value);
                     if (value != firstValue)
-                       sameValue = false;
+                       sameVal = false;
                 }
                 else
-                    sameValue = false;
+                    sameVal = false;
             }
 
             // 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, sameValue, varValues);
+            LoadAttributeEditor(parent, firstValue, info, editable, sameVal, varValues);
         }
     }
     else

+ 3 - 3
bin/Data/Scripts/Editor/EditorActions.as

@@ -821,10 +821,10 @@ class ApplyUIElementStyleAction : EditAction
                 XMLElement rootElem = elementData.root;
                 uint index = rootElem.GetUInt("index");
                 uint listItemIndex = rootElem.GetUInt("listItemIndex");
-                UIElement@ element = parent.children[index];
+                UIElement@ elem = parent.children[index];
                 UIElement@ parentItem = hierarchyList.items[GetListIndex(parent)];
-                UpdateHierarchyItem(listItemIndex, element, parentItem);
-                SetUIElementModified(element);
+                UpdateHierarchyItem(listItemIndex, elem, parentItem);
+                SetUIElementModified(elem);
                 hierarchyUpdateSelections.Push(listItemIndex);
             }
 

+ 3 - 3
bin/Data/Scripts/Editor/EditorCubeCapture.as

@@ -16,7 +16,7 @@ void PrepareZonesForCubeRendering()
         return;
         
     Array<Component@>@ zones = editorScene.GetComponents("Zone", true);
-    for (int i = 0; i < zones.length; ++i)
+    for (uint i = 0; i < zones.length; ++i)
     {
         Zone@ srcZone = cast<Zone>(zones[i]);
         if (zones[i].enabled)
@@ -55,12 +55,12 @@ void PrepareZonesForCubeRendering()
 void UnprepareZonesForCubeRendering()
 {
     // Clean up the clones
-    for (int i = 0; i < cloneZones.length; ++i)
+    for (uint i = 0; i < cloneZones.length; ++i)
         cloneZones[i].Remove();
     cloneZones.Clear();
         
     // Reenable anyone we disabled
-    for (int i = 0; i < disabledZones.length; ++i)
+    for (uint i = 0; i < disabledZones.length; ++i)
         disabledZones[i].enabled = true;
     disabledZones.Clear();
     

+ 3 - 3
bin/Data/Scripts/Editor/EditorHierarchyWindow.as

@@ -1088,9 +1088,9 @@ Array<Node@> GetMultipleSourceNodes(UIElement@ source)
 
                 if (item_.vars[TYPE_VAR] == ITEM_NODE)
                 {
-                    Node@ node = editorScene.GetNode(item_.vars[NODE_ID_VAR].GetUInt());
-                    if (node !is null)
-                        nodeList.Push(node);
+                    Node@ n = editorScene.GetNode(item_.vars[NODE_ID_VAR].GetUInt());
+                    if (n !is null)
+                        nodeList.Push(n);
                 }
             }
         }

+ 5 - 5
bin/Data/Scripts/Editor/EditorInspectorWindow.as

@@ -709,7 +709,7 @@ void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
     {
         // 1. Add established tags from current editable UIElement to menu
         Array<String> elementTags = editUIElement.tags;
-        for (int i =0; i < elementTags.length; i++) 
+        for (uint i = 0; i < elementTags.length; i++) 
         {
             bool isHasTag = editUIElement.HasTag(elementTags[i]);
             String taggedIndicator = (isHasTag ? Indicator : "");
@@ -718,7 +718,7 @@ void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
 
         // 2. Add default tags
         Array<String> stdTags = defaultTags.Split(';');
-        for (int i=0; i < stdTags.length; i++) 
+        for (uint i= 0; i < stdTags.length; i++) 
         {
             bool isHasTag = editUIElement.HasTag(stdTags[i]);
             // Add this tag into menu if only Node not tadded with it yet, otherwise it showed on step 1.
@@ -733,7 +733,7 @@ void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
     {
         // 1. Add established tags from Node to menu
         Array<String> nodeTags = editNode.tags;
-        for (int i =0; i < nodeTags.length; i++) 
+        for (uint i = 0; i < nodeTags.length; i++) 
         {
             bool isHasTag = editNode.HasTag(nodeTags[i]);
             String taggedIndicator = (isHasTag ? Indicator : "");
@@ -742,7 +742,7 @@ void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
 
         Array<String> sceneTags = editorScene.tags;
         // 2. Add tags from Scene.tags (In this scenario Scene.tags used as storage for frequently used tags in current Scene only)
-        for (int i =0; i < sceneTags.length; i++)
+        for (uint i = 0; i < sceneTags.length; i++)
         {
             bool isHasTag = editNode.HasTag(sceneTags[i]);
             // Add this tag into menu if only Node not tadded with it yet, otherwise it showed on step 1.
@@ -755,7 +755,7 @@ void HandleTagsSelect(StringHash eventType, VariantMap& eventData)
 
         // 3. Add default tags
         Array<String> stdTags = defaultTags.Split(';');
-        for (int i=0; i<stdTags.length; i++)
+        for (uint i = 0; i < stdTags.length; i++)
         {
             bool isHasTag = editNode.HasTag(stdTags[i]);
             // Add this tag into menu if only Node not tadded with it yet, otherwise it showed on step 1.

+ 3 - 3
bin/Data/Scripts/Editor/EditorLayers.as

@@ -151,7 +151,7 @@ void ChangeNodeViewMask(Node@ node, EditActionGroup@ group, int mask)
     Array<Component@> components = node.GetComponents();
     if (components.length > 0) 
     {
-        for (int componentIndex = 0; componentIndex < components.length; componentIndex++) 
+        for (uint componentIndex = 0; componentIndex < components.length; componentIndex++) 
         {
             Component@ component = components[componentIndex];
             Drawable@ drawable = cast<Drawable>(component);
@@ -191,7 +191,7 @@ void EstablishBitMaskToSelectedNodes()
     // Group for storing undo actions
     EditActionGroup group;
     
-    for (int indexNode = 0; indexNode < selectedNodes.length; indexNode++) 
+    for (uint indexNode = 0; indexNode < selectedNodes.length; indexNode++) 
     {
         Node@ node = selectedNodes[indexNode];
         if (node !is null) 
@@ -209,7 +209,7 @@ void EstablishBitMaskToSelectedNodes()
             Array<Node@> children = node.GetChildren(true);
             if (children.length > 0) 
             {
-                for (int i =0; i < children.length; i++) 
+                for (uint i = 0; i < children.length; i++) 
                 {
                     ChangeNodeViewMask(children[i], group, mask);
                 }

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

@@ -266,7 +266,7 @@ void CreateResourceFilterUI()
     sorted.Sort();
     sorted.Insert(0, ResourceType(RESOURCE_TYPE_UNKNOWN, ResourceTypeName(RESOURCE_TYPE_UNKNOWN)) );
     sorted.Insert(0, ResourceType(RESOURCE_TYPE_UNUSABLE,  ResourceTypeName(RESOURCE_TYPE_UNUSABLE)) );
-    int halfColumns = Ceil( float(sorted.length) / float(columns) );
+    uint halfColumns = uint( Ceil( float(sorted.length) / float(columns) ) );
 
     for (uint i = 0; i < sorted.length; ++i)
     {

+ 3 - 3
bin/Data/Scripts/Editor/EditorScene.as

@@ -1253,10 +1253,10 @@ bool SceneRenderZoneCubemaps()
     Array<Zone@> capturedThisCall;
     bool alreadyCapturing = activeCubeCapture.length > 0; // May have managed to quickly queue up a second round of zones to render cubemaps for
     
-    for (int i = 0; i < selectedNodes.length; ++i)
+    for (uint i = 0; i < selectedNodes.length; ++i)
     {
         Array<Component@>@ zones = selectedNodes[i].GetComponents("Zone", true);
-        for (int z = 0; z < zones.length; ++z)
+        for (uint z = 0; z < zones.length; ++z)
         {
             Zone@ zone = cast<Zone>(zones[z]);
             if (zone !is null)
@@ -1267,7 +1267,7 @@ bool SceneRenderZoneCubemaps()
         }
     }
     
-    for (int i = 0; i < selectedComponents.length; ++i)
+    for (uint i = 0; i < selectedComponents.length; ++i)
     {
         Zone@ zone = cast<Zone>(selectedComponents[i]);
         if (zone !is null)

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

@@ -1438,7 +1438,7 @@ void UpdateView(float timeStep)
             }
             else
             {
-                for (int i = 0; i < selectedNodes.length; i++)
+                for (uint i = 0; i < selectedNodes.length; i++)
                 {
                     bb.Merge(selectedNodes[i].position);
                 }

+ 3 - 3
bin/Data/Scripts/Editor/EditorViewDebugIcons.as

@@ -56,9 +56,9 @@ Array<String> ComponentTypes = {"Light",
 Array<BillboardSet@> debugIconsSet(ICON_COUNT);
 Node@ debugIconsNode = null;
 int stepDebugIconsUpdate = 100; //ms
-int timeToNextDebugIconsUpdate = 0;
+uint timeToNextDebugIconsUpdate = 0;
 int stepDebugIconsUpdateSplinePath = 1000; //ms
-int timeToNextDebugIconsUpdateSplinePath = 0;
+uint timeToNextDebugIconsUpdateSplinePath = 0;
 const int splinePathResolution = 16;
 const float splineStep = 1.0f / splinePathResolution;
 bool debugIconsShow = true;
@@ -149,7 +149,7 @@ void UpdateViewDebugIcons()
             {
 
                 // Fill with new data
-                for(int i=0;i<nodes.length; i++)
+                for(uint i = 0;i < nodes.length; i++)
                 {
                     Component@ component = nodes[i].GetComponent(ComponentTypes[iconType]);
                     if (component is null) continue;