diff options
Diffstat (limited to 'editor')
35 files changed, 619 insertions, 186 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 09f55bea0c..da81732a01 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5297,10 +5297,18 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } switch (animation->track_get_type(i)) { - case Animation::TYPE_TRANSFORM: text += " (Transform)"; break; - case Animation::TYPE_METHOD: text += " (Methods)"; break; - case Animation::TYPE_BEZIER: text += " (Bezier)"; break; - case Animation::TYPE_AUDIO: text += " (Audio)"; break; + case Animation::TYPE_TRANSFORM: + text += " (Transform)"; + break; + case Animation::TYPE_METHOD: + text += " (Methods)"; + break; + case Animation::TYPE_BEZIER: + text += " (Bezier)"; + break; + case Animation::TYPE_AUDIO: + text += " (Audio)"; + break; default: { }; } diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 987d5649b1..76716f01b7 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -309,7 +309,8 @@ void FindReplaceBar::_update_results_count() { results_count = 0; String searched = get_search_text(); - if (searched.empty()) return; + if (searched.empty()) + return; String full_text = text_edit->get_text(); @@ -317,7 +318,8 @@ void FindReplaceBar::_update_results_count() { while (true) { int pos = is_case_sensitive() ? full_text.find(searched, from_pos) : full_text.findn(searched, from_pos); - if (pos == -1) break; + if (pos == -1) + break; if (is_whole_words()) { from_pos++; // Making sure we won't hit the same match next time, if we get out via a continue. diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index bef5c3c2b0..4556a6e827 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -171,20 +171,48 @@ void ConnectDialog::_add_bind() { Variant value; switch (vt) { - case Variant::BOOL: value = false; break; - case Variant::INT: value = 0; break; - case Variant::FLOAT: value = 0.0; break; - case Variant::STRING: value = ""; break; - case Variant::STRING_NAME: value = ""; break; - case Variant::VECTOR2: value = Vector2(); break; - case Variant::RECT2: value = Rect2(); break; - case Variant::VECTOR3: value = Vector3(); break; - case Variant::PLANE: value = Plane(); break; - case Variant::QUAT: value = Quat(); break; - case Variant::AABB: value = AABB(); break; - case Variant::BASIS: value = Basis(); break; - case Variant::TRANSFORM: value = Transform(); break; - case Variant::COLOR: value = Color(); break; + case Variant::BOOL: + value = false; + break; + case Variant::INT: + value = 0; + break; + case Variant::FLOAT: + value = 0.0; + break; + case Variant::STRING: + value = ""; + break; + case Variant::STRING_NAME: + value = ""; + break; + case Variant::VECTOR2: + value = Vector2(); + break; + case Variant::RECT2: + value = Rect2(); + break; + case Variant::VECTOR3: + value = Vector3(); + break; + case Variant::PLANE: + value = Plane(); + break; + case Variant::QUAT: + value = Quat(); + break; + case Variant::AABB: + value = AABB(); + break; + case Variant::BASIS: + value = Basis(); + break; + case Variant::TRANSFORM: + value = Transform(); + break; + case Variant::COLOR: + value = Color(); + break; default: { ERR_FAIL(); } break; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 152989f90b..0fa62253c3 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -74,7 +74,8 @@ void ScriptEditorDebugger::_put_msg(String p_message, Array p_data) { void ScriptEditorDebugger::debug_copy() { String msg = reason->get_text(); - if (msg == "") return; + if (msg == "") + return; DisplayServer::get_singleton()->clipboard_set(msg); } diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 6a06c6657e..2411852541 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -691,7 +691,8 @@ bool EditorFileDialog::_is_open_should_be_disabled() { void EditorFileDialog::update_file_name() { int idx = filter->get_selected() - 1; if ((idx == -1 && filter->get_item_count() == 2) || (filter->get_item_count() > 2 && idx >= 0 && idx < filter->get_item_count() - 2)) { - if (idx == -1) idx += 1; + if (idx == -1) + idx += 1; String filter_str = filters[idx]; String file_str = file->get_text(); String base_name = file_str.get_basename(); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index b566ad0fa4..b2bcab4717 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1497,7 +1497,8 @@ void EditorHelp::_notification(int p_what) { _class_desc_resized(); } } break; - default: break; + default: + break; } } @@ -1642,7 +1643,8 @@ void EditorHelpBit::_notification(int p_what) { rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); } break; - default: break; + default: + break; } } @@ -1786,7 +1788,8 @@ void FindBar::_update_results_count() { results_count = 0; String searched = search_text->get_text(); - if (searched.empty()) return; + if (searched.empty()) + return; String full_text = rich_text_label->get_text(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 90cea06439..c37ede4166 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3082,7 +3082,8 @@ void EditorNode::_remove_edited_scene(bool p_change_tab) { ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index)); } - if (p_change_tab) _scene_tab_changed(new_index); + if (p_change_tab) + _scene_tab_changed(new_index); editor_data.remove_scene(old_index); editor_data.get_undo_redo().clear_history(false); _update_title(); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 5213d7ec15..c5772e0ea7 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3318,13 +3318,27 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ EditorPropertyMember::Type type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE; switch (p_hint) { - case PROPERTY_HINT_METHOD_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE; break; - case PROPERTY_HINT_METHOD_OF_INSTANCE: type = EditorPropertyMember::MEMBER_METHOD_OF_INSTANCE; break; - case PROPERTY_HINT_METHOD_OF_SCRIPT: type = EditorPropertyMember::MEMBER_METHOD_OF_SCRIPT; break; - case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_VARIANT_TYPE; break; - case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE; break; - case PROPERTY_HINT_PROPERTY_OF_INSTANCE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE; break; - case PROPERTY_HINT_PROPERTY_OF_SCRIPT: type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT; break; + case PROPERTY_HINT_METHOD_OF_BASE_TYPE: + type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE; + break; + case PROPERTY_HINT_METHOD_OF_INSTANCE: + type = EditorPropertyMember::MEMBER_METHOD_OF_INSTANCE; + break; + case PROPERTY_HINT_METHOD_OF_SCRIPT: + type = EditorPropertyMember::MEMBER_METHOD_OF_SCRIPT; + break; + case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: + type = EditorPropertyMember::MEMBER_PROPERTY_OF_VARIANT_TYPE; + break; + case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: + type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE; + break; + case PROPERTY_HINT_PROPERTY_OF_INSTANCE: + type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE; + break; + case PROPERTY_HINT_PROPERTY_OF_SCRIPT: + type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT; + break; default: { } } diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index f0ee5d451f..f52e340a26 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -504,18 +504,26 @@ void ExportTemplateManager::_notification(int p_what) { status = TTR("Disconnected"); errored = true; break; - case HTTPClient::STATUS_RESOLVING: status = TTR("Resolving"); break; + case HTTPClient::STATUS_RESOLVING: + status = TTR("Resolving"); + break; case HTTPClient::STATUS_CANT_RESOLVE: status = TTR("Can't Resolve"); errored = true; break; - case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting..."); break; + case HTTPClient::STATUS_CONNECTING: + status = TTR("Connecting..."); + break; case HTTPClient::STATUS_CANT_CONNECT: status = TTR("Can't Connect"); errored = true; break; - case HTTPClient::STATUS_CONNECTED: status = TTR("Connected"); break; - case HTTPClient::STATUS_REQUESTING: status = TTR("Requesting..."); break; + case HTTPClient::STATUS_CONNECTED: + status = TTR("Connected"); + break; + case HTTPClient::STATUS_REQUESTING: + status = TTR("Requesting..."); + break; case HTTPClient::STATUS_BODY: status = TTR("Downloading"); if (download_templates->get_body_size() > 0) { diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 45e376a2aa..1a1e7171b9 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -538,12 +538,18 @@ Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) { String EditorSceneImporterGLTF::_get_component_type_name(const uint32_t p_component) { switch (p_component) { - case COMPONENT_TYPE_BYTE: return "Byte"; - case COMPONENT_TYPE_UNSIGNED_BYTE: return "UByte"; - case COMPONENT_TYPE_SHORT: return "Short"; - case COMPONENT_TYPE_UNSIGNED_SHORT: return "UShort"; - case COMPONENT_TYPE_INT: return "Int"; - case COMPONENT_TYPE_FLOAT: return "Float"; + case COMPONENT_TYPE_BYTE: + return "Byte"; + case COMPONENT_TYPE_UNSIGNED_BYTE: + return "UByte"; + case COMPONENT_TYPE_SHORT: + return "Short"; + case COMPONENT_TYPE_UNSIGNED_SHORT: + return "UShort"; + case COMPONENT_TYPE_INT: + return "Int"; + case COMPONENT_TYPE_FLOAT: + return "Float"; } return "<Error>"; @@ -655,12 +661,24 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, double *dst int EditorSceneImporterGLTF::_get_component_type_size(const int component_type) { switch (component_type) { - case COMPONENT_TYPE_BYTE: return 1; break; - case COMPONENT_TYPE_UNSIGNED_BYTE: return 1; break; - case COMPONENT_TYPE_SHORT: return 2; break; - case COMPONENT_TYPE_UNSIGNED_SHORT: return 2; break; - case COMPONENT_TYPE_INT: return 4; break; - case COMPONENT_TYPE_FLOAT: return 4; break; + case COMPONENT_TYPE_BYTE: + return 1; + break; + case COMPONENT_TYPE_UNSIGNED_BYTE: + return 1; + break; + case COMPONENT_TYPE_SHORT: + return 2; + break; + case COMPONENT_TYPE_UNSIGNED_SHORT: + return 2; + break; + case COMPONENT_TYPE_INT: + return 4; + break; + case COMPONENT_TYPE_FLOAT: + return 4; + break; default: { ERR_FAIL_V(0); } diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp index 1d7bed3975..9d72396449 100644 --- a/editor/import/resource_importer_csv_translation.cpp +++ b/editor/import/resource_importer_csv_translation.cpp @@ -83,9 +83,15 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const String delimiter; switch ((int)p_options["delimiter"]) { - case 0: delimiter = ","; break; - case 1: delimiter = ";"; break; - case 2: delimiter = "\t"; break; + case 0: + delimiter = ","; + break; + case 1: + delimiter = ";"; + break; + case 2: + delimiter = "\t"; + break; } FileAccessRef f = FileAccess::open(p_source_file, FileAccess::READ); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 239fae2268..e7f87acd03 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -221,16 +221,26 @@ int ResourceImporterScene::get_preset_count() const { String ResourceImporterScene::get_preset_name(int p_idx) const { switch (p_idx) { - case PRESET_SINGLE_SCENE: return TTR("Import as Single Scene"); - case PRESET_SEPARATE_ANIMATIONS: return TTR("Import with Separate Animations"); - case PRESET_SEPARATE_MATERIALS: return TTR("Import with Separate Materials"); - case PRESET_SEPARATE_MESHES: return TTR("Import with Separate Objects"); - case PRESET_SEPARATE_MESHES_AND_MATERIALS: return TTR("Import with Separate Objects+Materials"); - case PRESET_SEPARATE_MESHES_AND_ANIMATIONS: return TTR("Import with Separate Objects+Animations"); - case PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Materials+Animations"); - case PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Objects+Materials+Animations"); - case PRESET_MULTIPLE_SCENES: return TTR("Import as Multiple Scenes"); - case PRESET_MULTIPLE_SCENES_AND_MATERIALS: return TTR("Import as Multiple Scenes+Materials"); + case PRESET_SINGLE_SCENE: + return TTR("Import as Single Scene"); + case PRESET_SEPARATE_ANIMATIONS: + return TTR("Import with Separate Animations"); + case PRESET_SEPARATE_MATERIALS: + return TTR("Import with Separate Materials"); + case PRESET_SEPARATE_MESHES: + return TTR("Import with Separate Objects"); + case PRESET_SEPARATE_MESHES_AND_MATERIALS: + return TTR("Import with Separate Objects+Materials"); + case PRESET_SEPARATE_MESHES_AND_ANIMATIONS: + return TTR("Import with Separate Objects+Animations"); + case PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS: + return TTR("Import with Separate Materials+Animations"); + case PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS: + return TTR("Import with Separate Objects+Materials+Animations"); + case PRESET_MULTIPLE_SCENES: + return TTR("Import as Multiple Scenes"); + case PRESET_MULTIPLE_SCENES_AND_MATERIALS: + return TTR("Import as Multiple Scenes+Materials"); } return ""; diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp index a2f178de12..3a6215e035 100644 --- a/editor/import/resource_importer_shader_file.cpp +++ b/editor/import/resource_importer_shader_file.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* resource_importer_shader_file.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "resource_importer_shader_file.h" #include "core/io/marshalls.h" diff --git a/editor/import/resource_importer_shader_file.h b/editor/import/resource_importer_shader_file.h index f6b50bee9e..fa95ceecc1 100644 --- a/editor/import/resource_importer_shader_file.h +++ b/editor/import/resource_importer_shader_file.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* resource_importer_shader_file.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef RESOURCE_IMPORTER_SHADER_FILE_H #define RESOURCE_IMPORTER_SHADER_FILE_H diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index c321e85546..2a399087b2 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -431,7 +431,8 @@ bool EditorNode3DGizmo::intersect_frustum(const Camera3D *p_camera, const Vector ERR_FAIL_COND_V(!spatial_node, false); ERR_FAIL_COND_V(!valid, false); - if (hidden && !gizmo_plugin->is_selectable_when_hidden()) return false; + if (hidden && !gizmo_plugin->is_selectable_when_hidden()) + return false; if (selectable_icon_size > 0.0f) { Vector3 origin = spatial_node->get_global_transform().get_origin(); @@ -470,10 +471,12 @@ bool EditorNode3DGizmo::intersect_frustum(const Camera3D *p_camera, const Vector break; } } - if (any_out) break; + if (any_out) + break; } - if (!any_out) return true; + if (!any_out) + return true; } if (collision_mesh.is_valid()) { @@ -504,7 +507,8 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point, ERR_FAIL_COND_V(!spatial_node, false); ERR_FAIL_COND_V(!valid, false); - if (hidden && !gizmo_plugin->is_selectable_when_hidden()) return false; + if (hidden && !gizmo_plugin->is_selectable_when_hidden()) + return false; if (r_gizmo_handle && !hidden) { @@ -785,7 +789,8 @@ EditorNode3DGizmo::EditorNode3DGizmo() { EditorNode3DGizmo::~EditorNode3DGizmo() { - if (gizmo_plugin != nullptr) gizmo_plugin->unregister_gizmo(this); + if (gizmo_plugin != nullptr) + gizmo_plugin->unregister_gizmo(this); clear(); } @@ -2207,12 +2212,18 @@ int VisibilityNotifier3DGizmoPlugin::get_priority() const { String VisibilityNotifier3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { - case 0: return "Size X"; - case 1: return "Size Y"; - case 2: return "Size Z"; - case 3: return "Pos X"; - case 4: return "Pos Y"; - case 5: return "Pos Z"; + case 0: + return "Size X"; + case 1: + return "Size Y"; + case 2: + return "Size Z"; + case 3: + return "Pos X"; + case 4: + return "Pos Y"; + case 5: + return "Pos Z"; } return ""; @@ -2399,12 +2410,18 @@ bool GPUParticles3DGizmoPlugin::is_selectable_when_hidden() const { String GPUParticles3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { - case 0: return "Size X"; - case 1: return "Size Y"; - case 2: return "Size Z"; - case 3: return "Pos X"; - case 4: return "Pos Y"; - case 5: return "Pos Z"; + case 0: + return "Size X"; + case 1: + return "Size Y"; + case 2: + return "Size Z"; + case 3: + return "Pos X"; + case 4: + return "Pos Y"; + case 5: + return "Pos Z"; } return ""; @@ -2564,12 +2581,18 @@ int ReflectionProbeGizmoPlugin::get_priority() const { String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { - case 0: return "Extents X"; - case 1: return "Extents Y"; - case 2: return "Extents Z"; - case 3: return "Origin X"; - case 4: return "Origin Y"; - case 5: return "Origin Z"; + case 0: + return "Extents X"; + case 1: + return "Extents Y"; + case 2: + return "Extents Z"; + case 3: + return "Origin X"; + case 4: + return "Origin Y"; + case 5: + return "Origin Z"; } return ""; @@ -2747,9 +2770,12 @@ int DecalGizmoPlugin::get_priority() const { String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { - case 0: return "Extents X"; - case 1: return "Extents Y"; - case 2: return "Extents Z"; + case 0: + return "Extents X"; + case 1: + return "Extents Y"; + case 2: + return "Extents Z"; } return ""; @@ -2888,9 +2914,12 @@ int GIProbeGizmoPlugin::get_priority() const { String GIProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { - case 0: return "Extents X"; - case 1: return "Extents Y"; - case 2: return "Extents Z"; + case 0: + return "Extents X"; + case 1: + return "Extents Y"; + case 2: + return "Extents Z"; } return ""; diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index bb5147972c..1928d49556 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -1297,7 +1297,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const } } } break; - default: break; + default: + break; } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e882b3a8d7..65c0763e63 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1624,20 +1624,28 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) { switch (drag_type) { case DRAG_ANCHOR_TOP_LEFT: - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false); + if (!use_single_axis || !use_y) + control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false); + if (!use_single_axis || use_y) + control->set_anchor(MARGIN_TOP, new_anchor.y, false, false); break; case DRAG_ANCHOR_TOP_RIGHT: - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false); + if (!use_single_axis || !use_y) + control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false); + if (!use_single_axis || use_y) + control->set_anchor(MARGIN_TOP, new_anchor.y, false, false); break; case DRAG_ANCHOR_BOTTOM_RIGHT: - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false); + if (!use_single_axis || !use_y) + control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false); + if (!use_single_axis || use_y) + control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false); break; case DRAG_ANCHOR_BOTTOM_LEFT: - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false); + if (!use_single_axis || !use_y) + control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false); + if (!use_single_axis || use_y) + control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false); break; case DRAG_ANCHOR_ALL: if (!use_single_axis || !use_y) { @@ -5037,7 +5045,8 @@ void CanvasItemEditor::_focus_selection(int p_op) { Map<Node *, Object *> &selection = editor_selection->get_selection(); for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key()); - if (!canvas_item) continue; + if (!canvas_item) + continue; if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root()) continue; @@ -5065,7 +5074,8 @@ void CanvasItemEditor::_focus_selection(int p_op) { rect = rect.merge(canvas_item_rect); } }; - if (count == 0) return; + if (count == 0) + return; if (p_op == VIEW_CENTER_TO_SELECTION) { @@ -6252,7 +6262,8 @@ void CanvasItemEditorViewport::_notification(int p_what) { disconnect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); } break; - default: break; + default: + break; } } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 594dd0d0cb..8973dca963 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -81,7 +81,7 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const { Ref<LineShape2D> line = node->get_shape(); if (idx == 0) { - return line->get_d(); + return line->get_distance(); } else { return line->get_normal(); } @@ -162,7 +162,7 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) { Ref<LineShape2D> line = node->get_shape(); if (idx == 0) { - line->set_d(p_point.length()); + line->set_distance(p_point.length()); } else { line->set_normal(p_point.normalized()); } @@ -260,9 +260,9 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) { Ref<LineShape2D> line = node->get_shape(); if (idx == 0) { - undo_redo->add_do_method(line.ptr(), "set_d", line->get_d()); + undo_redo->add_do_method(line.ptr(), "set_distance", line->get_distance()); undo_redo->add_do_method(canvas_item_editor, "update_viewport"); - undo_redo->add_undo_method(line.ptr(), "set_d", p_org); + undo_redo->add_undo_method(line.ptr(), "set_distance", p_org); undo_redo->add_undo_method(canvas_item_editor, "update_viewport"); } else { undo_redo->add_do_method(line.ptr(), "set_normal", line->get_normal()); @@ -485,8 +485,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla Ref<LineShape2D> shape = node->get_shape(); handles.resize(2); - handles.write[0] = shape->get_normal() * shape->get_d(); - handles.write[1] = shape->get_normal() * (shape->get_d() + 30.0); + handles.write[0] = shape->get_normal() * shape->get_distance(); + handles.write[1] = shape->get_normal() * (shape->get_distance() + 30.0); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); p_overlay->draw_texture(h, gt.xform(handles[1]) - size); diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp index 566ff378c3..2b0d3f2582 100644 --- a/editor/plugins/debugger_editor_plugin.cpp +++ b/editor/plugins/debugger_editor_plugin.cpp @@ -179,12 +179,18 @@ void DebuggerEditorPlugin::_update_debug_options() { bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", false); int instances = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_instances", 1); - if (check_deploy_remote) _menu_option(RUN_DEPLOY_REMOTE_DEBUG); - if (check_file_server) _menu_option(RUN_FILE_SERVER); - if (check_debug_collisions) _menu_option(RUN_DEBUG_COLLISONS); - if (check_debug_navigation) _menu_option(RUN_DEBUG_NAVIGATION); - if (check_live_debug) _menu_option(RUN_LIVE_DEBUG); - if (check_reload_scripts) _menu_option(RUN_RELOAD_SCRIPTS); + if (check_deploy_remote) + _menu_option(RUN_DEPLOY_REMOTE_DEBUG); + if (check_file_server) + _menu_option(RUN_FILE_SERVER); + if (check_debug_collisions) + _menu_option(RUN_DEBUG_COLLISONS); + if (check_debug_navigation) + _menu_option(RUN_DEBUG_NAVIGATION); + if (check_live_debug) + _menu_option(RUN_LIVE_DEBUG); + if (check_reload_scripts) + _menu_option(RUN_RELOAD_SCRIPTS); int len = instances_menu->get_item_count(); for (int idx = 0; idx < len; idx++) { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 55b50f526c..1bf5999906 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -51,7 +51,6 @@ #include "scene/gui/subviewport_container.h" #include "scene/resources/packed_scene.h" #include "scene/resources/surface_tool.h" -#include "servers/display_server.h" #define DISTANCE_DEFAULT 4 @@ -196,12 +195,20 @@ void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) { _update_focus(); } orbiting = false; + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); + Input::get_singleton()->warp_mouse_position(orbiting_mouse_start); + } } } const Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { if (orbiting) { + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_VISIBLE) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); + orbiting_mouse_start = mm->get_global_position(); + } viewport->_nav_orbit(mm, viewport->_get_warped_mouse_motion(mm)); focused_axis = -1; } else { @@ -711,9 +718,11 @@ void Node3DEditorViewport::_select_region() { item = sel; } - if (selected.find(item) != -1) continue; + if (selected.find(item) != -1) + continue; - if (_is_node_locked(item)) continue; + if (_is_node_locked(item)) + continue; Ref<EditorNode3DGizmo> seg = sp->get_gizmo(); @@ -776,11 +785,16 @@ static int _get_key_modifier_setting(const String &p_property) { switch (EditorSettings::get_singleton()->get(p_property).operator int()) { - case 0: return 0; - case 1: return KEY_SHIFT; - case 2: return KEY_ALT; - case 3: return KEY_META; - case 4: return KEY_CONTROL; + case 0: + return 0; + case 1: + return KEY_SHIFT; + case 2: + return KEY_ALT; + case 3: + return KEY_META; + case 4: + return KEY_CONTROL; } return 0; } @@ -1374,7 +1388,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (cursor.region_select) { - if (!clicked_wants_append) _clear_selected(); + if (!clicked_wants_append) + _clear_selected(); _select_region(); cursor.region_select = false; @@ -2069,7 +2084,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } if (k->get_keycode() == KEY_SPACE) { - if (!k->is_pressed()) emit_signal("toggle_maximize_view", this); + if (!k->is_pressed()) + emit_signal("toggle_maximize_view", this); } } @@ -2210,14 +2226,14 @@ void Node3DEditorViewport::set_freelook_active(bool active_now) { } // Hide mouse like in an FPS (warping doesn't work) - DisplayServer::get_singleton()->mouse_set_mode(DisplayServer::MOUSE_MODE_CAPTURED); + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); } else if (freelook_active && !active_now) { // Sync camera cursor to cursor to "cut" interpolation jumps due to changing referential cursor = camera_cursor; // Restore mouse - DisplayServer::get_singleton()->mouse_set_mode(DisplayServer::MOUSE_MODE_VISIBLE); + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); } freelook_active = active_now; @@ -3186,6 +3202,8 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { ERR_FAIL_COND(p_activate && !preview); ERR_FAIL_COND(!p_activate && !previewing); + rotation_control->set_visible(!p_activate); + if (!p_activate) { previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); @@ -4624,7 +4642,8 @@ Dictionary Node3DEditor::get_state() const { Dictionary gizmos_status; for (int i = 0; i < gizmo_plugins_by_name.size(); i++) { - if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; + if (!gizmo_plugins_by_name[i]->can_be_hidden()) + continue; int state = gizmos_menu->get_item_state(gizmos_menu->get_item_index(i)); String name = gizmo_plugins_by_name[i]->get_name(); gizmos_status[name] = state; @@ -4718,7 +4737,8 @@ void Node3DEditor::set_state(const Dictionary &p_state) { gizmos_status.get_key_list(&keys); for (int j = 0; j < gizmo_plugins_by_name.size(); ++j) { - if (!gizmo_plugins_by_name[j]->can_be_hidden()) continue; + if (!gizmo_plugins_by_name[j]->can_be_hidden()) + continue; int state = EditorNode3DGizmoPlugin::VISIBLE; for (int i = 0; i < keys.size(); i++) { if (gizmo_plugins_by_name.write[j]->get_name() == keys[i]) { @@ -5483,7 +5503,8 @@ void Node3DEditor::_update_gizmos_menu() { gizmos_menu->clear(); for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) { - if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; + if (!gizmo_plugins_by_name[i]->can_be_hidden()) + continue; String plugin_name = gizmo_plugins_by_name[i]->get_name(); const int plugin_state = gizmo_plugins_by_name[i]->get_state(); gizmos_menu->add_multistate_item(TTR(plugin_name), 3, plugin_state, i); @@ -5504,7 +5525,8 @@ void Node3DEditor::_update_gizmos_menu() { void Node3DEditor::_update_gizmos_menu_theme() { for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) { - if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue; + if (!gizmo_plugins_by_name[i]->can_be_hidden()) + continue; const int plugin_state = gizmo_plugins_by_name[i]->get_state(); const int idx = gizmos_menu->get_item_index(i); switch (plugin_state) { @@ -5915,9 +5937,11 @@ void Node3DEditor::_request_gizmo(Object *p_obj) { } void Node3DEditor::_toggle_maximize_view(Object *p_viewport) { - if (!p_viewport) return; + if (!p_viewport) + return; Node3DEditorViewport *current_viewport = Object::cast_to<Node3DEditorViewport>(p_viewport); - if (!current_viewport) return; + if (!current_viewport) + return; int index = -1; bool maximized = false; @@ -5929,7 +5953,8 @@ void Node3DEditor::_toggle_maximize_view(Object *p_viewport) { break; } } - if (index == -1) return; + if (index == -1) + return; if (!maximized) { @@ -6646,7 +6671,8 @@ Ref<StandardMaterial3D> EditorNode3DGizmoPlugin::get_material(const String &p_na ERR_FAIL_COND_V(!materials.has(p_name), Ref<StandardMaterial3D>()); ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<StandardMaterial3D>()); - if (p_gizmo.is_null() || materials[p_name].size() == 1) return materials[p_name][0]; + if (p_gizmo.is_null() || materials[p_name].size() == 1) + return materials[p_name][0]; int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0); @@ -6683,7 +6709,8 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::get_gizmo(Node3D *p_spatial) { Ref<EditorNode3DGizmo> ref = create_gizmo(p_spatial); - if (ref.is_null()) return ref; + if (ref.is_null()) + return ref; ref->set_plugin(this); ref->set_spatial_node(p_spatial); @@ -6742,7 +6769,8 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) } Ref<EditorNode3DGizmo> ref; - if (has_gizmo(p_spatial)) ref.instance(); + if (has_gizmo(p_spatial)) + ref.instance(); return ref; } diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 71da14ae1a..fdc0741651 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -158,6 +158,7 @@ class ViewportRotationControl : public Control { Node3DEditorViewport *viewport = nullptr; Vector<Color> axis_colors; Vector<int> axis_menu_options; + Vector2i orbiting_mouse_start; bool orbiting = false; int focused_axis = -2; diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 4516b7035b..2edb337b1c 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -288,8 +288,10 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { Vector2 gpoint = mm->get_position(); Ref<Curve2D> curve = node->get_curve(); - if (curve == nullptr) return true; - if (curve->get_point_count() < 2) return true; + if (curve == nullptr) + return true; + if (curve->get_point_count() < 2) + return true; // Find edge edge_point = xform.xform(curve->get_closest_point(xform.affine_inverse().xform(mm->get_position()))); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index d3ece9556d..6c475d829f 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -631,7 +631,8 @@ Ref<EditorNode3DGizmo> Path3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { Ref<Path3DGizmo> ref; Path3D *path = Object::cast_to<Path3D>(p_spatial); - if (path) ref = Ref<Path3DGizmo>(memnew(Path3DGizmo(path))); + if (path) + ref = Ref<Path3DGizmo>(memnew(Path3DGizmo(path))); return ref; } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c79c97737a..109d83d838 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -822,7 +822,8 @@ void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { - if (color_panel->is_visible()) return; + if (color_panel->is_visible()) + return; Node *base = get_tree()->get_edited_scene_root(); if (base) { base = _find_node_for_script(base, base, script); diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index 296c7a01b6..9d5ffd6516 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* shader_file_editor_plugin.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "shader_file_editor_plugin.h" #include "core/io/resource_loader.h" diff --git a/editor/plugins/shader_file_editor_plugin.h b/editor/plugins/shader_file_editor_plugin.h index 44d32de2f1..7df177a0d5 100644 --- a/editor/plugins/shader_file_editor_plugin.h +++ b/editor/plugins/shader_file_editor_plugin.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* shader_file_editor_plugin.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef SHADER_FILE_EDITOR_PLUGIN_H #define SHADER_FILE_EDITOR_PLUGIN_H diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index b246b611fd..d9be2e32cb 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -74,11 +74,21 @@ void ThemeEditor::_name_menu_about_to_show() { switch (type_select->get_selected()) { - case 0: Theme::get_default()->get_icon_list(fromtype, &names); break; - case 1: Theme::get_default()->get_stylebox_list(fromtype, &names); break; - case 2: Theme::get_default()->get_font_list(fromtype, &names); break; - case 3: Theme::get_default()->get_color_list(fromtype, &names); break; - case 4: Theme::get_default()->get_constant_list(fromtype, &names); break; + case 0: + Theme::get_default()->get_icon_list(fromtype, &names); + break; + case 1: + Theme::get_default()->get_stylebox_list(fromtype, &names); + break; + case 2: + Theme::get_default()->get_font_list(fromtype, &names); + break; + case 3: + Theme::get_default()->get_color_list(fromtype, &names); + break; + case 4: + Theme::get_default()->get_constant_list(fromtype, &names); + break; } } else if (popup_mode == POPUP_REMOVE) { @@ -324,11 +334,21 @@ void ThemeEditor::_dialog_cbk() { switch (type_select->get_selected()) { - case 0: theme->set_icon(name_edit->get_text(), type_edit->get_text(), Ref<Texture2D>()); break; - case 1: theme->set_stylebox(name_edit->get_text(), type_edit->get_text(), Ref<StyleBox>()); break; - case 2: theme->set_font(name_edit->get_text(), type_edit->get_text(), Ref<Font>()); break; - case 3: theme->set_color(name_edit->get_text(), type_edit->get_text(), Color()); break; - case 4: theme->set_constant(name_edit->get_text(), type_edit->get_text(), 0); break; + case 0: + theme->set_icon(name_edit->get_text(), type_edit->get_text(), Ref<Texture2D>()); + break; + case 1: + theme->set_stylebox(name_edit->get_text(), type_edit->get_text(), Ref<StyleBox>()); + break; + case 2: + theme->set_font(name_edit->get_text(), type_edit->get_text(), Ref<Font>()); + break; + case 3: + theme->set_color(name_edit->get_text(), type_edit->get_text(), Color()); + break; + case 4: + theme->set_constant(name_edit->get_text(), type_edit->get_text(), 0); + break; } } break; @@ -376,11 +396,21 @@ void ThemeEditor::_dialog_cbk() { case POPUP_REMOVE: { switch (type_select->get_selected()) { - case 0: theme->clear_icon(name_edit->get_text(), type_edit->get_text()); break; - case 1: theme->clear_stylebox(name_edit->get_text(), type_edit->get_text()); break; - case 2: theme->clear_font(name_edit->get_text(), type_edit->get_text()); break; - case 3: theme->clear_color(name_edit->get_text(), type_edit->get_text()); break; - case 4: theme->clear_constant(name_edit->get_text(), type_edit->get_text()); break; + case 0: + theme->clear_icon(name_edit->get_text(), type_edit->get_text()); + break; + case 1: + theme->clear_stylebox(name_edit->get_text(), type_edit->get_text()); + break; + case 2: + theme->clear_font(name_edit->get_text(), type_edit->get_text()); + break; + case 3: + theme->clear_color(name_edit->get_text(), type_edit->get_text()); + break; + case 4: + theme->clear_constant(name_edit->get_text(), type_edit->get_text()); + break; } } break; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index c393b15a97..b0d325efc1 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -126,7 +126,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) { sb->get_shape_owners(&shapes); for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) { - if (sb->is_shape_owner_disabled(E->get())) continue; + if (sb->is_shape_owner_disabled(E->get())) + continue; Transform2D shape_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get()); bool one_way = sb->is_shape_owner_one_way_collision_enabled(E->get()); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 35ed29f562..07251ad7ad 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1239,11 +1239,13 @@ void VisualShaderEditor::_port_name_focus_out(Object *line_edit, int p_node_id, List<String> output_names; for (int i = 0; i < node->get_input_port_count(); i++) { - if (!p_output && i == p_port_id) continue; + if (!p_output && i == p_port_id) + continue; input_names.push_back(node->get_input_port_name(i)); } for (int i = 0; i < node->get_output_port_count(); i++) { - if (p_output && i == p_port_id) continue; + if (p_output && i == p_port_id) + continue; output_names.push_back(node->get_output_port_name(i)); } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index c918a799e1..2d1eb54e9a 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2429,12 +2429,24 @@ ProjectManager::ProjectManager() { #endif } break; - case 1: editor_set_scale(0.75); break; - case 2: editor_set_scale(1.0); break; - case 3: editor_set_scale(1.25); break; - case 4: editor_set_scale(1.5); break; - case 5: editor_set_scale(1.75); break; - case 6: editor_set_scale(2.0); break; + case 1: + editor_set_scale(0.75); + break; + case 2: + editor_set_scale(1.0); + break; + case 3: + editor_set_scale(1.25); + break; + case 4: + editor_set_scale(1.5); + break; + case 5: + editor_set_scale(1.75); + break; + case 6: + editor_set_scale(2.0); + break; default: { editor_set_scale(custom_display_scale); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 49c02dc895..afcba4f67f 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -446,11 +446,13 @@ void ProjectSettingsEditor::_show_last_added(const Ref<InputEvent> &p_event, con } child = child->get_next(); } - if (found) break; + if (found) + break; r = r->get_next(); } - if (found) input_editor->ensure_cursor_is_visible(); + if (found) + input_editor->ensure_cursor_is_visible(); } void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) { @@ -804,12 +806,23 @@ void ProjectSettingsEditor::_update_actions() { if (mb.is_valid()) { String str = _get_device_string(mb->get_device()) + ", "; switch (mb->get_button_index()) { - case BUTTON_LEFT: str += TTR("Left Button"); break; - case BUTTON_RIGHT: str += TTR("Right Button"); break; - case BUTTON_MIDDLE: str += TTR("Middle Button"); break; - case BUTTON_WHEEL_UP: str += TTR("Wheel Up"); break; - case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down"); break; - default: str += vformat(TTR("%d Button"), mb->get_button_index()); + case BUTTON_LEFT: + str += TTR("Left Button"); + break; + case BUTTON_RIGHT: + str += TTR("Right Button"); + break; + case BUTTON_MIDDLE: + str += TTR("Middle Button"); + break; + case BUTTON_WHEEL_UP: + str += TTR("Wheel Up"); + break; + case BUTTON_WHEEL_DOWN: + str += TTR("Wheel Down"); + break; + default: + str += vformat(TTR("%d Button"), mb->get_button_index()); } action2->set_text(0, str); @@ -1596,7 +1609,8 @@ void ProjectSettingsEditor::_update_translations() { String n = names[i]; String l = langs[i]; bool is_checked = l_filter.has(l); - if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && !is_checked) continue; + if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && !is_checked) + continue; TreeItem *t = translation_filter->create_item(root); t->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index a8aeb05150..5ee5fbcf9c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -491,8 +491,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { int index = E->get()->get_index(); - if (index > highest_id) highest_id = index; - if (index < lowest_id) lowest_id = index; + if (index > highest_id) + highest_id = index; + if (index < lowest_id) + lowest_id = index; if (E->get()->get_parent() != common_parent) common_parent = nullptr; @@ -501,8 +503,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0)) break; // one or more nodes can not be moved - if (selection.size() == 1) editor_data->get_undo_redo().create_action(TTR("Move Node In Parent")); - if (selection.size() > 1) editor_data->get_undo_redo().create_action(TTR("Move Nodes In Parent")); + if (selection.size() == 1) + editor_data->get_undo_redo().create_action(TTR("Move Node In Parent")); + if (selection.size() > 1) + editor_data->get_undo_redo().create_action(TTR("Move Nodes In Parent")); for (int i = 0; i < selection.size(); i++) { Node *top_node = selection[i]; @@ -986,8 +990,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } } else { switch (p_tool) { - case TOOL_CREATE_2D_SCENE: new_node = memnew(Node2D); break; - case TOOL_CREATE_3D_SCENE: new_node = memnew(Node3D); break; + case TOOL_CREATE_2D_SCENE: + new_node = memnew(Node2D); + break; + case TOOL_CREATE_3D_SCENE: + new_node = memnew(Node3D); + break; case TOOL_CREATE_USER_INTERFACE: { Control *node = memnew(Control); node->set_anchors_and_margins_preset(PRESET_WIDE); //more useful for resizable UIs. diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 12b21d871b..f84b7e73ed 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -167,11 +167,14 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must String p = p_path.strip_edges(); - if (p == "") return TTR("Path is empty."); - if (p.get_file().get_basename() == "") return TTR("Filename is empty."); + if (p == "") + return TTR("Path is empty."); + if (p.get_file().get_basename() == "") + return TTR("Filename is empty."); p = ProjectSettings::get_singleton()->localize_path(p); - if (!p.begins_with("res://")) return TTR("Path is not local."); + if (!p.begins_with("res://")) + return TTR("Path is not local."); DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); if (d->change_dir(p.get_base_dir()) != OK) { @@ -216,12 +219,15 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must index++; } - if (!found) return TTR("Invalid extension."); - if (!match) return TTR("Wrong extension chosen."); + if (!found) + return TTR("Invalid extension."); + if (!match) + return TTR("Wrong extension chosen."); /* Let ScriptLanguage do custom validation */ String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p); - if (path_error != "") return path_error; + if (path_error != "") + return path_error; /* All checks passed */ return ""; diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index 566ac54612..6bf9c5ffae 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* shader_globals_editor.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "shader_globals_editor.h" #include "editor_node.h" diff --git a/editor/shader_globals_editor.h b/editor/shader_globals_editor.h index 59cdeddd8d..b3dbddc87e 100644 --- a/editor/shader_globals_editor.h +++ b/editor/shader_globals_editor.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* shader_globals_editor.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef SHADER_GLOBALS_EDITOR_H #define SHADER_GLOBALS_EDITOR_H |