diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-02-20 22:24:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-20 22:24:58 +0100 |
commit | 8107fc98b6ceae749b3c10e6f0432e904961867b (patch) | |
tree | 6c0ab829b02aba47ff3dc27b9a14d3c3a0658a3b /editor/import | |
parent | 132e2f458df7a3551a251d68afeccd0362ca6be2 (diff) | |
parent | 8d51618949d5ea8a94e0f504401e8f852a393968 (diff) |
Merge pull request #25853 from marxin/fix-25316-wshadow-local
Add -Wshadow=local to warnings and fix reported issues (#25316).
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/editor_import_collada.cpp | 60 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 38 | ||||
-rw-r--r-- | editor/import/resource_importer_layered_texture.cpp | 4 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 12 |
4 files changed, 57 insertions, 57 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index dbf63102cf..652f1ebac9 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -724,13 +724,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me int _prim_ofs = 0; int vertidx = 0; - for (int p_i = 0; p_i < p.count; p_i++) { + for (int p_j = 0; p_j < p.count; p_j++) { int amount; if (p.polygons.size()) { - ERR_FAIL_INDEX_V(p_i, p.polygons.size(), ERR_INVALID_DATA); - amount = p.polygons[p_i]; + ERR_FAIL_INDEX_V(p_j, p.polygons.size(), ERR_INVALID_DATA); + amount = p.polygons[p_j]; } else { amount = 3; //triangles; } @@ -1100,7 +1100,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres if (Object::cast_to<MeshInstance>(node)) { - Collada::NodeGeometry *ng = static_cast<Collada::NodeGeometry *>(p_node); + Collada::NodeGeometry *ng2 = static_cast<Collada::NodeGeometry *>(p_node); MeshInstance *mi = Object::cast_to<MeshInstance>(node); @@ -1113,16 +1113,16 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres Vector<int> bone_remap; Vector<Ref<ArrayMesh> > morphs; - if (ng->controller) { + if (ng2->controller) { - String ngsource = ng->source; + String ngsource = ng2->source; if (collada.state.skin_controller_data_map.has(ngsource)) { ERR_FAIL_COND_V(!collada.state.skin_controller_data_map.has(ngsource), ERR_INVALID_DATA); skin = &collada.state.skin_controller_data_map[ngsource]; - Vector<String> skeletons = ng->skeletons; + Vector<String> skeletons = ng2->skeletons; ERR_FAIL_COND_V(skeletons.empty(), ERR_INVALID_DATA); @@ -1185,12 +1185,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres Vector<String> names = morph->sources[target].sarray; for (int i = 0; i < names.size(); i++) { - String meshid = names[i]; - if (collada.state.mesh_data_map.has(meshid)) { + String meshid2 = names[i]; + if (collada.state.mesh_data_map.has(meshid2)) { Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); - const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; + const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2]; mesh->set_name(meshdata.name); - Error err = _create_mesh_surfaces(false, mesh, ng->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false); + Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false); ERR_FAIL_COND_V(err, err); morphs.push_back(mesh); @@ -1212,7 +1212,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres } } else { - meshid = ng->source; + meshid = ng2->source; } Ref<ArrayMesh> mesh; @@ -1226,7 +1226,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; mesh->set_name(meshdata.name); - Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials); + Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials); ERR_FAIL_COND_V(err, err); mesh_cache[meshid] = mesh; @@ -1246,8 +1246,8 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres String matname = meshdata.primitives[i].material; - if (ng->material_map.has(matname)) { - String target = ng->material_map[matname].target; + if (ng2->material_map.has(matname)) { + String target = ng2->material_map[matname].target; Ref<Material> material; if (!material_cache.has(target)) { @@ -1296,25 +1296,25 @@ Error ColladaImport::load(const String &p_path, int p_flags, bool p_force_make_t for (int i = 0; i < vs.root_nodes.size(); i++) { - Error err = _create_scene_skeletons(vs.root_nodes[i]); - if (err != OK) { + Error err2 = _create_scene_skeletons(vs.root_nodes[i]); + if (err2 != OK) { memdelete(scene); - ERR_FAIL_COND_V(err, err); + ERR_FAIL_COND_V(err2, err2); } } for (int i = 0; i < vs.root_nodes.size(); i++) { - Error err = _create_scene(vs.root_nodes[i], scene); - if (err != OK) { + Error err2 = _create_scene(vs.root_nodes[i], scene); + if (err2 != OK) { memdelete(scene); - ERR_FAIL_COND_V(err, err); + ERR_FAIL_COND_V(err2, err2); } - Error err2 = _create_resources(vs.root_nodes[i], p_use_compression); - if (err2 != OK) { + Error err3 = _create_resources(vs.root_nodes[i], p_use_compression); + if (err3 != OK) { memdelete(scene); - ERR_FAIL_COND_V(err2, err2); + ERR_FAIL_COND_V(err3, err3); } } @@ -1627,10 +1627,10 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones ERR_CONTINUE(xf.data.size() < 4); xf.data.write[3] = data[0]; } else if (at.component == "X" || at.component == "Y" || at.component == "Z") { - int cn = at.component[0] - 'X'; - ERR_CONTINUE(cn >= xf.data.size()); + int cn2 = at.component[0] - 'X'; + ERR_CONTINUE(cn2 >= xf.data.size()); ERR_CONTINUE(data.size() > 1); - xf.data.write[cn] = data[0]; + xf.data.write[cn2] = data[0]; } else if (data.size() == xf.data.size()) { xf.data = data; } else { @@ -1747,11 +1747,11 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones animation->track_set_path(track, path); animation->track_set_imported(track, true); //helps merging later - for (int i = 0; i < at.keys.size(); i++) { + for (int j = 0; j < at.keys.size(); j++) { - float time = at.keys[i].time; + float time = at.keys[j].time; Variant value; - Vector<float> data = at.keys[i].data; + Vector<float> data = at.keys[j].data; if (data.size() == 1) { //push a float value = data[0]; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index c29e9281fa..ff2f68ffd3 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -244,8 +244,8 @@ Error EditorSceneImporterGLTF::_parse_nodes(GLTFState &state) { if (n.has("children")) { Array children = n["children"]; - for (int i = 0; i < children.size(); i++) { - node->children.push_back(children[i]); + for (int j = 0; j < children.size(); j++) { + node->children.push_back(children[j]); } } @@ -879,7 +879,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { if (p.has("mode")) { int mode = p["mode"]; ERR_FAIL_INDEX_V(mode, 7, ERR_FILE_CORRUPT); - static const Mesh::PrimitiveType primitives[7] = { + static const Mesh::PrimitiveType primitives2[7] = { Mesh::PRIMITIVE_POINTS, Mesh::PRIMITIVE_LINES, Mesh::PRIMITIVE_LINE_LOOP, @@ -889,7 +889,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { Mesh::PRIMITIVE_TRIANGLE_FAN, }; - primitive = primitives[mode]; + primitive = primitives2[mode]; } if (a.has("POSITION")) { @@ -922,17 +922,17 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { //PoolVector<int> v = array[Mesh::ARRAY_BONES]; //PoolVector<int>::Read r = v.read(); - for (int j = 0; j < wc; j += 4) { + for (int k = 0; k < wc; k += 4) { float total = 0.0; - total += w[j + 0]; - total += w[j + 1]; - total += w[j + 2]; - total += w[j + 3]; + total += w[k + 0]; + total += w[k + 1]; + total += w[k + 2]; + total += w[k + 3]; if (total > 0.0) { - w[j + 0] /= total; - w[j + 1] /= total; - w[j + 2] /= total; - w[j + 3] /= total; + w[k + 0] /= total; + w[k + 1] /= total; + w[k + 2] /= total; + w[k + 3] /= total; } //print_verbose(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3])); @@ -950,8 +950,8 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { int is = indices.size(); PoolVector<int>::Write w = indices.write(); - for (int i = 0; i < is; i += 3) { - SWAP(w[i + 1], w[i + 2]); + for (int k = 0; k < is; k += 3) { + SWAP(w[k + 1], w[k + 2]); } } array[Mesh::ARRAY_INDEX] = indices; @@ -964,10 +964,10 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { indices.resize(vs); { PoolVector<int>::Write w = indices.write(); - for (int i = 0; i < vs; i += 3) { - w[i] = i; - w[i + 1] = i + 2; - w[i + 2] = i + 1; + for (int k = 0; k < vs; k += 3) { + w[k] = k; + w[k + 1] = k + 2; + w[k + 2] = k + 1; } } array[Mesh::ARRAY_INDEX] = indices; diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index f43df02916..e38265b619 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -132,9 +132,9 @@ void ResourceImporterLayeredTexture::_save_tex(const Vector<Ref<Image> > &p_imag int mmc = image->get_mipmap_count() + 1; f->store_32(mmc); - for (int i = 0; i < mmc; i++) { + for (int j = 0; j < mmc; j++) { - if (i > 0) { + if (j > 0) { image->shrink_x2(); } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 2616ba6e87..ad436b2797 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1314,9 +1314,9 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p if (bool(p_options["external_files/store_in_subdir"])) { String subdir_name = p_source_file.get_file().get_basename(); DirAccess *da = DirAccess::open(base_path); - Error err = da->make_dir(subdir_name); + Error err2 = da->make_dir(subdir_name); memdelete(da); - ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err); + ERR_FAIL_COND_V(err2 != OK && err2 != ERR_ALREADY_EXISTS, err2); base_path = base_path.plus_file(subdir_name); } } @@ -1331,7 +1331,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p float texel_size = p_options["meshes/lightmap_texel_size"]; texel_size = MAX(0.001, texel_size); - EditorProgress progress("gen_lightmaps", TTR("Generating Lightmaps"), meshes.size()); + EditorProgress progress2("gen_lightmaps", TTR("Generating Lightmaps"), meshes.size()); int step = 0; for (Map<Ref<ArrayMesh>, Transform>::Element *E = meshes.front(); E; E = E->next()) { @@ -1341,10 +1341,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p name = "Mesh " + itos(step); } - progress.step(TTR("Generating for Mesh: ") + name + " (" + itos(step) + "/" + itos(meshes.size()) + ")", step); + progress2.step(TTR("Generating for Mesh: ") + name + " (" + itos(step) + "/" + itos(meshes.size()) + ")", step); - Error err = mesh->lightmap_unwrap(E->get(), texel_size); - if (err != OK) { + Error err2 = mesh->lightmap_unwrap(E->get(), texel_size); + if (err2 != OK) { EditorNode::add_io_error("Mesh '" + name + "' failed lightmap generation. Please fix geometry."); } step++; |