diff options
-rw-r--r-- | core/io/http_client.cpp | 12 | ||||
-rw-r--r-- | core/io/http_client.h | 2 | ||||
-rw-r--r-- | doc/classes/HTTPClient.xml | 18 | ||||
-rw-r--r-- | doc/classes/Node2D.xml | 8 | ||||
-rw-r--r-- | doc/classes/RichTextLabel.xml | 23 | ||||
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 74 | ||||
-rw-r--r-- | editor/project_manager.h | 5 | ||||
-rw-r--r-- | editor/property_editor.cpp | 23 | ||||
-rw-r--r-- | platform/javascript/audio_driver_javascript.cpp | 79 | ||||
-rw-r--r-- | platform/javascript/audio_driver_javascript.h | 16 | ||||
-rw-r--r-- | scene/3d/light.cpp | 6 |
12 files changed, 206 insertions, 62 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index b8c0a2b616..46d52384e5 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -189,16 +189,6 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str return OK; } -Error HTTPClient::send_body_text(const String &p_body) { - - return OK; -} - -Error HTTPClient::send_body_data(const PoolByteArray &p_body) { - - return OK; -} - bool HTTPClient::has_response() const { return response_headers.size() != 0; @@ -629,8 +619,6 @@ void HTTPClient::_bind_methods() { ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection); ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::request_raw); ClassDB::bind_method(D_METHOD("request", "method", "url", "headers", "body"), &HTTPClient::request, DEFVAL(String())); - ClassDB::bind_method(D_METHOD("send_body_text", "body"), &HTTPClient::send_body_text); - ClassDB::bind_method(D_METHOD("send_body_data", "body"), &HTTPClient::send_body_data); ClassDB::bind_method(D_METHOD("close"), &HTTPClient::close); ClassDB::bind_method(D_METHOD("has_response"), &HTTPClient::has_response); diff --git a/core/io/http_client.h b/core/io/http_client.h index 023370ae81..f8a3349e6e 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -169,8 +169,6 @@ public: Error request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body); Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body = String()); - Error send_body_text(const String &p_body); - Error send_body_data(const PoolByteArray &p_body); void close(); diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index e75aee0126..f148545848 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -169,24 +169,6 @@ Sends body raw, as a byte array, does not encode it in any way. </description> </method> - <method name="send_body_data"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="body" type="PoolByteArray"> - </argument> - <description> - Stub function - </description> - </method> - <method name="send_body_text"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="body" type="String"> - </argument> - <description> - Stub function - </description> - </method> <method name="set_blocking_mode"> <return type="void"> </return> diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index b00020b227..669a0fb9ff 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -322,13 +322,13 @@ Position, relative to the node's parent. </member> <member name="rotation" type="float" setter="set_rotation" getter="get_rotation"> - Rotation in radians. + Rotation in radians, relative to the node's parent. </member> <member name="rotation_deg" type="float" setter="set_rotation_in_degrees" getter="get_rotation_in_degrees"> - Rotation in degrees. + Rotation in degrees, relative to the node's parent. </member> <member name="scale" type="Vector2" setter="set_scale" getter="get_scale"> - Rotation in degrees. + The node's scale. Unscaled value: [code](1, 1)[/code] </member> <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> Local [Transform2D]. @@ -337,7 +337,7 @@ Z-index. Controls the order in which the nodes render. A node with a higher Z-index will display in front of others. </member> <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative"> - Make the node's Z-index relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. + If [code]true[/code] the node's Z-index is relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. </member> </members> <constants> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index c28a2b26b4..7f9955d29b 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -31,6 +31,7 @@ <return type="int" enum="Error"> </return> <argument index="0" name="bbcode" type="String"> + Adds BBCode to the text label. </argument> <description> </description> @@ -39,24 +40,28 @@ <return type="void"> </return> <description> + Clears the label's text. </description> </method> <method name="get_bbcode" qualifiers="const"> <return type="String"> </return> <description> + Returns label's BBCode. </description> </method> <method name="get_line_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of lines in the text. </description> </method> <method name="get_percent_visible" qualifiers="const"> <return type="float"> </return> <description> + Returns the text's visibility as a floating point value between 0.0 and 1.0. </description> </method> <method name="get_tab_size" qualifiers="const"> @@ -69,13 +74,14 @@ <return type="String"> </return> <description> - Returns the raw text, stripping out the formatting information. + Returns the label's text with the formatting removed. </description> </method> <method name="get_total_character_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the total number of characters. </description> </method> <method name="get_v_scroll"> @@ -94,6 +100,7 @@ <return type="int"> </return> <description> + Returns the number of visible lines. </description> </method> <method name="is_meta_underlined" qualifiers="const"> @@ -112,6 +119,7 @@ <return type="bool"> </return> <description> + Returns [code]true[/code] if active scrolling is enabled. </description> </method> <method name="is_scroll_following" qualifiers="const"> @@ -124,19 +132,21 @@ <return type="bool"> </return> <description> - Return true if selecting the text inside this richtext is allowed. + Returns [code]true[/code] if the label's text can be selected. </description> </method> <method name="is_using_bbcode" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the label has BBCode. </description> </method> <method name="newline"> <return type="void"> </return> <description> + Adds a newline to the end of the rich text. </description> </method> <method name="parse_bbcode"> @@ -243,6 +253,7 @@ <argument index="0" name="text" type="String"> </argument> <description> + Sets the BBCode text to the label. </description> </method> <method name="set_meta_underline"> @@ -267,6 +278,7 @@ <argument index="0" name="percent_visible" type="float"> </argument> <description> + Sets the text's visibility. Takes a floating point value between 0.0 and 1.0. </description> </method> <method name="set_scroll_active"> @@ -291,7 +303,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Set to true if selecting the text inside this richtext is allowed. + If [code]true[/code] text can be selected. </description> </method> <method name="set_tab_size"> @@ -341,14 +353,19 @@ </methods> <members> <member name="bbcode_enabled" type="bool" setter="set_use_bbcode" getter="is_using_bbcode"> + If [code]true[/code] the label uses BBCode formatting. Default value: [code]false[/code]. </member> <member name="bbcode_text" type="String" setter="set_bbcode" getter="get_bbcode"> + The label's text in BBCode format. </member> <member name="override_selected_font_color" type="bool" setter="set_override_selected_font_color" getter="is_overriding_selected_font_color"> + If [code]true[/code] the label uses the custom font color. Default value: [code]false[/code]. </member> <member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible"> + The text's visibility, as a [float] between 0.0 and 1.0. </member> <member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters"> + The restricted number of characters to display in the label. </member> </members> <signals> diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 5fe7b53a7d..f39342b680 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -769,7 +769,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { //actions[VS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"]=ShaderLanguage::TYPE_VEC2; actions[VS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord"; - actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrotFacing"; + actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing"; actions[VS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap"; actions[VS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth"; actions[VS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo"; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d1210ee26a..8f81febf31 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -48,6 +48,7 @@ #include "scene/gui/separator.h" #include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" +#include "translation.h" #include "version.h" #include "version_hash.gen.h" @@ -1325,6 +1326,28 @@ void ProjectManager::_erase_project() { erase_ask->popup_centered_minsize(); } +void ProjectManager::_language_selected(int p_id) { + + String lang = language_btn->get_item_metadata(p_id); + EditorSettings::get_singleton()->set("interface/editor/editor_language", lang); + language_btn->set_text(lang); + language_btn->set_icon(get_icon("Environment", "EditorIcons")); + + language_restart_ask->set_text(TTR("Language changed.\nThe UI will update next time the editor or project manager starts.")); + language_restart_ask->popup_centered(); +} + +void ProjectManager::_restart_confirm() { + + List<String> args = OS::get_singleton()->get_cmdline_args(); + String exec = OS::get_singleton()->get_executable_path(); + OS::ProcessID pid = 0; + Error err = OS::get_singleton()->execute(exec, args, false, &pid); + ERR_FAIL_COND(err); + + get_tree()->quit(); +} + void ProjectManager::_exit_dialog() { get_tree()->quit(); @@ -1398,6 +1421,8 @@ void ProjectManager::_bind_methods() { ClassDB::bind_method("_rename_project", &ProjectManager::_rename_project); ClassDB::bind_method("_erase_project", &ProjectManager::_erase_project); ClassDB::bind_method("_erase_project_confirm", &ProjectManager::_erase_project_confirm); + ClassDB::bind_method("_language_selected", &ProjectManager::_language_selected); + ClassDB::bind_method("_restart_confirm", &ProjectManager::_restart_confirm); ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog); ClassDB::bind_method("_load_recent_projects", &ProjectManager::_load_recent_projects); ClassDB::bind_method("_on_project_renamed", &ProjectManager::_on_project_renamed); @@ -1482,9 +1507,13 @@ ProjectManager::ProjectManager() { //vb->add_child(memnew(HSeparator)); //vb->add_margin_child("\n",memnew(Control)); + Control *center_box = memnew(Control); + center_box->set_v_size_flags(SIZE_EXPAND_FILL); + vb->add_child(center_box); + tabs = memnew(TabContainer); - vb->add_child(tabs); - tabs->set_v_size_flags(SIZE_EXPAND_FILL); + center_box->add_child(tabs); + tabs->set_anchors_and_margins_preset(Control::PRESET_WIDE); HBoxContainer *tree_hb = memnew(HBoxContainer); projects_hb = tree_hb; @@ -1585,6 +1614,40 @@ ProjectManager::ProjectManager() { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } + HBoxContainer *settings_hb = memnew(HBoxContainer); + settings_hb->set_alignment(BoxContainer::ALIGN_END); + settings_hb->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN); + + language_btn = memnew(OptionButton); + + Vector<String> editor_languages; + List<PropertyInfo> editor_settings_properties; + EditorSettings::get_singleton()->get_property_list(&editor_settings_properties); + for (List<PropertyInfo>::Element *E = editor_settings_properties.front(); E; E = E->next()) { + PropertyInfo &pi = E->get(); + if (pi.name == "interface/editor/editor_language") { + editor_languages = pi.hint_string.split(","); + } + } + String current_lang = EditorSettings::get_singleton()->get("interface/editor/editor_language"); + for (int i = 0; i < editor_languages.size(); i++) { + String lang = editor_languages[i]; + String lang_name = TranslationServer::get_singleton()->get_locale_name(lang); + language_btn->add_item(lang_name + " [" + lang + "]", i); + language_btn->set_item_metadata(i, lang); + if (current_lang == lang) { + language_btn->select(i); + language_btn->set_text(lang); + } + } + language_btn->set_icon(get_icon("Environment", "EditorIcons")); + + settings_hb->add_child(language_btn); + language_btn->connect("item_selected", this, "_language_selected"); + + center_box->add_child(settings_hb); + settings_hb->set_anchors_and_margins_preset(Control::PRESET_TOP_RIGHT); + CenterContainer *cc = memnew(CenterContainer); Button *cancel = memnew(Button); cancel->set_text(TTR("Exit")); @@ -1595,6 +1658,13 @@ ProjectManager::ProjectManager() { // + language_restart_ask = memnew(ConfirmationDialog); + language_restart_ask->get_ok()->set_text(TTR("Restart Now")); + language_restart_ask->get_ok()->connect("pressed", this, "_restart_confirm"); + language_restart_ask->get_cancel()->set_text(TTR("Continue")); + + gui_base->add_child(language_restart_ask); + erase_ask = memnew(ConfirmationDialog); erase_ask->get_ok()->set_text(TTR("Remove")); erase_ask->get_ok()->connect("pressed", this, "_erase_project_confirm"); diff --git a/editor/project_manager.h b/editor/project_manager.h index bfae0b2297..656bd2d19c 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -54,6 +54,7 @@ class ProjectManager : public Control { ProjectListFilter *project_filter; + ConfirmationDialog *language_restart_ask; ConfirmationDialog *erase_ask; ConfirmationDialog *multi_open_ask; ConfirmationDialog *multi_run_ask; @@ -71,6 +72,8 @@ class ProjectManager : public Control { TabContainer *tabs; + OptionButton *language_btn; + Control *gui_base; void _scan_projects(); @@ -84,6 +87,8 @@ class ProjectManager : public Control { void _erase_project(); void _erase_project_confirm(); void _update_project_buttons(); + void _language_selected(int p_id); + void _restart_confirm(); void _exit_dialog(); void _scan_begin(const String &p_base); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index b7cc9347f2..b676d74879 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -1767,18 +1767,18 @@ void CustomPropertyEditor::_focus_exit() { void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) { int w = 100; - int h = 18; + int h = 60; int m = 5; - set_size(Size2(w, m * 2 + (h + m) * p_strings.size())); + set_size(Size2((m * 2 + w) * p_strings.size() - m, h)); for (int i = 0; i < MAX_ACTION_BUTTONS; i++) { if (i < p_strings.size()) { action_buttons[i]->show(); action_buttons[i]->set_text(p_strings[i]); - action_buttons[i]->set_position(Point2(m, m + i * (h + m))); - action_buttons[i]->set_size(Size2(w - m * 2, h)); + action_buttons[i]->set_position(Point2(m + i * (w + m), m)); + action_buttons[i]->set_size(Size2(w, h - m * 2)); action_buttons[i]->set_flat(true); } else { action_buttons[i]->hide(); @@ -1788,13 +1788,14 @@ void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int p_label_w, const List<String> &p_strings) { - int w = 80; - int h = 20; - int m = 10; + int cell_width = 80; + int cell_height = 20; + int cell_margin = 10; + int hor_spacing = 8; // Spacing between labels and their values int rows = ((p_amount - 1) / p_columns) + 1; - set_size(Size2(m * (1 + p_columns) + (w + p_label_w) * p_columns, m * (1 + rows) + h * rows)); + set_size(Size2(cell_margin * (1 + p_columns) + (cell_width + p_label_w + hor_spacing) * p_columns, cell_margin * (1 + rows) + cell_height * rows)); for (int i = 0; i < MAX_VALUE_EDITORS; i++) { @@ -1805,9 +1806,9 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int value_editor[i]->show(); value_label[i]->show(); value_label[i]->set_text(i < p_strings.size() ? p_strings[i] : String("")); - value_editor[i]->set_position(Point2(m + p_label_w + c * (w + m + p_label_w), m + r * (h + m))); - value_editor[i]->set_size(Size2(w, h)); - value_label[i]->set_position(Point2(m + c * (w + m + p_label_w), m + r * (h + m))); + value_editor[i]->set_position(Point2(cell_margin + p_label_w + hor_spacing + c * (cell_width + cell_margin + p_label_w + hor_spacing), cell_margin + r * (cell_height + cell_margin))); + value_editor[i]->set_size(Size2(cell_width, cell_height)); + value_label[i]->set_position(Point2(cell_margin + c * (cell_width + cell_margin + p_label_w + hor_spacing), cell_margin + r * (cell_height + cell_margin))); value_editor[i]->set_editable(!read_only); } else { value_editor[i]->hide(); diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp index 4c0e5fd966..cd3974669f 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/javascript/audio_driver_javascript.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "audio_driver_javascript.h" +#include <emscripten.h> #include <string.h> #define MAX_NUMBER_INTERFACES 3 @@ -38,22 +39,91 @@ //AudioDriverJavaScript* AudioDriverJavaScript::s_ad=NULL; +AudioDriverJavaScript *AudioDriverJavaScript::singleton_js = NULL; const char *AudioDriverJavaScript::get_name() const { return "JavaScript"; } +extern "C" { + +void js_audio_driver_mix_function(int p_frames) { + + //print_line("MIXI! "+itos(p_frames)); + AudioDriverJavaScript::singleton_js->mix_to_js(p_frames); +} +} + +void AudioDriverJavaScript::mix_to_js(int p_frames) { + + int todo = p_frames; + int offset = 0; + + while (todo) { + + int tomix = MIN(todo, INTERNAL_BUFFER_SIZE); + + audio_server_process(p_frames, stream_buffer); + for (int i = 0; i < tomix * internal_buffer_channels; i++) { + internal_buffer[i] = float(stream_buffer[i] >> 16) * 32768.0; + } + + /* clang-format off */ + EM_ASM_({ + var data = HEAPF32.subarray($0 / 4, $0 / 4 + $2 * 2); + + for (var channel = 0; channel < _as_output_buffer.numberOfChannels; channel++) { + var outputData = _as_output_buffer.getChannelData(channel); + // Loop through samples + for (var sample = 0; sample < $2; sample++) { + // make output equal to the same as the input + outputData[sample + $1] = data[sample * 2 + channel]; + } + } + }, internal_buffer, offset, tomix); + /* clang-format on */ + + todo -= tomix; + offset += tomix; + } +} + Error AudioDriverJavaScript::init() { return OK; } void AudioDriverJavaScript::start() { + + internal_buffer_channels = 2; + internal_buffer = memnew_arr(float, INTERNAL_BUFFER_SIZE *internal_buffer_channels); + stream_buffer = memnew_arr(int32_t, INTERNAL_BUFFER_SIZE * 4); //max 4 channels + + /* clang-format off */ + EM_ASM( + _as_audioctx = new (window.AudioContext || window.webkitAudioContext)(); + + audio_server_mix_function = Module.cwrap('js_audio_driver_mix_function', 'void', ['number']); + ); + + int buffer_latency = 16384; + EM_ASM_( { + _as_script_node = _as_audioctx.createScriptProcessor($0, 0, 2); + _as_script_node.connect(_as_audioctx.destination); + console.log(_as_script_node.bufferSize); + + _as_script_node.onaudioprocess = function(audioProcessingEvent) { + // The output buffer contains the samples that will be modified and played + _as_output_buffer = audioProcessingEvent.outputBuffer; + audio_server_mix_function(_as_output_buffer.getChannelData(0).length); + } + }, buffer_latency); + /* clang-format on */ } int AudioDriverJavaScript::get_mix_rate() const { - return 44100; + return mix_rate; } AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const { @@ -63,7 +133,7 @@ AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const { void AudioDriverJavaScript::lock() { - /* + /*no locking, as threads are not supported if (active && mutex) mutex->lock(); */ @@ -71,7 +141,7 @@ void AudioDriverJavaScript::lock() { void AudioDriverJavaScript::unlock() { - /* + /*no locking, as threads are not supported if (active && mutex) mutex->unlock(); */ @@ -81,4 +151,7 @@ void AudioDriverJavaScript::finish() { } AudioDriverJavaScript::AudioDriverJavaScript() { + + mix_rate = 44100; + singleton_js = this; } diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h index c5cebe800f..c3adeca07b 100644 --- a/platform/javascript/audio_driver_javascript.h +++ b/platform/javascript/audio_driver_javascript.h @@ -35,7 +35,23 @@ #include "os/mutex.h" class AudioDriverJavaScript : public AudioDriver { + + enum { + INTERNAL_BUFFER_SIZE = 4096, + STREAM_SCALE_BITS = 12 + + }; + + int mix_rate; + float *internal_buffer; + int internal_buffer_channels; + int internal_buffer_size; + int32_t *stream_buffer; + public: + void mix_to_js(int p_frames); + static AudioDriverJavaScript *singleton_js; + virtual const char *get_name() const; virtual Error init(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index e994f4c79e..02d10523e7 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -369,12 +369,6 @@ DirectionalLight::DirectionalLight() set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE); blend_splits = false; - -#ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) - // Create light with a default natural "sun" orientation in editor, instead of looking horizontally on X - set_rotation_in_degrees(Vector3(-50, 25, 30)); -#endif } void OmniLight::set_shadow_mode(ShadowMode p_mode) { |