diff options
95 files changed, 765 insertions, 360 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index f5ddd9c761..12310f6151 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -205,6 +205,7 @@ ClassDB::ClassInfo::ClassInfo() { creation_func = NULL; inherits_ptr = NULL; disabled = false; + exposed = false; } ClassDB::ClassInfo::~ClassInfo() { } @@ -1284,6 +1285,15 @@ bool ClassDB::is_class_enabled(StringName p_class) { return !ti->disabled; } +bool ClassDB::is_class_exposed(StringName p_class) { + + OBJTYPE_RLOCK; + + ClassInfo *ti = classes.getptr(p_class); + ERR_FAIL_COND_V(!ti, false); + return ti->exposed; +} + StringName ClassDB::get_category(const StringName &p_node) { ERR_FAIL_COND_V(!classes.has(p_node), StringName()); diff --git a/core/class_db.h b/core/class_db.h index f6b97748b0..5910a2ce01 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -127,6 +127,7 @@ public: StringName inherits; StringName name; bool disabled; + bool exposed; Object *(*creation_func)(); ClassInfo(); ~ClassInfo(); @@ -168,6 +169,7 @@ public: ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func = &creator<T>; + t->exposed = true; T::register_custom_data_to_otdb(); } @@ -176,6 +178,9 @@ public: GLOBAL_LOCK_FUNCTION; T::initialize_class(); + ClassInfo *t = classes.getptr(T::get_class_static()); + ERR_FAIL_COND(!t); + t->exposed = true; //nothing } @@ -193,6 +198,7 @@ public: ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func = &_create_ptr_func<T>; + t->exposed = true; T::register_custom_data_to_otdb(); } @@ -347,6 +353,8 @@ public: static void set_class_enabled(StringName p_class, bool p_enable); static bool is_class_enabled(StringName p_class); + static bool is_class_exposed(StringName p_class); + static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class); static void get_resource_base_extensions(List<String> *p_extensions); static void get_extensions_for_type(const StringName &p_class, List<String> *p_extensions); diff --git a/core/os/input.cpp b/core/os/input.cpp index a4b82299a7..848b003d5e 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -58,6 +58,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("is_action_just_released", "action"), &Input::is_action_just_released); ClassDB::bind_method(D_METHOD("add_joy_mapping", "mapping", "update_existing"), &Input::add_joy_mapping, DEFVAL(false)); ClassDB::bind_method(D_METHOD("remove_joy_mapping", "guid"), &Input::remove_joy_mapping); + ClassDB::bind_method(D_METHOD("joy_connection_changed", "device", "connected", "name", "guid"), &Input::joy_connection_changed); ClassDB::bind_method(D_METHOD("is_joy_known", "device"), &Input::is_joy_known); ClassDB::bind_method(D_METHOD("get_joy_axis", "device", "axis"), &Input::get_joy_axis); ClassDB::bind_method(D_METHOD("get_joy_name", "device"), &Input::get_joy_name); diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 3994011c06..c4d1b199a0 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -261,7 +261,7 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack) { return true; } -Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { +Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards) { //If looking for files in network, just use network! @@ -270,11 +270,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); -#ifdef DEBUG_ENABLED - } else { - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open project over network"); -#endif } return OK; @@ -292,12 +287,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { //load override from location of the main pack _load_settings(p_main_pack.get_base_dir().plus_file("override.cfg")); -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + p_main_pack + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + p_main_pack + "/project.godot or project.binary"); -#endif } return OK; @@ -315,18 +304,9 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_resource_pack(datapack_name)) { found = true; } else { -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open " + datapack_name); -#endif datapack_name = filebase_name + ".pck"; if (_load_resource_pack(datapack_name)) { found = true; -#ifdef DEBUG_ENABLED - } else { - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open " + datapack_name); -#endif } } @@ -335,13 +315,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { // load override from location of executable _load_settings(exec_path.get_base_dir().plus_file("override.cfg")); - -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + datapack_name + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + datapack_name + "/project.godot or project.binary"); -#endif } return OK; @@ -362,12 +335,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + resource_path + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + resource_path + "/project.godot or project.binary"); -#endif } return OK; @@ -393,18 +360,16 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { candidate = current_dir; found = true; break; -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + current_dir + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + current_dir + "/project.godot or project.binary"); -#endif } - d->change_dir(".."); - if (d->get_current_dir() == current_dir) - break; //not doing anything useful - current_dir = d->get_current_dir(); + if (p_upwards) { + d->change_dir(".."); + if (d->get_current_dir() == current_dir) + break; //not doing anything useful + current_dir = d->get_current_dir(); + } else { + break; + } } resource_path = candidate; diff --git a/core/project_settings.h b/core/project_settings.h index ea6034dc84..f75cad815f 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -139,7 +139,7 @@ public: void set_order(const String &p_name, int p_order); void set_builtin_order(const String &p_name); - Error setup(const String &p_path, const String &p_main_pack); + Error setup(const String &p_path, const String &p_main_pack, bool p_upwards = false); Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true); Error save(); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 0e34a3eea5..c6d7cd44e8 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -40,6 +40,7 @@ #include "io/config_file.h" #include "io/http_client.h" #include "io/marshalls.h" +#include "io/networked_multiplayer_peer.h" #include "io/packet_peer.h" #include "io/packet_peer_udp.h" #include "io/pck_packer.h" @@ -109,6 +110,8 @@ void register_core_types() { ClassDB::register_class<Object>(); + ClassDB::register_virtual_class<Script>(); + ClassDB::register_class<Reference>(); ClassDB::register_class<WeakRef>(); ClassDB::register_class<Resource>(); @@ -136,6 +139,7 @@ void register_core_types() { ClassDB::register_virtual_class<IP>(); ClassDB::register_virtual_class<PacketPeer>(); ClassDB::register_class<PacketPeerStream>(); + ClassDB::register_virtual_class<NetworkedMultiplayerPeer>(); ClassDB::register_class<MainLoop>(); //ClassDB::register_type<OptimizedSaver>(); ClassDB::register_class<Translation>(); @@ -185,6 +189,20 @@ void register_core_settings() { void register_core_singletons() { + ClassDB::register_class<ProjectSettings>(); + ClassDB::register_virtual_class<IP>(); + ClassDB::register_class<_Geometry>(); + ClassDB::register_class<_ResourceLoader>(); + ClassDB::register_class<_ResourceSaver>(); + ClassDB::register_class<_OS>(); + ClassDB::register_class<_Engine>(); + ClassDB::register_class<_ClassDB>(); + ClassDB::register_class<_Marshalls>(); + ClassDB::register_class<TranslationServer>(); + ClassDB::register_virtual_class<Input>(); + ClassDB::register_class<InputMap>(); + ClassDB::register_class<_JSON>(); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ProjectSettings", ProjectSettings::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("IP", IP::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Geometry", _Geometry::get_singleton())); diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 6a7262bd14..86bfe88ea9 100644 --- a/doc/classes/ARVRServer.xml +++ b/doc/classes/ARVRServer.xml @@ -14,7 +14,7 @@ <method name="add_interface"> <return type="void"> </return> - <argument index="0" name="arg0" type="ARVRInterface"> + <argument index="0" name="interface" type="ARVRInterface"> </argument> <description> Mostly exposed for GDNative based interfaces, this is called to register an available interface with the AR/VR server. @@ -94,7 +94,7 @@ <method name="remove_interface"> <return type="void"> </return> - <argument index="0" name="arg0" type="ARVRInterface"> + <argument index="0" name="interface" type="ARVRInterface"> </argument> <description> Removes a registered interface, again exposed mostly for GDNative based interfaces. @@ -103,7 +103,7 @@ <method name="set_primary_interface"> <return type="void"> </return> - <argument index="0" name="arg0" type="ARVRInterface"> + <argument index="0" name="interface" type="ARVRInterface"> </argument> <description> Changes the primary interface to the specified interface. Again mostly exposed for GDNative interfaces. diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index 74a7f6c8a4..70b880eb43 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -380,11 +380,11 @@ </signal> </signals> <constants> - <constant name="ANIMATION_PROCESS_FIXED" value="0"> - Process animation on fixed process. This is specially useful when animating kinematic bodies. + <constant name="ANIMATION_PROCESS_PHYSICS" value="0"> + Process animation during the physics process. This is specially useful when animating physics bodies. </constant> <constant name="ANIMATION_PROCESS_IDLE" value="1"> - Process animation on idle process. + Process animation during the idle process. </constant> </constants> </class> diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml index f088d21e41..b92e59b902 100644 --- a/doc/classes/AnimationTreePlayer.xml +++ b/doc/classes/AnimationTreePlayer.xml @@ -659,7 +659,7 @@ <constant name="NODE_TRANSITION" value="9"> Transition node. </constant> - <constant name="ANIMATION_PROCESS_FIXED" value="0"> + <constant name="ANIMATION_PROCESS_PHYSICS" value="0"> </constant> <constant name="ANIMATION_PROCESS_IDLE" value="1"> </constant> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 2cfbaffe04..7c1d72333b 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -178,8 +178,6 @@ </description> </method> <method name="invert"> - <return type="Array"> - </return> <description> Reverse the order of the elements in the array (so first element will now be the last) and return reference to the array. </description> @@ -241,15 +239,11 @@ </description> </method> <method name="sort"> - <return type="Array"> - </return> <description> Sort the array using natural order and return reference to the array. </description> </method> <method name="sort_custom"> - <return type="Array"> - </return> <argument index="0" name="obj" type="Object"> </argument> <argument index="1" name="func" type="String"> diff --git a/doc/classes/AudioBusLayout.xml b/doc/classes/AudioBusLayout.xml index e5b17b8dfb..045c6c2bf9 100644 --- a/doc/classes/AudioBusLayout.xml +++ b/doc/classes/AudioBusLayout.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioBusLayout" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Stores information about the audiobusses. </brief_description> <description> + Stores position, muting, solo, bypass, effects, effect position, volume, and the connections between busses. See [AudioServer] for usage. </description> <tutorials> </tutorials> diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml index 4cda24530b..f399f9f07a 100644 --- a/doc/classes/AudioEffectReverb.xml +++ b/doc/classes/AudioEffectReverb.xml @@ -136,7 +136,7 @@ High-pass filter passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. Value can range from 0 to 1. Default value: [code]0[/code]. </member> <member name="predelay_feedback" type="float" setter="set_predelay_msec" getter="get_predelay_msec"> - Output percent of predelay. Value can range from 0 to 1. Default value: [code]1[/code]. + Output percent of predelay. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="predelay_msec" type="float" setter="set_predelay_msec" getter="get_predelay_msec"> Time between the original signal and the early reflections of the reverb signal. Default value: [code]150ms[/code]. diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml index 768987fd0b..f8320c23af 100644 --- a/doc/classes/AudioServer.xml +++ b/doc/classes/AudioServer.xml @@ -17,6 +17,7 @@ <argument index="0" name="at_position" type="int" default="-1"> </argument> <description> + Adds a bus at [code]at_position[/code]. </description> </method> <method name="add_bus_effect"> @@ -29,18 +30,21 @@ <argument index="2" name="at_position" type="int" default="-1"> </argument> <description> + Adds an [AudioEffect] effect to the bus [code]bus_idx[/code] at [code]at_position[/code]. </description> </method> <method name="generate_bus_layout" qualifiers="const"> <return type="AudioBusLayout"> </return> <description> + Generates an [AudioBusLayout] using the available busses and effects. </description> </method> <method name="get_bus_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of available busses. </description> </method> <method name="get_bus_effect"> @@ -51,6 +55,7 @@ <argument index="1" name="effect_idx" type="int"> </argument> <description> + Returns the [AudioEffect] at position [code]effect_idx[/code] in bus [code]bus_idx[/code]. </description> </method> <method name="get_bus_effect_count"> @@ -59,6 +64,7 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + Returns the number of effects on the bus at [code]bus_idx[/code]. </description> </method> <method name="get_bus_index" qualifiers="const"> @@ -67,6 +73,7 @@ <argument index="0" name="bus_name" type="String"> </argument> <description> + Returns the index of the bus with the name [code]bus_name[/code]. </description> </method> <method name="get_bus_name" qualifiers="const"> @@ -75,6 +82,7 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + Returns the name of the bus with the index [code]bus_idx[/code]. </description> </method> <method name="get_bus_peak_volume_left_db" qualifiers="const"> @@ -85,6 +93,7 @@ <argument index="1" name="channel" type="int"> </argument> <description> + Returns the peak volume of the left speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code]. </description> </method> <method name="get_bus_peak_volume_right_db" qualifiers="const"> @@ -95,6 +104,7 @@ <argument index="1" name="channel" type="int"> </argument> <description> + Returns the peak volume of the right speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code]. </description> </method> <method name="get_bus_send" qualifiers="const"> @@ -103,6 +113,7 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + Returns the name of the bus that the bus at index [code]bus_idx[/code] sends to. </description> </method> <method name="get_bus_volume_db" qualifiers="const"> @@ -111,18 +122,21 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + Returns the volume of the bus at index [code]bus_idx[/code] in dB. </description> </method> <method name="get_mix_rate" qualifiers="const"> <return type="float"> </return> <description> + Returns the sample rate at the output of the audioserver. </description> </method> <method name="get_speaker_mode" qualifiers="const"> <return type="int" enum="AudioServer.SpeakerMode"> </return> <description> + Returns the speaker configuration. </description> </method> <method name="is_bus_bypassing_effects" qualifiers="const"> @@ -131,6 +145,7 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is bypassing effects. </description> </method> <method name="is_bus_effect_enabled" qualifiers="const"> @@ -141,6 +156,7 @@ <argument index="1" name="effect_idx" type="int"> </argument> <description> + If [code]true[/code] the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled. </description> </method> <method name="is_bus_mute" qualifiers="const"> @@ -149,6 +165,7 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is muted. </description> </method> <method name="is_bus_solo" qualifiers="const"> @@ -157,12 +174,14 @@ <argument index="0" name="bus_idx" type="int"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is in solo mode. </description> </method> <method name="lock"> <return type="void"> </return> <description> + Locks the audio drivers mainloop. Remember to unlock it afterwards. </description> </method> <method name="move_bus"> @@ -173,6 +192,7 @@ <argument index="1" name="to_index" type="int"> </argument> <description> + Moves the bus from index [code]index[/code] to index [code]to_index[/code]. </description> </method> <method name="remove_bus"> @@ -181,6 +201,7 @@ <argument index="0" name="index" type="int"> </argument> <description> + Removes the bus at index [code]index[/code]. </description> </method> <method name="remove_bus_effect"> @@ -191,6 +212,7 @@ <argument index="1" name="effect_idx" type="int"> </argument> <description> + Removes the effect at index [code]effect_idx[/code] from the bus at index [code]bus_idx[/code]. </description> </method> <method name="set_bus_bypass_effects"> @@ -201,6 +223,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is bypassing effects. </description> </method> <method name="set_bus_count"> @@ -209,6 +232,7 @@ <argument index="0" name="amount" type="int"> </argument> <description> + Adds and removes busses to make the number of busses match [code]amount[/code]. </description> </method> <method name="set_bus_effect_enabled"> @@ -221,6 +245,7 @@ <argument index="2" name="enabled" type="bool"> </argument> <description> + If [code]true[/code] the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled. </description> </method> <method name="set_bus_layout"> @@ -229,6 +254,7 @@ <argument index="0" name="bus_layout" type="AudioBusLayout"> </argument> <description> + Overwrites the currently used [AudioBusLayout]. </description> </method> <method name="set_bus_mute"> @@ -239,6 +265,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is muted. </description> </method> <method name="set_bus_name"> @@ -249,6 +276,7 @@ <argument index="1" name="name" type="String"> </argument> <description> + Sets the name of the bus at index [code]bus_idx[/code] to [code]name[/code]. </description> </method> <method name="set_bus_send"> @@ -259,6 +287,7 @@ <argument index="1" name="send" type="String"> </argument> <description> + Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/send]. </description> </method> <method name="set_bus_solo"> @@ -269,6 +298,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + If [code]true[/code] the bus at index [code]bus_idx[/code] is in solo mode. </description> </method> <method name="set_bus_volume_db"> @@ -279,6 +309,7 @@ <argument index="1" name="volume_db" type="float"> </argument> <description> + Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code]. </description> </method> <method name="swap_bus_effects"> @@ -291,27 +322,33 @@ <argument index="2" name="by_effect_idx" type="int"> </argument> <description> + Swaps the position of two effects in bus [code]bus_idx[/code]. </description> </method> <method name="unlock"> <return type="void"> </return> <description> + Unlocks the audiodriver's main loop. After locking it always unlock it. </description> </method> </methods> <signals> <signal name="bus_layout_changed"> <description> + Emitted when the [AudioBusLayout] changes. </description> </signal> </signals> <constants> <constant name="SPEAKER_MODE_STEREO" value="0"> + Two or fewer speakers are detected. </constant> <constant name="SPEAKER_SURROUND_51" value="2"> + A 5.1 channel surround setup detected. </constant> <constant name="SPEAKER_SURROUND_71" value="3"> + A 7.1 channel surround setup detected. </constant> </constants> </class> diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml index 30a9a8f070..f45beec42c 100644 --- a/doc/classes/AudioStreamPlayback.xml +++ b/doc/classes/AudioStreamPlayback.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Meta class for playing back audio. </brief_description> <description> + Can play, loop, pause a scroll through Audio. See [AudioStream] and [AudioStreamOGGVorbis] for usage. </description> <tutorials> </tutorials> diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml index 9b104fe757..1a9ad85565 100644 --- a/doc/classes/AudioStreamPlayer.xml +++ b/doc/classes/AudioStreamPlayer.xml @@ -7,6 +7,7 @@ Plays background audio. </description> <tutorials> + http://docs.godotengine.org/en/latest/learning/features/audio/index.html </tutorials> <demos> </demos> @@ -27,6 +28,7 @@ <return type="float"> </return> <description> + Returns the position in the [AudioStream]. </description> </method> <method name="get_stream" qualifiers="const"> @@ -121,15 +123,16 @@ </methods> <members> <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled"> - If [code]true[/code], audio plays when added to scene tree. Default value: [code]false[/code]. + If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code]. </member> <member name="bus" type="String" setter="set_bus" getter="get_bus"> Bus on which this audio is playing. </member> <member name="mix_target" type="int" setter="set_mix_target" getter="get_mix_target" enum="AudioStreamPlayer.MixTarget"> + If the audio configuration has more than two speakers, this sets the target channels. See [code]MIX_TARGET_*[/code] constants. </member> <member name="playing" type="bool" setter="_set_playing" getter="is_playing"> - If [code]true[/code], audio is playing. + If [code]true[/code] audio is playing. </member> <member name="stream" type="AudioStream" setter="set_stream" getter="get_stream"> The [AudioStream] object to be played. @@ -147,10 +150,13 @@ </signals> <constants> <constant name="MIX_TARGET_STEREO" value="0"> + The audio will be played only on the first channel. </constant> <constant name="MIX_TARGET_SURROUND" value="1"> + The audio will be played on all surround channels. </constant> <constant name="MIX_TARGET_CENTER" value="2"> + The audio will be played on the second channel, which is usually the center. </constant> </constants> </class> diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml index 600e0858dd..c6fd8ff54f 100644 --- a/doc/classes/AudioStreamPlayer2D.xml +++ b/doc/classes/AudioStreamPlayer2D.xml @@ -40,6 +40,7 @@ <return type="float"> </return> <description> + Returns the position in the [AudioStream]. </description> </method> <method name="get_stream" qualifiers="const"> @@ -156,7 +157,7 @@ Dampens audio over distance with this as an exponent. </member> <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled"> - If [code]true[/code], audio plays when added to scene tree. Default value: [code]false[/code]. + If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code]. </member> <member name="bus" type="String" setter="set_bus" getter="get_bus"> Bus on which this audio is playing. @@ -165,7 +166,7 @@ Maximum distance from which audio is still hearable. </member> <member name="playing" type="bool" setter="_set_playing" getter="is_playing"> - If [code]true[/code], audio is playing. + If [code]true[/code] audio is playing. </member> <member name="stream" type="AudioStream" setter="set_stream" getter="get_stream"> The [AudioStream] object to be played. diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index 886b2b975a..52914af9fc 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -82,6 +82,7 @@ <return type="float"> </return> <description> + Returns the position in the [AudioStream]. </description> </method> <method name="get_stream" qualifiers="const"> @@ -288,7 +289,7 @@ Decides if audio should get quieter with distance linearly, quadratically or logarithmically. </member> <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled"> - If [code]true[/code], audio plays audio plays when added to scene tree. Default value: [code]false[/code]. + If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code]. </member> <member name="bus" type="String" setter="set_bus" getter="get_bus"> Bus on which this audio is playing. @@ -300,7 +301,7 @@ The angle in which the audio reaches cameras undampened. </member> <member name="emission_angle_enabled" type="bool" setter="set_emission_angle_enabled" getter="is_emission_angle_enabled"> - If [code]true[/code], the audio should be dampened according to the direction of the sound. + If [code]true[/code] the audio should be dampened according to the direction of the sound. </member> <member name="emission_angle_filter_attenuation_db" type="float" setter="set_emission_angle_filter_attenuation_db" getter="get_emission_angle_filter_attenuation_db"> dampens audio if camera is outside of 'emission_angle_degrees' and 'emission_angle_enabled' is set by this factor, in dB. @@ -356,8 +357,8 @@ <constant name="DOPPLER_TRACKING_IDLE_STEP" value="1"> Executes doppler trackin in idle step. </constant> - <constant name="DOPPLER_TRACKING_FIXED_STEP" value="2"> - Executes doppler tracking in fixed step. + <constant name="DOPPLER_TRACKING_PHYSICS_STEP" value="2"> + Executes doppler tracking in physics step. </constant> </constants> </class> diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml index 068b91204c..aeebcf9c87 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera.xml @@ -267,7 +267,7 @@ <constant name="DOPPLER_TRACKING_IDLE_STEP" value="1"> Simulate Doppler effect by tracking positions of objects that are changed in [code]_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]). </constant> - <constant name="DOPPLER_TRACKING_FIXED_STEP" value="2"> + <constant name="DOPPLER_TRACKING_PHYSICS_STEP" value="2"> Simulate Doppler effect by tracking positions of objects that are changed in [code]_physics_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]). </constant> </constants> diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml index 87414eb03a..74c12cb9b2 100644 --- a/doc/classes/ColorPicker.xml +++ b/doc/classes/ColorPicker.xml @@ -93,6 +93,8 @@ </theme_item> <theme_item name="margin" type="int"> </theme_item> + <theme_item name="preset_bg" type="Texture"> + </theme_item> <theme_item name="screen_picker" type="Texture"> </theme_item> <theme_item name="sv_height" type="int"> diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 59b74edd77..7b54be36c9 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -72,6 +72,8 @@ <constants> </constants> <theme_items> + <theme_item name="bg" type="Texture"> + </theme_item> <theme_item name="disabled" type="StyleBox"> </theme_item> <theme_item name="focus" type="StyleBox"> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index b3bdd1d6c2..77bbfa186b 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -578,23 +578,26 @@ <description> </description> </method> - <method name="set_anchors_preset"> + <method name="set_anchors_and_margins_preset"> <return type="void"> </return> <argument index="0" name="preset" type="int" enum="Control.LayoutPreset"> </argument> - <argument index="1" name="keep_margin" type="bool" default="false"> + <argument index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0"> + </argument> + <argument index="2" name="margin" type="int" default="0"> </argument> <description> </description> </method> - <method name="set_area_as_parent_rect"> + <method name="set_anchors_preset"> <return type="void"> </return> - <argument index="0" name="margin" type="int" default="0"> + <argument index="0" name="preset" type="int" enum="Control.LayoutPreset"> + </argument> + <argument index="1" name="keep_margin" type="bool" default="false"> </argument> <description> - Change all margins and anchors, so this Control always takes up the same area as the parent Control. This is a helper (see [method set_anchor], [method set_margin]). </description> </method> <method name="set_begin"> @@ -713,6 +716,18 @@ Set a margin offset. Margin can be one of (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM). Offset value being set depends on the anchor mode. </description> </method> + <method name="set_margins_preset"> + <return type="void"> + </return> + <argument index="0" name="preset" type="int" enum="Control.LayoutPreset"> + </argument> + <argument index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0"> + </argument> + <argument index="2" name="margin" type="int" default="0"> + </argument> + <description> + </description> + </method> <method name="set_mouse_filter"> <return type="void"> </return> @@ -1096,6 +1111,14 @@ <constant name="PRESET_WIDE" value="15"> Snap all 4 anchors to the respective corners of the parent container. Set all 4 margins to 0 after you applied this preset and the [code]Control[/code] will fit its parent container. Use with [method set_anchors_preset]. </constant> + <constant name="PRESET_MODE_MINSIZE" value="0"> + </constant> + <constant name="PRESET_MODE_KEEP_HEIGHT" value="2"> + </constant> + <constant name="PRESET_MODE_KEEP_WIDTH" value="1"> + </constant> + <constant name="PRESET_MODE_KEEP_SIZE" value="3"> + </constant> <constant name="SIZE_EXPAND" value="2"> Tells the parent [Container] to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See [member size_flags_stretch_ratio]. Use with [member size_flags_horizontal] and [member size_flags_vertical]. </constant> diff --git a/doc/classes/Curve.xml b/doc/classes/Curve.xml index ef43d9024c..c89ab6fb9b 100644 --- a/doc/classes/Curve.xml +++ b/doc/classes/Curve.xml @@ -170,7 +170,7 @@ </description> </method> <method name="set_point_offset"> - <return type="void"> + <return type="int"> </return> <argument index="0" name="index" type="int"> </argument> diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index e4ce2ff3f0..c130add523 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="DynamicFont" inherits="Font" category="Core" version="3.0.alpha.custom_build"> <brief_description> + DynamicFont renders vector font files at runtime. </brief_description> <description> + DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like [BitmapFont]. This trades the faster loading time of [BitmapFont]\ s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths. </description> <tutorials> </tutorials> @@ -15,6 +17,7 @@ <argument index="0" name="data" type="DynamicFontData"> </argument> <description> + Adds a fallback font. </description> </method> <method name="get_fallback" qualifiers="const"> @@ -23,12 +26,14 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the fallback font at index [code]idx[/code]. </description> </method> <method name="get_fallback_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of fallback fonts. </description> </method> <method name="get_font_data" qualifiers="const"> @@ -41,6 +46,7 @@ <return type="int"> </return> <description> + Returns the font size in pixels. </description> </method> <method name="get_spacing" qualifiers="const"> @@ -49,18 +55,21 @@ <argument index="0" name="type" type="int"> </argument> <description> + Returns the given type of spacing in pixels. See [code]SPACING_*[/code] constants. </description> </method> <method name="get_use_filter" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if filtering is used. </description> </method> <method name="get_use_mipmaps" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if mipmapping is used. </description> </method> <method name="remove_fallback"> @@ -69,6 +78,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Removes the fallback font at index [code]idx[/code]. </description> </method> <method name="set_fallback"> @@ -79,6 +89,7 @@ <argument index="1" name="data" type="DynamicFontData"> </argument> <description> + Sets the fallback font at index [code]idx[/code]. </description> </method> <method name="set_font_data"> @@ -87,6 +98,7 @@ <argument index="0" name="data" type="DynamicFontData"> </argument> <description> + Sets the [DynamicFontData]. </description> </method> <method name="set_size"> @@ -95,6 +107,7 @@ <argument index="0" name="data" type="int"> </argument> <description> + Sets the font size. </description> </method> <method name="set_spacing"> @@ -105,6 +118,7 @@ <argument index="1" name="value" type="int"> </argument> <description> + Sets the spacing of the given type. See [code]SPACING_*[/code] constants. </description> </method> <method name="set_use_filter"> @@ -113,6 +127,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> + Set to [code]true[/code] to use filtering. </description> </method> <method name="set_use_mipmaps"> @@ -121,35 +136,48 @@ <argument index="0" name="enable" type="bool"> </argument> <description> + Set to [code]true[/code] to use mipmapping. </description> </method> </methods> <members> <member name="extra_spacing_bottom" type="int" setter="set_spacing" getter="get_spacing"> + Extra spacing at the bottom in pixels. </member> <member name="extra_spacing_char" type="int" setter="set_spacing" getter="get_spacing"> + Extra character spacing in pixels. </member> <member name="extra_spacing_space" type="int" setter="set_spacing" getter="get_spacing"> + Extra space spacing in pixels. </member> <member name="extra_spacing_top" type="int" setter="set_spacing" getter="get_spacing"> + Extra spacing at the top in pixels. </member> <member name="font_data" type="DynamicFontData" setter="set_font_data" getter="get_font_data"> + The font data. </member> <member name="size" type="int" setter="set_size" getter="get_size"> + The font size. </member> <member name="use_filter" type="bool" setter="set_use_filter" getter="get_use_filter"> + If [code]true[/code] filtering is used. </member> <member name="use_mipmaps" type="bool" setter="set_use_mipmaps" getter="get_use_mipmaps"> + If [code]true[/code] mipmapping is used. </member> </members> <constants> <constant name="SPACING_TOP" value="0"> + Spacing at the top. </constant> <constant name="SPACING_BOTTOM" value="1"> + Spacing at the bottom. </constant> <constant name="SPACING_CHAR" value="2"> + Character spacing. </constant> <constant name="SPACING_SPACE" value="3"> + Space spacing. </constant> </constants> </class> diff --git a/doc/classes/DynamicFontData.xml b/doc/classes/DynamicFontData.xml index 51e4e0d231..9012b46e08 100644 --- a/doc/classes/DynamicFontData.xml +++ b/doc/classes/DynamicFontData.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="DynamicFontData" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Used with [DynamicFont] to describe the location of a font file. </brief_description> <description> + Used with [DynamicFont] to describe the location of a vector font file for dynamic rendering at runtime. </description> <tutorials> </tutorials> @@ -13,6 +15,7 @@ <return type="String"> </return> <description> + Returns the font path. </description> </method> <method name="set_font_path"> @@ -21,11 +24,13 @@ <argument index="0" name="path" type="String"> </argument> <description> + Sets the font path. </description> </method> </methods> <members> <member name="font_path" type="String" setter="set_font_path" getter="get_font_path"> + The path to the vector font file. </member> </members> <constants> diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 0422e9a64e..203c96516b 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -84,9 +84,9 @@ <method name="make_mesh_previews"> <return type="Array"> </return> - <argument index="0" name="arg0" type="Array"> + <argument index="0" name="meshes" type="Array"> </argument> - <argument index="1" name="arg1" type="int"> + <argument index="1" name="preview_size" type="int"> </argument> <description> </description> diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 37c7a47a51..17a4d2fe4b 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -69,6 +69,14 @@ Get the list of recently visited folders in the file dialog for this project. </description> </method> + <method name="get_setting" qualifiers="const"> + <return type="Variant"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="get_settings_path" qualifiers="const"> <return type="String"> </return> @@ -78,6 +86,30 @@ settings/templates - where export templates are located </description> </method> + <method name="has_setting" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="property_can_revert"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="property_get_revert"> + <return type="Variant"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="set_favorite_dirs"> <return type="void"> </return> @@ -87,6 +119,16 @@ Set the list of favorite directories for this project. </description> </method> + <method name="set_initial_value"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="value" type="Variant"> + </argument> + <description> + </description> + </method> <method name="set_recent_dirs"> <return type="void"> </return> @@ -96,6 +138,16 @@ Set the list of recently visited folders in the file dialog for this project. </description> </method> + <method name="set_setting"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="value" type="Variant"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="settings_changed"> diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index 3880c45a86..2918200633 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Environment" inherits="Resource" category="Core" version="3.0"> +<class name="Environment" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> <brief_description> Resource for environment nodes (like [WorldEnvironment]) that define multiple rendering options. </brief_description> @@ -226,7 +226,7 @@ <description> </description> </method> - <method name="get_sky_scale" qualifiers="const"> + <method name="get_sky_custom_fov" qualifiers="const"> <return type="float"> </return> <description> @@ -794,7 +794,7 @@ <description> </description> </method> - <method name="set_sky_scale"> + <method name="set_sky_custom_fov"> <return type="void"> </return> <argument index="0" name="scale" type="float"> @@ -1042,8 +1042,8 @@ <member name="background_sky" type="Sky" setter="set_sky" getter="get_sky"> [Sky] resource defined as background. </member> - <member name="background_sky_scale" type="float" setter="set_sky_scale" getter="get_sky_scale"> - [Sky] resource's scale. + <member name="background_sky_custom_fov" type="float" setter="set_sky_custom_fov" getter="get_sky_custom_fov"> + [Sky] resource's custom field of view. </member> <member name="dof_blur_far_amount" type="float" setter="set_dof_blur_far_amount" getter="get_dof_blur_far_amount"> Amount of far blur. diff --git a/doc/classes/GDNativeLibrary.xml b/doc/classes/GDNativeLibrary.xml index c3561856cc..361c89e6b3 100644 --- a/doc/classes/GDNativeLibrary.xml +++ b/doc/classes/GDNativeLibrary.xml @@ -9,6 +9,12 @@ <demos> </demos> <methods> + <method name="get_active_library_path" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> <method name="get_library_path" qualifiers="const"> <return type="String"> </return> diff --git a/doc/classes/HSlider.xml b/doc/classes/HSlider.xml index 91f95d1548..25e62b90e3 100644 --- a/doc/classes/HSlider.xml +++ b/doc/classes/HSlider.xml @@ -19,6 +19,8 @@ </theme_item> <theme_item name="grabber" type="Texture"> </theme_item> + <theme_item name="grabber_area" type="StyleBox"> + </theme_item> <theme_item name="grabber_disabled" type="Texture"> </theme_item> <theme_item name="grabber_disabled" type="StyleBox"> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 3d8b4154f8..e56200f63d 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -237,6 +237,20 @@ Returns true or false depending on whether mouse button is pressed or not. You can pass BUTTON_*, which are pre-defined constants listed in [@Global Scope]. </description> </method> + <method name="joy_connection_changed"> + <return type="void"> + </return> + <argument index="0" name="device" type="int"> + </argument> + <argument index="1" name="connected" type="bool"> + </argument> + <argument index="2" name="name" type="String"> + </argument> + <argument index="3" name="guid" type="String"> + </argument> + <description> + </description> + </method> <method name="parse_input_event"> <return type="void"> </return> diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml index e7c58fdb3a..badc098494 100644 --- a/doc/classes/KinematicBody2D.xml +++ b/doc/classes/KinematicBody2D.xml @@ -122,4 +122,4 @@ </members> <constants> </constants> -</class>
\ No newline at end of file +</class> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index e35f64a9c0..a484556e69 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -9,7 +9,7 @@ [b]Scene tree:[/b] The [SceneTree] contains the active tree of nodes. When a node is added to the scene tree, it receives the NOTIFICATION_ENTER_TREE notification and its [method _enter_tree] callback is triggered. Children nodes are always added [i]after[/i] their parent node, i.e. the [method _enter_tree] callback of a parent node will be triggered before its child's. Once all nodes have been added in the scene tree, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, from the children up to the parent nodes. It means that when adding a scene to the scene tree, the following order will be used for the callbacks: [method _enter_tree] of the parent, [method _enter_tree] of the children, [method _ready] of the children and finally [method _ready] of the parent (and that recursively for the whole scene). - [b]Processing:[/b] Nodes can be set to the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback [method _process], toggled with [method set_process]) happens as fast as possible and is dependent on the frame rate, so the processing time [i]delta[/i] is variable. Fixed processing (callback [method _fixed_process], toggled with [method set_fixed_process]) happens a fixed amount of times per second (by default 60) and is useful to link itself to the physics. + [b]Processing:[/b] Nodes can be set to the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback [method _process], toggled with [method set_process]) happens as fast as possible and is dependent on the frame rate, so the processing time [i]delta[/i] is variable. Physics processing (callback [method _physics_process], toggled with [method set_physics_process]) happens a fixed amount of times per second (by default 60) and is useful to link itself to the physics. Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it. To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though. Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children. @@ -36,24 +36,24 @@ Corresponds to the NOTIFICATION_EXIT_TREE notification in [method Object._notification]. </description> </method> - <method name="_fixed_process" qualifiers="virtual"> + <method name="_input" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="delta" type="float"> + <argument index="0" name="event" type="InputEvent"> </argument> <description> - Called during the fixed processing step of the main loop. Fixed processing means that the frame rate is synced to the physics, i.e. the [code]delta[/code] variable should be constant. - It is only called if fixed processing has been enabled with [method set_fixed_process]. - Corresponds to the NOTIFICATION_FIXED_PROCESS notification in [method Object._notification]. + Called when there is a change to input devices. Propagated through the node tree until a Node consumes it. </description> </method> - <method name="_input" qualifiers="virtual"> + <method name="_physics_process" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="event" type="InputEvent"> + <argument index="0" name="delta" type="float"> </argument> <description> - Called when there is a change to input devices. Propagated through the node tree until a Node consumes it. + Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the [code]delta[/code] variable should be constant. + It is only called if physics processing has been enabled with [method set_physics_process]. + Corresponds to the NOTIFICATION_PHYSICS_PROCESS notification in [method Object._notification]. </description> </method> <method name="_process" qualifiers="virtual"> @@ -187,13 +187,6 @@ Return a filename that may be contained by the node. When a scene is instanced from a file, it topmost node contains the filename from where it was loaded (see [method set_filename]). </description> </method> - <method name="get_fixed_process_delta_time" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the time elapsed since the last fixed frame (see [method _fixed_process]). This is always the same in fixed processing unless the frames per second is changed in [OS]. - </description> - </method> <method name="get_groups" qualifiers="const"> <return type="Array"> </return> @@ -294,6 +287,13 @@ Return the pause mode (PAUSE_MODE_*) of this Node. </description> </method> + <method name="get_physics_process_delta_time" qualifiers="const"> + <return type="float"> + </return> + <description> + Return the time elapsed since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed in [OS]. + </description> + </method> <method name="get_position_in_parent" qualifiers="const"> <return type="int"> </return> @@ -359,19 +359,6 @@ <description> </description> </method> - <method name="is_fixed_processing" qualifiers="const"> - <return type="bool"> - </return> - <description> - Return true if fixed processing is enabled (see [method set_fixed_process]). - </description> - </method> - <method name="is_fixed_processing_internal" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="is_greater_than" qualifiers="const"> <return type="bool"> </return> @@ -403,6 +390,19 @@ <description> </description> </method> + <method name="is_physics_processing" qualifiers="const"> + <return type="bool"> + </return> + <description> + Return true if physics processing is enabled (see [method set_physics_process]). + </description> + </method> + <method name="is_physics_processing_internal" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="is_processing" qualifiers="const"> <return type="bool"> </return> @@ -666,23 +666,6 @@ A node can contain a filename. This filename should not be changed by the user, unless writing editors and tools. When a scene is instanced from a file, it topmost node contains the filename from where it was loaded. </description> </method> - <method name="set_fixed_process"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Enables or disables node fixed framerate processing. When a node is being processed, it will receive a NOTIFICATION_PROCESS at a fixed (usually 60 fps, check [OS] to change that) interval (and the [method _fixed_process] callback will be called if exists). It is common to check how much time was elapsed since the previous frame by calling [method get_fixed_process_delta_time]. - </description> - </method> - <method name="set_fixed_process_internal"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_name"> <return type="void"> </return> @@ -720,6 +703,23 @@ Set pause mode (PAUSE_MODE_*) of this Node. </description> </method> + <method name="set_physics_process"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + Enables or disables the node's physics (alias fixed framerate) processing. When a node is being processed, it will receive a NOTIFICATION_PHYSICS_PROCESS at a fixed (usually 60 fps, check [OS] to change that) interval (and the [method _physics_process] callback will be called if exists). It is common to check how much time was elapsed since the previous frame by calling [method get_physics_process_delta_time]. + </description> + </method> + <method name="set_physics_process_internal"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_process"> <return type="void"> </return> @@ -806,7 +806,8 @@ </constant> <constant name="NOTIFICATION_READY" value="13" enum=""> </constant> - <constant name="NOTIFICATION_FIXED_PROCESS" value="16" enum=""> + <constant name="NOTIFICATION_PHYSICS_PROCESS" value="16" enum=""> + Notification received every frame when the physics process flag is set (see [method set_physics_process]). </constant> <constant name="NOTIFICATION_PROCESS" value="17" enum=""> Notification received every frame when the process flag is set (see [method set_process]). @@ -833,7 +834,7 @@ </constant> <constant name="NOTIFICATION_INTERNAL_PROCESS" value="25" enum=""> </constant> - <constant name="NOTIFICATION_INTERNAL_FIXED_PROCESS" value="26" enum=""> + <constant name="NOTIFICATION_INTERNAL_PHYSICS_PROCESS" value="26" enum=""> </constant> <constant name="RPC_MODE_DISABLED" value="0"> </constant> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index f78821e158..73b424eb12 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -397,6 +397,12 @@ You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight savings time (dst), if present, is ignored. </description> </method> + <method name="get_virtual_keyboard_height"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="get_window_position" qualifiers="const"> <return type="Vector2"> </return> @@ -420,6 +426,14 @@ Returns [code]true[/code] if an environment variable exists. </description> </method> + <method name="has_feature" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="tag_name" type="String"> + </argument> + <description> + </description> + </method> <method name="has_touchscreen_ui_hint" qualifiers="const"> <return type="bool"> </return> @@ -468,7 +482,7 @@ <return type="bool"> </return> <description> - Returns [code]true[/code] if the "Okay" button should appear on the left and "Cancel" on the right. + Returns [code]true[/code] if the "Okay" button should appear on the left and "Cancel" on the right. </description> </method> <method name="is_scancode_unicode" qualifiers="const"> diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index 82ee3531f1..2dc3aa239b 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -77,6 +77,8 @@ <constant name="RENDER_DRAW_CALLS_IN_FRAME" value="16"> Draw calls per frame. 3D only. </constant> + <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20"> + </constant> <constant name="RENDER_VIDEO_MEM_USED" value="17"> Video memory used. Includes both texture and vertex memory. </constant> @@ -86,8 +88,6 @@ <constant name="RENDER_VERTEX_MEM_USED" value="19"> Vertex memory used. </constant> - <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20"> - </constant> <constant name="PHYSICS_2D_ACTIVE_OBJECTS" value="21"> Number of active [RigidBody2D] nodes in the game. </constant> diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/Physics2DServer.xml index fd093edc84..37e1567891 100644 --- a/doc/classes/Physics2DServer.xml +++ b/doc/classes/Physics2DServer.xml @@ -372,6 +372,14 @@ Return the continuous collision detection mode. </description> </method> + <method name="body_get_direct_state"> + <return type="Physics2DDirectBodyState"> + </return> + <argument index="0" name="body" type="RID"> + </argument> + <description> + </description> + </method> <method name="body_get_max_contacts_reported" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml index 145f5a0163..e6c81825ad 100644 --- a/doc/classes/PhysicsServer.xml +++ b/doc/classes/PhysicsServer.xml @@ -337,6 +337,14 @@ <description> </description> </method> + <method name="body_get_direct_state"> + <return type="PhysicsDirectBodyState"> + </return> + <argument index="0" name="body" type="RID"> + </argument> + <description> + </description> + </method> <method name="body_get_max_contacts_reported" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 1a3ea5c5c7..bdf2cc0062 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -51,6 +51,14 @@ Return the order of a configuration value (influences when saved to the config file). </description> </method> + <method name="get_setting" qualifiers="const"> + <return type="Variant"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="get_singleton" qualifiers="const"> <return type="Object"> </return> @@ -68,7 +76,7 @@ Convert a localized path (res://) to a full native OS path. </description> </method> - <method name="has" qualifiers="const"> + <method name="has_setting" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="String"> @@ -153,6 +161,16 @@ Set the order of a configuration value (influences when saved to the config file). </description> </method> + <method name="set_setting"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="value" type="Variant"> + </argument> + <description> + </description> + </method> </methods> <constants> </constants> diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml index 2e6efff769..b75b72b218 100644 --- a/doc/classes/RayCast.xml +++ b/doc/classes/RayCast.xml @@ -5,12 +5,9 @@ </brief_description> <description> A RayCast represents a line from its origin to its destination position, [code]cast_to[/code]. It is used to query the 3D space in order to find the closest object along the path of the ray. - RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code], by setting proper filtering with collision layers, or by filtering object types with type masks. - Only enabled raycasts will be able to query the space and report collisions. - - RayCast calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. + RayCast calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. </description> <tutorials> </tutorials> @@ -47,7 +44,7 @@ </return> <description> Updates the collision information for the ray. - Use this method to update the collision information immediately instead of waiting for the next [code]_fixed_process[/code] call, for example if the ray or its parent has changed state. Note: [code]enabled == true[/code] is not required for this to work. + Use this method to update the collision information immediately instead of waiting for the next [code]_physics_process[/code] call, for example if the ray or its parent has changed state. Note: [code]enabled == true[/code] is not required for this to work. </description> </method> <method name="get_cast_to" qualifiers="const"> diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 5520abe050..a42d2ab587 100644 --- a/doc/classes/RayCast2D.xml +++ b/doc/classes/RayCast2D.xml @@ -7,7 +7,7 @@ A RayCast represents a line from its origin to its destination position, [code]cast_to[/code]. It is used to query the 2D space in order to find the closest object along the path of the ray. RayCast2D can ignore some objects by adding them to the exception list via [code]add_exception[/code], by setting proper filtering with collision layers, or by filtering object types with type masks. Only enabled raycasts will be able to query the space and report collisions. - RayCast2D calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. + RayCast2D calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. </description> <tutorials> </tutorials> @@ -43,7 +43,7 @@ <return type="void"> </return> <description> - Updates the collision information for the ray. Use this method to update the collision information immediately instead of waiting for the next [code]_fixed_process[/code] call, for example if the ray or its parent has changed state. Note: [code]enabled == true[/code] is not required for this to work. + Updates the collision information for the ray. Use this method to update the collision information immediately instead of waiting for the next [code]_physics_process[/code] call, for example if the ray or its parent has changed state. Note: [code]enabled == true[/code] is not required for this to work. </description> </method> <method name="get_cast_to" qualifiers="const"> diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index c40d9339d1..fd32f35a06 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -336,10 +336,6 @@ <description> </description> </signal> - <signal name="fixed_frame"> - <description> - </description> - </signal> <signal name="idle_frame"> <description> </description> @@ -368,6 +364,10 @@ <description> </description> </signal> + <signal name="physics_frame"> + <description> + </description> + </signal> <signal name="screen_resized"> <description> </description> @@ -404,5 +404,7 @@ </constant> <constant name="STRETCH_ASPECT_KEEP_HEIGHT" value="3"> </constant> + <constant name="STRETCH_ASPECT_EXPAND" value="4"> + </constant> </constants> </class> diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml index 344a42b7c0..db47875050 100644 --- a/doc/classes/SpatialMaterial.xml +++ b/doc/classes/SpatialMaterial.xml @@ -27,6 +27,12 @@ <description> </description> </method> + <method name="get_ao_light_affect" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_ao_texture_channel" qualifiers="const"> <return type="int" enum="SpatialMaterial.TextureChannel"> </return> @@ -357,6 +363,14 @@ <description> </description> </method> + <method name="set_ao_light_affect"> + <return type="void"> + </return> + <argument index="0" name="amount" type="float"> + </argument> + <description> + </description> + </method> <method name="set_ao_texture_channel"> <return type="void"> </return> @@ -777,6 +791,8 @@ </member> <member name="ao_enabled" type="bool" setter="set_feature" getter="get_feature"> </member> + <member name="ao_light_affect" type="float" setter="set_ao_light_affect" getter="get_ao_light_affect"> + </member> <member name="ao_on_uv2" type="bool" setter="set_flag" getter="get_flag"> </member> <member name="ao_texture" type="Texture" setter="set_texture" getter="get_texture"> @@ -1059,13 +1075,13 @@ </constant> <constant name="FLAG_MAX" value="12"> </constant> - <constant name="DIFFUSE_LAMBERT" value="0"> + <constant name="DIFFUSE_BURLEY" value="0"> </constant> - <constant name="DIFFUSE_LAMBERT_WRAP" value="1"> + <constant name="DIFFUSE_LAMBERT" value="1"> </constant> - <constant name="DIFFUSE_OREN_NAYAR" value="2"> + <constant name="DIFFUSE_LAMBERT_WRAP" value="2"> </constant> - <constant name="DIFFUSE_BURLEY" value="3"> + <constant name="DIFFUSE_OREN_NAYAR" value="3"> </constant> <constant name="DIFFUSE_TOON" value="4"> </constant> diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/SpatialVelocityTracker.xml index 2cbc2b9739..95871c8cdc 100644 --- a/doc/classes/SpatialVelocityTracker.xml +++ b/doc/classes/SpatialVelocityTracker.xml @@ -15,7 +15,7 @@ <description> </description> </method> - <method name="is_tracking_fixed_step" qualifiers="const"> + <method name="is_tracking_physics_step" qualifiers="const"> <return type="bool"> </return> <description> @@ -29,7 +29,7 @@ <description> </description> </method> - <method name="set_track_fixed_step"> + <method name="set_track_physics_step"> <return type="void"> </return> <argument index="0" name="enable" type="bool"> diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index 7ed681ea12..f6c3367704 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -210,7 +210,7 @@ If set, texture can be seen from the back as well, if not, it is invisible when looking at it from behind. </constant> <constant name="FLAG_MAX" value="3"> - Used internally to mark the end of the Flags section. + Used internally to mark the end of the Flags section. </constant> <constant name="ALPHA_CUT_DISABLED" value="0"> </constant> diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml index 35979bb1fc..035dec7980 100644 --- a/doc/classes/Timer.xml +++ b/doc/classes/Timer.xml @@ -141,8 +141,8 @@ </signal> </signals> <constants> - <constant name="TIMER_PROCESS_FIXED" value="0"> - Update the Timer at fixed intervals (framerate processing). + <constant name="TIMER_PROCESS_PHYSICS" value="0"> + Update the Timer during the physics step at each frame (fixed framerate processing). </constant> <constant name="TIMER_PROCESS_IDLE" value="1"> Update the Timer during the idle time at each frame. diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index 10ebc72134..3cf56bbf11 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -25,7 +25,7 @@ <argument index="4" name="tooltip" type="String" default=""""> </argument> <description> - Adds a button with [Texture] [code]button[/code] at column [code]column[/code]. The [code]button_idx[/code] index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling [code]get_buton_count()[/code] immediately after this method. Optionally, the button can be [code]disabled[/code] and have a [code]tooltip[/code]. + Adds a button with [Texture] [code]button[/code] at column [code]column[/code]. The [code]button_idx[/code] index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling [code]get_buton_count()[/code] immediately after this method. Optionally, the button can be [code]disabled[/code] and have a [code]tooltip[/code]. </description> </method> <method name="clear_custom_bg_color"> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index d291f44de3..c90ac09557 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -296,7 +296,7 @@ <argument index="0" name="mode" type="int" enum="Tween.TweenProcessMode"> </argument> <description> - Set whether the Tween uses [code]_process[/code] or [code]_fixed_process[/code] (accepts TWEEN_PROCESS_IDLE and TWEEN_PROCESS_FIXED constants, respectively). + Set whether the Tween uses [code]_process[/code] or [code]_physics_process[/code] (accepts TWEEN_PROCESS_IDLE and TWEEN_PROCESS_PHYSICS constants, respectively). </description> </method> <method name="start"> @@ -422,8 +422,8 @@ </signal> </signals> <constants> - <constant name="TWEEN_PROCESS_FIXED" value="0"> - The [Tween] should use [code]_fixed_process[/code] for timekeeping when this is enabled. + <constant name="TWEEN_PROCESS_PHYSICS" value="0"> + The [Tween] should use [code]_physics_process[/code] for timekeeping when this is enabled. </constant> <constant name="TWEEN_PROCESS_IDLE" value="1"> The [Tween] should use [code]_process[/code] for timekeeping when this is enabled (default). diff --git a/doc/classes/VSlider.xml b/doc/classes/VSlider.xml index e4ba4a19c5..fa4fa34d54 100644 --- a/doc/classes/VSlider.xml +++ b/doc/classes/VSlider.xml @@ -19,6 +19,8 @@ </theme_item> <theme_item name="grabber" type="Texture"> </theme_item> + <theme_item name="grabber_area" type="StyleBox"> + </theme_item> <theme_item name="grabber_disabled" type="Texture"> </theme_item> <theme_item name="grabber_disabled" type="StyleBox"> diff --git a/doc/classes/VehicleWheel.xml b/doc/classes/VehicleWheel.xml index 82e93e0f01..b2e54e25bc 100644 --- a/doc/classes/VehicleWheel.xml +++ b/doc/classes/VehicleWheel.xml @@ -39,6 +39,12 @@ <description> </description> </method> + <method name="get_skidinfo" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_suspension_max_force" qualifiers="const"> <return type="float"> </return> diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index b8ef1f8d22..0359f4694d 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -33,8 +33,6 @@ </method> </methods> <members> - <member name="fixed_process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled"> - </member> <member name="freeze_bodies" type="bool" setter="set_enabler" getter="is_enabler_enabled"> </member> <member name="pause_animated_sprites" type="bool" setter="set_enabler" getter="is_enabler_enabled"> @@ -43,6 +41,8 @@ </member> <member name="pause_particles" type="bool" setter="set_enabler" getter="is_enabler_enabled"> </member> + <member name="physics_process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled"> + </member> <member name="process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled"> </member> </members> @@ -61,8 +61,8 @@ <constant name="ENABLER_PARENT_PROCESS" value="3"> This enabler will stop the parent's _process function. </constant> - <constant name="ENABLER_PARENT_FIXED_PROCESS" value="4"> - This enabler will stop the parent's _fixed_process function. + <constant name="ENABLER_PARENT_PHYSICS_PROCESS" value="4"> + This enabler will stop the parent's _physics_process function. </constant> <constant name="ENABLER_MAX" value="6"> </constant> diff --git a/doc/classes/VisualScriptYield.xml b/doc/classes/VisualScriptYield.xml index b8938daa67..a0d95f151a 100644 --- a/doc/classes/VisualScriptYield.xml +++ b/doc/classes/VisualScriptYield.xml @@ -47,7 +47,7 @@ <constants> <constant name="YIELD_FRAME" value="1"> </constant> - <constant name="YIELD_FIXED_FRAME" value="2"> + <constant name="YIELD_PHYSICS_FRAME" value="2"> </constant> <constant name="YIELD_WAIT" value="3"> </constant> diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index 242fc18ab9..85e6207d3f 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -18,6 +18,12 @@ <description> </description> </method> + <method name="force_sync"> + <return type="void"> + </return> + <description> + </description> + </method> <method name="texture_create"> <return type="RID"> </return> diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 4c9d0f181e..6117c91a6a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2142,7 +2142,6 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_ first = false; } - glFrontFace(GL_CW); glBindVertexArray(0); state.scene_shader.set_conditional(SceneShaderGLES3::USE_INSTANCING, false); @@ -2351,22 +2350,7 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C glDepthFunc(GL_LEQUAL); glColorMask(1, 1, 1, 1); - float flip_sign = p_vflip ? -1 : 1; - - Vector3 vertices[8] = { - Vector3(-1, -1 * flip_sign, 1), - Vector3(0, 1, 0), - Vector3(1, -1 * flip_sign, 1), - Vector3(1, 1, 0), - Vector3(1, 1 * flip_sign, 1), - Vector3(1, 0, 0), - Vector3(-1, 1 * flip_sign, 1), - Vector3(0, 0, 0) - - }; - - //sky uv vectors - float vw, vh, zn; + // Camera CameraMatrix camera; if (p_custom_fov) { @@ -2381,17 +2365,39 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C camera = p_projection; } - camera.get_viewport_size(vw, vh); - zn = p_projection.get_z_near(); + float flip_sign = p_vflip ? -1 : 1; - for (int i = 0; i < 4; i++) { + /* + If matrix[2][0] or matrix[2][1] we're dealing with an asymmetrical projection matrix. This is the case for stereoscopic rendering (i.e. VR). + To ensure the image rendered is perspective correct we need to move some logic into the shader. For this the USE_ASYM_PANO option is introduced. + It also means the uv coordinates are ignored in this mode and we don't need our loop. + */ + bool asymmetrical = ((camera.matrix[2][0] != 0.0) || (camera.matrix[2][1] != 0.0)); - Vector3 uv = vertices[i * 2 + 1]; - uv.x = (uv.x * 2.0 - 1.0) * vw; - uv.y = -(uv.y * 2.0 - 1.0) * vh; - uv.z = -zn; - vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized(); - vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z; + Vector3 vertices[8] = { + Vector3(-1, -1 * flip_sign, 1), + Vector3(0, 1, 0), + Vector3(1, -1 * flip_sign, 1), + Vector3(1, 1, 0), + Vector3(1, 1 * flip_sign, 1), + Vector3(1, 0, 0), + Vector3(-1, 1 * flip_sign, 1), + Vector3(0, 0, 0) + }; + + if (!asymmetrical) { + float vw, vh, zn; + camera.get_viewport_size(vw, vh); + zn = p_projection.get_z_near(); + + for (int i = 0; i < 4; i++) { + Vector3 uv = vertices[i * 2 + 1]; + uv.x = (uv.x * 2.0 - 1.0) * vw; + uv.y = -(uv.y * 2.0 - 1.0) * vh; + uv.z = -zn; + vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized(); + vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z; + } } glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts); @@ -2400,16 +2406,24 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C glBindVertexArray(state.sky_array); - storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, true); + storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_ASYM_PANO, asymmetrical); + storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, !asymmetrical); storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_MULTIPLIER, true); storage->shaders.copy.bind(); storage->shaders.copy.set_uniform(CopyShaderGLES3::MULTIPLIER, p_energy); + if (asymmetrical) { + // pack the bits we need from our projection matrix + storage->shaders.copy.set_uniform(CopyShaderGLES3::ASYM_PROJ, camera.matrix[2][0], camera.matrix[0][0], camera.matrix[2][1], camera.matrix[1][1]); + ///@TODO I couldn't get mat3 + p_transform.basis to work, that would be better here. + storage->shaders.copy.set_uniform(CopyShaderGLES3::PANO_TRANSFORM, p_transform); + } glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glBindVertexArray(0); glColorMask(1, 1, 1, 1); + storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_ASYM_PANO, false); storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_MULTIPLIER, false); storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, false); } @@ -5026,6 +5040,8 @@ void RasterizerSceneGLES3::initialize() { } state.debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED; + + glFrontFace(GL_CW); } void RasterizerSceneGLES3::iteration() { diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index d33193ee50..743fe122d1 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -27,6 +27,8 @@ void main() { #if defined(USE_CUBEMAP) || defined(USE_PANORAMA) cube_interp = cube_in; +#elif defined(USE_ASYM_PANO) + uv_interp = vertex_attrib.xy; #else uv_interp = uv_in; #ifdef V_FLIP @@ -59,6 +61,11 @@ in vec3 cube_interp; in vec2 uv_interp; #endif +#ifdef USE_ASYM_PANO +uniform highp mat4 pano_transform; +uniform highp vec4 asym_proj; +#endif + #ifdef USE_CUBEMAP uniform samplerCube source_cube; //texunit:0 #else @@ -70,7 +77,7 @@ uniform sampler2D source; //texunit:0 uniform float multiplier; #endif -#ifdef USE_PANORAMA +#if defined(USE_PANORAMA) || defined(USE_ASYM_PANO) vec4 texturePanorama(vec3 normal,sampler2D pano ) { @@ -122,6 +129,21 @@ void main() { vec4 color = texturePanorama( normalize(cube_interp), source ); +#elif defined(USE_ASYM_PANO) + + // When an assymetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result. + // Note that we're ignoring the x-offset for IPD, with Z sufficiently in the distance it becomes neglectible, as a result we could probably just set cube_normal.z to -1. + // The Matrix[2][0] (= asym_proj.x) and Matrix[2][1] (= asym_proj.z) values are what provide the right shift in the image. + + vec3 cube_normal; + cube_normal.z = -1000000.0; + cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y; + cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a; + cube_normal = mat3(pano_transform) * cube_normal; + cube_normal.z = -cube_normal.z; + + vec4 color = texturePanorama( normalize(cube_normal.xyz), source ); + #elif defined(USE_CUBEMAP) vec4 color = texture( source_cube, normalize(cube_interp) ); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 341a5bf2c7..b322a4c957 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -865,11 +865,57 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) { #endif -// GGX Specular -// Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl -float G1V(float dotNV, float k) -{ - return 1.0 / (dotNV * (1.0 - k) + k); + +// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V. +// We're dividing this factor off because the overall term we'll end up looks like +// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012): +// +// F(L.V) D(N.H) G(N.L) G(N.V) / (4 N.L N.V) +// +// We're basically regouping this as +// +// F(L.V) D(N.H) [G(N.L)/(2 N.L)] [G(N.V) / (2 N.V)] +// +// and thus, this function implements the [G(N.m)/(2 N.m)] part with m = L or V. +// +// The contents of the D and G (G1) functions (GGX) are taken from +// E. Heitz, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs", J. Comp. Graph. Tech. 3 (2) (2014). +// Eqns 71-72 and 85-86 (see also Eqns 43 and 80). + +float G_GGX_2cos(float cos_theta_m, float alpha) { + // Schlick's approximation + // C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994) + // Eq. (19), although see Heitz (2014) the about the problems with his derivation. + // It nevertheless approximates GGX well with k = alpha/2. + float k = 0.5*alpha; + return 0.5 / (cos_theta_m * (1.0 - k) + k); + + // float cos2 = cos_theta_m*cos_theta_m; + // float sin2 = (1.0-cos2); + // return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) ); +} + +float D_GXX(float cos_theta_m, float alpha) { + float alpha2 = alpha*alpha; + float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m; + return alpha2/(M_PI * d * d); +} + +float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { + float cos2 = cos_theta_m * cos_theta_m; + float sin2 = (1.0-cos2); + float s_x = alpha_x * cos_phi; + float s_y = alpha_y * sin_phi; + return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 )); +} + +float D_GXX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { + float cos2 = cos_theta_m * cos_theta_m; + float sin2 = (1.0-cos2); + float r_x = cos_phi/alpha_x; + float r_y = sin_phi/alpha_y; + float d = cos2 + sin2*(r_x * r_x + r_y * r_y); + return 1.0 / (M_PI * alpha_x * alpha_y * d * d ); } @@ -1019,7 +1065,6 @@ LIGHT_SHADER_CODE #elif defined(SPECULAR_SCHLICK_GGX) // shlick+ggx as default - float alpha = roughness * roughness; vec3 H = normalize(V + L); @@ -1035,26 +1080,22 @@ LIGHT_SHADER_CODE float ay = ry*ry; float XdotH = dot( T, H ); float YdotH = dot( B, H ); - float denom = XdotH*XdotH / (ax*ax) + YdotH*YdotH / (ay*ay) + cNdotH*cNdotH; - float D = 1.0 / ( M_PI * ax*ay * denom*denom ); + float D = D_GXX_anisotropic(cNdotH, ax, ay, XdotH, YdotH); + float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH); #else - float alphaSqr = alpha * alpha; - float denom = cNdotH * cNdotH * (alphaSqr - 1.0) + 1.0; - float D = alphaSqr / (M_PI * denom * denom); + float alpha = roughness * roughness; + float D = D_GGX(cNdotH, alpha); + float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha); #endif // F float F0 = 1.0; // FIXME float cLdotH5 = SchlickFresnel(cLdotH); float F = mix(cLdotH5, 1.0, F0); - // V - float k = alpha / 2.0f; - float vis = G1V(cNdotL, k) * G1V(cNdotV, k); - - float speci = cNdotL * D * F * vis; + float specular_brdf_NL = cNdotL * D * F * G; - specular_light += speci * light_color * specular_blob_intensity * attenuation; + specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation; #endif #if defined(LIGHT_USE_CLEARCOAT) @@ -1069,7 +1110,7 @@ LIGHT_SHADER_CODE #endif float Dr = GTR1(cNdotH, mix(.1, .001, clearcoat_gloss)); float Fr = mix(.04, 1.0, cLdotH5); - float Gr = G1V(cNdotL, .25) * G1V(cNdotV, .25); + float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25); specular_light += .25*clearcoat*Gr*Fr*Dr; diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl index 73dec4f90c..2f671158b2 100644 --- a/drivers/gles3/shaders/tonemap.glsl +++ b/drivers/gles3/shaders/tonemap.glsl @@ -175,12 +175,9 @@ vec3 tonemap_reindhart(vec3 color,float white) { return ( color * ( 1.0 + ( color / ( white) ) ) ) / ( 1.0 + color ); } - void main() { - ivec2 coord = ivec2(gl_FragCoord.xy); - vec3 color = texelFetch(source,coord,0).rgb; - + vec4 color = textureLod(source, uv_interp, 0.0); #ifdef USE_AUTO_EXPOSURE @@ -324,5 +321,3 @@ void main() { frag_color=vec4(color.rgb,1.0); } - - diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index e0a62b316d..2a3d48746f 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -343,7 +343,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo execvp(getprogname(), &args[0]); } #else - execv(p_path.utf8().get_data(), &args[0]); + execvp(p_path.utf8().get_data(), &args[0]); #endif // still alive? something failed.. fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data()); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ff415c83f1..1ca88133b8 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -373,6 +373,9 @@ void EditorNode::_fs_changed() { String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; ERR_PRINT(err.utf8().get_data()); } else { + // ensures export_project does not loop infinitely, because notifications may + // come during the export + export_defer.preset = ""; platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); } } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index b4460c5619..a528662e0f 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -258,7 +258,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_resource_previewer"), &EditorInterface::get_resource_previewer); ClassDB::bind_method(D_METHOD("get_resource_filesystem"), &EditorInterface::get_resource_file_system); ClassDB::bind_method(D_METHOD("get_editor_viewport"), &EditorInterface::get_editor_viewport); - ClassDB::bind_method(D_METHOD("make_mesh_previews"), &EditorInterface::_make_mesh_previews); + ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews); ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene); ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 477d440f28..d56756502d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -467,6 +467,8 @@ void ScriptEditor::_update_recent_scripts() { recent_scripts->add_separator(); recent_scripts->add_shortcut(ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Files"))); + + recent_scripts->set_as_minsize(); } void ScriptEditor::_open_recent_script(int p_idx) { @@ -474,7 +476,7 @@ void ScriptEditor::_open_recent_script(int p_idx) { // clear button if (p_idx == recent_scripts->get_item_count() - 1) { previous_scripts.clear(); - _update_recent_scripts(); + call_deferred("_update_recent_scripts"); return; } @@ -2240,6 +2242,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input); ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed); + ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script); ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9f23df5c03..d1210ee26a 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -750,6 +750,9 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { if (!k->is_pressed()) return; + if (tabs->get_current_tab() != 0) + return; + bool scancode_handled = true; switch (k->get_scancode()) { diff --git a/main/main.cpp b/main/main.cpp index e06f423bfc..6fbd906679 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -162,6 +162,7 @@ void Main::print_help(const char *p_binary) { #endif OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n"); + OS::get_singleton()->print(" -u, --upwards Scan folders upwards for project.godot file.\n"); OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n"); OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n"); OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n"); @@ -257,6 +258,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph translation_server = memnew(TranslationServer); performance = memnew(Performance); + ClassDB::register_class<Performance>(); globals->add_singleton(ProjectSettings::Singleton("Performance", performance)); GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); @@ -289,6 +291,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph String video_driver = ""; String audio_driver = ""; String game_path = "."; + bool upwards = false; String debug_mode; String debug_host; String main_pack; @@ -497,6 +500,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->print("Missing relative or absolute path, aborting.\n"); goto error; } + } else if (I->get() == "-u" || I->get() == "--upwards") { // scan folders upwards + upwards = true; } else if (I->get().ends_with("project.godot")) { String path; String file = I->get(); @@ -694,7 +699,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif - if (globals->setup(game_path, main_pack) != OK) { + if (globals->setup(game_path, main_pack, upwards) != OK) { #ifdef TOOLS_ENABLED editor = false; diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 3676570ec1..cd01233ce4 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -81,6 +81,12 @@ <description> </description> </method> + <method name="get_used_cells" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> <method name="resource_changed"> <return type="void"> </return> diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index fe78ce423c..b475782729 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -654,6 +654,13 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) { StringName type_name = p_object->get_class_name(); + // ¯\_(ツ)_/¯ + const ClassDB::ClassInfo *classinfo = ClassDB::classes.getptr(type_name); + while (classinfo && !classinfo->exposed) + classinfo = classinfo->inherits_ptr; + ERR_FAIL_NULL_V(classinfo, NULL); + type_name = classinfo->name; + GDMonoClass *type_class = GDMonoUtils::type_get_proxy_class(type_name); ERR_FAIL_NULL_V(type_class, NULL); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 123f00ea10..704910c5b9 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -133,12 +133,6 @@ static bool is_csharp_keyword(const String &p_name) { p_name == "virtual" || p_name == "volatile" || p_name == "void" || p_name == "while"; } -static bool is_singleton_black_listed(const String &p_type) { - - return p_type == "IP_Unix" || p_type == "InputDefault" || p_type == "AudioServerSW" || p_type == "PhysicsServerSW" || - p_type == "Physics2DServerSW" || p_type == "SpatialSoundServerSW" || p_type == "SpatialSound2DServerSW"; -} - inline static String escape_csharp_keyword(const String &p_name) { return is_csharp_keyword(p_name) ? "@" + p_name : p_name; @@ -247,9 +241,6 @@ void BindingsGenerator::_generate_header_icalls() { void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) { - if (p_itype.base_name.length() && obj_types[p_itype.base_name].is_singleton && is_singleton_black_listed(p_itype.name)) - return; - for (const List<MethodInterface>::Element *E = p_itype.methods.front(); E; E = E->next()) { const MethodInterface &imethod = E->get(); @@ -580,9 +571,6 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str bool is_derived_type = itype.base_name.length(); - if (is_derived_type && obj_types[itype.base_name].is_singleton && is_singleton_black_listed(itype.name)) - return ERR_SKIP; - List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls; if (verbose_output) @@ -1167,9 +1155,6 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) { for (Map<String, TypeInterface>::Element *type_elem = obj_types.front(); type_elem; type_elem = type_elem->next()) { const TypeInterface &itype = type_elem->get(); - if (itype.base_name.length() && obj_types[itype.base_name].is_singleton && is_singleton_black_listed(itype.name)) - continue; - List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls; OS::get_singleton()->print(String("Generating " + itype.name + "...\n").utf8()); @@ -1519,6 +1504,12 @@ void BindingsGenerator::_populate_object_type_interfaces() { itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name); itype.memory_own = itype.is_reference; + if (!ClassDB::is_class_exposed(type_cname)) { + WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed"); + class_list.pop_front(); + continue; + } + itype.c_out = "\treturn "; itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED; itype.c_out += itype.is_reference ? "(%1.ptr());\n" : "(%1);\n"; diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp index 2a84f0d1a6..2656de5b14 100644 --- a/modules/mono/register_types.cpp +++ b/modules/mono/register_types.cpp @@ -44,6 +44,7 @@ void register_mono_types() { _godotsharp = memnew(_GodotSharp); + ClassDB::register_class<_GodotSharp>(); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GodotSharp", _GodotSharp::get_singleton())); script_language_cs = memnew(CSharpLanguage); diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp index 2b943df5ba..80d0bd78d5 100644 --- a/platform/haiku/context_gl_haiku.cpp +++ b/platform/haiku/context_gl_haiku.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "context_gl_haiku.h" -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow *p_window) { window = p_window; diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h index 40daf43ab9..a9a13a2b7f 100644 --- a/platform/haiku/context_gl_haiku.h +++ b/platform/haiku/context_gl_haiku.h @@ -30,7 +30,7 @@ #ifndef CONTEXT_GL_HAIKU_H #define CONTEXT_GL_HAIKU_H -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) #include "drivers/gl_context/context_gl.h" diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 9f2f88bb4e..1d52752f21 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -105,7 +105,7 @@ void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_ window->SetFlags(flags); } -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) context_gl = memnew(ContextGL_Haiku(window)); context_gl->initialize(); context_gl->make_current(); @@ -161,7 +161,7 @@ void OS_Haiku::finalize() { memdelete(input); -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) memdelete(context_gl); #endif } diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index d2fafb9129..d929f7e43b 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -60,7 +60,7 @@ private: AudioDriverMediaKit driver_media_kit; #endif -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_Haiku *context_gl; #endif diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index 74f8d80a76..1d737879f6 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -39,24 +39,41 @@ JavaScript *JavaScript::get_singleton() { return singleton; } +extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_poolbytearray_and_open_write(PoolByteArray *p_arr, PoolByteArray::Write *r_write, int p_len) { + + p_arr->resize(p_len); + *r_write = p_arr->write(); + return r_write->ptr(); +} + Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { union { - int i; + bool b; double d; char *s; } js_data[4]; + + PoolByteArray arr; + PoolByteArray::Write arr_write; + /* clang-format off */ Variant::Type return_type = static_cast<Variant::Type>(EM_ASM_INT({ + const CODE = $0; + const USE_GLOBAL_EXEC_CONTEXT = $1; + const PTR = $2; + const ELEM_LEN = $3; + const BYTEARRAY_PTR = $4; + const BYTEARRAY_WRITE_PTR = $5; var eval_ret; try { - if ($3) { // p_use_global_exec_context + if (USE_GLOBAL_EXEC_CONTEXT) { // indirect eval call grants global execution context var global_eval = eval; - eval_ret = global_eval(UTF8ToString($2)); + eval_ret = global_eval(UTF8ToString(CODE)); } else { - eval_ret = eval(UTF8ToString($2)); + eval_ret = eval(UTF8ToString(CODE)); } } catch (e) { Module.printErr(e); @@ -66,16 +83,11 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { switch (typeof eval_ret) { case 'boolean': - // bitwise op yields 32-bit int - setValue($0, eval_ret|0, 'i32'); + setValue(PTR, eval_ret, 'i32'); return 1; // BOOL case 'number': - if ((eval_ret|0)===eval_ret) { - setValue($0, eval_ret|0, 'i32'); - return 2; // INT - } - setValue($0, eval_ret, 'double'); + setValue(PTR, eval_ret, 'double'); return 3; // REAL case 'string': @@ -85,7 +97,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { if (array_ptr===0) { throw new Error('String allocation failed (probably out of memory)'); } - setValue($0, array_ptr|0 , '*'); + setValue(PTR, array_ptr , '*'); stringToUTF8(eval_ret, array_ptr, array_len); return 4; // STRING } catch (e) { @@ -102,41 +114,50 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { break; } - else if (typeof eval_ret.x==='number' && typeof eval_ret.y==='number') { - setValue($0, eval_ret.x, 'double'); - setValue($0+$1, eval_ret.y, 'double'); + if (ArrayBuffer.isView(eval_ret) && !(eval_ret instanceof Uint8Array)) { + eval_ret = new Uint8Array(eval_ret.buffer); + } + else if (eval_ret instanceof ArrayBuffer) { + eval_ret = new Uint8Array(eval_ret); + } + if (eval_ret instanceof Uint8Array) { + var bytes_ptr = ccall('resize_poolbytearray_and_open_write', 'number', ['number', 'number' ,'number'], [BYTEARRAY_PTR, BYTEARRAY_WRITE_PTR, eval_ret.length]); + HEAPU8.set(eval_ret, bytes_ptr); + return 20; // POOL_BYTE_ARRAY + } + + if (typeof eval_ret.x==='number' && typeof eval_ret.y==='number') { + setValue(PTR, eval_ret.x, 'double'); + setValue(PTR + ELEM_LEN, eval_ret.y, 'double'); if (typeof eval_ret.z==='number') { - setValue($0+$1*2, eval_ret.z, 'double'); + setValue(PTR + ELEM_LEN*2, eval_ret.z, 'double'); return 7; // VECTOR3 } else if (typeof eval_ret.width==='number' && typeof eval_ret.height==='number') { - setValue($0+$1*2, eval_ret.width, 'double'); - setValue($0+$1*3, eval_ret.height, 'double'); + setValue(PTR + ELEM_LEN*2, eval_ret.width, 'double'); + setValue(PTR + ELEM_LEN*3, eval_ret.height, 'double'); return 6; // RECT2 } return 5; // VECTOR2 } - else if (typeof eval_ret.r==='number' && typeof eval_ret.g==='number' && typeof eval_ret.b==='number') { - // assume 8-bit rgb components since we're on the web - setValue($0, eval_ret.r, 'double'); - setValue($0+$1, eval_ret.g, 'double'); - setValue($0+$1*2, eval_ret.b, 'double'); - setValue($0+$1*3, typeof eval_ret.a==='number' ? eval_ret.a : 1, 'double'); + if (typeof eval_ret.r === 'number' && typeof eval_ret.g === 'number' && typeof eval_ret.b === 'number') { + setValue(PTR, eval_ret.r, 'double'); + setValue(PTR + ELEM_LEN, eval_ret.g, 'double'); + setValue(PTR + ELEM_LEN*2, eval_ret.b, 'double'); + setValue(PTR + ELEM_LEN*3, typeof eval_ret.a === 'number' ? eval_ret.a : 1, 'double'); return 14; // COLOR } break; } return 0; // NIL - }, js_data, sizeof *js_data, p_code.utf8().get_data(), p_use_global_exec_context)); + }, p_code.utf8().get_data(), p_use_global_exec_context, js_data, sizeof *js_data, &arr, &arr_write)); /* clang-format on */ switch (return_type) { case Variant::BOOL: - return !!js_data->i; - case Variant::INT: - return js_data->i; + return js_data->b; case Variant::REAL: return js_data->d; case Variant::STRING: { @@ -153,7 +174,10 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { case Variant::RECT2: return Rect2(js_data[0].d, js_data[1].d, js_data[2].d, js_data[3].d); case Variant::COLOR: - return Color(js_data[0].d / 255., js_data[1].d / 255., js_data[2].d / 255., js_data[3].d); + return Color(js_data[0].d, js_data[1].d, js_data[2].d, js_data[3].d); + case Variant::POOL_BYTE_ARRAY: + arr_write = PoolByteArray::Write(); + return arr; } return Variant(); } diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 8640f27699..64b6d202a1 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -27,7 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) // // C++ Implementation: context_gl_x11 diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h index 912d4d0133..0059cbc311 100644 --- a/platform/windows/context_gl_win.h +++ b/platform/windows/context_gl_win.h @@ -27,7 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) // // C++ Interface: context_gl_x11 // diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 0cc9734119..4f9d4a84b9 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -30,7 +30,7 @@ #include "context_gl_x11.h" #ifdef X11_ENABLED -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index ba01b51d59..c37bac5e9b 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -35,7 +35,7 @@ */ #ifdef X11_ENABLED -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) #include "drivers/gl_context/context_gl.h" #include "os/os.h" diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 041666a594..e389c6932e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -235,7 +235,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au // maybe contextgl wants to be in charge of creating the window //print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height)); -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, true)); context_gl->initialize(); @@ -533,7 +533,7 @@ void OS_X11::finalize() { XUnmapWindow(x11_display, x11_window); XDestroyWindow(x11_display, x11_window); -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) memdelete(context_gl); #endif for (int i = 0; i < CURSOR_MAX; i++) { diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 0d5c272ed4..36355f11bc 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -94,7 +94,7 @@ class OS_X11 : public OS_Unix { int xdnd_version; -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_X11 *context_gl; #endif //Rasterizer *rasterizer; diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index c2edb173d7..5982556c18 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -298,10 +298,8 @@ void AnimatedSprite::_validate_property(PropertyInfo &property) const { property.hint = PROPERTY_HINT_SPRITE_FRAME; - if (frames->has_animation(animation)) { + if (frames->has_animation(animation) && frames->get_frame_count(animation) > 1) { property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1"; - } else { - property.hint_string = "0,0,0"; } } } diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp index 3db234f7cc..55d837458a 100644 --- a/scene/gui/separator.cpp +++ b/scene/gui/separator.cpp @@ -32,7 +32,11 @@ Size2 Separator::get_minimum_size() const { Size2 ms(3, 3); - ms[orientation] = get_constant("separation"); + if (orientation == VERTICAL) { + ms.x = get_constant("separation"); + } else { // HORIZONTAL + ms.y = get_constant("separation"); + } return ms; } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index a85a0fb9f7..75268aad1f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -266,9 +266,11 @@ void register_scene_types() { ClassDB::register_class<Control>(); ClassDB::register_class<Button>(); ClassDB::register_class<Label>(); + ClassDB::register_class<ScrollBar>(); ClassDB::register_class<HScrollBar>(); ClassDB::register_class<VScrollBar>(); ClassDB::register_class<ProgressBar>(); + ClassDB::register_class<Slider>(); ClassDB::register_class<HSlider>(); ClassDB::register_class<VSlider>(); ClassDB::register_class<Popup>(); @@ -352,6 +354,7 @@ void register_scene_types() { #ifndef _3D_DISABLED ClassDB::register_class<BoneAttachment>(); ClassDB::register_virtual_class<VisualInstance>(); + ClassDB::register_virtual_class<GeometryInstance>(); ClassDB::register_class<Camera>(); ClassDB::register_class<Listener>(); ClassDB::register_class<ARVRCamera>(); @@ -361,6 +364,7 @@ void register_scene_types() { ClassDB::register_class<InterpolatedCamera>(); ClassDB::register_class<MeshInstance>(); ClassDB::register_class<ImmediateGeometry>(); + ClassDB::register_virtual_class<SpriteBase3D>(); ClassDB::register_class<Sprite3D>(); ClassDB::register_class<AnimatedSprite3D>(); ClassDB::register_virtual_class<Light>(); @@ -380,6 +384,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init ClassDB::register_virtual_class<CollisionObject>(); + ClassDB::register_virtual_class<PhysicsBody>(); ClassDB::register_class<StaticBody>(); ClassDB::register_class<RigidBody>(); ClassDB::register_class<KinematicCollision>(); @@ -494,6 +499,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init + ClassDB::register_virtual_class<Shape>(); ClassDB::register_class<RayShape>(); ClassDB::register_class<SphereShape>(); ClassDB::register_class<BoxShape>(); @@ -531,6 +537,7 @@ void register_scene_types() { ClassDB::register_class<DynamicFontData>(); ClassDB::register_class<DynamicFont>(); + ClassDB::register_virtual_class<StyleBox>(); ClassDB::register_class<StyleBoxEmpty>(); ClassDB::register_class<StyleBoxTexture>(); ClassDB::register_class<StyleBoxFlat>(); diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 1fd84a860e..fdc3b79db6 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -486,7 +486,8 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const { { PoolVector<uint8_t>::Write w = pv.write(); - copymem(w.ptr(), data, data_bytes); + uint8_t *dataptr = (uint8_t *)data; + copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 923639bc79..402e06f621 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -512,6 +512,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // HSlider theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "HSlider", focus); @@ -524,6 +525,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // VSlider theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "VSlider", focus); diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index aa879f8aed..4dfc40e9e4 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -53,10 +53,10 @@ void ARVRServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_tracker_count"), &ARVRServer::get_tracker_count); ClassDB::bind_method(D_METHOD("get_tracker", "idx"), &ARVRServer::get_tracker); - ClassDB::bind_method(D_METHOD("set_primary_interface"), &ARVRServer::set_primary_interface); + ClassDB::bind_method(D_METHOD("set_primary_interface", "interface"), &ARVRServer::set_primary_interface); - ClassDB::bind_method(D_METHOD("add_interface"), &ARVRServer::add_interface); - ClassDB::bind_method(D_METHOD("remove_interface"), &ARVRServer::remove_interface); + ClassDB::bind_method(D_METHOD("add_interface", "interface"), &ARVRServer::add_interface); + ClassDB::bind_method(D_METHOD("remove_interface", "interface"), &ARVRServer::remove_interface); BIND_ENUM_CONSTANT(TRACKER_CONTROLLER); BIND_ENUM_CONSTANT(TRACKER_BASESTATION); diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 845a3443b7..1aee2144aa 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -79,6 +79,12 @@ ARVRServer *arvr_server = NULL; void register_server_types() { arvr_server = memnew(ARVRServer); + ClassDB::register_virtual_class<VisualServer>(); + ClassDB::register_class<AudioServer>(); + ClassDB::register_virtual_class<PhysicsServer>(); + ClassDB::register_virtual_class<Physics2DServer>(); + ClassDB::register_class<ARVRServer>(); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("VisualServer", VisualServer::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("AudioServer", AudioServer::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("PhysicsServer", PhysicsServer::get_singleton())); @@ -95,6 +101,8 @@ void register_server_types() { ClassDB::register_virtual_class<AudioStreamPlayback>(); ClassDB::register_class<AudioStreamRandomPitch>(); ClassDB::register_virtual_class<AudioEffect>(); + ClassDB::register_class<AudioEffectEQ>(); + ClassDB::register_class<AudioEffectFilter>(); ClassDB::register_class<AudioBusLayout>(); { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 47a5f4c7f3..2b34aa0e42 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1445,6 +1445,7 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac void VisualServer::_bind_methods() { + ClassDB::bind_method(D_METHOD("force_sync"), &VisualServer::sync); ClassDB::bind_method(D_METHOD("force_draw"), &VisualServer::draw); ClassDB::bind_method(D_METHOD("texture_create"), &VisualServer::texture_create); ClassDB::bind_method(D_METHOD("texture_create_from_image", "image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT)); diff --git a/thirdparty/README.md b/thirdparty/README.md index 6e1dcb8df4..335fcdd80b 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -121,7 +121,7 @@ Files extracted from upstream source: ## libpng - Upstream: http://libpng.org/pub/png/libpng.html -- Version: 1.6.32 +- Version: 1.6.33 - License: libpng/zlib Files extracted from upstream source: diff --git a/thirdparty/libpng/LICENSE b/thirdparty/libpng/LICENSE index b7ad4b9eaf..57c366feea 100644 --- a/thirdparty/libpng/LICENSE +++ b/thirdparty/libpng/LICENSE @@ -10,8 +10,8 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are -Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are +libpng versions 1.0.7, July 1, 2000 through 1.6.33, September 28, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -22,6 +22,9 @@ added to the list of Contributing Authors: Cosmin Truta Gilles Vollant James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -127,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson glennrp at users.sourceforge.net -June 9, 2016 +September 28, 2017 diff --git a/thirdparty/libpng/png.c b/thirdparty/libpng/png.c index 2352df13cb..55134729c7 100644 --- a/thirdparty/libpng/png.c +++ b/thirdparty/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32; +typedef png_libpng_version_1_6_33 Your_png_h_is_not_version_1_6_33; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -816,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \ + "libpng version 1.6.33 - September 28, 2017" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.32 - August 24, 2017\ + return "libpng version 1.6.33 - September 28, 2017\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -1913,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace, */ if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "invalid sRGB rendering intent"); + (png_alloc_size_t)intent, "invalid sRGB rendering intent"); if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 && colorspace->rendering_intent != intent) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "inconsistent rendering intents"); + (png_alloc_size_t)intent, "inconsistent rendering intents"); if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0) { @@ -1979,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace, if (profile_length < 132) return png_icc_profile_error(png_ptr, colorspace, name, profile_length, "too short"); - return 1; } @@ -2224,22 +2223,23 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace, * being in range. All defined tag types have an 8 byte header - a 4 byte * type signature then 0. */ + + /* This is a hard error; potentially it can cause read outside the + * profile. + */ + if (tag_start > profile_length || tag_length > profile_length - tag_start) + return png_icc_profile_error(png_ptr, colorspace, name, tag_id, + "ICC profile tag outside profile"); + if ((tag_start & 3) != 0) { - /* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is + /* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is * only a warning here because libpng does not care about the * alignment. */ (void)png_icc_profile_error(png_ptr, NULL, name, tag_id, "ICC profile tag start not a multiple of 4"); } - - /* This is a hard error; potentially it can cause read outside the - * profile. - */ - if (tag_start > profile_length || tag_length > profile_length - tag_start) - return png_icc_profile_error(png_ptr, colorspace, name, tag_id, - "ICC profile tag outside profile"); } return 1; /* success, maybe with warnings */ @@ -3761,7 +3761,7 @@ png_log16bit(png_uint_32 x) * of getting this accuracy in practice. * * To deal with this the following exp() function works out the exponent of the - * frational part of the logarithm by using an accurate 32-bit value from the + * fractional part of the logarithm by using an accurate 32-bit value from the * top four fractional bits then multiplying in the remaining bits. */ static const png_uint_32 diff --git a/thirdparty/libpng/png.h b/thirdparty/libpng/png.h index 51ac8abe74..a5f142b89c 100644 --- a/thirdparty/libpng/png.h +++ b/thirdparty/libpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.32, August 24, 2017 + * libpng version 1.6.33, September 28, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017: + * libpng versions 0.97, January 1998, through 1.6.33, September 28, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.33, September 28, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -213,7 +213,7 @@ * ... * 1.5.28 15 10527 15.so.15.28[.0] * ... - * 1.6.32 16 10632 16.so.16.32[.0] + * 1.6.33 16 10633 16.so.16.33[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -241,13 +241,13 @@ * Y2K compliance in libpng: * ========================= * - * August 24, 2017 + * September 28, 2017 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.32 are Y2K compliant. It is my belief that + * upward through 1.6.33 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -309,8 +309,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.32" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n" +#define PNG_LIBPNG_VER_STRING "1.6.33" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.33 - September 28, 2017\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -318,7 +318,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 32 +#define PNG_LIBPNG_VER_RELEASE 33 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -349,7 +349,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10632 /* 1.6.32 */ +#define PNG_LIBPNG_VER 10633 /* 1.6.33 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -459,7 +459,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_32; +typedef char* png_libpng_version_1_6_33; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2819,6 +2819,8 @@ typedef struct # define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ #endif +#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */ + /* Commonly used formats have predefined macros. * * First the single byte (sRGB) formats: diff --git a/thirdparty/libpng/pngconf.h b/thirdparty/libpng/pngconf.h index c0f15547be..e99e827dda 100644 --- a/thirdparty/libpng/pngconf.h +++ b/thirdparty/libpng/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.32, August 24, 2017 + * libpng version 1.6.33, September 28, 2017 * * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/thirdparty/libpng/pnglibconf.h b/thirdparty/libpng/pnglibconf.h index 9e45f73129..cbf715dd93 100644 --- a/thirdparty/libpng/pnglibconf.h +++ b/thirdparty/libpng/pnglibconf.h @@ -1,8 +1,8 @@ -/* libpng 1.6.32 STANDARD API DEFINITION */ +/* libpng 1.6.33 STANDARD API DEFINITION */ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.32 - August 24, 2017 */ +/* Libpng version 1.6.33 - September 28, 2017 */ /* Copyright (c) 1998-2017 Glenn Randers-Pehrson */ diff --git a/thirdparty/libpng/pngread.c b/thirdparty/libpng/pngread.c index e34ddd99a0..da32e9ad9c 100644 --- a/thirdparty/libpng/pngread.c +++ b/thirdparty/libpng/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -3759,7 +3759,13 @@ png_image_read_direct(png_voidp argument) mode = PNG_ALPHA_PNG; output_gamma = PNG_DEFAULT_sRGB; } - + + if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) + { + mode = PNG_ALPHA_OPTIMIZED; + change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + /* If 'do_local_background' is set check for the presence of gamma * correction; this is part of the work-round for the libpng bug * described above. @@ -3985,6 +3991,10 @@ png_image_read_direct(png_voidp argument) else if (do_local_compose != 0) /* internal error */ png_error(png_ptr, "png_image_read: alpha channel lost"); + if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) { + info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + if (info_ptr->bit_depth == 16) info_format |= PNG_FORMAT_FLAG_LINEAR; diff --git a/thirdparty/libpng/pngrtran.c b/thirdparty/libpng/pngrtran.c index 9a30ddf22b..c189650313 100644 --- a/thirdparty/libpng/pngrtran.c +++ b/thirdparty/libpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.31 [July 27, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -430,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -447,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -581,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -592,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_ptr->palette_to_index[i] = (png_byte)i; } - hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 * + hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 * (sizeof (png_dsortp)))); num_new_palette = num_palette; @@ -623,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, { t = (png_dsortp)png_malloc_warn(png_ptr, - (png_uint_32)(sizeof (png_dsort))); + (png_alloc_size_t)(sizeof (png_dsort))); if (t == NULL) break; @@ -748,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_size_t num_entries = ((png_size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr, - (png_uint_32)(num_entries * (sizeof (png_byte)))); + (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); - distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * + distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); memset(distance, 0xff, num_entries * (sizeof (png_byte))); @@ -3322,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= + tmp |= (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } diff --git a/thirdparty/libpng/pngrutil.c b/thirdparty/libpng/pngrutil.c index a4fa71457b..8692933bd8 100644 --- a/thirdparty/libpng/pngrutil.c +++ b/thirdparty/libpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -314,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn) if (buffer != NULL) { + memset(buffer, 0, new_size); /* just in case */ png_ptr->read_buffer = buffer; png_ptr->read_buffer_size = new_size; } @@ -673,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr, if (text != NULL) { + memset(text, 0, buffer_size); + ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/, png_ptr->read_buffer + prefix_size, &lzsize, text + prefix_size, newlength); @@ -736,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr, { /* inflateReset failed, store the error message */ png_zstream_error(png_ptr, ret); - - if (ret == Z_STREAM_END) - ret = PNG_UNEXPECTED_ZLIB_RETURN; + ret = PNG_UNEXPECTED_ZLIB_RETURN; } } @@ -1476,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) /* Now read the tag table; a variable size buffer is * needed at this point, allocate one for the whole * profile. The header check has already validated - * that none of these stuff will overflow. + * that none of this stuff will overflow. */ const png_uint_32 tag_count = png_get_uint_32( profile_header+128); @@ -1583,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return; } } - - else if (size > 0) - errmsg = "truncated"; - -#ifndef __COVERITY__ - else + if (errmsg == NULL) errmsg = png_ptr->zstream.msg; -#endif } - /* else png_icc_check_tag_table output an error */ } - else /* profile truncated */ errmsg = png_ptr->zstream.msg; } @@ -3144,28 +3137,28 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; - if (png_ptr->chunk_name != png_IDAT) - { # ifdef PNG_SET_USER_LIMITS_SUPPORTED - if (png_ptr->user_chunk_malloc_max > 0 && - png_ptr->user_chunk_malloc_max < limit) - limit = png_ptr->user_chunk_malloc_max; + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; # elif PNG_USER_CHUNK_MALLOC_MAX > 0 - if (PNG_USER_CHUNK_MALLOC_MAX < limit) - limit = PNG_USER_CHUNK_MALLOC_MAX; + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; # endif - } - else + if (png_ptr->chunk_name == png_IDAT) { + png_alloc_size_t idat_limit = PNG_UINT_31_MAX; size_t row_factor = (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) + 1 + (png_ptr->interlaced? 6: 0)); if (png_ptr->height > PNG_UINT_32_MAX/row_factor) - limit=PNG_UINT_31_MAX; + idat_limit=PNG_UINT_31_MAX; else - limit = png_ptr->height * row_factor; - limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */ - limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX; + idat_limit = png_ptr->height * row_factor; + row_factor = row_factor > 32566? 32566 : row_factor; + idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */ + idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX; + limit = limit < idat_limit? idat_limit : limit; } if (length > limit) diff --git a/thirdparty/libpng/pngtrans.c b/thirdparty/libpng/pngtrans.c index 326ac33f0e..6882f0fd7b 100644 --- a/thirdparty/libpng/pngtrans.c +++ b/thirdparty/libpng/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.30 [June 28, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) return; /* The filler channel has gone already */ /* Fix the rowbytes value. */ - row_info->rowbytes = (unsigned int)(dp-row); + row_info->rowbytes = (png_size_t)(dp-row); } #endif @@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * forms produced on either GCC or MSVC. */ int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); - png_bytep rp = png_ptr->row_buf + row_info->rowbytes; + png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1; switch (row_info->bit_depth) { diff --git a/thirdparty/libpng/pngwrite.c b/thirdparty/libpng/pngwrite.c index a7662acb71..a16d77ce00 100644 --- a/thirdparty/libpng/pngwrite.c +++ b/thirdparty/libpng/pngwrite.c @@ -1940,7 +1940,7 @@ png_image_write_main(png_voidp argument) int colormap = (format & PNG_FORMAT_FLAG_COLORMAP); int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */ int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA); - int write_16bit = linear && !colormap && (display->convert_to_8bit == 0); + int write_16bit = linear && (display->convert_to_8bit == 0); # ifdef PNG_BENIGN_ERRORS_SUPPORTED /* Make sure we error out on any bad situation */ |