diff options
24 files changed, 125 insertions, 94 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/core/script_language.cpp b/core/script_language.cpp index 5ead91f26e..384e41e4bd 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -58,7 +58,6 @@ void Script::_bind_methods() { ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal); ClassDB::bind_method(D_METHOD("is_tool"), &Script::is_tool); - ClassDB::bind_method(D_METHOD("get_node_type"), &Script::get_node_type); } void ScriptServer::set_scripting_enabled(bool p_enabled) { diff --git a/core/script_language.h b/core/script_language.h index c243ef781b..5da72d0492 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -107,8 +107,6 @@ public: virtual bool is_tool() const = 0; - virtual String get_node_type() const = 0; - virtual ScriptLanguage *get_language() const = 0; virtual bool has_script_signal(const StringName &p_signal) const = 0; diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml index 9ce1a93121..82d572b81b 100644 --- a/doc/classes/AudioEffectFilter.xml +++ b/doc/classes/AudioEffectFilter.xml @@ -75,7 +75,7 @@ <member name="db" type="int" setter="set_db" getter="get_db" enum="AudioEffectFilter.FilterDB"> </member> <member name="gain" type="float" setter="set_gain" getter="get_gain"> - Gain amount of the frequences after the filter. + Gain amount of the frequencies after the filter. </member> <member name="resonance" type="float" setter="set_resonance" getter="get_resonance"> Amount of boost in the overtones near the cutoff frequency. diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index 93140a0df6..352e270e77 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -348,10 +348,13 @@ If [code]true[/code] the camera only moves when reaching the vertical drag margins. If [code]false[/code] the camera moves vertically regardless of margins. Default value: [code]true[/code]. </member> <member name="editor_draw_drag_margin" type="bool" setter="set_margin_drawing_enabled" getter="is_margin_drawing_enabled"> + If [code]true[/code] draws the camera's drag margin rectangle in the editor. Default value: [code]false[/code] </member> <member name="editor_draw_limits" type="bool" setter="set_limit_drawing_enabled" getter="is_limit_drawing_enabled"> + If [code]true[/code] draws the camera's limits rectangle in the editor. Default value: [code]true[/code] </member> <member name="editor_draw_screen" type="bool" setter="set_screen_drawing_enabled" getter="is_screen_drawing_enabled"> + If [code]true[/code] draws the camera's screen rectangle in the editor. Default value: [code]false[/code] </member> <member name="limit_bottom" type="int" setter="set_limit" getter="get_limit"> Bottom scroll limit in pixels. The camera stops moving when reaching this value. @@ -363,6 +366,7 @@ Right scroll limit in pixels. The camera stops moving when reaching this value. </member> <member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled"> + If [code]true[/code] the camera smoothly stops when reaches its limits. Default value: [code]false[/code] </member> <member name="limit_top" type="int" setter="set_limit" getter="get_limit"> Top scroll limit in pixels. The camera stops moving when reaching this value. @@ -371,13 +375,13 @@ The camera's offset, useful for looking around or camera shake animations. </member> <member name="rotating" type="bool" setter="set_rotating" getter="is_rotating"> - If [code]true[/code] the camera can rotate during gameplay. Default value: [code]false[/code]. + If [code]true[/code] the camera rotates with the target. Default value: [code]false[/code] </member> <member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled"> - If [code]true[/code] the camera's velocity changes gradually, preventing sudden starts and stops. Default value: [code]false[/code]. + If [code]true[/code] the camera smoothly moves towards the target at [member smoothing_speed]. Default value: [code]false[/code] </member> <member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing"> - How fast the camera's velocity changes if smoothing is enabled. + Speed in pixels per second of the camera's smoothing effect when [member smoothing_enabled] is [code]true[/code] </member> <member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom"> The camera's zoom relative to the viewport. Values larger than [code]Vector2(1, 1)[/code] zoom out and smaller values zoom in. For an example, use [code]Vector2(0.5, 0.5)[/code] for a 2x zoom in, and [code]Vector2(4, 4)[/code] for a 4x zoom out. 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/doc/classes/Script.xml b/doc/classes/Script.xml index 307afba8a7..c13e009976 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -19,12 +19,6 @@ Returns true if the script can be instanced. </description> </method> - <method name="get_node_type" qualifiers="const"> - <return type="String"> - </return> - <description> - </description> - </method> <method name="get_source_code" qualifiers="const"> <return type="String"> </return> diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index e424d32575..c1df7def2e 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -270,10 +270,6 @@ bool NativeScript::is_tool() const { return false; } -String NativeScript::get_node_type() const { - return ""; // NOTE(karroffel): uhm? -} - ScriptLanguage *NativeScript::get_language() const { return NativeScriptLanguage::get_singleton(); } diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index e6ea4fed80..e8fc9e6880 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -142,8 +142,6 @@ public: virtual bool is_tool() const; - virtual String get_node_type() const; - virtual ScriptLanguage *get_language() const; virtual bool has_script_signal(const StringName &p_signal) const; diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 7dd10a8bdf..4169b07f63 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -346,11 +346,6 @@ bool PluginScript::get_property_default_value(const StringName &p_property, Vari return false; } -String PluginScript::get_node_type() const { - // Even GDscript doesn't know what to put here ! - return ""; // ? -} - ScriptLanguage *PluginScript::get_language() const { return _language; } diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index e6b8643cd9..5600bca5ef 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -103,8 +103,6 @@ public: bool is_tool() const { return _tool; } - virtual String get_node_type() const; - virtual ScriptLanguage *get_language() const; virtual bool has_script_signal(const StringName &p_signal) const; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index cf6529d5ae..3f3818ffb9 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -609,11 +609,6 @@ Error GDScript::reload(bool p_keep_state) { return OK; } -String GDScript::get_node_type() const { - - return ""; // ? -} - ScriptLanguage *GDScript::get_language() const { return GDScriptLanguage::get_singleton(); diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 6573d6b345..e0d142014a 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -172,7 +172,6 @@ public: virtual Error reload(bool p_keep_state = false); - virtual String get_node_type() const; void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too... Error load_source_code(const String &p_path); Error load_byte_code(const String &p_path); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 5155373a00..8d4e19469a 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1720,11 +1720,6 @@ Error CSharpScript::reload(bool p_keep_state) { return ERR_FILE_MISSING_DEPENDENCIES; } -String CSharpScript::get_node_type() const { - - return ""; // ? -} - ScriptLanguage *CSharpScript::get_language() const { return CSharpLanguage::get_singleton(); diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 8700b7fc5c..65a6450da5 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -138,7 +138,6 @@ public: virtual bool is_tool() const { return tool; } virtual Ref<Script> get_base_script() const; - virtual String get_node_type() const; virtual ScriptLanguage *get_language() const; /* TODO */ virtual void get_script_method_list(List<MethodInfo> *p_list) const {} diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 6d8ee2bd47..765fe4c2f2 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -974,11 +974,6 @@ bool VisualScript::is_tool() const { return false; } -String VisualScript::get_node_type() const { - - return String(); -} - ScriptLanguage *VisualScript::get_language() const { return VisualScriptLanguage::singleton; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index f2f5168b63..0f60b103c9 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -339,8 +339,6 @@ public: virtual bool is_tool() const; - virtual String get_node_type() const; - virtual ScriptLanguage *get_language() const; virtual bool has_script_signal(const StringName &p_signal) const; 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/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 35f94bff59..c53241e985 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -452,7 +452,7 @@ String NavigationPolygonInstance::get_configuration_warning() const { return String(); } - c = Object::cast_to<Node2D>(get_parent()); + c = Object::cast_to<Node2D>(c->get_parent()); } return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data."); 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) { |