summaryrefslogtreecommitdiff
path: root/editor/export
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-12-29 01:24:45 +0100
committerkobewi <kobewi4e@gmail.com>2023-01-21 18:44:42 +0100
commit615c5170345b2b549be6271d11319a10a5ce34bf (patch)
treee8a8011f1c5a166636a9f68b65e108ad7bc878a0 /editor/export
parent277d5361df22c4aa18e93354190b7694dfdf6249 (diff)
Use range iterators in LocalVector loops
Diffstat (limited to 'editor/export')
-rw-r--r--editor/export/editor_export_platform.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index cacd181ad8..8da52e20f7 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -503,8 +503,8 @@ bool EditorExportPlatform::_export_customize_dictionary(Dictionary &dict, LocalV
case Variant::OBJECT: {
Ref<Resource> res = v;
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -550,8 +550,8 @@ bool EditorExportPlatform::_export_customize_array(Array &arr, LocalVector<Ref<E
case Variant::OBJECT: {
Ref<Resource> res = v;
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -597,8 +597,8 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
case Variant::OBJECT: {
Ref<Resource> res = p_object->get(E.name);
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -715,16 +715,16 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
ERR_FAIL_COND_V(ps.is_null(), p_path);
Node *node = ps->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE); // Make sure the child scene root gets the correct inheritance chain.
ERR_FAIL_COND_V(node == nullptr, p_path);
- if (customize_scenes_plugins.size()) {
- for (uint32_t i = 0; i < customize_scenes_plugins.size(); i++) {
- Node *customized = customize_scenes_plugins[i]->_customize_scene(node, p_path);
+ if (!customize_scenes_plugins.is_empty()) {
+ for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
+ Node *customized = plugin->_customize_scene(node, p_path);
if (customized != nullptr) {
node = customized;
modified = true;
}
}
}
- if (customize_resources_plugins.size()) {
+ if (!customize_resources_plugins.is_empty()) {
if (_export_customize_scene_resources(node, node, customize_resources_plugins)) {
modified = true;
}
@@ -746,9 +746,9 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
Ref<Resource> res = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
ERR_FAIL_COND_V(res.is_null(), p_path);
- if (customize_resources_plugins.size()) {
- for (uint32_t i = 0; i < customize_resources_plugins.size(); i++) {
- Ref<Resource> new_res = customize_resources_plugins[i]->_customize_resource(res, p_path);
+ if (!customize_resources_plugins.is_empty()) {
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, p_path);
if (new_res.is_valid()) {
modified = true;
if (new_res != res) {
@@ -960,7 +960,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
bool convert_text_to_binary = GLOBAL_GET("editor/export/convert_text_resources_to_binary");
- if (convert_text_to_binary || customize_resources_plugins.size() || customize_scenes_plugins.size()) {
+ if (convert_text_to_binary || !customize_resources_plugins.is_empty() || !customize_scenes_plugins.is_empty()) {
// See if we have something to open
Ref<FileAccess> f = FileAccess::open(export_base_path.path_join("file_cache"), FileAccess::READ);
if (f.is_valid()) {
@@ -1179,7 +1179,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
idx++;
}
- if (convert_text_to_binary || customize_resources_plugins.size() || customize_scenes_plugins.size()) {
+ if (convert_text_to_binary || !customize_resources_plugins.is_empty() || !customize_scenes_plugins.is_empty()) {
// End scene customization
String fcache = export_base_path.path_join("file_cache");
@@ -1196,12 +1196,12 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
ERR_PRINT("Error opening export file cache: " + fcache);
}
- for (uint32_t i = 0; i < customize_resources_plugins.size(); i++) {
- customize_resources_plugins[i]->_end_customize_resources();
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ plugin->_end_customize_resources();
}
- for (uint32_t i = 0; i < customize_scenes_plugins.size(); i++) {
- customize_scenes_plugins[i]->_end_customize_scenes();
+ for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
+ plugin->_end_customize_scenes();
}
}
//save config!