diff options
-rw-r--r-- | COPYRIGHT.txt | 5 | ||||
-rw-r--r-- | core/io/http_client.cpp | 31 | ||||
-rw-r--r-- | doc/classes/ProjectSettings.xml | 2 | ||||
-rw-r--r-- | drivers/unix/net_socket_posix.cpp | 19 | ||||
-rw-r--r-- | drivers/unix/net_socket_posix.h | 1 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 2 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 14 | ||||
-rw-r--r-- | editor/inspector_dock.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 41 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 65 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 3 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 1 | ||||
-rw-r--r-- | scene/3d/light.cpp | 7 | ||||
-rw-r--r-- | scene/animation/tween_interpolaters.cpp | 6 | ||||
-rw-r--r-- | scene/gui/control.h | 2 | ||||
-rw-r--r-- | scene/main/http_request.cpp | 17 |
18 files changed, 160 insertions, 64 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 49c602eb84..cf08225a40 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -96,6 +96,11 @@ Copyright: 1997-2017, Sam Lantinga 2014-2018, Godot Engine contributors. License: Expat and Zlib +Files: ./scene/animation/tween_interpolaters.cpp +Comment: Penner Easing +Copyright: 2001, Robert Penner +License: BSD-3-clause + Files: ./servers/physics/gjk_epa.cpp ./servers/physics/joints/generic_6dof_joint_sw.cpp ./servers/physics/joints/generic_6dof_joint_sw.h diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index f241be890c..de0b6860f9 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -275,7 +275,7 @@ void HTTPClient::close() { response_headers.clear(); response_str.clear(); - body_size = 0; + body_size = -1; body_left = 0; chunk_left = 0; read_until_eof = false; @@ -404,7 +404,7 @@ Error HTTPClient::poll() { String response; response.parse_utf8((const char *)response_str.ptr()); Vector<String> responses = response.split("\n"); - body_size = 0; + body_size = -1; chunked = false; body_left = 0; chunk_left = 0; @@ -448,7 +448,7 @@ Error HTTPClient::poll() { } } - if (body_size || chunked) { + if (body_size != -1 || chunked) { status = STATUS_BODY; } else if (!keep_alive) { @@ -665,11 +665,24 @@ Error HTTPClient::_get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received if (blocking) { - Error err = connection->get_data(p_buffer, p_bytes); - if (err == OK) - r_received = p_bytes; - else - r_received = 0; + // We can't use StreamPeer.get_data, since when reaching EOF we will get an + // error without knowing how many bytes we received. + Error err = ERR_FILE_EOF; + int read; + int left = p_bytes; + r_received = 0; + while (left > 0) { + err = connection->get_partial_data(p_buffer, left, read); + if (err == OK) { + r_received += read; + } else if (err == ERR_FILE_EOF) { + r_received += read; + return err; + } else { + return err; + } + left -= read; + } return err; } else { return connection->get_partial_data(p_buffer, p_bytes, r_received); @@ -687,7 +700,7 @@ HTTPClient::HTTPClient() { resolving = IP::RESOLVER_INVALID_ID; status = STATUS_DISCONNECTED; conn_port = -1; - body_size = 0; + body_size = -1; chunked = false; body_left = 0; read_until_eof = false; diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 1bf2e6d83c..b0d1cf8619 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -630,7 +630,7 @@ Fix to improve physics jitter, specially on monitors where refresh rate is different than physics FPS. </member> <member name="rendering/environment/default_clear_color" type="Color" setter="" getter=""> - Default background clear color. + Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method VisualServer.set_default_clear_color]. </member> <member name="rendering/limits/buffers/blend_shape_max_buffer_size_kb" type="int" setter="" getter=""> Max buffer size for blend shapes. Any blend shape bigger than this will not work. diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index ea19b6a700..9dcc6038ab 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -150,9 +150,24 @@ NetSocket *NetSocketPosix::_create_func() { } void NetSocketPosix::make_default() { +#if defined(WINDOWS_ENABLED) + if (_create == NULL) { + WSADATA data; + WSAStartup(MAKEWORD(2, 2), &data); + } +#endif _create = _create_func; } +void NetSocketPosix::cleanup() { +#if defined(WINDOWS_ENABLED) + if (_create != NULL) { + WSACleanup(); + } + _create = NULL; +#endif +} + NetSocketPosix::NetSocketPosix() { _sock = SOCK_EMPTY; _ip_type = IP::TYPE_NONE; @@ -169,10 +184,11 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() { if (err == WSAEISCONN) return ERR_NET_IS_CONNECTED; - if (err == WSAEINPROGRESS || errno == WSAEALREADY) + if (err == WSAEINPROGRESS || err == WSAEALREADY) return ERR_NET_IN_PROGRESS; if (err == WSAEWOULDBLOCK) return ERR_NET_WOULD_BLOCK; + ERR_PRINTS("Socket error: " + itos(err)); return ERR_NET_OTHER; #else if (errno == EISCONN) @@ -181,6 +197,7 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() { return ERR_NET_IN_PROGRESS; if (errno == EAGAIN || errno == EWOULDBLOCK) return ERR_NET_WOULD_BLOCK; + ERR_PRINTS("Socket error: " + itos(errno)); return ERR_NET_OTHER; #endif } diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h index ee178136f3..8177e01987 100644 --- a/drivers/unix/net_socket_posix.h +++ b/drivers/unix/net_socket_posix.h @@ -67,6 +67,7 @@ protected: public: static void make_default(); + static void cleanup(); virtual Error open(Type p_sock_type, IP::Type &ip_type); virtual void close(); diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 1225d00aad..9936c95cf9 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -139,6 +139,8 @@ void OS_Unix::initialize_core() { } void OS_Unix::finalize_core() { + + NetSocketPosix::cleanup(); } void OS_Unix::alert(const String &p_alert, const String &p_title) { diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 6e684fcd4c..3d034989ed 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1479,12 +1479,16 @@ void EditorFileSystem::_reimport_file(const String &p_file) { cf.instance(); Error err = cf->load(p_file + ".import"); if (err == OK) { - List<String> sk; - cf->get_section_keys("params", &sk); - for (List<String>::Element *E = sk.front(); E; E = E->next()) { - params[E->get()] = cf->get_value("params", E->get()); + if (cf->has_section("params")) { + List<String> sk; + cf->get_section_keys("params", &sk); + for (List<String>::Element *E = sk.front(); E; E = E->next()) { + params[E->get()] = cf->get_value("params", E->get()); + } + } + if (cf->has_section("remap")) { + importer_name = cf->get_value("remap", "importer"); } - importer_name = cf->get_value("remap", "importer"); } } else { diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 9145a66510..7aad973a96 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -405,8 +405,8 @@ void InspectorDock::update(Object *p_object) { PopupMenu *p = object_menu->get_popup(); p->clear(); - p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL); - p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL); + p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand All Properties")), EXPAND_ALL); + p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All Properties")), COLLAPSE_ALL); p->add_separator(); if (is_resource) { p->add_item(TTR("Save"), RESOURCE_SAVE); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f25ca4786e..9dd6a8e0ed 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -59,25 +59,10 @@ void ScriptEditorBase::_bind_methods() { ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text"))); } -static bool _can_open_in_editor(Script *p_script) { - +static bool _is_built_in_script(Script *p_script) { String path = p_script->get_path(); - if (path.find("::") != -1) { - //refuse handling this if it can't be edited - - bool valid = false; - for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_edited_scene_count(); i++) { - if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) { - valid = true; - break; - } - } - - return valid; - } - - return true; + return path.find("::") != -1; } class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache { @@ -2736,7 +2721,7 @@ void ScriptEditor::set_scene_root_script(Ref<Script> p_script) { if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) return; - if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) { + if (open_dominant && p_script.is_valid()) { edit(p_script); } } @@ -3232,7 +3217,17 @@ ScriptEditor::~ScriptEditor() { void ScriptEditorPlugin::edit(Object *p_object) { if (Object::cast_to<Script>(p_object)) { - script_editor->edit(Object::cast_to<Script>(p_object)); + + Script *p_script = Object::cast_to<Script>(p_object); + String scene_path = p_script->get_path().get_slice("::", 0); + + if (_is_built_in_script(p_script) && !EditorNode::get_singleton()->is_scene_open(scene_path)) { + EditorNode::get_singleton()->load_scene(scene_path); + + script_editor->call_deferred("edit", p_script); + } else { + script_editor->edit(p_script); + } } if (Object::cast_to<TextFile>(p_object)) { @@ -3247,13 +3242,7 @@ bool ScriptEditorPlugin::handles(Object *p_object) const { } if (Object::cast_to<Script>(p_object)) { - - bool valid = _can_open_in_editor(Object::cast_to<Script>(p_object)); - - if (!valid) { //user tried to open it by clicking - EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded")); - } - return valid; + return true; } return p_object->is_class("Script"); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index cbb2213128..bdeeaa106d 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1556,7 +1556,7 @@ void ScriptTextEditor::register_editor() { #endif ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T); ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y); - ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X); + ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I); ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I); #ifdef OSX_ENABLED diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index c07220d42c..b451092709 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1717,6 +1717,32 @@ void ScriptEditorDebugger::_error_selected() { emit_signal("goto_script_line", s, int(meta[1]) - 1); } +void ScriptEditorDebugger::_expand_errors_list() { + + TreeItem *root = error_tree->get_root(); + if (!root) + return; + + TreeItem *item = root->get_children(); + while (item) { + item->set_collapsed(false); + item = item->get_next(); + } +} + +void ScriptEditorDebugger::_collapse_errors_list() { + + TreeItem *root = error_tree->get_root(); + if (!root) + return; + + TreeItem *item = root->get_children(); + while (item) { + item->set_collapsed(true); + item = item->get_next(); + } +} + void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) { hide_on_stop = p_hide; @@ -1861,6 +1887,8 @@ void ScriptEditorDebugger::_bind_methods() { ClassDB::bind_method(D_METHOD("_error_selected"), &ScriptEditorDebugger::_error_selected); ClassDB::bind_method(D_METHOD("_error_activated"), &ScriptEditorDebugger::_error_activated); + ClassDB::bind_method(D_METHOD("_expand_errors_list"), &ScriptEditorDebugger::_expand_errors_list); + ClassDB::bind_method(D_METHOD("_collapse_errors_list"), &ScriptEditorDebugger::_collapse_errors_list); ClassDB::bind_method(D_METHOD("_profiler_activate"), &ScriptEditorDebugger::_profiler_activate); ClassDB::bind_method(D_METHOD("_profiler_seeked"), &ScriptEditorDebugger::_profiler_seeked); ClassDB::bind_method(D_METHOD("_clear_errors_list"), &ScriptEditorDebugger::_clear_errors_list); @@ -1999,8 +2027,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { } { //errors + VBoxContainer *errvb = memnew(VBoxContainer); + errvb->set_name(TTR("Errors")); + HBoxContainer *errhb = memnew(HBoxContainer); - errhb->set_name(TTR("Errors")); + errvb->add_child(errhb); + + Button *expand_all = memnew(Button); + expand_all->set_text(TTR("Expand All")); + expand_all->connect("pressed", this, "_expand_errors_list"); + errhb->add_child(expand_all); + + Button *collapse_all = memnew(Button); + collapse_all->set_text(TTR("Collapse All")); + collapse_all->connect("pressed", this, "_collapse_errors_list"); + errhb->add_child(collapse_all); + + Control *space = memnew(Control); + space->set_h_size_flags(SIZE_EXPAND_FILL); + errhb->add_child(space); + + clearbutton = memnew(Button); + clearbutton->set_text(TTR("Clear")); + clearbutton->set_h_size_flags(0); + clearbutton->connect("pressed", this, "_clear_errors_list"); + errhb->add_child(clearbutton); error_tree = memnew(Tree); error_tree->set_columns(2); @@ -2012,22 +2063,16 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { error_tree->set_select_mode(Tree::SELECT_ROW); error_tree->set_hide_root(true); - error_tree->set_h_size_flags(SIZE_EXPAND_FILL); + error_tree->set_v_size_flags(SIZE_EXPAND_FILL); error_tree->set_allow_rmb_select(true); error_tree->connect("item_rmb_selected", this, "_error_tree_item_rmb_selected"); - errhb->add_child(error_tree); + errvb->add_child(error_tree); item_menu = memnew(PopupMenu); item_menu->connect("id_pressed", this, "_item_menu_id_pressed"); error_tree->add_child(item_menu); - clearbutton = memnew(Button); - clearbutton->set_text(TTR("Clear")); - clearbutton->set_v_size_flags(0); - clearbutton->connect("pressed", this, "_clear_errors_list"); - errhb->add_child(clearbutton); - - tabs->add_child(errhb); + tabs->add_child(errvb); } { // remote scene tree diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 017619e56f..cebf6d785e 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -181,6 +181,9 @@ class ScriptEditorDebugger : public Control { void _error_activated(); void _error_selected(); + void _expand_errors_list(); + void _collapse_errors_list(); + void _profiler_activate(bool p_enable); void _profiler_seeked(); diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 5b5f30244e..f489c0894f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -406,6 +406,8 @@ void OSUWP::finalize() { } void OSUWP::finalize_core() { + + NetSocketPosix::cleanup(); } void OSUWP::alert(const String &p_alert, const String &p_title) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 6723210432..67fc1c7496 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1512,6 +1512,7 @@ void OS_Windows::finalize_core() { timeEndPeriod(1); memdelete(process_map); + NetSocketPosix::cleanup(); } void OS_Windows::alert(const String &p_alert, const String &p_title) { diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 80c2f005b6..d674958d33 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -48,6 +48,13 @@ void Light::set_param(Param p_param, float p_value) { if (p_param == PARAM_SPOT_ANGLE || p_param == PARAM_RANGE) { update_gizmo(); + + if (p_param == PARAM_SPOT_ANGLE) { + _change_notify("spot_angle"); + } else if (p_param == PARAM_RANGE) { + _change_notify("omni_range"); + _change_notify("spot_range"); + } } } diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp index 11f2b0c17f..52aa7403c0 100644 --- a/scene/animation/tween_interpolaters.cpp +++ b/scene/animation/tween_interpolaters.cpp @@ -28,6 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +/** + * Adapted from Penner Easing equations' C++ port. + * Source: https://github.com/jesusgollonet/ofpennereasing + * License: BSD-3-clause + */ + #include "tween.h" const real_t pi = 3.1415926535898; diff --git a/scene/gui/control.h b/scene/gui/control.h index c38cd66245..eb39d9ca0f 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -76,7 +76,7 @@ public: SIZE_EXPAND = 2, SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL, SIZE_SHRINK_CENTER = 4, //ignored by expand or fill - SIZE_SHRINK_END = 8, //ignored by expand or fil + SIZE_SHRINK_END = 8, //ignored by expand or fill }; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 4750e05633..a9b7fba9c7 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -330,15 +330,13 @@ bool HTTPRequest::_update_connection() { return true; } - if (client->is_response_chunked()) { - body_len = -1; // No body len because chunked, change your webserver configuration if you want body len - } else { - body_len = client->get_response_body_length(); + // No body len (-1) if chunked or no content-length header was provided. + // Change your webserver configuration if you want body len. + body_len = client->get_response_body_length(); - if (body_size_limit >= 0 && body_len > body_size_limit) { - call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); - return true; - } + if (body_size_limit >= 0 && body_len > body_size_limit) { + call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); + return true; } if (download_to_file != String()) { @@ -378,6 +376,9 @@ bool HTTPRequest::_update_connection() { call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body); return true; } + } else if (client->get_status() == HTTPClient::STATUS_DISCONNECTED) { + // We read till EOF, with no errors. Request is done. + call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body); } return false; |