summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp8
-rw-r--r--editor/animation_track_editor.h2
-rw-r--r--editor/array_property_edit.cpp6
-rw-r--r--editor/audio_stream_preview.h2
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/connections_dialog.cpp2
-rw-r--r--editor/dictionary_property_edit.cpp5
-rw-r--r--editor/editor_audio_buses.cpp38
-rw-r--r--editor/editor_autoload_settings.cpp11
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_export.cpp8
-rw-r--r--editor/editor_file_system.cpp12
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_inspector.h4
-rw-r--r--editor/editor_plugin.cpp2
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_profiler.cpp4
-rw-r--r--editor/editor_properties.cpp12
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_run.cpp6
-rw-r--r--editor/editor_run_native.h2
-rw-r--r--editor/editor_settings.cpp9
-rw-r--r--editor/editor_settings.h5
-rw-r--r--editor/export_template_manager.cpp7
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp6
-rw-r--r--editor/multi_node_edit.cpp2
-rw-r--r--editor/node_dock.cpp4
-rw-r--r--editor/plugin_config_dialog.h2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp4
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp4
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp8
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp8
-rw-r--r--editor/plugins/animation_tree_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp15
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp5
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_editor_plugin.h2
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp12
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp5
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h6
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/rename_dialog.cpp18
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/spatial_editor_gizmos.cpp18
60 files changed, 135 insertions, 201 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 6e47fadb20..4d48beed0a 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -286,7 +286,7 @@ public:
if (name == "value") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -302,7 +302,7 @@ public:
}
if (name == "in_handle") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -318,7 +318,7 @@ public:
}
if (name == "out_handle") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -4887,7 +4887,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
continue;
}
- if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || cleanup_keys->is_pressed() == false)
+ if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || !cleanup_keys->is_pressed())
continue;
for (int j = 0; j < p_animation->track_get_key_count(i); j++) {
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 1452d5519c..61a2cf02b3 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -332,7 +332,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _update_scroll(double);
void _update_step(double p_new_step);
- void _update_length(double p_new_step);
+ void _update_length(double p_new_len);
void _dropped_track(int p_from_track, int p_to_track);
void _add_track(int p_type);
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 72beeaaf45..f2471e80d4 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -93,7 +93,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (newsize == size)
return true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Resize Array"));
ur->add_do_method(this, "_set_size", newsize);
ur->add_undo_method(this, "_set_size", size);
@@ -141,7 +141,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
Variant::CallError ce;
Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value Type"));
ur->add_do_method(this, "_set_value", idx, new_value);
@@ -157,7 +157,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
Variant arr = get_array();
Variant value = arr.get(idx);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value"));
ur->add_do_method(this, "_set_value", idx, p_value);
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
index fca0aabac1..90b59cf8c1 100644
--- a/editor/audio_stream_preview.h
+++ b/editor/audio_stream_preview.h
@@ -78,7 +78,7 @@ protected:
public:
static AudioStreamPreviewGenerator *get_singleton() { return singleton; }
- Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_preview);
+ Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_stream);
AudioStreamPreviewGenerator();
};
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index a0d319c81b..4bc9dff26c 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -48,7 +48,7 @@
String Collada::Effect::get_texture_path(const String &p_source, Collada &state) const {
- String image = p_source;
+ const String &image = p_source;
ERR_FAIL_COND_V(!state.state.image_map.has(image), "");
return state.state.image_map[image].path;
}
@@ -1101,6 +1101,7 @@ void Collada::_parse_mesh_geometry(XMLParser &parser, String p_id, String p_name
Vector<float> values = _read_float_array(parser);
if (polygons) {
+ ERR_CONTINUE(prim.vertex_size == 0);
prim.polygons.push_back(values.size() / prim.vertex_size);
int from = prim.indices.size();
prim.indices.resize(from + values.size());
@@ -2522,7 +2523,6 @@ Error Collada::load(const String &p_path, int p_flags) {
state.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
state.import_flags = p_flags;
/* Skip headers */
- err = OK;
while ((err = parser.read()) == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 6d3603f31b..d04392dabf 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -649,7 +649,7 @@ Open connection dialog with TreeItem data to CREATE a brand-new connection.
void ConnectionsDock::_open_connection_dialog(TreeItem &item) {
String signal = item.get_metadata(0).operator Dictionary()["name"];
- String signalname = signal;
+ const String &signalname = signal;
String midname = selectedNode->get_name();
for (int i = 0; i < midname.length(); i++) { //TODO: Regex filter may be cleaner.
CharType c = midname[i];
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
index 9f4096ca02..62b50b16f2 100644
--- a/editor/dictionary_property_edit.cpp
+++ b/editor/dictionary_property_edit.cpp
@@ -42,7 +42,6 @@ void DictionaryPropertyEdit::_notif_changev(const String &p_v) {
void DictionaryPropertyEdit::_set_key(const Variant &p_old_key, const Variant &p_new_key) {
// TODO: Set key of a dictionary is not allowed yet
- return;
}
void DictionaryPropertyEdit::_set_value(const Variant &p_key, const Variant &p_value) {
@@ -129,7 +128,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (type == "key" && index < keys.size()) {
const Variant &key = keys[index];
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Key"));
ur->add_do_method(this, "_set_key", key, p_value);
@@ -144,7 +143,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (dict.has(key)) {
Variant value = dict[key];
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Value"));
ur->add_do_method(this, "_set_value", key, p_value);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 57fac241b0..b9fb532c4a 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -288,7 +288,7 @@ void EditorAudioBus::_name_changed(const String &p_new_name) {
}
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
StringName current = AudioServer::get_singleton()->get_bus_name(get_index());
ur->create_action(TTR("Rename Audio Bus"));
@@ -323,7 +323,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
float p_db = this->_normalized_volume_to_scaled_db(p_normalized);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index()));
@@ -400,7 +400,7 @@ void EditorAudioBus::_solo_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Solo"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), solo->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), AudioServer::get_singleton()->is_bus_solo(get_index()));
@@ -414,7 +414,7 @@ void EditorAudioBus::_mute_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Mute"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), mute->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), AudioServer::get_singleton()->is_bus_mute(get_index()));
@@ -428,7 +428,7 @@ void EditorAudioBus::_bypass_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Bypass Effects"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), bypass->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), AudioServer::get_singleton()->is_bus_bypassing_effects(get_index()));
@@ -443,7 +443,7 @@ void EditorAudioBus::_send_selected(int p_which) {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", get_index(), send->get_item_text(p_which));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", get_index(), AudioServer::get_singleton()->get_bus_send(get_index()));
@@ -492,7 +492,7 @@ void EditorAudioBus::_effect_edited() {
int index = effect->get_metadata(0);
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, effect->is_checked(0));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index));
@@ -519,7 +519,7 @@ void EditorAudioBus::_effect_add(int p_which) {
afxr->set_name(effect_options->get_item_text(p_which));
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), afxr, -1);
ur->add_undo_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect_count(get_index()));
@@ -671,7 +671,7 @@ void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data,
bool enabled = AudioServer::get_singleton()->is_bus_effect_enabled(bus, effect);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", bus, effect);
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(bus, effect), paste_at);
@@ -712,7 +712,7 @@ void EditorAudioBus::_delete_effect_pressed(int p_option) {
int index = item->get_metadata(0);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), index);
ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(get_index(), index), index);
@@ -980,11 +980,7 @@ void EditorAudioBusDrop::_notification(int p_what) {
bool EditorAudioBusDrop::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
Dictionary d = p_data;
- if (d.has("type") && String(d["type"]) == "move_audio_bus") {
- return true;
- }
-
- return false;
+ return (d.has("type") && String(d["type"]) == "move_audio_bus");
}
void EditorAudioBusDrop::drop_data(const Point2 &p_point, const Variant &p_data) {
@@ -1013,7 +1009,7 @@ void EditorAudioBuses::_update_buses() {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
- bool is_master = i == 0 ? true : false;
+ bool is_master = (i == 0);
EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master));
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
@@ -1075,7 +1071,7 @@ void EditorAudioBuses::_notification(int p_what) {
void EditorAudioBuses::_add_bus() {
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count() + 1);
@@ -1109,7 +1105,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
return;
}
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus", index);
@@ -1133,7 +1129,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
void EditorAudioBuses::_duplicate_bus(int p_which) {
int add_at_pos = p_which + 1;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Duplicate Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus", add_at_pos);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", add_at_pos, AudioServer::get_singleton()->get_bus_name(p_which) + " Copy");
@@ -1158,7 +1154,7 @@ void EditorAudioBuses::_reset_bus_volume(Object *p_which) {
EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
int index = bus->get_index();
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Reset Bus Volume"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", index, 0.f);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
@@ -1180,7 +1176,7 @@ void EditorAudioBuses::_request_drop_end() {
void EditorAudioBuses::_drop_at_index(int p_bus, int p_index) {
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "move_bus", p_bus, p_index);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 913eb35f8a..0be7db3236 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -545,10 +545,7 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
int section = tree->get_drop_section_at_position(p_point);
- if (section < -1)
- return false;
-
- return true;
+ return section >= -1;
}
return false;
@@ -650,7 +647,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
return false;
}
- String path = p_path;
+ const String &path = p_path;
if (!FileAccess::exists(path)) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist."));
return false;
@@ -663,7 +660,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
name = "autoload/" + name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add AutoLoad"));
// Singleton autoloads are represented with a leading "*" in their path.
@@ -690,7 +687,7 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) {
String name = "autoload/" + p_name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
int order = ProjectSettings::get_singleton()->get_order(name);
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index e04bca2a9e..7733ecb9da 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -186,7 +186,7 @@ EditorDirDialog::EditorDirDialog() {
tree->connect("item_activated", this, "_ok");
- makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel() ? true : false, "makedir");
+ makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
makedir->connect("pressed", this, "_make_dir");
makedialog = memnew(ConfirmationDialog);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index b5325a07a5..bebd5b2412 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -977,7 +977,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
ftmp = FileAccess::open(tmppath, FileAccess::READ);
if (!ftmp) {
memdelete(f);
- ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE);
+ ERR_EXPLAIN("Can't open file to read from path: " + String(tmppath));
+ ERR_FAIL_V(ERR_CANT_CREATE);
}
const int bufsize = 16384;
@@ -1455,10 +1456,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
err += TTR("Custom release template not found.") + "\n";
}
- if (dvalid || rvalid)
- valid = true;
- else
- valid = false;
+ valid = dvalid || rvalid;
if (!err.empty())
r_error = err;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 4ddb28b440..3c7c6ec9ed 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1290,13 +1290,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
r_file_pos = cpos;
*r_d = fs;
- if (cpos != -1) {
-
- return true;
- } else {
-
- return false;
- }
+ return cpos != -1;
}
String EditorFileSystem::get_file_type(const String &p_file) const {
@@ -1604,7 +1598,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
//all went well, overwrite config files with proper remaps and md5s
for (Map<String, Map<StringName, Variant> >::Element *E = source_file_options.front(); E; E = E->next()) {
- String file = E->key();
+ const String &file = E->key();
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(file);
FileAccessRef f = FileAccess::open(file + ".import", FileAccess::WRITE);
ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
@@ -1939,7 +1933,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (err) {
memdelete(da);
ERR_EXPLAIN("Failed to create 'res://.import' folder.");
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL();
}
}
memdelete(da);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 26d793cf65..790a70a3cc 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -389,7 +389,6 @@ void EditorHelp::_update_doc() {
if (prev) {
class_desc->add_text(" , ");
- prev = false;
}
_add_type(E->get().name);
@@ -540,7 +539,6 @@ void EditorHelp::_update_doc() {
class_desc->pop(); //cell
class_desc->push_cell();
class_desc->pop(); //cell
- any_previous = false;
}
String group_prefix;
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 0550509ba2..117a63699e 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -139,7 +139,7 @@ public:
bool is_selected() const;
void set_label_reference(Control *p_control);
- void set_bottom_editor(Control *p_editor);
+ void set_bottom_editor(Control *p_control);
void set_use_folding(bool p_use_folding);
bool is_using_folding() const;
@@ -317,7 +317,7 @@ class EditorInspector : public ScrollContainer {
void _node_removed(Node *p_node);
void _changed_callback(Object *p_changed, const char *p_prop);
- void _edit_request_change(Object *p_changed, const String &p_prop);
+ void _edit_request_change(Object *p_object, const String &p_prop);
void _filter_changed(const String &p_text);
void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 055e1338dd..78c38af555 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -184,7 +184,7 @@ Node *EditorInterface::get_edited_scene_root() {
Array EditorInterface::get_open_scenes() const {
Array ret;
- Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
+ Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
int scns_amount = scenes.size();
for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 0d700cd9b6..ec369bbdbb 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -101,7 +101,7 @@ public:
Error save_scene();
void save_scene_as(const String &p_scene, bool p_with_preview = true);
- Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_trnasforms, int p_preview_size);
+ Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_transforms, int p_preview_size);
EditorInterface();
};
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index f73cd0beb5..9cf36f162d 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -227,8 +227,6 @@ void EditorProfiler::_update_plot() {
Map<StringName, int> plot_prev;
//Map<StringName,int> plot_max;
- uint64_t time = OS::get_singleton()->get_ticks_usec();
-
for (int i = 0; i < w; i++) {
for (int j = 0; j < h * 4; j++) {
@@ -340,8 +338,6 @@ void EditorProfiler::_update_plot() {
wr[widx + 3] = 255;
}
}
-
- time = OS::get_singleton()->get_ticks_usec() - time;
}
wr = PoolVector<uint8_t>::Write();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index d5f4d54e5c..8e4ec47435 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2303,7 +2303,7 @@ void EditorPropertyResource::_update_menu_items() {
}
for (Set<String>::Element *F = valid_inheritors.front(); F; F = F->next()) {
- String t = F->get();
+ const String &t = F->get();
bool is_custom_resource = false;
Ref<Texture> icon;
@@ -2469,8 +2469,8 @@ void EditorPropertyResource::_fold_other_editors(Object *p_self) {
if (!res.is_valid())
return;
bool use_editor = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
- EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
+ for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
+ EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}
@@ -2516,7 +2516,7 @@ void EditorPropertyResource::update_property() {
sub_inspector->set_keying(is_keying());
sub_inspector->set_read_only(is_read_only());
sub_inspector->set_use_folding(is_using_folding());
- sub_inspector->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ sub_inspector->set_undo_redo(EditorNode::get_undo_redo());
sub_inspector_vbox = memnew(VBoxContainer);
add_child(sub_inspector_vbox);
@@ -2526,8 +2526,8 @@ void EditorPropertyResource::update_property() {
assign->set_pressed(true);
bool use_editor = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
- EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
+ for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
+ EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 5f18959689..a49f9489e1 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -791,7 +791,7 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::_RID: {
- prop = memnew(EditorPropertyNil);
+ prop = memnew(EditorPropertyRID);
} break;
case Variant::OBJECT: {
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 0ba32395ec..4bd68a593f 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -50,10 +50,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
args.push_back(resource_path.replace(" ", "%20"));
}
- if (true) {
- args.push_back("--remote-debug");
- args.push_back(remote_host + ":" + String::num(remote_port));
- }
+ args.push_back("--remote-debug");
+ args.push_back(remote_host + ":" + String::num(remote_port));
args.push_back("--allow_focus_steal_pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));
diff --git a/editor/editor_run_native.h b/editor/editor_run_native.h
index d62c982725..a5c28b0cb4 100644
--- a/editor/editor_run_native.h
+++ b/editor/editor_run_native.h
@@ -36,7 +36,7 @@
class EditorRunNative : public HBoxContainer {
- GDCLASS(EditorRunNative, BoxContainer);
+ GDCLASS(EditorRunNative, HBoxContainer);
Map<int, MenuButton *> menus;
bool first;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 58e3cc6fc1..8dfac3ce52 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -107,7 +107,7 @@ bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value)
}
if (save_changed_setting) {
- if (props[p_name].save != true) {
+ if (!props[p_name].save) {
props[p_name].save = true;
changed = true;
}
@@ -690,7 +690,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
keys.sort();
for (const List<String>::Element *E = keys.front(); E; E = E->next()) {
- String key = E->get();
+ const String &key = E->get();
if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) {
cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html());
}
@@ -698,10 +698,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
Error err = cf->save(p_file);
- if (err == OK) {
- return true;
- }
- return false;
+ return err == OK;
}
bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) {
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 2ee8dd805b..890850629e 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -73,8 +73,6 @@ private:
bool restart_if_changed;
VariantContainer() :
order(0),
- variant(Variant()),
- initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@@ -83,7 +81,6 @@ private:
VariantContainer(const Variant &p_variant, int p_order) :
order(p_order),
variant(p_variant),
- initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@@ -123,7 +120,7 @@ private:
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
void _load_default_text_editor_theme();
bool _save_text_editor_theme(String p_file);
- bool _is_default_text_editor_theme(String p_file);
+ bool _is_default_text_editor_theme(String p_theme_name);
protected:
static void _bind_methods();
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 4e499021f9..bd61e6182c 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -314,7 +314,8 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (!f) {
ret = unzGoToNextFile(pkg);
fc++;
- ERR_CONTINUE(!f);
+ ERR_EXPLAIN("Can't open file from path: " + String(to_write));
+ ERR_CONTINUE(true);
}
f->store_buffer(data.ptr(), data.size());
@@ -406,9 +407,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
} break;
case HTTPRequest::RESULT_BODY_SIZE_LIMIT_EXCEEDED:
case HTTPRequest::RESULT_CONNECTION_ERROR:
- case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH: {
- template_list_state->set_text(TTR("Can't connect."));
- } break;
+ case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH:
case HTTPRequest::RESULT_SSL_HANDSHAKE_ERROR:
case HTTPRequest::RESULT_CANT_CONNECT: {
template_list_state->set_text(TTR("Can't connect."));
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index e57217bb11..83e529ac35 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -244,7 +244,7 @@ void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
void FileSystemDock::_update_display_mode(bool p_force) {
// Compute the new display mode
if (p_force || old_display_mode != display_mode) {
- button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT ? true : false);
+ button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT);
switch (display_mode) {
case DISPLAY_MODE_TREE_ONLY:
tree->show();
@@ -2063,8 +2063,6 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
}
}
}
-
- return;
}
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 46eaf71a8a..76f92665db 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -204,7 +204,7 @@ private:
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
void _save_scenes_after_move(const Map<String, String> &p_renames) const;
void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
- void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const;
+ void _update_project_settings_after_move(const Map<String, String> &p_renames) const;
void _file_deleted(String p_file);
void _folder_deleted(String p_folder);
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index b3eb7ae83b..eb119b4ba3 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -34,7 +34,7 @@
#include "core/io/resource_importer.h"
class EditorImportPlugin : public ResourceImporter {
- GDCLASS(EditorImportPlugin, Reference);
+ GDCLASS(EditorImportPlugin, ResourceImporter);
protected:
static void _bind_methods();
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 0989a43705..a8197ec2a2 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1135,7 +1135,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? 1 : 0));
@@ -1145,8 +1145,8 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out ? true : false));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_linear_error"), 0.05));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_angular_error"), 0.01));
@@ -1237,7 +1237,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
Error ResourceImporterScene::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
- String src_path = p_source_file;
+ const String &src_path = p_source_file;
Ref<EditorSceneImporter> importer;
String ext = src_path.get_extension().to_lower();
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index e89f862c1b..498e0f6fb8 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -85,7 +85,7 @@ public:
String get_source_folder() const;
String get_source_file() const;
virtual Node *post_import(Node *p_scene);
- virtual void init(const String &p_scene_folder, const String &p_scene_path);
+ virtual void init(const String &p_source_folder, const String &p_source_file);
EditorScenePostImport();
};
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 5865ceb3af..25431179b5 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -205,11 +205,11 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/normal_map", PROPERTY_HINT_ENUM, "Detect,Enable,Disabled"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirrored"), p_preset == PRESET_3D ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset == PRESET_2D_PIXEL ? false : true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset != PRESET_2D_PIXEL));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/anisotropic"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/srgb", PROPERTY_HINT_ENUM, "Disable,Enable,Detect"), 2));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/premult_alpha"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/HDR_as_SRGB"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/invert_color"), false));
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index eca4e58abe..51a6cc6757 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -205,7 +205,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
PackData &pack_data = pack_data_files.write[idx];
- String source = E->key();
+ const String &source = E->key();
const Map<StringName, Variant> &options = E->get();
Ref<Image> image;
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index e39f2dabaa..1787a3b88d 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -210,12 +210,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("bits: "+itos(format_bits));
*/
- int len = frames;
- if (format_channels == 2)
- len *= 2;
- if (format_bits > 8)
- len *= 2;
-
data.resize(frames * format_channels);
if (format_bits == 8) {
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 56a04f615d..6af7e4bd00 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -50,7 +50,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
name = "script";
}
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS);
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index e3fb579667..1c0151ed0a 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -119,13 +119,13 @@ NodeDock::NodeDock() {
groups_button->connect("pressed", this, "show_groups");
connections = memnew(ConnectionsDock(EditorNode::get_singleton()));
- connections->set_undoredo(EditorNode::get_singleton()->get_undo_redo());
+ connections->set_undoredo(EditorNode::get_undo_redo());
add_child(connections);
connections->set_v_size_flags(SIZE_EXPAND_FILL);
connections->hide();
groups = memnew(GroupsEditor);
- groups->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ groups->set_undo_redo(EditorNode::get_undo_redo());
add_child(groups);
groups->set_v_size_flags(SIZE_EXPAND_FILL);
groups->hide();
diff --git a/editor/plugin_config_dialog.h b/editor/plugin_config_dialog.h
index 74febfe408..525b7755dd 100644
--- a/editor/plugin_config_dialog.h
+++ b/editor/plugin_config_dialog.h
@@ -62,7 +62,7 @@ protected:
static void _bind_methods();
public:
- void config(const String &p_plugin_dir_name);
+ void config(const String &p_config_path);
PluginConfigDialog();
~PluginConfigDialog();
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 1afd7df049..2931678c80 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -807,7 +807,7 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi
canvas_item_editor = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
wip_active = false;
edited_point = PosVertex();
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 2ae39d90de..e07f041eb1 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
error_panel->add_child(error_label);
error_label->set_text("hmmm");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
menu = memnew(PopupMenu);
add_child(menu);
@@ -751,7 +751,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
dragging_selected = false;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 5e8fb8e059..b422e3e927 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -1043,7 +1043,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
error_panel->add_child(error_label);
error_label->set_text("eh");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@@ -1061,7 +1061,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
selected_triangle = -1;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index dff6eb5c5e..65282ccfc2 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -598,7 +598,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
- String bone = concat;
+ const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {
@@ -796,7 +796,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
ERR_FAIL_COND(!gn);
- String new_name = p_text;
+ const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@@ -804,7 +804,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
return; //nothing to do
}
- String base_name = new_name;
+ const String &base_name = new_name;
int base = 1;
String name = base_name;
while (blend_tree->has_node(name)) {
@@ -964,5 +964,5 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index a8866a1a87..5163b372b2 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1868,7 +1868,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor = p_node;
anim_editor = memnew(AnimationPlayerEditor(editor, this));
- anim_editor->set_undo_redo(editor->get_undo_redo());
+ anim_editor->set_undo_redo(EditorNode::get_undo_redo());
editor->add_bottom_panel_item(TTR("Animation"), anim_editor);
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index e25e7ac7ed..bc22d9315e 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1094,7 +1094,7 @@ void AnimationNodeStateMachineEditor::_removed_from_graph() {
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
- String new_name = p_text;
+ const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@@ -1102,7 +1102,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
return; // Nothing to do.
}
- String base_name = new_name;
+ const String &base_name = new_name;
int base = 1;
String name = base_name;
while (state_machine->has_node(name)) {
@@ -1365,7 +1365,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
error_panel->add_child(error_label);
error_panel->hide();
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@@ -1390,7 +1390,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
over_text = false;
diff --git a/editor/plugins/animation_tree_player_editor_plugin.cpp b/editor/plugins/animation_tree_player_editor_plugin.cpp
index f5d21ffb26..c99ad7f441 100644
--- a/editor/plugins/animation_tree_player_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_player_editor_plugin.cpp
@@ -511,9 +511,7 @@ void AnimationTreePlayerEditor::_draw_node(const StringName &p_node) {
font->draw_halign(ci, ofs + ascofs, HALIGN_CENTER, w, p_node, font_color);
ofs.y += h;
- int count = 2; // title and name
int inputs = anim_tree->node_get_input_count(p_node);
- count += inputs ? inputs : 1;
float icon_h_ofs = Math::floor((font->get_height() - slot_icon->get_height()) / 2.0) + 1;
@@ -618,7 +616,7 @@ AnimationTreePlayerEditor::ClickType AnimationTreePlayerEditor::_locate_click(co
for (const List<StringName>::Element *E = order.back(); E; E = E->prev()) {
- StringName node = E->get();
+ const StringName &node = E->get();
AnimationTreePlayer::NodeType type = anim_tree->node_get_type(node);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 3c24fd19b6..10f53182bf 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -71,8 +71,7 @@ class SnapDialog : public ConfirmationDialog {
SpinBox *rotation_step;
public:
- SnapDialog() :
- ConfirmationDialog() {
+ SnapDialog() {
const int SPIN_BOX_GRID_RANGE = 256;
const int SPIN_BOX_ROTATION_RANGE = 360;
Label *label;
@@ -490,8 +489,6 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
r_items.push_back(res);
}
}
-
- return;
}
void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items) {
@@ -1999,11 +1996,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
return true;
}
- if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
- // Accept the key event in any case
- return true;
- }
- return false;
+ return (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)); // Accept the key event in any case
}
bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
@@ -4340,7 +4333,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->get_parent_item())
continue;
- if (n2d->has_meta("_edit_bone_") && (bool)n2d->get_meta("_edit_bone_") == true)
+ if (n2d->has_meta("_edit_bone_") && n2d->get_meta("_edit_bone_"))
continue;
undo_redo->add_do_method(n2d, "set_meta", "_edit_bone_", true);
@@ -4390,7 +4383,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
continue;
- if (canvas_item->has_meta("_edit_ik_") && (bool)canvas_item->get_meta("_edit_ik_") == true)
+ if (canvas_item->has_meta("_edit_ik_") && canvas_item->get_meta("_edit_ik_"))
continue;
undo_redo->add_do_method(canvas_item, "set_meta", "_edit_ik_", true);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index ff221eb758..a46682d494 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -425,7 +425,7 @@ private:
List<CanvasItem *> _get_edited_canvas_items(bool retreive_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
- void _expand_encompassing_rect_using_children(Rect2 &p_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
+ void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
Rect2 _get_encompassing_rect(const Node *p_node);
Object *_get_editor_data(Object *p_what);
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 6ab554cb05..87cb0d04a2 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -527,7 +527,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
node = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
add_child(memnew(VSeparator));
button_create = memnew(ToolButton);
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index a10eddb131..b87bd29cbd 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -179,7 +179,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
// Check for segment split.
- if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge == true) {
+ if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
Vector2 gpoint2 = mb->get_position();
Ref<Curve2D> curve = node->get_curve();
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 53300f45ec..b8d95efd49 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -293,10 +293,7 @@ bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Vari
Vector<String> files = d["files"];
- if (files.size() == 0)
- return false;
-
- return true;
+ return files.size() != 0;
}
return false;
}
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 326e8394a0..05f682f469 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -131,7 +131,7 @@ void EditorPropertyRootMotion::_node_assign() {
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
- String bone = concat;
+ const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {
diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h
index 33a9128a11..558e954815 100644
--- a/editor/plugins/skeleton_editor_plugin.h
+++ b/editor/plugins/skeleton_editor_plugin.h
@@ -69,7 +69,7 @@ protected:
PhysicalBone *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
public:
- void edit(Skeleton *p_mesh);
+ void edit(Skeleton *p_node);
SkeletonEditor();
~SkeletonEditor();
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 701b9e8144..3bddc6d6d4 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -133,7 +133,7 @@ public:
virtual bool is_editable() const;
void set_hidden(bool p_hidden);
- void set_plugin(EditorSpatialGizmoPlugin *p_gizmo);
+ void set_plugin(EditorSpatialGizmoPlugin *p_plugin);
EditorSpatialGizmo();
~EditorSpatialGizmo();
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 16f93b8fd3..82e8248216 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -1848,7 +1848,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
manual_position = Vector2(0, 0);
canvas_item_editor_viewport = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
tool = TOOL_NONE;
selection_active = false;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 4b225fddf5..069d9d25ee 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -263,7 +263,7 @@ void TileSetEditor::_notification(int p_what) {
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
current_tile = -1;
VBoxContainer *left_container = memnew(VBoxContainer);
@@ -829,8 +829,8 @@ void TileSetEditor::_on_workspace_draw() {
case EDITMODE_BITMASK: {
Color c(1, 0, 0, 0.5);
Color ci(0.3, 0.6, 1, 0.5);
- for (float x = 0; x < region.size.x / (spacing + size.x); x++) {
- for (float y = 0; y < region.size.y / (spacing + size.y); y++) {
+ for (int x = 0; x < region.size.x / (spacing + size.x); x++) {
+ for (int y = 0; y < region.size.y / (spacing + size.y); y++) {
Vector2 coord(x, y);
Point2 anchor(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
anchor += WORKSPACE_MARGIN;
@@ -2009,11 +2009,7 @@ bool TileSetEditor::_sort_tiles(Variant p_a, Variant p_b) {
return true;
} else if (pos_a.y == pos_b.y) {
- if (pos_a.x < pos_b.x) {
- return true;
- } else {
- return false;
- }
+ return (pos_a.x < pos_b.x);
} else {
return false;
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index bfb005cd0b..ddf49aa9ea 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -158,10 +158,7 @@ bool VisualShaderEditor::_is_available(int p_mode) {
p_mode = temp_mode;
}
- if (p_mode != -1 && ((p_mode & current_mode) == 0)) {
- return false;
- }
- return true;
+ return (p_mode == -1 || (p_mode & current_mode) != 0);
}
void VisualShaderEditor::_update_options_menu() {
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 567706b808..e89814df3d 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -176,12 +176,12 @@ class VisualShaderEditor : public VBoxContainer {
void _input_select_item(Ref<VisualShaderNodeInput> input, String name);
- void _add_input_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _add_input_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_input_port(int p_node, int p_port);
void _change_input_port_type(int p_type, int p_node, int p_port);
void _change_input_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
- void _add_output_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _add_output_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_output_port(int p_node, int p_port);
void _change_output_port_type(int p_type, int p_node, int p_port);
void _change_output_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
@@ -204,7 +204,7 @@ class VisualShaderEditor : public VBoxContainer {
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
- bool _is_available(int p_flags);
+ bool _is_available(int p_mode);
void _update_created_node(GraphNode *node);
protected:
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index ee78b240a4..956da92c35 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -166,7 +166,7 @@ void ProjectExportDialog::_update_presets() {
void ProjectExportDialog::_update_export_all() {
- bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0 ? true : false;
+ bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
@@ -986,7 +986,7 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
export_all_dialog->hide();
- _export_all(p_str == "release" ? false : true);
+ _export_all(p_str != "release");
}
void ProjectExportDialog::_export_all(bool p_debug) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 872f8fcd2c..df0dd8781e 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -808,7 +808,7 @@ void ProjectSettingsEditor::update_plugins() {
void ProjectSettingsEditor::_item_selected(const String &p_path) {
- String selected_path = p_path;
+ const String &selected_path = p_path;
if (selected_path == String())
return;
category->set_text(globals_editor->get_current_section());
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 4fa1bd74fe..82d974cae3 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -917,7 +917,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
}
for (Set<String>::Element *j = valid_inheritors.front(); j; j = j->next()) {
- String t = j->get();
+ const String &t = j->get();
bool is_custom_resource = false;
Ref<Texture> icon;
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 858b14a733..40343cf908 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -475,17 +475,17 @@ String RenameDialog::_substitute(const String &subject, const Node *node, int co
if (root_node) {
result = result.replace("${ROOT}", root_node->get_name());
}
-
- Node *parent_node = node->get_parent();
- if (parent_node) {
- if (node == root_node) {
- // Can not substitute parent of root.
- result = result.replace("${PARENT}", "");
- } else {
- result = result.replace("${PARENT}", parent_node->get_name());
+ if (node) {
+ Node *parent_node = node->get_parent();
+ if (parent_node) {
+ if (node == root_node) {
+ // Can not substitute parent of root.
+ result = result.replace("${PARENT}", "");
+ } else {
+ result = result.replace("${PARENT}", parent_node->get_name());
+ }
}
}
-
return result;
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index d6c8e6b452..ff188a00d3 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -981,11 +981,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
return true;
}
- if (String(d["type"]) == "nodes") {
- return true;
- }
-
- return false;
+ return String(d["type"]) == "nodes";
}
void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index c4b8999401..fc4ff2ecfc 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -275,15 +275,13 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLE_FAN, a);
mesh->surface_set_material(0, p_material);
- if (true) {
- float md = 0;
- for (int i = 0; i < vs.size(); i++) {
+ float md = 0;
+ for (int i = 0; i < vs.size(); i++) {
- md = MAX(0, vs[i].length());
- }
- if (md) {
- mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
- }
+ md = MAX(0, vs[i].length());
+ }
+ if (md) {
+ mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
}
selectable_icon_size = p_scale;
@@ -432,9 +430,7 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
}
}
- if (!any_out)
- return true;
- return false;
+ return !any_out;
}
if (collision_segments.size()) {