diff options
-rw-r--r-- | core/project_settings.cpp | 2 | ||||
-rw-r--r-- | editor/editor_help_search.cpp | 6 | ||||
-rw-r--r-- | editor/editor_help_search.h | 1 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/editor_profiler.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 37 | ||||
-rw-r--r-- | main/main.cpp | 3 | ||||
-rw-r--r-- | modules/enet/networked_multiplayer_enet.cpp | 11 | ||||
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 20 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 2 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 6 | ||||
-rw-r--r-- | scene/gui/range.cpp | 2 | ||||
-rw-r--r-- | scene/gui/scroll_container.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 2 | ||||
-rw-r--r-- | scene/resources/material.h | 2 |
16 files changed, 74 insertions, 31 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp index ba5cdd782f..067578e354 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -107,7 +107,7 @@ String ProjectSettings::localize_path(const String &p_path) const { if (plocal == "") { return ""; }; - return plocal + path.substr((sep + 1), path.size() - (sep + 1)); + return plocal + path.substr(sep, path.size() - sep); }; } diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 27e61362ed..517a1c34d1 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -170,7 +170,11 @@ void EditorHelpSearch::popup_dialog(const String &p_term) { if (p_term == "") { search_box->clear(); } else { - old_search = true; + if (old_term == p_term) + old_search = true; + else + old_term = p_term; + search_box->set_text(p_term); search_box->select_all(); } diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index 12ffd024a7..0be2f3419b 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -59,6 +59,7 @@ class EditorHelpSearch : public ConfirmationDialog { OptionButton *filter_combo; Tree *results_tree; bool old_search; + String old_term; class Runner; Ref<Runner> search; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ef382c0a19..ab41019ac3 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6121,7 +6121,7 @@ EditorNode::EditorNode() { p = debug_menu->get_popup(); p->set_hide_on_window_lose_focus(true); - p->set_hide_on_item_selection(false); + p->set_hide_on_checkable_item_selection(false); p->add_check_shortcut(ED_SHORTCUT("editor/deploy_with_remote_debug", TTR("Deploy with Remote Debug")), RUN_DEPLOY_REMOTE_DEBUG); p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged.")); p->add_check_shortcut(ED_SHORTCUT("editor/small_deploy_with_network_fs", TTR("Small Deploy with Network FS")), RUN_FILE_SERVER); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 471742948f..020cb3bada 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -88,14 +88,13 @@ void EditorProfiler::clear() { frame_metrics.resize(metric_size); last_metric = -1; variables->clear(); - //activate->set_pressed(false); plot_sigs.clear(); plot_sigs.insert("physics_frame_time"); plot_sigs.insert("category_frame_time"); updating_frame = true; cursor_metric_edit->set_min(0); - cursor_metric_edit->set_max(0); + cursor_metric_edit->set_max(100); // Doesn't make much sense, but we can't have min == max. Doesn't hurt. cursor_metric_edit->set_value(0); updating_frame = false; hover_metric = -1; diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index e07f041eb1..475e4c8d67 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -702,13 +702,13 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { bottom_hb->set_h_size_flags(SIZE_EXPAND_FILL); min_value = memnew(SpinBox); - min_value->set_max(0); min_value->set_min(-10000); + min_value->set_max(0); min_value->set_step(0.01); max_value = memnew(SpinBox); - max_value->set_max(10000); max_value->set_min(0.01); + max_value->set_max(10000); max_value->set_step(0.01); label_value = memnew(LineEdit); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f7e997a269..54bf8ce5a2 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2497,7 +2497,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2514,7 +2517,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2525,7 +2531,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co Vector<String> files = d["files"]; - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } int num_tabs_before = tab_container->get_child_count(); for (int i = 0; i < files.size(); i++) { String file = files[i]; @@ -2551,16 +2560,20 @@ void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) { if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) return; if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { - int next_tab = script_list->get_current() + 1; - next_tab %= script_list->get_item_count(); - _go_to_tab(script_list->get_item_metadata(next_tab)); - _update_script_names(); + if (script_list->get_item_count() > 1) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } } if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { - int next_tab = script_list->get_current() - 1; - next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; - _go_to_tab(script_list->get_item_metadata(next_tab)); - _update_script_names(); + if (script_list->get_item_count() > 1) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } } if (ED_IS_SHORTCUT("script_editor/window_move_up", p_event)) { _menu_option(WINDOW_MOVE_UP); @@ -3238,7 +3251,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP); ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN); ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD); // these should be KEY_GREATER and KEY_LESS but those don't work - ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COLON); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA); set_process_unhandled_input(true); file_menu = memnew(MenuButton); diff --git a/main/main.cpp b/main/main.cpp index c34d3da618..22a31d597e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1517,6 +1517,9 @@ bool Main::start() { ERR_FAIL_COND_V_MSG(script_res.is_null(), false, "Can't load script: " + script); if (check_only) { + if (!script_res->is_valid()) { + OS::get_singleton()->set_exit_code(1); + } return false; } diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index a787cd3b80..2f6ed5efc0 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -440,6 +440,8 @@ void NetworkedMultiplayerENet::close_connection(uint32_t wait_usec) { for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) { if (E->get()) { enet_peer_disconnect_now(E->get(), unique_id); + int *id = (int *)(E->get()->data); + memdelete(id); peers_disconnected = true; } } @@ -455,6 +457,7 @@ void NetworkedMultiplayerENet::close_connection(uint32_t wait_usec) { enet_host_destroy(host); active = false; incoming_packets.clear(); + peer_map.clear(); unique_id = 1; // Server is 1 connection_status = CONNECTION_DISCONNECTED; } @@ -471,10 +474,13 @@ void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) { // enet_peer_disconnect_now doesn't generate ENET_EVENT_TYPE_DISCONNECT, // notify everyone else, send disconnect signal & remove from peer_map like in poll() + int *id = NULL; for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) { - if (E->key() == p_peer) + if (E->key() == p_peer) { + id = (int *)(E->get()->data); continue; + } ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE); encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]); @@ -482,6 +488,9 @@ void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) { enet_peer_send(E->get(), SYSCH_CONFIG, packet); } + if (id) + memdelete(id); + emit_signal("peer_disconnected", p_peer); peer_map.erase(p_peer); } else { diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 840971dcf8..10eb719235 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -1363,6 +1363,26 @@ Stops the function execution and returns the current suspended state to the calling function. From the caller, call [method GDScriptFunctionState.resume] on the state to resume execution. This invalidates the state. Within the resumed function, [code]yield()[/code] returns whatever was passed to the [code]resume()[/code] function call. If passed an object and a signal, the execution is resumed when the object emits the given signal. In this case, [code]yield()[/code] returns the argument passed to [code]emit_signal()[/code] if the signal takes only one argument, or an array containing all the arguments passed to [code]emit_signal()[/code] if the signal takes multiple arguments. + You can also use [code]yield[/code] to wait for a function to finish: + [codeblock] + func _ready -> void: + yield(do_something(), "completed") + yield(do_something_else(), "completed") + print("All functions are done!") + + func do_something(): + print("Something is done!") + + func do_something_else(): + print("Something else is done!") + + # prints: + # Something is done! + # Something else is done! + # All functions are done! + [/codeblock] + When yielding on a function, the [code]completed[/code] signal will be emitted automatically when the function returns. It can, therefore, be used as the [code]signal[/code] parameter of the [code]yield[/code] method to resume. + If you are planning on calling the same function within a loop, you should consider using [code]yield(get_tree(), "idle_frame")[/code] also. </description> </method> </methods> diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index e5166d102b..dac6721fb4 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -2224,7 +2224,7 @@ Error OS_OSX::shell_open(String p_uri) { } String OS_OSX::get_locale() const { - NSString *locale_code = [[NSLocale currentLocale] localeIdentifier]; + NSString *locale_code = [[NSLocale preferredLanguages] objectAtIndex:0]; return [locale_code UTF8String]; } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 1406586361..3884622942 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -969,16 +969,16 @@ void ItemList::_notification(int p_what) { } if (all_fit) { - float page = size.height - bg->get_minimum_size().height; + float page = MAX(0, size.height - bg->get_minimum_size().height); float max = MAX(page, ofs.y + max_h); if (auto_height) auto_height_value = ofs.y + max_h + bg->get_minimum_size().height; - scroll_bar->set_max(max); - scroll_bar->set_page(page); if (max <= page) { scroll_bar->set_value(0); scroll_bar->hide(); } else { + scroll_bar->set_max(max); + scroll_bar->set_page(page); scroll_bar->show(); if (do_autoscroll_to_bottom) diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 362697b4ad..5682232bc4 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -100,7 +100,6 @@ void Range::set_value(double p_val) { shared->emit_value_changed(); } void Range::set_min(double p_min) { - shared->min = p_min; set_value(shared->val); @@ -109,7 +108,6 @@ void Range::set_min(double p_min) { update_configuration_warning(); } void Range::set_max(double p_max) { - shared->max = p_max; set_value(shared->val); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index a840e3fec1..fa23bf91dd 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -388,7 +388,6 @@ void ScrollContainer::update_scrollbars() { if (hide_scroll_v) { v_scroll->hide(); - v_scroll->set_max(0); scroll.y = 0; } else { @@ -406,7 +405,6 @@ void ScrollContainer::update_scrollbars() { if (hide_scroll_h) { h_scroll->hide(); - h_scroll->set_max(0); scroll.x = 0; } else { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index b997d7a064..2558a930b6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -417,7 +417,6 @@ void TextEdit::_update_scrollbars() { cursor.line_ofs = 0; cursor.wrap_ofs = 0; v_scroll->set_value(0); - v_scroll->set_max(0); v_scroll->hide(); } @@ -436,7 +435,6 @@ void TextEdit::_update_scrollbars() { cursor.x_ofs = 0; h_scroll->set_value(0); - h_scroll->set_max(0); h_scroll->hide(); } diff --git a/scene/resources/material.h b/scene/resources/material.h index 1c69a754b6..11f8f20cf3 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -252,7 +252,7 @@ private: uint64_t flags : 18; uint64_t detail_blend_mode : 2; uint64_t diffuse_mode : 3; - uint64_t specular_mode : 2; + uint64_t specular_mode : 3; uint64_t invalid_key : 1; uint64_t deep_parallax : 1; uint64_t billboard_mode : 2; |