diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | doc/classes/AudioStreamRandomizer.xml | 4 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 6 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 4 | ||||
-rw-r--r-- | editor/import/audio_stream_import_settings.cpp | 38 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/audio_stream_randomizer_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 55 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.h | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript.cpp | 10 | ||||
-rw-r--r-- | modules/gdscript/gdscript.h | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 17 | ||||
-rw-r--r-- | modules/svg/image_loader_svg.cpp | 23 | ||||
-rw-r--r-- | modules/svg/image_loader_svg.h | 1 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 7 | ||||
-rw-r--r-- | scene/animation/animation_node_state_machine.cpp | 7 | ||||
-rw-r--r-- | servers/audio/audio_stream.cpp | 6 | ||||
-rw-r--r-- | servers/audio/audio_stream.h | 2 |
19 files changed, 123 insertions, 97 deletions
diff --git a/.gitignore b/.gitignore index 1292be06fd..ca96220570 100644 --- a/.gitignore +++ b/.gitignore @@ -242,8 +242,10 @@ xcuserdata/ [Rr]eleases/ x64/ x86/ -# Not build results, this is Theora source code. -!thirdparty/libtheora/x86/ + +# Do not ignore x86 folders anywhere under thirdparty libraries +!thirdparty/**/x86/ + [Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ diff --git a/doc/classes/AudioStreamRandomizer.xml b/doc/classes/AudioStreamRandomizer.xml index 9b58d78af5..d93f853c89 100644 --- a/doc/classes/AudioStreamRandomizer.xml +++ b/doc/classes/AudioStreamRandomizer.xml @@ -12,8 +12,10 @@ <method name="add_stream"> <return type="void" /> <param index="0" name="index" type="int" /> + <param index="1" name="stream" type="AudioStream" /> + <param index="2" name="weight" type="float" default="1.0" /> <description> - Insert a stream at the specified index. + Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool. </description> </method> <method name="get_stream" qualifiers="const"> diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index b02a100784..711fd7b962 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -152,12 +152,10 @@ Vector<String> OS_Unix::get_video_adapter_driver_info() const { String OS_Unix::get_stdin_string(bool p_block) { if (p_block) { char buff[1024]; - String ret = stdin_buf + fgets(buff, 1024, stdin); - stdin_buf = ""; - return ret; + return String::utf8(fgets(buff, 1024, stdin)); } - return ""; + return String(); } Error OS_Unix::get_entropy(uint8_t *r_buffer, int p_bytes) { diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index ce06a52a95..68d2dd0042 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -46,8 +46,6 @@ protected: virtual void finalize_core() override; - String stdin_buf; - public: OS_Unix(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 2df14aef6c..5bf45687ab 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3867,6 +3867,10 @@ void EditorInspector::_notification(int p_what) { _update_inspector_bg(); } break; + case NOTIFICATION_THEME_CHANGED: { + update_tree(); + } break; + case NOTIFICATION_ENTER_TREE: { if (!sub_inspector) { get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed)); diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index 71d0d4b399..92d4397c68 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -465,12 +465,17 @@ void AudioStreamImportSettings::_settings_changed() { updating_settings = true; stream->call("set_loop", loop->is_pressed()); stream->call("set_loop_offset", loop_offset->get_value()); + if (loop->is_pressed()) { + loop_offset->set_editable(true); + } else { + loop_offset->set_editable(false); + } + if (bpm_enabled->is_pressed()) { stream->call("set_bpm", bpm_edit->get_value()); - beats_enabled->show(); - beats_edit->show(); - bar_beats_label->show(); - bar_beats_edit->show(); + beats_enabled->set_disabled(false); + beats_edit->set_editable(true); + bar_beats_edit->set_editable(true); double bpm = bpm_edit->get_value(); if (bpm > 0) { float beat_size = 60 / float(bpm); @@ -486,10 +491,9 @@ void AudioStreamImportSettings::_settings_changed() { } else { stream->call("set_bpm", 0); stream->call("set_bar_beats", 4); - beats_enabled->hide(); - beats_edit->hide(); - bar_beats_label->hide(); - bar_beats_edit->hide(); + beats_enabled->set_disabled(true); + beats_edit->set_editable(false); + bar_beats_edit->set_editable(false); } if (bpm_enabled->is_pressed() && beats_enabled->is_pressed()) { stream->call("set_beat_count", beats_edit->get_value()); @@ -552,15 +556,6 @@ AudioStreamImportSettings::AudioStreamImportSettings() { bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); interactive_hb->add_child(bpm_edit); interactive_hb->add_spacer(); - bar_beats_label = memnew(Label(TTR("Bar Beats:"))); - interactive_hb->add_child(bar_beats_label); - bar_beats_edit = memnew(SpinBox); - bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams.")); - bar_beats_edit->set_min(2); - bar_beats_edit->set_max(32); - bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); - interactive_hb->add_child(bar_beats_edit); - interactive_hb->add_spacer(); beats_enabled = memnew(CheckBox); beats_enabled->set_text(TTR("Beat Count:")); beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); @@ -570,6 +565,15 @@ AudioStreamImportSettings::AudioStreamImportSettings() { beats_edit->set_max(99999); beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); interactive_hb->add_child(beats_edit); + bar_beats_label = memnew(Label(TTR("Bar Beats:"))); + interactive_hb->add_child(bar_beats_label); + bar_beats_edit = memnew(SpinBox); + bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams.")); + bar_beats_edit->set_min(2); + bar_beats_edit->set_max(32); + bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); + interactive_hb->add_child(bar_beats_edit); + interactive_hb->add_spacer(); main_vbox->add_margin_child(TTR("Music Playback:"), interactive_hb); color_rect = memnew(ColorRect); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 7c3ecd5d4e..6483a18a4d 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -43,6 +43,11 @@ #include "editor/project_settings_editor.h" #include "scene/gui/menu_button.h" +#include "modules/modules_enabled.gen.h" // For svg. +#ifdef MODULE_SVG_ENABLED +#include "modules/svg/image_loader_svg.h" +#endif + static inline void setup_http_request(HTTPRequest *request) { request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); @@ -751,13 +756,30 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedB uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; uint8_t jpg_signature[3] = { 255, 216, 255 }; + uint8_t webp_signature[4] = { 82, 73, 70, 70 }; + uint8_t bmp_signature[2] = { 66, 77 }; if (r) { if ((memcmp(&r[0], &png_signature[0], 8) == 0) && Image::_png_mem_loader_func) { image->copy_internals_from(Image::_png_mem_loader_func(r, len)); } else if ((memcmp(&r[0], &jpg_signature[0], 3) == 0) && Image::_jpg_mem_loader_func) { image->copy_internals_from(Image::_jpg_mem_loader_func(r, len)); + } else if ((memcmp(&r[0], &webp_signature[0], 4) == 0) && Image::_webp_mem_loader_func) { + image->copy_internals_from(Image::_webp_mem_loader_func(r, len)); + } else if ((memcmp(&r[0], &bmp_signature[0], 2) == 0) && Image::_bmp_mem_loader_func) { + image->copy_internals_from(Image::_bmp_mem_loader_func(r, len)); } +#ifdef MODULE_SVG_ENABLED + else { + ImageLoaderSVG svg_loader; + Ref<Image> img = Ref<Image>(memnew(Image)); + Error err = svg_loader.create_image_from_utf8_buffer(img, image_data, 1.0, false); + + if (err == OK) { + image->copy_internals_from(img); + } + } +#endif } if (!image->is_empty()) { diff --git a/editor/plugins/audio_stream_randomizer_editor_plugin.cpp b/editor/plugins/audio_stream_randomizer_editor_plugin.cpp index e21a50a434..61b7683a05 100644 --- a/editor/plugins/audio_stream_randomizer_editor_plugin.cpp +++ b/editor/plugins/audio_stream_randomizer_editor_plugin.cpp @@ -81,7 +81,7 @@ void AudioStreamRandomizerEditorPlugin::_move_stream_array_element(Object *p_und if (p_from_index < 0) { undo_redo_man->add_undo_method(randomizer, "remove_stream", p_to_pos < 0 ? randomizer->get_streams_count() : p_to_pos); } else if (p_to_pos < 0) { - undo_redo_man->add_undo_method(randomizer, "add_stream", p_from_index); + undo_redo_man->add_undo_method(randomizer, "add_stream", p_from_index, Ref<AudioStream>()); } List<PropertyInfo> properties; @@ -107,7 +107,7 @@ void AudioStreamRandomizerEditorPlugin::_move_stream_array_element(Object *p_und #undef ADD_UNDO if (p_from_index < 0) { - undo_redo_man->add_do_method(randomizer, "add_stream", p_to_pos); + undo_redo_man->add_do_method(randomizer, "add_stream", p_to_pos, Ref<AudioStream>()); } else if (p_to_pos < 0) { undo_redo_man->add_do_method(randomizer, "remove_stream", p_from_index); } else { diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 369a59c443..f7fb211014 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -47,43 +47,7 @@ VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = nullptr; void VersionControlEditorPlugin::_bind_methods() { - ClassDB::bind_method(D_METHOD("_initialize_vcs"), &VersionControlEditorPlugin::_initialize_vcs); - ClassDB::bind_method(D_METHOD("_set_credentials"), &VersionControlEditorPlugin::_set_credentials); - ClassDB::bind_method(D_METHOD("_update_set_up_warning"), &VersionControlEditorPlugin::_update_set_up_warning); - ClassDB::bind_method(D_METHOD("_commit"), &VersionControlEditorPlugin::_commit); - ClassDB::bind_method(D_METHOD("_refresh_stage_area"), &VersionControlEditorPlugin::_refresh_stage_area); - ClassDB::bind_method(D_METHOD("_move_all"), &VersionControlEditorPlugin::_move_all); - ClassDB::bind_method(D_METHOD("_load_diff"), &VersionControlEditorPlugin::_load_diff); - ClassDB::bind_method(D_METHOD("_display_diff"), &VersionControlEditorPlugin::_display_diff); - ClassDB::bind_method(D_METHOD("_item_activated"), &VersionControlEditorPlugin::_item_activated); - ClassDB::bind_method(D_METHOD("_update_branch_create_button"), &VersionControlEditorPlugin::_update_branch_create_button); - ClassDB::bind_method(D_METHOD("_update_remote_create_button"), &VersionControlEditorPlugin::_update_remote_create_button); - ClassDB::bind_method(D_METHOD("_update_commit_button"), &VersionControlEditorPlugin::_update_commit_button); - ClassDB::bind_method(D_METHOD("_refresh_branch_list"), &VersionControlEditorPlugin::_refresh_branch_list); - ClassDB::bind_method(D_METHOD("_set_commit_list_size"), &VersionControlEditorPlugin::_set_commit_list_size); - ClassDB::bind_method(D_METHOD("_refresh_commit_list"), &VersionControlEditorPlugin::_refresh_commit_list); - ClassDB::bind_method(D_METHOD("_refresh_remote_list"), &VersionControlEditorPlugin::_refresh_remote_list); - ClassDB::bind_method(D_METHOD("_ssh_public_key_selected"), &VersionControlEditorPlugin::_ssh_public_key_selected); - ClassDB::bind_method(D_METHOD("_ssh_private_key_selected"), &VersionControlEditorPlugin::_ssh_private_key_selected); - ClassDB::bind_method(D_METHOD("_commit_message_gui_input"), &VersionControlEditorPlugin::_commit_message_gui_input); - ClassDB::bind_method(D_METHOD("_cell_button_pressed"), &VersionControlEditorPlugin::_cell_button_pressed); - ClassDB::bind_method(D_METHOD("_discard_all"), &VersionControlEditorPlugin::_discard_all); - ClassDB::bind_method(D_METHOD("_create_branch"), &VersionControlEditorPlugin::_create_branch); - ClassDB::bind_method(D_METHOD("_create_remote"), &VersionControlEditorPlugin::_create_remote); - ClassDB::bind_method(D_METHOD("_remove_branch"), &VersionControlEditorPlugin::_remove_branch); - ClassDB::bind_method(D_METHOD("_remove_remote"), &VersionControlEditorPlugin::_remove_remote); - ClassDB::bind_method(D_METHOD("_branch_item_selected"), &VersionControlEditorPlugin::_branch_item_selected); - ClassDB::bind_method(D_METHOD("_remote_selected"), &VersionControlEditorPlugin::_remote_selected); - ClassDB::bind_method(D_METHOD("_fetch"), &VersionControlEditorPlugin::_fetch); - ClassDB::bind_method(D_METHOD("_pull"), &VersionControlEditorPlugin::_pull); - ClassDB::bind_method(D_METHOD("_push"), &VersionControlEditorPlugin::_push); - ClassDB::bind_method(D_METHOD("_extra_option_selected"), &VersionControlEditorPlugin::_extra_option_selected); - ClassDB::bind_method(D_METHOD("_update_extra_options"), &VersionControlEditorPlugin::_update_extra_options); - ClassDB::bind_method(D_METHOD("_popup_branch_remove_confirm"), &VersionControlEditorPlugin::_popup_branch_remove_confirm); - ClassDB::bind_method(D_METHOD("_popup_remote_remove_confirm"), &VersionControlEditorPlugin::_popup_remote_remove_confirm); - ClassDB::bind_method(D_METHOD("_popup_file_dialog"), &VersionControlEditorPlugin::_popup_file_dialog); - - ClassDB::bind_method(D_METHOD("popup_vcs_set_up_dialog"), &VersionControlEditorPlugin::popup_vcs_set_up_dialog); + // No binds required so far. } void VersionControlEditorPlugin::_create_vcs_metadata_files() { @@ -435,6 +399,10 @@ void VersionControlEditorPlugin::_discard_file(String p_file_path, EditorVCSInte EditorFileSystem::get_singleton()->update_file(p_file_path); } +void VersionControlEditorPlugin::_confirm_discard_all() { + discard_all_confirm->popup_centered(); +} + void VersionControlEditorPlugin::_discard_all() { TreeItem *file_entry = unstaged_files->get_root()->get_first_child(); while (file_entry) { @@ -1240,10 +1208,21 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_remote_list)); unstage_title->add_child(refresh_button); + discard_all_confirm = memnew(AcceptDialog); + discard_all_confirm->set_title(TTR("Discard all changes")); + discard_all_confirm->set_min_size(Size2i(400, 50)); + discard_all_confirm->set_text(TTR("This operation is IRREVERSIBLE. Your changes will be deleted FOREVER.")); + discard_all_confirm->set_hide_on_ok(true); + discard_all_confirm->set_ok_button_text(TTR("Permanentally delete my changes")); + discard_all_confirm->add_cancel_button(); + version_commit_dock->add_child(discard_all_confirm); + + discard_all_confirm->get_ok_button()->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_discard_all)); + discard_all_button = memnew(Button); discard_all_button->set_tooltip_text(TTR("Discard all changes")); discard_all_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); - discard_all_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_discard_all)); + discard_all_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_confirm_discard_all)); discard_all_button->set_flat(true); unstage_title->add_child(discard_all_button); diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h index 3340384a92..3cb18ba5b5 100644 --- a/editor/plugins/version_control_editor_plugin.h +++ b/editor/plugins/version_control_editor_plugin.h @@ -86,6 +86,8 @@ private: FileDialog *set_up_ssh_private_key_file_dialog = nullptr; Label *set_up_warning_text = nullptr; + AcceptDialog *discard_all_confirm = nullptr; + OptionButton *commit_list_size_button = nullptr; AcceptDialog *branch_create_confirm = nullptr; @@ -157,6 +159,7 @@ private: void _force_push(); void _fetch(); void _commit(); + void _confirm_discard_all(); void _discard_all(); void _refresh_stage_area(); void _refresh_branch_list(); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 57a29cc81e..1fe1561559 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1966,6 +1966,16 @@ void GDScriptLanguage::add_named_global_constant(const StringName &p_name, const named_globals[p_name] = p_value; } +Variant GDScriptLanguage::get_any_global_constant(const StringName &p_name) { + if (named_globals.has(p_name)) { + return named_globals[p_name]; + } + if (globals.has(p_name)) { + return _global_array[globals[p_name]]; + } + ERR_FAIL_V_MSG(Variant(), vformat("Could not find any global constant with name: %s.", p_name)); +} + void GDScriptLanguage::remove_named_global_constant(const StringName &p_name) { ERR_FAIL_COND(!named_globals.has(p_name)); named_globals.erase(p_name); diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 332d18f720..39367e377b 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -455,6 +455,9 @@ public: _FORCE_INLINE_ Variant *get_global_array() { return _global_array; } _FORCE_INLINE_ const HashMap<StringName, int> &get_global_map() const { return globals; } _FORCE_INLINE_ const HashMap<StringName, Variant> &get_named_globals_map() const { return named_globals; } + // These two functions should be used when behavior needs to be consistent between in-editor and running the scene + bool has_any_global_constant(const StringName &p_name) { return named_globals.has(p_name) || globals.has(p_name); } + Variant get_any_global_constant(const StringName &p_name); _FORCE_INLINE_ static GDScriptLanguage *get_singleton() { return singleton; } diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 1a1c2193bf..0aea2b9c16 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3403,8 +3403,8 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident } } } else if (ResourceLoader::get_resource_type(autoload.path) == "PackedScene") { - if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) { - Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name]; + if (GDScriptLanguage::get_singleton()->has_any_global_constant(name)) { + Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name); Node *node = Object::cast_to<Node>(constant); if (node != nullptr) { Ref<GDScript> scr = node->get_script(); @@ -3426,17 +3426,8 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident } } - if (GDScriptLanguage::get_singleton()->get_global_map().has(name)) { - int idx = GDScriptLanguage::get_singleton()->get_global_map()[name]; - Variant constant = GDScriptLanguage::get_singleton()->get_global_array()[idx]; - p_identifier->set_datatype(type_from_variant(constant, p_identifier)); - p_identifier->is_constant = true; - p_identifier->reduced_value = constant; - return; - } - - if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) { - Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name]; + if (GDScriptLanguage::get_singleton()->has_any_global_constant(name)) { + Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name); p_identifier->set_datatype(type_from_variant(constant, p_identifier)); p_identifier->is_constant = true; p_identifier->reduced_value = constant; diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index 2dba4916a0..b194e7cb3f 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -67,19 +67,12 @@ void ImageLoaderSVG::_replace_color_property(const HashMap<Color, Color> &p_colo } } -Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, String p_string, float p_scale, bool p_upsample, const HashMap<Color, Color> &p_color_map) { +Error ImageLoaderSVG::create_image_from_utf8_buffer(Ref<Image> p_image, const PackedByteArray &p_buffer, float p_scale, bool p_upsample) { ERR_FAIL_COND_V_MSG(Math::is_zero_approx(p_scale), ERR_INVALID_PARAMETER, "ImageLoaderSVG: Can't load SVG with a scale of 0."); - if (p_color_map.size()) { - _replace_color_property(p_color_map, "stop-color=\"", p_string); - _replace_color_property(p_color_map, "fill=\"", p_string); - _replace_color_property(p_color_map, "stroke=\"", p_string); - } - std::unique_ptr<tvg::Picture> picture = tvg::Picture::gen(); - PackedByteArray bytes = p_string.to_utf8_buffer(); - tvg::Result result = picture->load((const char *)bytes.ptr(), bytes.size(), "svg", true); + tvg::Result result = picture->load((const char *)p_buffer.ptr(), p_buffer.size(), "svg", true); if (result != tvg::Result::Success) { return ERR_INVALID_DATA; } @@ -149,6 +142,18 @@ Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, String p_stri return OK; } +Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, String p_string, float p_scale, bool p_upsample, const HashMap<Color, Color> &p_color_map) { + if (p_color_map.size()) { + _replace_color_property(p_color_map, "stop-color=\"", p_string); + _replace_color_property(p_color_map, "fill=\"", p_string); + _replace_color_property(p_color_map, "stroke=\"", p_string); + } + + PackedByteArray bytes = p_string.to_utf8_buffer(); + + return create_image_from_utf8_buffer(p_image, bytes, p_scale, p_upsample); +} + void ImageLoaderSVG::get_recognized_extensions(List<String> *p_extensions) const { p_extensions->push_back("svg"); } diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h index 84511f1708..d955a04f1e 100644 --- a/modules/svg/image_loader_svg.h +++ b/modules/svg/image_loader_svg.h @@ -41,6 +41,7 @@ class ImageLoaderSVG : public ImageFormatLoader { public: static void set_forced_color_map(const HashMap<Color, Color> &p_color_map); + Error create_image_from_utf8_buffer(Ref<Image> p_image, const PackedByteArray &p_buffer, float p_scale, bool p_upsample); Error create_image_from_string(Ref<Image> p_image, String p_string, float p_scale, bool p_upsample, const HashMap<Color, Color> &p_color_map); virtual Error load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) override; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index a083a98c72..f8633d29ac 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1164,8 +1164,11 @@ bool OS_Windows::set_environment(const String &p_var, const String &p_value) con String OS_Windows::get_stdin_string(bool p_block) { if (p_block) { - char buff[1024]; - return fgets(buff, 1024, stdin); + WCHAR buff[1024]; + DWORD count = 0; + if (ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), buff, 1024, &count, nullptr)) { + return String::utf16((const char16_t *)buff, count); + } } return String(); diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 293e04eb1f..aff2b11267 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -835,7 +835,8 @@ void AnimationNodeStateMachine::rename_node(const StringName &p_name, const Stri _rename_transitions(p_name, p_new_name); - emit_signal("tree_changed"); + emit_changed(); + emit_signal(SNAME("tree_changed")); } void AnimationNodeStateMachine::_rename_transitions(const StringName &p_name, const StringName &p_new_name) { @@ -878,9 +879,8 @@ void AnimationNodeStateMachine::_rename_transitions(const StringName &p_name, co transitions.write[i].to = p_new_name; } - - updating_transitions = false; } + updating_transitions = false; } void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const { @@ -1292,6 +1292,7 @@ Vector2 AnimationNodeStateMachine::get_node_position(const StringName &p_name) c } void AnimationNodeStateMachine::_tree_changed() { + emit_changed(); emit_signal(SNAME("tree_changed")); } diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 113e728106..84c21f7cd6 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -410,12 +410,12 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() { //////////////////////////////// -void AudioStreamRandomizer::add_stream(int p_index) { +void AudioStreamRandomizer::add_stream(int p_index, Ref<AudioStream> p_stream, float p_weight) { if (p_index < 0) { p_index = audio_stream_pool.size(); } ERR_FAIL_COND(p_index > audio_stream_pool.size()); - PoolEntry entry{ nullptr, 1.0f }; + PoolEntry entry{ p_stream, p_weight }; audio_stream_pool.insert(p_index, entry); emit_signal(SNAME("changed")); notify_property_list_changed(); @@ -709,7 +709,7 @@ void AudioStreamRandomizer::_get_property_list(List<PropertyInfo> *p_list) const } void AudioStreamRandomizer::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_stream", "index"), &AudioStreamRandomizer::add_stream); + ClassDB::bind_method(D_METHOD("add_stream", "index", "stream", "weight"), &AudioStreamRandomizer::add_stream, DEFVAL(1.0)); ClassDB::bind_method(D_METHOD("move_stream", "index_from", "index_to"), &AudioStreamRandomizer::move_stream); ClassDB::bind_method(D_METHOD("remove_stream", "index"), &AudioStreamRandomizer::remove_stream); diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h index c6ae6817e7..0d3f7bca04 100644 --- a/servers/audio/audio_stream.h +++ b/servers/audio/audio_stream.h @@ -241,7 +241,7 @@ protected: void _get_property_list(List<PropertyInfo> *p_list) const; public: - void add_stream(int p_index); + void add_stream(int p_index, Ref<AudioStream> p_stream, float p_weight = 1.0); void move_stream(int p_index_from, int p_index_to); void remove_stream(int p_index); |