From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- editor/editor_data.cpp | 103 ------------------------------------------------- 1 file changed, 103 deletions(-) (limited to 'editor/editor_data.cpp') diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 9c739474d1..6f6a863b70 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -39,9 +39,7 @@ #include "scene/resources/packed_scene.h" void EditorHistory::cleanup_history() { - for (int i = 0; i < history.size(); i++) { - bool fail = false; for (int j = 0; j < history[i].path.size(); j++) { @@ -79,7 +77,6 @@ void EditorHistory::cleanup_history() { } void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only) { - Object *obj = ObjectDB::get_instance(p_object); ERR_FAIL_COND(!obj); Reference *r = Object::cast_to(obj); @@ -122,22 +119,18 @@ void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int } void EditorHistory::add_object_inspector_only(ObjectID p_object) { - _add_object(p_object, "", -1, true); } void EditorHistory::add_object(ObjectID p_object) { - _add_object(p_object, "", -1); } void EditorHistory::add_object(ObjectID p_object, const String &p_subprop) { - _add_object(p_object, p_subprop, -1); } void EditorHistory::add_object(ObjectID p_object, int p_relevel) { - _add_object(p_object, "", p_relevel); } @@ -149,7 +142,6 @@ int EditorHistory::get_history_pos() { } bool EditorHistory::is_history_obj_inspector_only(int p_obj) const { - ERR_FAIL_INDEX_V(p_obj, history.size(), false); ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), false); return history[p_obj].path[history[p_obj].level].inspector_only; @@ -165,12 +157,10 @@ bool EditorHistory::is_at_beginning() const { return current <= 0; } bool EditorHistory::is_at_end() const { - return ((current + 1) >= history.size()); } bool EditorHistory::next() { - cleanup_history(); if ((current + 1) < history.size()) @@ -182,7 +172,6 @@ bool EditorHistory::next() { } bool EditorHistory::previous() { - cleanup_history(); if (current > 0) @@ -194,7 +183,6 @@ bool EditorHistory::previous() { } bool EditorHistory::is_current_inspector_only() const { - if (current < 0 || current >= history.size()) return false; @@ -202,7 +190,6 @@ bool EditorHistory::is_current_inspector_only() const { return h.path[h.level].inspector_only; } ObjectID EditorHistory::get_current() { - if (current < 0 || current >= history.size()) return ObjectID(); @@ -215,7 +202,6 @@ ObjectID EditorHistory::get_current() { } int EditorHistory::get_path_size() const { - if (current < 0 || current >= history.size()) return 0; @@ -224,7 +210,6 @@ int EditorHistory::get_path_size() const { } ObjectID EditorHistory::get_path_object(int p_index) const { - if (current < 0 || current >= history.size()) return ObjectID(); @@ -240,7 +225,6 @@ ObjectID EditorHistory::get_path_object(int p_index) const { } String EditorHistory::get_path_property(int p_index) const { - if (current < 0 || current >= history.size()) return ""; @@ -252,20 +236,16 @@ String EditorHistory::get_path_property(int p_index) const { } void EditorHistory::clear() { - history.clear(); current = -1; } EditorHistory::EditorHistory() { - current = -1; } EditorPlugin *EditorData::get_editor(Object *p_object) { - for (int i = 0; i < editor_plugins.size(); i++) { - if (editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) return editor_plugins[i]; } @@ -274,9 +254,7 @@ EditorPlugin *EditorData::get_editor(Object *p_object) { } EditorPlugin *EditorData::get_subeditor(Object *p_object) { - for (int i = 0; i < editor_plugins.size(); i++) { - if (!editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) return editor_plugins[i]; } @@ -295,9 +273,7 @@ Vector EditorData::get_subeditors(Object *p_object) { } EditorPlugin *EditorData::get_editor(String p_name) { - for (int i = 0; i < editor_plugins.size(); i++) { - if (editor_plugins[i]->get_name() == p_name) return editor_plugins[i]; } @@ -306,14 +282,12 @@ EditorPlugin *EditorData::get_editor(String p_name) { } void EditorData::copy_object_params(Object *p_object) { - clipboard.clear(); List pinfo; p_object->get_property_list(&pinfo); for (List::Element *E = pinfo.front(); E; E = E->next()) { - if (!(E->get().usage & PROPERTY_USAGE_EDITOR) || E->get().name == "script" || E->get().name == "scripts") continue; @@ -325,18 +299,14 @@ void EditorData::copy_object_params(Object *p_object) { } void EditorData::get_editor_breakpoints(List *p_breakpoints) { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->get_breakpoints(p_breakpoints); } } Dictionary EditorData::get_editor_states() const { - Dictionary metadata; for (int i = 0; i < editor_plugins.size(); i++) { - Dictionary state = editor_plugins[i]->get_state(); if (state.empty()) continue; @@ -353,17 +323,14 @@ Dictionary EditorData::get_scene_editor_states(int p_idx) const { } void EditorData::set_editor_states(const Dictionary &p_states) { - List keys; p_states.get_key_list(&keys); List::Element *E = keys.front(); for (; E; E = E->next()) { - String name = E->get(); int idx = -1; for (int i = 0; i < editor_plugins.size(); i++) { - if (editor_plugins[i]->get_name() == name) { idx = i; break; @@ -377,64 +344,49 @@ void EditorData::set_editor_states(const Dictionary &p_states) { } void EditorData::notify_edited_scene_changed() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->edited_scene_changed(); editor_plugins[i]->notify_scene_changed(get_edited_scene_root()); } } void EditorData::notify_resource_saved(const Ref &p_resource) { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->notify_resource_saved(p_resource); } } void EditorData::clear_editor_states() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->clear(); } } void EditorData::save_editor_external_data() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->save_external_data(); } } void EditorData::apply_changes_in_editors() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->apply_changes(); } } void EditorData::save_editor_global_states() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->save_global_state(); } } void EditorData::restore_editor_global_states() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->restore_global_state(); } } void EditorData::paste_object_params(Object *p_object) { - ERR_FAIL_NULL(p_object); undo_redo.create_action(TTR("Paste Params")); for (List::Element *E = clipboard.front(); E; E = E->next()) { @@ -446,11 +398,9 @@ void EditorData::paste_object_params(Object *p_object) { } bool EditorData::call_build() { - bool result = true; for (int i = 0; i < editor_plugins.size() && result; i++) { - result &= editor_plugins[i]->build(); } @@ -458,18 +408,15 @@ bool EditorData::call_build() { } UndoRedo &EditorData::get_undo_redo() { - return undo_redo; } void EditorData::remove_editor_plugin(EditorPlugin *p_plugin) { - p_plugin->undo_redo = nullptr; editor_plugins.erase(p_plugin); } void EditorData::add_editor_plugin(EditorPlugin *p_plugin) { - p_plugin->undo_redo = &undo_redo; editor_plugins.push_back(p_plugin); } @@ -478,13 +425,11 @@ int EditorData::get_editor_plugin_count() const { return editor_plugins.size(); } EditorPlugin *EditorData::get_editor_plugin(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, editor_plugins.size(), nullptr); return editor_plugins[p_idx]; } void EditorData::add_custom_type(const String &p_type, const String &p_inherits, const Ref