diff options
317 files changed, 4863 insertions, 2472 deletions
diff --git a/.gitattributes b/.gitattributes index f8959dd2d1..03c6f96f80 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,3 +8,4 @@ drivers/* linguist-vendored *.h eol=lf *.py eol=lf *.hpp eol=lf +*.xml eol=lf diff --git a/core/array.cpp b/core/array.cpp index 30184a002e..171c11776c 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -233,9 +233,10 @@ struct _ArrayVariantSort { } }; -void Array::sort() { +Array &Array::sort() { _p->array.sort_custom<_ArrayVariantSort>(); + return *this; } struct _ArrayVariantSortCustom { @@ -253,19 +254,21 @@ struct _ArrayVariantSortCustom { return res; } }; -void Array::sort_custom(Object *p_obj, const StringName &p_function) { +Array &Array::sort_custom(Object *p_obj, const StringName &p_function) { - ERR_FAIL_NULL(p_obj); + ERR_FAIL_NULL_V(p_obj, *this); SortArray<Variant, _ArrayVariantSortCustom> avs; avs.compare.obj = p_obj; avs.compare.func = p_function; avs.sort(_p->array.ptr(), _p->array.size()); + return *this; } -void Array::invert() { +Array &Array::invert() { _p->array.invert(); + return *this; } void Array::push_front(const Variant &p_value) { diff --git a/core/array.h b/core/array.h index 8a647dd13b..2c29103108 100644 --- a/core/array.h +++ b/core/array.h @@ -68,9 +68,9 @@ public: Variant front() const; Variant back() const; - void sort(); - void sort_custom(Object *p_obj, const StringName &p_function); - void invert(); + Array &sort(); + Array &sort_custom(Object *p_obj, const StringName &p_function); + Array &invert(); int find(const Variant &p_value, int p_from = 0) const; int rfind(const Variant &p_value, int p_from = -1) const; 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/image.cpp b/core/image.cpp index c7f21d5599..943cbaf51d 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2474,6 +2474,7 @@ void Image::fix_alpha_edges() { if (rp[3] < alpha_threshold) continue; + closest_dist = dist; closest_color[0] = rp[0]; closest_color[1] = rp[1]; closest_color[2] = rp[2]; diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index c93e12f7da..e5da307153 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -62,12 +62,12 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8 writing = false; key = p_key; uint32_t magic = p_base->get_32(); - print_line("MAGIC: " + itos(magic)); ERR_FAIL_COND_V(magic != COMP_MAGIC, ERR_FILE_UNRECOGNIZED); + mode = Mode(p_base->get_32()); ERR_FAIL_INDEX_V(mode, MODE_MAX, ERR_FILE_CORRUPT); ERR_FAIL_COND_V(mode == 0, ERR_FILE_CORRUPT); - print_line("MODE: " + itos(mode)); + unsigned char md5d[16]; p_base->get_buffer(md5d, 16); length = p_base->get_64(); diff --git a/core/io/logger.cpp b/core/io/logger.cpp index b94007d316..ad6371f1e1 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -33,6 +33,17 @@ #include "os/os.h" #include "print_string.h" +// va_copy was defined in the C99, but not in C++ standards before C++11. +// When you compile C++ without --std=c++<XX> option, compilers still define +// va_copy, otherwise you have to use the internal version (__va_copy). +#if !defined(va_copy) +#if defined(__GNUC__) +#define va_copy(d, s) __va_copy(d, s) +#else +#define va_copy(d, s) ((d) = (s)) +#endif +#endif + bool Logger::should_log(bool p_err) { return (!p_err || _print_error_enabled) && (p_err || _print_line_enabled); } 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/Makefile b/doc/Makefile index d68c66f8eb..2f9fefe794 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -24,5 +24,5 @@ rst: rm -rf $(OUTPUTDIR)/rst mkdir -p $(OUTPUTDIR)/rst pushd $(OUTPUTDIR)/rst - python2 $(TOOLSDIR)/makerst.py $(CLASSES) + python $(TOOLSDIR)/makerst.py $(CLASSES) popd diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml index 1c2e761b57..9aed6c96ef 100644 --- a/doc/classes/ARVRInterface.xml +++ b/doc/classes/ARVRInterface.xml @@ -94,7 +94,7 @@ <argument index="0" name="initialized" type="bool"> </argument> <description> - Initialise/uninitilise this interface (same effect as calling intialize/uninitialize). + Initialize/uninitialize this interface (same effect as calling initialize/uninitialize). </description> </method> <method name="set_is_primary"> diff --git a/doc/classes/ARVRScriptInterface.xml b/doc/classes/ARVRScriptInterface.xml deleted file mode 100644 index 182147a015..0000000000 --- a/doc/classes/ARVRScriptInterface.xml +++ /dev/null @@ -1,118 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRScriptInterface" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build"> - <brief_description> - Base class for GDNative based ARVR interfaces. - </brief_description> - <description> - This class is used as a base class/interface class for implementing GDNative based ARVR interfaces and as a result exposes more of the internals of the ARVR server. - </description> - <tutorials> - </tutorials> - <demos> - </demos> - <methods> - <method name="_get_projection_for_eye" qualifiers="virtual"> - <return type="void"> - </return> - <description> - Should return the projection 4x4 matrix for the requested eye. - </description> - </method> - <method name="commit_for_eye" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="eye" type="int"> - </argument> - <argument index="1" name="render_target" type="RID"> - </argument> - <description> - Outputs a finished render buffer to the AR/VR device for the given eye. - </description> - </method> - <method name="get_anchor_detection_is_enabled" qualifiers="virtual"> - <return type="bool"> - </return> - <description> - Returns true if achor detection is enabled (AR only). - </description> - </method> - <method name="get_capabilities" qualifiers="virtual"> - <return type="int"> - </return> - <description> - Returns a combination of flags providing information about the capabilities of this interface. - </description> - </method> - <method name="get_recommended_render_targetsize" qualifiers="virtual"> - <return type="Vector2"> - </return> - <description> - Returns the size at which we should render our scene to get optimal quality on the output device. - </description> - </method> - <method name="get_tracking_status" qualifiers="virtual"> - <return type="int"> - </return> - <description> - If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking. - </description> - </method> - <method name="get_transform_for_eye" qualifiers="virtual"> - <return type="Transform"> - </return> - <argument index="0" name="eye" type="int"> - </argument> - <argument index="1" name="cam_transform" type="Transform"> - </argument> - <description> - Get the location and orientation transform used when rendering a specific eye. - </description> - </method> - <method name="initialize" qualifiers="virtual"> - <return type="bool"> - </return> - <description> - Initialize this interface. - </description> - </method> - <method name="is_initialized" qualifiers="virtual"> - <return type="bool"> - </return> - <description> - Returns true if this interface has been initialized and is active. - </description> - </method> - <method name="is_stereo" qualifiers="virtual"> - <return type="bool"> - </return> - <description> - Returns true if we require stereoscopic rendering for this interface. - </description> - </method> - <method name="process" qualifiers="virtual"> - <return type="void"> - </return> - <description> - Gets called before rendering each frame so tracking data gets updated in time. - </description> - </method> - <method name="set_anchor_detection_is_enabled" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Enables anchor detection, this is used on AR interfaces and enables the extra logic that will detect planes, features, objects, etc. and adds/modifies anchor points. - </description> - </method> - <method name="uninitialize" qualifiers="virtual"> - <return type="void"> - </return> - <description> - Turn this interface off. - </description> - </method> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 6a7262bd14..5e1055d568 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. @@ -178,7 +178,7 @@ Used internally to filter trackers of any known type. </constant> <constant name="TRACKER_ANY" value="255"> - Used interally to select all trackers. + Used internally to select all trackers. </constant> </constants> </class> 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 47100f23b8..7c1d72333b 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -179,7 +179,7 @@ </method> <method name="invert"> <description> - Reverse the order of the elements in the array (so first element will now be the last). + Reverse the order of the elements in the array (so first element will now be the last) and return reference to the array. </description> </method> <method name="pop_back"> @@ -240,7 +240,7 @@ </method> <method name="sort"> <description> - Sort the array using natural order. + Sort the array using natural order and return reference to the array. </description> </method> <method name="sort_custom"> @@ -249,7 +249,7 @@ <argument index="1" name="func" type="String"> </argument> <description> - Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. + Sort the array using a custom method and return reference to the array. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. </description> </method> </methods> 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/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml index 1a6aa1d2b6..8b970e675e 100644 --- a/doc/classes/AudioEffectDistortion.xml +++ b/doc/classes/AudioEffectDistortion.xml @@ -5,7 +5,7 @@ Modify the sound to make it dirty. </brief_description> <description> - Modify the sound and make it dirty. Differents types available : clip, tan, lofi (bit crushing), overdrive, or waveshape. + Modify the sound and make it dirty. Different types are available : clip, tan, lofi (bit crushing), overdrive, or waveshape. By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently. </description> <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..84f6792ef0 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. @@ -309,7 +310,7 @@ Sets the absolute maximum of the soundlevel, in dB. </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance"> - Sets the distance from wich the 'out_of_range_mode' takes effect. Has no effect if set to 0. + Sets the distance from which the 'out_of_range_mode' takes effect. Has no effect if set to 0. </member> <member name="out_of_range_mode" type="int" setter="set_out_of_range_mode" getter="get_out_of_range_mode" enum="AudioStreamPlayer3D.OutOfRangeMode"> Decides if audio should pause when source is outside of 'max_distance' range. @@ -354,10 +355,10 @@ Disables doppler tracking. </constant> <constant name="DOPPLER_TRACKING_IDLE_STEP" value="1"> - Executes doppler trackin in idle step. + Executes doppler tracking 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/BitmapFont.xml b/doc/classes/BitmapFont.xml index e983c59782..07027c4b42 100644 --- a/doc/classes/BitmapFont.xml +++ b/doc/classes/BitmapFont.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="BitmapFont" inherits="Font" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Renders text using [code]*.fnt[/code] fonts. </brief_description> <description> + Renders text using [code]*.fnt[/code] fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see [DynamicFont]. </description> <tutorials> </tutorials> @@ -23,7 +25,7 @@ <argument index="4" name="advance" type="float" default="-1"> </argument> <description> - Add a character to the font, where [i]character[/i] is the unicode value, [i]texture[/i] is the texture index, [i]rect[/i] is the region in the texture (in pixels!), [i]align[/i] is the (optional) alignment for the character and [i]advance[/i] is the (optional) advance. + Adds a character to the font, where [code]character[/code] is the unicode value, [code]texture[/code] is the texture index, [code]rect[/code] is the region in the texture (in pixels!), [code]align[/code] is the (optional) alignment for the character and [code]advance[/code] is the (optional) advance. </description> </method> <method name="add_kerning_pair"> @@ -36,7 +38,7 @@ <argument index="2" name="kerning" type="int"> </argument> <description> - Add a kerning pair to the [BitmapFont] as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character. + Adds a kerning pair to the [BitmapFont] as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character. </description> </method> <method name="add_texture"> @@ -45,14 +47,14 @@ <argument index="0" name="texture" type="Texture"> </argument> <description> - Add a texture to the [BitmapFont]. + Adds a texture to the [BitmapFont]. </description> </method> <method name="clear"> <return type="void"> </return> <description> - Clear all the font data. + Clears all the font data and settings. </description> </method> <method name="create_from_fnt"> @@ -61,6 +63,7 @@ <argument index="0" name="path" type="String"> </argument> <description> + Creates a BitmapFont from the [code]*.fnt[/code] file at [code]path[/code]. </description> </method> <method name="get_char_size" qualifiers="const"> @@ -71,13 +74,14 @@ <argument index="1" name="next" type="int" default="0"> </argument> <description> - Return the size of a character, optionally taking kerning into account if the next character is provided. + Returns the size of a character, optionally taking kerning into account if the next character is provided. </description> </method> <method name="get_fallback" qualifiers="const"> <return type="BitmapFont"> </return> <description> + Returns the fallback BitmapFont. </description> </method> <method name="get_kerning_pair" qualifiers="const"> @@ -88,7 +92,7 @@ <argument index="1" name="char_b" type="int"> </argument> <description> - Return a kerning pair as a difference. + Returns a kerning pair as a difference. </description> </method> <method name="get_texture" qualifiers="const"> @@ -97,12 +101,14 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the font atlas texture at index [code]idx[/code]. </description> </method> <method name="get_texture_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of textures in the BitmapFont atlas. </description> </method> <method name="set_ascent"> @@ -111,7 +117,7 @@ <argument index="0" name="px" type="float"> </argument> <description> - Set the font ascent (number of pixels above the baseline). + Sets the font ascent (number of pixels above the baseline). </description> </method> <method name="set_distance_field_hint"> @@ -120,6 +126,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> + If [code]true[/code] distance field hint is enabled. </description> </method> <method name="set_fallback"> @@ -128,6 +135,7 @@ <argument index="0" name="fallback" type="BitmapFont"> </argument> <description> + Sets the fallback BitmapFont. </description> </method> <method name="set_height"> @@ -136,24 +144,31 @@ <argument index="0" name="px" type="float"> </argument> <description> - Set the total font height (ascent plus descent) in pixels. + Sets the total font height (ascent plus descent) in pixels. </description> </method> </methods> <members> <member name="ascent" type="float" setter="set_ascent" getter="get_ascent"> + Ascent (number of pixels above the baseline). </member> <member name="chars" type="PoolIntArray" setter="_set_chars" getter="_get_chars"> + The characters in the BitmapFont. </member> <member name="distance_field" type="bool" setter="set_distance_field_hint" getter="is_distance_field_hint"> + If [code]true[/code] distance field hint is enabled. </member> <member name="fallback" type="BitmapFont" setter="set_fallback" getter="get_fallback"> + The fallback font. </member> <member name="height" type="float" setter="set_height" getter="get_height"> + Total font height (ascent plus descent) in pixels. </member> <member name="kernings" type="PoolIntArray" setter="_set_kernings" getter="_get_kernings"> + The font's kernings as [PoolIntArray]. </member> <member name="textures" type="Array" setter="_set_textures" getter="_get_textures"> + The font's [Texture]\ s. </member> </members> <constants> 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/CheckBox.xml b/doc/classes/CheckBox.xml index 6258eb503f..50b431e00c 100644 --- a/doc/classes/CheckBox.xml +++ b/doc/classes/CheckBox.xml @@ -4,7 +4,7 @@ Binary choice user interface widget </brief_description> <description> - A checkbox allows the user to make a binary choice (choosing only one of two posible options), for example Answer 'yes' or 'no'. + A checkbox allows the user to make a binary choice (choosing only one of two possible options), for example Answer 'yes' or 'no'. </description> <tutorials> </tutorials> 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/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint.xml index 67c7cc4cfe..78655c496d 100644 --- a/doc/classes/ConeTwistJoint.xml +++ b/doc/classes/ConeTwistJoint.xml @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> <brief_description> + A twist joint between two 3D bodies </brief_description> <description> + The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint]. + The twist axis is initiated as the x-axis of the [Joint]. + Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint in the local space of the two Bodies. </description> <tutorials> </tutorials> @@ -30,28 +34,49 @@ </methods> <members> <member name="bias" type="float" setter="set_param" getter="get_param"> + The speed with which the swing or twist will take place. + The higher, the faster. </member> <member name="relaxation" type="float" setter="set_param" getter="get_param"> + Defines, how fast the swing- and twist-speed-difference on both sides gets synced. </member> <member name="softness" type="float" setter="set_param" getter="get_param"> + The ease with which the joint starts to twist. If it's too low, it takes more force to start twisting the joint. </member> <member name="swing_span" type="float" setter="_set_swing_span" getter="_get_swing_span"> + Swing is rotation from side to side, around the axis perpendicular to the twist axis. + The swing span defines, how much rotation will not get corrected allong the swing axis. + Could be defined as looseness in the [ConeTwistJoint]. + If below 0.05, this behaviour is locked. Default value: [code]PI/4[/code]. </member> <member name="twist_span" type="float" setter="_set_twist_span" getter="_get_twist_span"> + Twist is the rotation around the twist axis, this value defined how far the joint can twist. + Twist is locked if below 0.05. </member> </members> <constants> <constant name="PARAM_SWING_SPAN" value="0"> + Swing is rotation from side to side, around the axis perpendicular to the twist axis. + The swing span defines, how much rotation will not get corrected allong the swing axis. + Could be defined as looseness in the [ConeTwistJoint]. + If below 0.05, this behaviour is locked. Default value: [code]PI/4[/code]. </constant> <constant name="PARAM_TWIST_SPAN" value="1"> + Twist is the rotation around the twist axis, this value defined how far the joint can twist. + Twist is locked if below 0.05. </constant> <constant name="PARAM_BIAS" value="2"> + The speed with which the swing or twist will take place. + The higher, the faster. </constant> <constant name="PARAM_SOFTNESS" value="3"> + The ease with which the joint starts to twist. If it's too low, it takes more force to start twisting the joint. </constant> <constant name="PARAM_RELAXATION" value="4"> + Defines, how fast the swing- and twist-speed-difference on both sides gets synced. </constant> <constant name="PARAM_MAX" value="5"> + End flag of PARAM_* constants, used internally. </constant> </constants> </class> diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index c2d1ec1355..846a100f3c 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -4,15 +4,22 @@ Helper class to handle INI-style files. </brief_description> <description> - This helper class can be used to store [Variant] values on the filesystem using an INI-style formatting. The stored values as referenced by a section and a key. The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used directly with accessing the filesystem. - The following example shows how to parse a INI-style file from the system, read its contents and store new values in it: + This helper class can be used to store [Variant] values on the filesystem using INI-style formatting. The stored values are indentified by a section and a key: + [codeblock] + [section] + some_key=42 + string_example="Hello World!" + a_vector=Vector3( 1, 0, 2 ) + [/codeblock] + The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used directly without accessing the filesystem. + The following example shows how to parse an INI-style file from the system, read its contents and store new values in it: [codeblock] var config = ConfigFile.new() var err = config.load("user://settings.cfg") if err == OK: # if not, something went wrong with the file loading # Look for the display/width pair, and default to 1024 if missing var screen_width = get_value("display", "width", 1024) - # Store a variable if and only it hasn't been defined yet + # Store a variable if and only if it hasn't been defined yet if not config.has_section_key("audio", "mute"): config.set_value("audio", "mute", false) # Save the changes by overwriting the previous file @@ -30,6 +37,7 @@ <argument index="0" name="section" type="String"> </argument> <description> + Deletes the specified section along with all the key-value pairs inside. </description> </method> <method name="get_section_keys" qualifiers="const"> @@ -38,14 +46,14 @@ <argument index="0" name="section" type="String"> </argument> <description> - Return an array of all defined key identifiers in the specified section. + Returns an array of all defined key identifiers in the specified section. </description> </method> <method name="get_sections" qualifiers="const"> <return type="PoolStringArray"> </return> <description> - Return an array of all defined section identifiers. + Returns an array of all defined section identifiers. </description> </method> <method name="get_value" qualifiers="const"> @@ -58,7 +66,7 @@ <argument index="2" name="default" type="Variant" default="null"> </argument> <description> - Return the current value for the specified section and key. If the section and/or the key do not exist, the method returns the value of the optional [i]default[/i] argument (and thus [code]NULL[/code] if not specified). + Returns the current value for the specified section and key. If the section and/or the key do not exist, the method returns the value of the optional [code]default[/code] argument, or [code]null[/code] if it is omitted. </description> </method> <method name="has_section" qualifiers="const"> @@ -67,7 +75,7 @@ <argument index="0" name="section" type="String"> </argument> <description> - Check if the specified section exists. + Returns [code]true[/code] if the specified section exists. </description> </method> <method name="has_section_key" qualifiers="const"> @@ -78,7 +86,7 @@ <argument index="1" name="key" type="String"> </argument> <description> - Check if the specified section-key pair exists. + Returns [code]true[/code] if the specified section-key pair exists. </description> </method> <method name="load"> @@ -87,7 +95,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Load the config file specified as a parameter. The file's contents are parsed and loaded in the ConfigFile object from which the method was called. The return value is one of the OK, FAILED or ERR_* constants listed in [@Global Scope] (if the load was successful, it returns OK). + Loads the config file specified as a parameter. The file's contents are parsed and loaded in the ConfigFile object which the method was called on. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@Global Scope]. If the load was successful, the return value is [code]OK[/code]. </description> </method> <method name="save"> @@ -96,8 +104,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Save the contents of the ConfigFile object to the file specified as a parameter. The output file uses an INI-style structure. - The return value is one of the OK, FAILED or ERR_* constants listed in [@Global Scope] (if the save was successful, it returns OK). + Saves the contents of the ConfigFile object to the file specified as a parameter. The output file uses an INI-style structure. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@Global Scope]. If the load was successful, the return value is [code]OK[/code]. </description> </method> <method name="set_value"> @@ -110,7 +117,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> - Assign a value to the specified key of the the specified section. If the section and/or the key do not exist, they are created. Passing a [code]NULL[/code] value deletes the specified key if it exists (and deletes the section if it ends up empty once the key has been removed). + Assigns a value to the specified key of the the specified section. If the section and/or the key do not exist, they are created. Passing a [code]null[/code] value deletes the specified key if it exists, and deletes the section if it ends up empty once the key has been removed. </description> </method> </methods> 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/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 05319e926c..da8f0f235b 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -35,7 +35,7 @@ func get_preset_name(i): return "Default" - func get_import_optons(i): + func get_import_options(i): return [{"name": "my_option", "default_value": false}] func load(src, dst, opts, r_platform_variants, r_gen_files): 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/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml index acf36b6a08..5174d9243b 100644 --- a/doc/classes/EditorResourcePreview.xml +++ b/doc/classes/EditorResourcePreview.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="EditorResourcePreview" inherits="Node" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Helper to generate previews of reources or files. + Helper to generate previews of resources or files. </brief_description> <description> This object is used to generate previews for resources of files. diff --git a/doc/classes/EditorSelection.xml b/doc/classes/EditorSelection.xml index 8d9bdd2c05..a6dc60ee7b 100644 --- a/doc/classes/EditorSelection.xml +++ b/doc/classes/EditorSelection.xml @@ -31,7 +31,7 @@ <return type="Array"> </return> <description> - Get the list of selectes nodes. + Get the list of selected nodes. </description> </method> <method name="get_transformable_selected_nodes"> 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/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml index baab995fab..545eadeed2 100644 --- a/doc/classes/EditorSpatialGizmo.xml +++ b/doc/classes/EditorSpatialGizmo.xml @@ -96,7 +96,7 @@ <argument index="2" name="cancel" type="bool" default="false"> </argument> <description> - Commit a handle being edited (handles must have been prevously added by [method add_handles]). + Commit a handle being edited (handles must have been previously added by [method add_handles]). If the cancel parameter is true, an option to restore the edited value to the original is provided. </description> </method> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 2372c619f5..5bb0810296 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Engine" inherits="Object" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Access to basic engine properties. </brief_description> <description> + The [Engine] class allows you to query and modify the game's run-time parameters, such as frames per second, time scale, and others. </description> <tutorials> </tutorials> @@ -13,7 +15,7 @@ <return type="int"> </return> <description> - Return the total amount of frames drawn. + Returns the total number of frames drawn. </description> </method> <method name="get_frames_per_second" qualifiers="const"> @@ -27,26 +29,28 @@ <return type="int"> </return> <description> - Return the amount of fixed iterations per second (for fixed process and physics). + Returns the number of fixed iterations per second (for fixed process and physics). </description> </method> <method name="get_main_loop" qualifiers="const"> <return type="MainLoop"> </return> <description> - Return the main loop object (see [MainLoop] and [SceneTree]). + Returns the main loop object (see [MainLoop] and [SceneTree]). </description> </method> <method name="get_target_fps" qualifiers="const"> <return type="float"> </return> <description> + Returns the desired frames per second. If the hardware cannot keep up, this setting may not be respected. It defaults to 0, which indicates no limit. </description> </method> <method name="get_time_scale"> <return type="float"> </return> <description> + Returns how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed. </description> </method> <method name="get_version_info" qualifiers="const"> @@ -67,12 +71,14 @@ <return type="bool"> </return> <description> + Returns [code]true[/code] if the editor is running. </description> </method> - <method name="is_in_fixed_frame" qualifiers="const"> + <method name="is_in_physics_frame" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop. </description> </method> <method name="set_editor_hint"> @@ -81,6 +87,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> + Sets the running inside the editor hint if [code]enabled[/code] is [code]true[/code]. </description> </method> <method name="set_iterations_per_second"> @@ -89,7 +96,7 @@ <argument index="0" name="iterations_per_second" type="int"> </argument> <description> - Set the amount of fixed iterations per second (for fixed process and physics). + Sets the number of fixed iterations per second (for fixed process and physics). </description> </method> <method name="set_target_fps"> @@ -98,6 +105,7 @@ <argument index="0" name="target_fps" type="int"> </argument> <description> + Sets the target frames per second. </description> </method> <method name="set_time_scale"> @@ -106,6 +114,7 @@ <argument index="0" name="time_scale" type="float"> </argument> <description> + Sets the time scale. </description> </method> </methods> 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/FileDialog.xml b/doc/classes/FileDialog.xml index d7a08368a5..b3d131ca40 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -86,7 +86,7 @@ <return type="bool"> </return> <description> - Return true if the diaog allows show hidden files. + Return true if the dialog allows show hidden files. </description> </method> <method name="set_access"> @@ -205,10 +205,10 @@ The dialog allows the selection of file and directory. </constant> <constant name="ACCESS_USERDATA" value="1"> - The dialog allows ascess files under [Resource] path(res://) . + The dialog allows access files under [Resource] path(res://) . </constant> <constant name="ACCESS_FILESYSTEM" value="2"> - The dialog allows ascess files in whole file system. + The dialog allows access files in whole file system. </constant> </constants> <theme_items> diff --git a/doc/classes/Generic6DOFJoint.xml b/doc/classes/Generic6DOFJoint.xml index 4b782e994a..89ec1fd836 100644 --- a/doc/classes/Generic6DOFJoint.xml +++ b/doc/classes/Generic6DOFJoint.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Generic6DOFJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> <brief_description> + The generic 6 degrees of freedom joint can implement a variety of joint-types by locking certain axes' rotation or translation. </brief_description> <description> + The first 3 dof axes are linear axes, which represent translation of Bodies, and the latter 3 dof axes represent the angular motion. Each axis can be either locked, or limited. </description> <tutorials> </tutorials> @@ -120,146 +122,217 @@ </methods> <members> <member name="angular_limit_x/damping" type="float" setter="set_param_x" getter="get_param_x"> + The amount of rotational damping across the x-axis. + The lower, the longer an impulse from one side takes to travel to the other side. </member> <member name="angular_limit_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x"> + If [code]true[/code] rotation across the x-axis is enabled. </member> <member name="angular_limit_x/erp" type="float" setter="set_param_x" getter="get_param_x"> + When rotating across x-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower. </member> <member name="angular_limit_x/force_limit" type="float" setter="set_param_x" getter="get_param_x"> + The maximum amount of force that can occur, when rotating arround x-axis. </member> <member name="angular_limit_x/lower_angle" type="float" setter="_set_angular_lo_limit_x" getter="_get_angular_lo_limit_x"> + The minimum rotation in negative direction to break loose and rotate arround the x-axis. </member> <member name="angular_limit_x/restitution" type="float" setter="set_param_x" getter="get_param_x"> + The amount of rotational restitution across the x-axis. The lower, the more restitution occurs. </member> <member name="angular_limit_x/softness" type="float" setter="set_param_x" getter="get_param_x"> + The speed of all rotations across the x-axis. </member> <member name="angular_limit_x/upper_angle" type="float" setter="_set_angular_hi_limit_x" getter="_get_angular_hi_limit_x"> + The minimum rotation in positive direction to break loose and rotate arround the x-axis. </member> <member name="angular_limit_y/damping" type="float" setter="set_param_y" getter="get_param_y"> + The amount of rotational damping across the y-axis. The lower, the more dampening occurs. </member> <member name="angular_limit_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y"> + If [code]true[/code] rotation across the y-axis is enabled. </member> <member name="angular_limit_y/erp" type="float" setter="set_param_y" getter="get_param_y"> + When rotating across y-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower. </member> <member name="angular_limit_y/force_limit" type="float" setter="set_param_y" getter="get_param_y"> + The maximum amount of force that can occur, when rotating arround y-axis. </member> <member name="angular_limit_y/lower_angle" type="float" setter="_set_angular_lo_limit_y" getter="_get_angular_lo_limit_y"> + The minimum rotation in negative direction to break loose and rotate arround the y-axis. </member> <member name="angular_limit_y/restitution" type="float" setter="set_param_y" getter="get_param_y"> + The amount of rotational restitution across the y-axis. The lower, the more restitution occurs. </member> <member name="angular_limit_y/softness" type="float" setter="set_param_y" getter="get_param_y"> + The speed of all rotations across the y-axis. </member> <member name="angular_limit_y/upper_angle" type="float" setter="_set_angular_hi_limit_y" getter="_get_angular_hi_limit_y"> + The minimum rotation in positive direction to break loose and rotate arround the y-axis. </member> <member name="angular_limit_z/damping" type="float" setter="set_param_z" getter="get_param_z"> + The amount of rotational damping across the z-axis. The lower, the more dampening occurs. </member> <member name="angular_limit_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z"> + If [code]true[/code] rotation across the z-axis is enabled. </member> <member name="angular_limit_z/erp" type="float" setter="set_param_z" getter="get_param_z"> + When rotating across z-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower. </member> <member name="angular_limit_z/force_limit" type="float" setter="set_param_z" getter="get_param_z"> + The maximum amount of force that can occur, when rotating arround z-axis. </member> <member name="angular_limit_z/lower_angle" type="float" setter="_set_angular_lo_limit_z" getter="_get_angular_lo_limit_z"> + The minimum rotation in negative direction to break loose and rotate arround the z-axis. </member> <member name="angular_limit_z/restitution" type="float" setter="set_param_z" getter="get_param_z"> + The amount of rotational restitution across the z-axis. The lower, the more restitution occurs. </member> <member name="angular_limit_z/softness" type="float" setter="set_param_z" getter="get_param_z"> + The speed of all rotations across the z-axis. </member> <member name="angular_limit_z/upper_angle" type="float" setter="_set_angular_hi_limit_z" getter="_get_angular_hi_limit_z"> + The minimum rotation in positive direction to break loose and rotate arround the z-axis. </member> <member name="angular_motor_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x"> + If [code]true[/code] a rotating motor at the x-axis is enabled. </member> <member name="angular_motor_x/force_limit" type="float" setter="set_param_x" getter="get_param_x"> + Maximum acceleration for the motor at the x-axis. </member> <member name="angular_motor_x/target_velocity" type="float" setter="set_param_x" getter="get_param_x"> + Target speed for the motor at the x-axis. </member> <member name="angular_motor_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y"> + If [code]true[/code] a rotating motor at the y-axis is enabled. </member> <member name="angular_motor_y/force_limit" type="float" setter="set_param_y" getter="get_param_y"> + Maximum acceleration for the motor at the y-axis. </member> <member name="angular_motor_y/target_velocity" type="float" setter="set_param_y" getter="get_param_y"> + Target speed for the motor at the y-axis. </member> <member name="angular_motor_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z"> + If [code]true[/code] a rotating motor at the z-axis is enabled. </member> <member name="angular_motor_z/force_limit" type="float" setter="set_param_z" getter="get_param_z"> + Maximum acceleration for the motor at the z-axis. </member> <member name="angular_motor_z/target_velocity" type="float" setter="set_param_z" getter="get_param_z"> + Target speed for the motor at the z-axis. </member> <member name="linear_limit_x/damping" type="float" setter="set_param_x" getter="get_param_x"> + The amount of damping that happens at the x-motion. </member> <member name="linear_limit_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x"> + If [code]true[/code] the linear motion across the x-axis is enabled. </member> <member name="linear_limit_x/lower_distance" type="float" setter="set_param_x" getter="get_param_x"> + The minimum difference between the pivot points' x-axis. </member> <member name="linear_limit_x/restitution" type="float" setter="set_param_x" getter="get_param_x"> + The amount of restitution on the x-axis movement The lower, the more momentum gets lost. </member> <member name="linear_limit_x/softness" type="float" setter="set_param_x" getter="get_param_x"> + A factor applied to the movement across the x-axis The lower, the slower the movement. </member> <member name="linear_limit_x/upper_distance" type="float" setter="set_param_x" getter="get_param_x"> + The maximum difference between the pivot points' x-axis. </member> <member name="linear_limit_y/damping" type="float" setter="set_param_y" getter="get_param_y"> + The amount of damping that happens at the y-motion. </member> <member name="linear_limit_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y"> + If [code]true[/code] the linear motion across the y-axis is enabled. </member> <member name="linear_limit_y/lower_distance" type="float" setter="set_param_y" getter="get_param_y"> + The minimum difference between the pivot points' y-axis. </member> <member name="linear_limit_y/restitution" type="float" setter="set_param_y" getter="get_param_y"> + The amount of restitution on the y-axis movement The lower, the more momentum gets lost. </member> <member name="linear_limit_y/softness" type="float" setter="set_param_y" getter="get_param_y"> + A factor applied to the movement across the y-axis The lower, the slower the movement. </member> <member name="linear_limit_y/upper_distance" type="float" setter="set_param_y" getter="get_param_y"> + The maximum difference between the pivot points' y-axis. </member> <member name="linear_limit_z/damping" type="float" setter="set_param_z" getter="get_param_z"> + The amount of damping that happens at the z-motion. </member> <member name="linear_limit_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z"> + If [code]true[/code] the linear motion across the z-axis is enabled. </member> <member name="linear_limit_z/lower_distance" type="float" setter="set_param_z" getter="get_param_z"> + The minimum difference between the pivot points' z-axis. </member> <member name="linear_limit_z/restitution" type="float" setter="set_param_z" getter="get_param_z"> + The amount of restitution on the z-axis movement The lower, the more momentum gets lost. </member> <member name="linear_limit_z/softness" type="float" setter="set_param_z" getter="get_param_z"> + A factor applied to the movement across the z-axis The lower, the slower the movement. </member> <member name="linear_limit_z/upper_distance" type="float" setter="set_param_z" getter="get_param_z"> + The maximum difference between the pivot points' z-axis. </member> </members> <constants> <constant name="PARAM_LINEAR_LOWER_LIMIT" value="0"> + The minimum difference between the pivot points' axes. </constant> <constant name="PARAM_LINEAR_UPPER_LIMIT" value="1"> + The maximum difference between the pivot points' axes. </constant> <constant name="PARAM_LINEAR_LIMIT_SOFTNESS" value="2"> + A factor applied to the movement across the axes The lower, the slower the movement. </constant> <constant name="PARAM_LINEAR_RESTITUTION" value="3"> + The amount of restitution on the axes movement The lower, the more momentum gets lost. </constant> <constant name="PARAM_LINEAR_DAMPING" value="4"> + The amount of damping that happens at the linear motion across the axes. </constant> <constant name="PARAM_ANGULAR_LOWER_LIMIT" value="5"> + The minimum rotation in negative direction to break loose and rotate arround the axes. </constant> <constant name="PARAM_ANGULAR_UPPER_LIMIT" value="6"> + The minimum rotation in positive direction to break loose and rotate arround the axes. </constant> <constant name="PARAM_ANGULAR_LIMIT_SOFTNESS" value="7"> + The speed of all rotations across the axes. </constant> <constant name="PARAM_ANGULAR_DAMPING" value="8"> + The amount of rotational damping across the axes. The lower, the more dampening occurs. </constant> <constant name="PARAM_ANGULAR_RESTITUTION" value="9"> + The amount of rotational restitution across the axes. The lower, the more restitution occurs. </constant> <constant name="PARAM_ANGULAR_FORCE_LIMIT" value="10"> + The maximum amount of force that can occur, when rotating arround the axes. </constant> <constant name="PARAM_ANGULAR_ERP" value="11"> + When rotating across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower. </constant> <constant name="PARAM_ANGULAR_MOTOR_TARGET_VELOCITY" value="12"> + Target speed for the motor at the axes. </constant> <constant name="PARAM_ANGULAR_MOTOR_FORCE_LIMIT" value="13"> + Maximum acceleration for the motor at the axes. </constant> <constant name="PARAM_MAX" value="14"> + End flag of PARAM_* constants, used internally. </constant> <constant name="FLAG_ENABLE_LINEAR_LIMIT" value="0"> + If [code]set[/code] there is linear motion possible within the given limits. </constant> <constant name="FLAG_ENABLE_ANGULAR_LIMIT" value="1"> + If [code]set[/code] there is rotational motion possible. </constant> <constant name="FLAG_ENABLE_MOTOR" value="2"> + If [code]set[/code] there is a rotational motor across these axes. </constant> <constant name="FLAG_MAX" value="3"> + End flag of FLAG_* constants, used internally. </constant> </constants> </class> 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/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index c2839890cf..b780d29d0e 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -166,7 +166,7 @@ Request does not have a response(yet). </constant> <constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7"> - Request exceded its maximum size limit, see [method set_body_size_limit]. + Request exceeded its maximum size limit, see [method set_body_size_limit]. </constant> <constant name="RESULT_REQUEST_FAILED" value="8"> Request failed. (unused) diff --git a/doc/classes/HingeJoint.xml b/doc/classes/HingeJoint.xml index ae3693c3a4..d18e63f8a3 100644 --- a/doc/classes/HingeJoint.xml +++ b/doc/classes/HingeJoint.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="HingeJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> <brief_description> + A hinge between two 3D bodies. </brief_description> <description> + Normaly uses the z-axis of body A as the hinge axis, another axis can be specified when adding it manually though. </description> <tutorials> </tutorials> @@ -48,50 +50,70 @@ </methods> <members> <member name="angular_limit/bias" type="float" setter="set_param" getter="get_param"> + The speed with which the rotation across the axis perpendicular to the hinge gets corrected. </member> <member name="angular_limit/enable" type="bool" setter="set_flag" getter="get_flag"> + If [code]true[/code] the hinges maximum and minimum rotation, defined by [member angular_limit/lower] and [member angular_limit/upper] has effects. </member> <member name="angular_limit/lower" type="float" setter="_set_lower_limit" getter="_get_lower_limit"> + The minimum rotation. only active if [member angular_limit/enable] is [code]true[/code]. </member> <member name="angular_limit/relaxation" type="float" setter="set_param" getter="get_param"> + The lower this value, the more the rotation gets slowed down. </member> <member name="angular_limit/softness" type="float" setter="set_param" getter="get_param"> </member> <member name="angular_limit/upper" type="float" setter="_set_upper_limit" getter="_get_upper_limit"> + The maximum rotation. only active if [member angular_limit/enable] is [code]true[/code]. </member> <member name="motor/enable" type="bool" setter="set_flag" getter="get_flag"> + When activated, a motor turns the hinge. </member> <member name="motor/max_impulse" type="float" setter="set_param" getter="get_param"> + Maximum acceleration for the motor. </member> <member name="motor/target_velocity" type="float" setter="set_param" getter="get_param"> + Target speed for the motor. </member> <member name="params/bias" type="float" setter="set_param" getter="get_param"> + The speed with wich the two bodies get pulled together when they move in different directions. </member> </members> <constants> <constant name="PARAM_BIAS" value="0"> + The speed with wich the two bodies get pulled together when they move in different directions. </constant> <constant name="PARAM_LIMIT_UPPER" value="1"> + The maximum rotation. only active if [member angular_limit/enable] is [code]true[/code]. </constant> <constant name="PARAM_LIMIT_LOWER" value="2"> + The minimum rotation. only active if [member angular_limit/enable] is [code]true[/code]. </constant> <constant name="PARAM_LIMIT_BIAS" value="3"> + The speed with which the rotation across the axis perpendicular to the hinge gets corrected. </constant> <constant name="PARAM_LIMIT_SOFTNESS" value="4"> </constant> <constant name="PARAM_LIMIT_RELAXATION" value="5"> + The lower this value, the more the rotation gets slowed down. </constant> <constant name="PARAM_MOTOR_TARGET_VELOCITY" value="6"> + Target speed for the motor. </constant> <constant name="PARAM_MOTOR_MAX_IMPULSE" value="7"> + Maximum acceleration for the motor. </constant> <constant name="PARAM_MAX" value="8"> + End flag of PARAM_* constants, used internally. </constant> <constant name="FLAG_USE_LIMIT" value="0"> + If [code]true[/code] the hinges maximum and minimum rotation, defined by [member angular_limit/lower] and [member angular_limit/upper] has effects. </constant> <constant name="FLAG_ENABLE_MOTOR" value="1"> + When activated, a motor turns the hinge. </constant> <constant name="FLAG_MAX" value="2"> + End flag of FLAG_* constants, used internally. </constant> </constants> </class> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 3d8b4154f8..d2d01dacb4 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -4,7 +4,7 @@ A Singleton that deals with inputs. </brief_description> <description> - A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joypads, and input actions. + A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joypads, and input actions. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap]. </description> <tutorials> </tutorials> @@ -75,7 +75,7 @@ <argument index="1" name="axis" type="int"> </argument> <description> - Returns the current value of the joypad axis at given index (see JOY_* constants in [@Global Scope]) + Returns the current value of the joypad axis at given index (see [code]JOY_*[/code] constants in [@Global Scope]) </description> </method> <method name="get_joy_axis_index_from_string"> @@ -180,6 +180,7 @@ <argument index="0" name="action" type="String"> </argument> <description> + Returns [code]true[/code] when you start pressing the action event. </description> </method> <method name="is_action_just_released" qualifiers="const"> @@ -188,6 +189,7 @@ <argument index="0" name="action" type="String"> </argument> <description> + Returns [code]true[/code] when you stop pressing the action event. </description> </method> <method name="is_action_pressed" qualifiers="const"> @@ -196,7 +198,7 @@ <argument index="0" name="action" type="String"> </argument> <description> - Returns true or false depending on whether the action event is pressed. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap]. + Returns [code]true[/code] if you are pressing the action event. </description> </method> <method name="is_joy_button_pressed" qualifiers="const"> @@ -207,7 +209,7 @@ <argument index="1" name="button" type="int"> </argument> <description> - Returns if the joypad button at the given index is currently pressed. (see JOY_* constants in [@Global Scope]) + Returns [code]true[/code] if you are pressing the joypad button. (see [code]JOY_*[/code] constants in [@Global Scope]) </description> </method> <method name="is_joy_known"> @@ -216,7 +218,7 @@ <argument index="0" name="device" type="int"> </argument> <description> - Returns if the specified device is known by the system. This means that it sets all button and axis indices exactly as defined in the JOY_* constants (see [@Global Scope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them. + Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in the [code]JOY_*[/code] constants (see [@Global Scope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them. </description> </method> <method name="is_key_pressed" qualifiers="const"> @@ -225,7 +227,7 @@ <argument index="0" name="scancode" type="int"> </argument> <description> - Returns true or false depending on whether the key is pressed or not. You can pass KEY_*, which are pre-defined constants listed in [@Global Scope]. + Returns [code]true[/code] if you are pressing the key. You can pass [code]KEY_*[/code], which are pre-defined constants listed in [@Global Scope]. </description> </method> <method name="is_mouse_button_pressed" qualifiers="const"> @@ -234,7 +236,21 @@ <argument index="0" name="button" type="int"> </argument> <description> - 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]. + Returns [code]true[/code] if you are pressing the mouse button. You can pass [code]BUTTON_*[/code], 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"> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index a8d879888f..37c1db51f5 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -217,7 +217,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns whether the tooptip is enabled for specified item index. + Returns whether the tooltip is enabled for specified item index. </description> </method> <method name="is_same_column_width" qualifiers="const"> @@ -511,7 +511,7 @@ <argument index="1" name="selected" type="bool"> </argument> <description> - Fired when a multiple selection is altered on a list allowing mutliple selection. + Fired when a multiple selection is altered on a list allowing multiple selection. </description> </signal> </signals> diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml index 86edaaf1e6..db9a681896 100644 --- a/doc/classes/JSONParseResult.xml +++ b/doc/classes/JSONParseResult.xml @@ -79,7 +79,7 @@ The error message if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants. </member> <member name="result" type="Variant" setter="set_result" getter="get_result"> - A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For exemple, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned. + A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For example, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned. [i]Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert all numerical values to float types.[/i] [codeblock] p = JSON.parse('["hello", "world", "!"]') diff --git a/doc/classes/Joint.xml b/doc/classes/Joint.xml index 2e7d24aac1..901f84fe5e 100644 --- a/doc/classes/Joint.xml +++ b/doc/classes/Joint.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Joint" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Base class for all 3D joints </brief_description> <description> + All 3D joints link two nodes, has a priority, and can decide if the two bodies of the nodes should be able to collide with each other </description> <tutorials> </tutorials> @@ -68,12 +70,16 @@ </methods> <members> <member name="collision/exclude_nodes" type="bool" setter="set_exclude_nodes_from_collision" getter="get_exclude_nodes_from_collision"> + If [code]true[/code] the two bodies of the nodes are not able to collide with each other. </member> <member name="nodes/node_a" type="NodePath" setter="set_node_a" getter="get_node_a"> + The [Node], the first side of the Joint attaches to. </member> <member name="nodes/node_b" type="NodePath" setter="set_node_b" getter="get_node_b"> + The [Node], the second side of the Joint attaches to. </member> <member name="solver/priority" type="int" setter="set_solver_priority" getter="get_solver_priority"> + The order in wich the solver is executed compared to the other [Joints], the lower, the earlier. </member> </members> <constants> 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/NinePatchRect.xml b/doc/classes/NinePatchRect.xml index 6829b36e14..c74f3c5a68 100644 --- a/doc/classes/NinePatchRect.xml +++ b/doc/classes/NinePatchRect.xml @@ -111,7 +111,7 @@ If [code]true[/code], draw the panel's center. Else, only draw the 9-slice's borders. Default value: [code]true[/code] </member> <member name="patch_margin_bottom" type="int" setter="set_patch_margin" getter="get_patch_margin"> - The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values indivually to create panels with non-uniform borders. + The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. </member> <member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin"> The height of the 9-slice's left column. 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 d411d07979..73b424eb12 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -26,14 +26,14 @@ <return type="bool"> </return> <description> - Return true if the host OS allows drawing. + Returns [code]true[/code] if the host OS allows drawing. </description> </method> <method name="can_use_threads" qualifiers="const"> <return type="bool"> </return> <description> - Returns if the current host platform is using multiple threads. + Returns [code]true[/code] if the current host platform is using multiple threads. </description> </method> <method name="delay_msec" qualifiers="const"> @@ -117,7 +117,7 @@ <return type="PoolStringArray"> </return> <description> - Return the commandline passed to the engine. + Returns the command line arguments passed to the engine. </description> </method> <method name="get_current_screen" qualifiers="const"> @@ -131,7 +131,7 @@ <return type="String"> </return> <description> - Return the absolute directory path of user data path([user://]). + Returns the absolute directory path of user data path([user://]). </description> </method> <method name="get_date" qualifiers="const"> @@ -166,7 +166,7 @@ <return type="int"> </return> <description> - Return the total amount of dynamic memory used (only works in debug). + Returns the total amount of dynamic memory used (only works in debug). </description> </method> <method name="get_environment" qualifiers="const"> @@ -175,14 +175,14 @@ <argument index="0" name="environment" type="String"> </argument> <description> - Return an environment variable. + Returns an environment variable. </description> </method> <method name="get_executable_path" qualifiers="const"> <return type="String"> </return> <description> - Return the path to the current engine executable. + Returns the path to the current engine executable. </description> </method> <method name="get_exit_code" qualifiers="const"> @@ -203,7 +203,7 @@ <return type="String"> </return> <description> - Return the host OS locale. + Returns the host OS locale. </description> </method> <method name="get_model_name" qualifiers="const"> @@ -217,25 +217,28 @@ <return type="String"> </return> <description> - Return the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11". + Returns the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11". </description> </method> <method name="get_power_percent_left"> <return type="int"> </return> <description> + Returns the amount of battery left in the device as a percentage. </description> </method> <method name="get_power_seconds_left"> <return type="int"> </return> <description> + Returns the time in seconds before the device runs out of battery. </description> </method> <method name="get_power_state"> <return type="int" enum="OS.PowerState"> </return> <description> + Returns the current state of the device regarding battery and power. See [code]POWERSTATE_*[/code] constants. </description> </method> <method name="get_process_id" qualifiers="const"> @@ -265,7 +268,7 @@ <return type="int"> </return> <description> - Returns the number of displays attached to the host machine + Returns the number of displays attached to the host machine. </description> </method> <method name="get_screen_dpi" qualifiers="const"> @@ -298,6 +301,7 @@ <argument index="0" name="screen" type="int" default="-1"> </argument> <description> + Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used. </description> </method> <method name="get_screen_size" qualifiers="const"> @@ -319,7 +323,7 @@ <return type="int"> </return> <description> - Return the max amount of static memory used (only works in debug). + Returns the max amount of static memory used (only works in debug). </description> </method> <method name="get_static_memory_usage" qualifiers="const"> @@ -335,6 +339,7 @@ <argument index="0" name="dir" type="int" enum="OS.SystemDir"> </argument> <description> + Returns the actual path to commonly used folders across different platforms. Available locations are specified in [OS.SystemDir]. </description> </method> <method name="get_system_time_secs" qualifiers="const"> @@ -348,7 +353,7 @@ <return type="int"> </return> <description> - Return the amount of time passed in milliseconds since the engine started. + Returns the amount of time passed in milliseconds since the engine started. </description> </method> <method name="get_time" qualifiers="const"> @@ -357,19 +362,21 @@ <argument index="0" name="utc" type="bool" default="false"> </argument> <description> - Returns current time as a dictionary of keys: hour, minute, second + Returns current time as a dictionary of keys: hour, minute, second. </description> </method> <method name="get_time_zone_info" qualifiers="const"> <return type="Dictionary"> </return> <description> + Returns the current time zone as a dictionary with the keys: bias and name. </description> </method> <method name="get_unique_id" qualifiers="const"> <return type="String"> </return> <description> + Returns a unique string. </description> </method> <method name="get_unix_time" qualifiers="const"> @@ -390,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> @@ -410,20 +423,29 @@ <argument index="0" name="environment" type="String"> </argument> <description> - Return true if an environment variable exists. + 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> <description> + Returns [code]true[/code] if the device has a touchscreen or emulates one. </description> </method> <method name="has_virtual_keyboard" qualifiers="const"> <return type="bool"> </return> <description> - Returns true if the platform has a virtual keyboard, false otherwise. + Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise. </description> </method> <method name="hide_virtual_keyboard"> @@ -446,20 +468,21 @@ <return type="bool"> </return> <description> - Return true if low cpu usage mode is enabled. + Returns [code]true[/code] if low cpu usage mode is enabled. </description> </method> <method name="is_keep_screen_on" qualifiers="const"> <return type="bool"> </return> <description> - Returns whether the screen is being kept on or not. + Returns [code]true[/code] if the screen is being kept on. </description> </method> <method name="is_ok_left_and_cancel_right" qualifiers="const"> <return type="bool"> </return> <description> + 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"> @@ -468,13 +491,14 @@ <argument index="0" name="code" type="int"> </argument> <description> + Returns [code]true[/code] if the input code has a unicode character. </description> </method> <method name="is_stdout_verbose" qualifiers="const"> <return type="bool"> </return> <description> - Return true if the engine was executed with -v (verbose stdout). + Returns [code]true[/code] if the engine was executed with -v (verbose stdout). </description> </method> <method name="is_userfs_persistent" qualifiers="const"> @@ -495,28 +519,28 @@ <return type="bool"> </return> <description> - Returns whether the window is in fullscreen mode or not. + Returns [code]true[/code] if the window is in fullscreen mode. </description> </method> <method name="is_window_maximized" qualifiers="const"> <return type="bool"> </return> <description> - Return true if the window is maximized. + Returns [code]true[/code] if the window is maximized. </description> </method> <method name="is_window_minimized" qualifiers="const"> <return type="bool"> </return> <description> - Return true if the window is minimized. + Returns [code]true[/code] if the window is minimized. </description> </method> <method name="is_window_resizable" qualifiers="const"> <return type="bool"> </return> <description> - Returns whether the window is resizable or not. + Returns [code]true[/code] if the window is resizable. </description> </method> <method name="kill"> @@ -532,12 +556,14 @@ <return type="bool"> </return> <description> + Returns [code]true[/code] if native video is playing. </description> </method> <method name="native_video_pause"> <return type="void"> </return> <description> + Pauses native video playback. </description> </method> <method name="native_video_play"> @@ -552,18 +578,21 @@ <argument index="3" name="subtitle_track" type="String"> </argument> <description> + Plays native video from the specified path, at the given volume and with audio and subtitle tracks. </description> </method> <method name="native_video_stop"> <return type="void"> </return> <description> + Stops native video playback. </description> </method> <method name="native_video_unpause"> <return type="void"> </return> <description> + Resumes native video playback. </description> </method> <method name="print_all_resources"> @@ -572,12 +601,14 @@ <argument index="0" name="tofile" type="String" default=""""> </argument> <description> + Shows all resources in the game. Optionally the list can be written to a file. </description> </method> <method name="print_all_textures_by_size"> <return type="void"> </return> <description> + Shows the list of loaded textures sorted by size in memory. </description> </method> <method name="print_resources_by_type"> @@ -586,6 +617,7 @@ <argument index="0" name="types" type="PoolStringArray"> </argument> <description> + Shows the number of resources loaded by the game of the given types. </description> </method> <method name="print_resources_in_use"> @@ -594,6 +626,7 @@ <argument index="0" name="short" type="bool" default="false"> </argument> <description> + Shows all resources currently used by the game. </description> </method> <method name="request_attention"> @@ -609,6 +642,7 @@ <argument index="0" name="borderless" type="bool"> </argument> <description> + Removes the window frame. </description> </method> <method name="set_clipboard"> @@ -617,7 +651,7 @@ <argument index="0" name="clipboard" type="String"> </argument> <description> - Set clipboard to the OS. + Sets clipboard to the OS. </description> </method> <method name="set_current_screen"> @@ -626,6 +660,7 @@ <argument index="0" name="screen" type="int"> </argument> <description> + Sets the current screen by index. </description> </method> <method name="set_exit_code"> @@ -634,6 +669,7 @@ <argument index="0" name="code" type="int"> </argument> <description> + Sets the exit code that will be returned by the game. </description> </method> <method name="set_icon"> @@ -642,6 +678,7 @@ <argument index="0" name="icon" type="Image"> </argument> <description> + Sets the game's icon. </description> </method> <method name="set_ime_position"> @@ -658,7 +695,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Set keep screen on if true, or goes to sleep by device setting if false. (for Android/iOS) + Sets keep screen on if true, or goes to sleep by device setting if false. (for Android/iOS) </description> </method> <method name="set_low_processor_usage_mode"> @@ -667,7 +704,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Set to true to enable the low cpu usage mode. In this mode, the screen only redraws when there are changes, and a considerable sleep time is inserted between frames. This way, editors using the engine UI only use very little cpu. + Set to [code]true[/code] to enable the low cpu usage mode. In this mode, the screen only redraws when there are changes, and a considerable sleep time is inserted between frames. Use this in tool mode to reduce CPU usage. </description> </method> <method name="set_screen_orientation"> @@ -685,6 +722,7 @@ <argument index="0" name="name" type="String"> </argument> <description> + Sets the name of the current thread. </description> </method> <method name="set_use_file_access_save_and_swap"> @@ -693,6 +731,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> + Enables backup saves if [code]enabled[/code] is [code]true[/code]. </description> </method> <method name="set_use_vsync"> @@ -719,7 +758,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Set the window size to maximized. + Set [code]true[/code] to maximize the window. </description> </method> <method name="set_window_minimized"> @@ -728,7 +767,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Set whether the window is minimized. + Set [code]true[/code] to minimize the window. </description> </method> <method name="set_window_position"> @@ -746,7 +785,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Set the window resizable state, if the window is not resizable it will preserve the dimensions specified in the project settings. + Sets the window resizable state, if the window is not resizable it will preserve the dimensions specified in the project settings. </description> </method> <method name="set_window_size"> @@ -773,6 +812,9 @@ <argument index="0" name="uri" type="String"> </argument> <description> + Requests the OS to open a resource with the most appropriate program. For example. + [code]OS.shell_open("C:\\Users\name\Downloads")[/code] on Windows opens the file explorer at the downloads folders of the user. + [code]OS.shell_open("http://godotengine.org")[/code] opens the default web browser on the official Godot website. </description> </method> <method name="show_virtual_keyboard"> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 67421487f1..d30ebfaef8 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -6,7 +6,7 @@ <description> Base class for all non built-in types. Everything not a built-in type starts the inheritance chain from this class. Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++). - Some derivates add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted. + Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them. Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together. </description> @@ -165,7 +165,7 @@ <return type="Array"> </return> <description> - Returns an [Array] of dictionaries with informations about signals that are connected to this object. + Returns an [Array] of dictionaries with information about signals that are connected to this object. Inside each [Dictionary] there are 3 fields: - "source" is a reference to signal emitter. - "signal_name" is name of connected signal. 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..edc46a53d0 100644 --- a/doc/classes/Physics2DServer.xml +++ b/doc/classes/Physics2DServer.xml @@ -21,7 +21,7 @@ <argument index="2" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )"> </argument> <description> - Add a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. + Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. </description> </method> <method name="area_attach_object_instance_id"> @@ -32,7 +32,7 @@ <argument index="1" name="id" type="int"> </argument> <description> - Assign the area to a descendant of [Object], so it can exist in the node tree. + Assigns the area to a descendant of [Object], so it can exist in the node tree. </description> </method> <method name="area_clear_shapes"> @@ -41,14 +41,14 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Remove all shapes from an area. It does not delete the shapes, so they can be reassigned later. + Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later. </description> </method> <method name="area_create"> <return type="RID"> </return> <description> - Create an [Area2D]. + Creates an [Area2D]. </description> </method> <method name="area_get_object_instance_id" qualifiers="const"> @@ -57,7 +57,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Get the instance ID of the object the area is assigned to. + Gets the instance ID of the object the area is assigned to. </description> </method> <method name="area_get_param" qualifiers="const"> @@ -68,7 +68,7 @@ <argument index="1" name="param" type="int" enum="Physics2DServer.AreaParameter"> </argument> <description> - Return an area parameter value. + Returns an area parameter value. A list of available parameters is on the AREA_PARAM_* constants. </description> </method> <method name="area_get_shape" qualifiers="const"> @@ -79,7 +79,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Return the [RID] of the nth shape of an area. + Returns the [RID] of the nth shape of an area. </description> </method> <method name="area_get_shape_count" qualifiers="const"> @@ -88,7 +88,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Return the number of shapes assigned to an area. + Returns the number of shapes assigned to an area. </description> </method> <method name="area_get_shape_transform" qualifiers="const"> @@ -99,7 +99,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Return the transform matrix of a shape within an area. + Returns the transform matrix of a shape within an area. </description> </method> <method name="area_get_space" qualifiers="const"> @@ -108,7 +108,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Return the space assigned to the area. + Returns the space assigned to the area. </description> </method> <method name="area_get_space_override_mode" qualifiers="const"> @@ -117,7 +117,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Return the space override mode for the area. + Returns the space override mode for the area. </description> </method> <method name="area_get_transform" qualifiers="const"> @@ -126,7 +126,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> - Return the transform matrix for an area. + Returns the transform matrix for an area. </description> </method> <method name="area_remove_shape"> @@ -137,7 +137,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Remove a shape from an area. It does not delete the shape, so it can be reassigned later. + Removes a shape from an area. It does not delete the shape, so it can be reassigned later. </description> </method> <method name="area_set_collision_layer"> @@ -148,7 +148,7 @@ <argument index="1" name="layer" type="int"> </argument> <description> - Assign the area to one or many physics layers. + Assigns the area to one or many physics layers. </description> </method> <method name="area_set_collision_mask"> @@ -159,7 +159,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> - Set which physics layers the area will monitor. + Sets which physics layers the area will monitor. </description> </method> <method name="area_set_monitor_callback"> @@ -172,7 +172,7 @@ <argument index="2" name="method" type="String"> </argument> <description> - Set the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: + Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: 1: AREA_BODY_ADDED or AREA_BODY_REMOVED, depending on whether the object entered or exited the area. 2: [RID] of the object that entered/exited the area. 3: Instance ID of the object that entered/exited the area. @@ -190,7 +190,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> - Set the value for an area parameter. A list of available parameters is on the AREA_PARAM_* constants. + Sets the value for an area parameter. A list of available parameters is on the AREA_PARAM_* constants. </description> </method> <method name="area_set_shape"> @@ -203,7 +203,7 @@ <argument index="2" name="shape" type="RID"> </argument> <description> - Substitute a given area shape by another. The old shape is selected by its index, the new one by its [RID]. + Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [RID]. </description> </method> <method name="area_set_shape_disabled"> @@ -216,6 +216,7 @@ <argument index="2" name="disable" type="bool"> </argument> <description> + Disables a given shape in this area if [code]disable is true[/code] </description> </method> <method name="area_set_shape_transform"> @@ -228,7 +229,7 @@ <argument index="2" name="transform" type="Transform2D"> </argument> <description> - Set the transform matrix for an area shape. + Sets the transform matrix for an area shape. </description> </method> <method name="area_set_space"> @@ -239,7 +240,7 @@ <argument index="1" name="space" type="RID"> </argument> <description> - Assign a space to the area. + Assigns a space to the area. </description> </method> <method name="area_set_space_override_mode"> @@ -250,7 +251,7 @@ <argument index="1" name="mode" type="int" enum="Physics2DServer.AreaSpaceOverrideMode"> </argument> <description> - Set the space override mode for the area. The modes are described in the constants AREA_SPACE_OVERRIDE_*. + Sets the space override mode for the area. The modes are described in the constants AREA_SPACE_OVERRIDE_*. </description> </method> <method name="area_set_transform"> @@ -261,7 +262,7 @@ <argument index="1" name="transform" type="Transform2D"> </argument> <description> - Set the transform matrix for an area. + Sets the transform matrix for an area. </description> </method> <method name="body_add_collision_exception"> @@ -272,7 +273,7 @@ <argument index="1" name="excepted_body" type="RID"> </argument> <description> - Add a body to the list of bodies exempt from collisions. + Adds a body to the list of bodies exempt from collisions. </description> </method> <method name="body_add_force"> @@ -285,7 +286,7 @@ <argument index="2" name="force" type="Vector2"> </argument> <description> - Add a positioned force to the applied force and torque. As with [method body_apply_impulse], both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied. + Adds a positioned force to the applied force and torque. As with [method body_apply_impulse], both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied. </description> </method> <method name="body_add_shape"> @@ -298,7 +299,7 @@ <argument index="2" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )"> </argument> <description> - Add a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. + Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. </description> </method> <method name="body_apply_impulse"> @@ -311,7 +312,7 @@ <argument index="2" name="impulse" type="Vector2"> </argument> <description> - Add a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. + Adds a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. </description> </method> <method name="body_attach_object_instance_id"> @@ -322,7 +323,7 @@ <argument index="1" name="id" type="int"> </argument> <description> - Assign the area to a descendant of [Object], so it can exist in the node tree. + Assigns the area to a descendant of [Object], so it can exist in the node tree. </description> </method> <method name="body_clear_shapes"> @@ -331,7 +332,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Remove all shapes from a body. + Removes all shapes from a body. </description> </method> <method name="body_create"> @@ -342,7 +343,7 @@ <argument index="1" name="init_sleeping" type="bool" default="false"> </argument> <description> - Create a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time. + Creates a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time. </description> </method> <method name="body_get_collision_layer" qualifiers="const"> @@ -351,7 +352,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the physics layer or layers a body belongs to. + Returns the physics layer or layers a body belongs to. </description> </method> <method name="body_get_collision_mask" qualifiers="const"> @@ -360,7 +361,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the physics layer or layers a body can collide with. + Returns the physics layer or layers a body can collide with. </description> </method> <method name="body_get_continuous_collision_detection_mode" qualifiers="const"> @@ -369,7 +370,16 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the continuous collision detection mode. + Returns 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> + Returns the [Physics2DDirectBodyState] of the body. </description> </method> <method name="body_get_max_contacts_reported" qualifiers="const"> @@ -378,7 +388,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the maximum contacts that can be reported. See [method body_set_max_contacts_reported]. + Returns the maximum contacts that can be reported. See [method body_set_max_contacts_reported]. </description> </method> <method name="body_get_mode" qualifiers="const"> @@ -387,7 +397,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the body mode. + Returns the body mode. </description> </method> <method name="body_get_object_instance_id" qualifiers="const"> @@ -396,7 +406,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Get the instance ID of the object the area is assigned to. + Gets the instance ID of the object the area is assigned to. </description> </method> <method name="body_get_param" qualifiers="const"> @@ -407,7 +417,7 @@ <argument index="1" name="param" type="int" enum="Physics2DServer.BodyParameter"> </argument> <description> - Return the value of a body parameter. + Returns the value of a body parameter. A list of available parameters is on the BODY_PARAM_* constants. </description> </method> <method name="body_get_shape" qualifiers="const"> @@ -418,7 +428,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Return the [RID] of the nth shape of a body. + Returns the [RID] of the nth shape of a body. </description> </method> <method name="body_get_shape_count" qualifiers="const"> @@ -427,7 +437,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the number of shapes assigned to a body. + Returns the number of shapes assigned to a body. </description> </method> <method name="body_get_shape_metadata" qualifiers="const"> @@ -438,7 +448,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Return the metadata of a shape of a body. + Returns the metadata of a shape of a body. </description> </method> <method name="body_get_shape_transform" qualifiers="const"> @@ -449,7 +459,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Return the transform matrix of a body shape. + Returns the transform matrix of a body shape. </description> </method> <method name="body_get_space" qualifiers="const"> @@ -458,7 +468,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return the [RID] of the space assigned to a body. + Returns the [RID] of the space assigned to a body. </description> </method> <method name="body_get_state" qualifiers="const"> @@ -469,7 +479,7 @@ <argument index="1" name="state" type="int" enum="Physics2DServer.BodyState"> </argument> <description> - Return a body state. + Returns a body state. </description> </method> <method name="body_is_omitting_force_integration" qualifiers="const"> @@ -478,7 +488,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> - Return whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). + Returns whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_remove_collision_exception"> @@ -489,7 +499,7 @@ <argument index="1" name="excepted_body" type="RID"> </argument> <description> - Remove a body from the list of bodies exempt from collisions. + Removes a body from the list of bodies exempt from collisions. </description> </method> <method name="body_remove_shape"> @@ -500,7 +510,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> - Remove a shape from a body. The shape is not deleted, so it can be reused afterwards. + Removes a shape from a body. The shape is not deleted, so it can be reused afterwards. </description> </method> <method name="body_set_axis_velocity"> @@ -511,7 +521,7 @@ <argument index="1" name="axis_velocity" type="Vector2"> </argument> <description> - Set an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. + Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. </description> </method> <method name="body_set_collision_layer"> @@ -522,7 +532,7 @@ <argument index="1" name="layer" type="int"> </argument> <description> - Set the physics layer or layers a body belongs to. + Sets the physics layer or layers a body belongs to. </description> </method> <method name="body_set_collision_mask"> @@ -533,7 +543,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> - Set the physics layer or layers a body can collide with. + Sets the physics layer or layers a body can collide with. </description> </method> <method name="body_set_continuous_collision_detection_mode"> @@ -544,7 +554,7 @@ <argument index="1" name="mode" type="int" enum="Physics2DServer.CCDMode"> </argument> <description> - Set the continuous collision detection mode from any of the CCD_MODE_* constants. + Sets the continuous collision detection mode from any of the CCD_MODE_* constants. Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. </description> </method> @@ -560,7 +570,7 @@ <argument index="3" name="userdata" type="Variant" default="null"> </argument> <description> - Set the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]). + Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]). </description> </method> <method name="body_set_max_contacts_reported"> @@ -571,7 +581,7 @@ <argument index="1" name="amount" type="int"> </argument> <description> - Set the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. + Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. </description> </method> <method name="body_set_mode"> @@ -582,7 +592,7 @@ <argument index="1" name="mode" type="int" enum="Physics2DServer.BodyMode"> </argument> <description> - Set the body mode, from one of the constants BODY_MODE*. + Sets the body mode, from one of the constants BODY_MODE*. </description> </method> <method name="body_set_omit_force_integration"> @@ -593,7 +603,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - Set whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). + Sets whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_set_param"> @@ -606,7 +616,7 @@ <argument index="2" name="value" type="float"> </argument> <description> - Set a body parameter (see BODY_PARAM* constants). + Sets a body parameter. A list of available parameters is on the BODY_PARAM_* constants. </description> </method> <method name="body_set_shape"> @@ -619,7 +629,7 @@ <argument index="2" name="shape" type="RID"> </argument> <description> - Substitute a given body shape by another. The old shape is selected by its index, the new one by its [RID]. + Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [RID]. </description> </method> <method name="body_set_shape_as_one_way_collision"> @@ -632,6 +642,7 @@ <argument index="2" name="enable" type="bool"> </argument> <description> + Enables one way collision on body if [code]enable is true[/code]. </description> </method> <method name="body_set_shape_disabled"> @@ -644,6 +655,7 @@ <argument index="2" name="disable" type="bool"> </argument> <description> + Disables shape in body if [code]disable is true[/code]. </description> </method> <method name="body_set_shape_metadata"> @@ -656,7 +668,7 @@ <argument index="2" name="metadata" type="Variant"> </argument> <description> - Set metadata of a shape within a body. This metadata is different from [method Object.set_meta], and can be retrieved on shape queries. + Sets metadata of a shape within a body. This metadata is different from [method Object.set_meta], and can be retrieved on shape queries. </description> </method> <method name="body_set_shape_transform"> @@ -669,7 +681,7 @@ <argument index="2" name="transform" type="Transform2D"> </argument> <description> - Set the transform matrix for a body shape. + Sets the transform matrix for a body shape. </description> </method> <method name="body_set_space"> @@ -680,7 +692,7 @@ <argument index="1" name="space" type="RID"> </argument> <description> - Assign a space to the body (see [method create_space]). + Assigns a space to the body (see [method create_space]). </description> </method> <method name="body_set_state"> @@ -693,7 +705,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> - Set a body state (see BODY_STATE* constants). + Sets a body state (see BODY_STATE* constants). </description> </method> <method name="body_test_motion"> @@ -710,7 +722,7 @@ <argument index="4" name="result" type="Physics2DTestMotionResult" default="null"> </argument> <description> - Return whether a body can move from a given point in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in. + Returns whether a body can move from a given point in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in. </description> </method> <method name="damped_spring_joint_create"> @@ -725,7 +737,7 @@ <argument index="3" name="body_b" type="RID"> </argument> <description> - Create a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. + Creates a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. </description> </method> <method name="damped_string_joint_get_param" qualifiers="const"> @@ -736,7 +748,7 @@ <argument index="1" name="param" type="int" enum="Physics2DServer.DampedStringParam"> </argument> <description> - Return the value of a damped spring joint parameter. + Returns the value of a damped spring joint parameter. </description> </method> <method name="damped_string_joint_set_param"> @@ -749,7 +761,7 @@ <argument index="2" name="value" type="float"> </argument> <description> - Set a damped spring joint parameter. Parameters are explained in the DAMPED_STRING* constants. + Sets a damped spring joint parameter. Parameters are explained in the DAMPED_STRING* constants. </description> </method> <method name="free_rid"> @@ -758,7 +770,7 @@ <argument index="0" name="rid" type="RID"> </argument> <description> - Destroy any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. + Destroys any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. </description> </method> <method name="get_process_info"> @@ -767,7 +779,7 @@ <argument index="0" name="process_info" type="int" enum="Physics2DServer.ProcessInfo"> </argument> <description> - Return information about the current state of the 2D physics engine. The states are listed under the INFO_* constants. + Returns information about the current state of the 2D physics engine. The states are listed under the INFO_* constants. </description> </method> <method name="groove_joint_create"> @@ -784,7 +796,7 @@ <argument index="4" name="body_b" type="RID"> </argument> <description> - Create a groove joint between two bodies. If not specified, the bodyies are assumed to be the joint itself. + Creates a groove joint between two bodies. If not specified, the bodyies are assumed to be the joint itself. </description> </method> <method name="joint_get_param" qualifiers="const"> @@ -795,7 +807,7 @@ <argument index="1" name="param" type="int" enum="Physics2DServer.JointParam"> </argument> <description> - Return the value of a joint parameter. + Returns the value of a joint parameter. </description> </method> <method name="joint_get_type" qualifiers="const"> @@ -804,7 +816,7 @@ <argument index="0" name="joint" type="RID"> </argument> <description> - Return the type of a joint (see JOINT_* constants). + Returns the type of a joint (see JOINT_* constants). </description> </method> <method name="joint_set_param"> @@ -817,7 +829,7 @@ <argument index="2" name="value" type="float"> </argument> <description> - Set a joint parameter. Parameters are explained in the JOINT_PARAM* constants. + Sets a joint parameter. Parameters are explained in the JOINT_PARAM* constants. </description> </method> <method name="pin_joint_create"> @@ -830,7 +842,7 @@ <argument index="2" name="body_b" type="RID"> </argument> <description> - Create a pin joint between two bodies. If not specified, the second body is assumed to be the joint itself. + Creates a pin joint between two bodies. If not specified, the second body is assumed to be the joint itself. </description> </method> <method name="set_active"> @@ -839,7 +851,7 @@ <argument index="0" name="active" type="bool"> </argument> <description> - Activate or deactivate the 2D physics engine. + Activates or deactivates the 2D physics engine. </description> </method> <method name="shape_create"> @@ -848,7 +860,7 @@ <argument index="0" name="type" type="int" enum="Physics2DServer.ShapeType"> </argument> <description> - Create a shape of type SHAPE_*. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape]. + Creates a shape of type SHAPE_*. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape]. </description> </method> <method name="shape_get_data" qualifiers="const"> @@ -857,7 +869,7 @@ <argument index="0" name="shape" type="RID"> </argument> <description> - Return the shape data. + Returns the shape data. </description> </method> <method name="shape_get_type" qualifiers="const"> @@ -866,7 +878,7 @@ <argument index="0" name="shape" type="RID"> </argument> <description> - Return the type of shape (see SHAPE_* constants). + Returns the type of shape (see SHAPE_* constants). </description> </method> <method name="shape_set_data"> @@ -877,14 +889,14 @@ <argument index="1" name="data" type="Variant"> </argument> <description> - Set the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type]. + Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type]. </description> </method> <method name="space_create"> <return type="RID"> </return> <description> - Create a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space]. + Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space]. </description> </method> <method name="space_get_direct_state"> @@ -893,7 +905,7 @@ <argument index="0" name="space" type="RID"> </argument> <description> - Return the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries. + Returns the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries. </description> </method> <method name="space_get_param" qualifiers="const"> @@ -904,7 +916,7 @@ <argument index="1" name="param" type="int" enum="Physics2DServer.SpaceParameter"> </argument> <description> - Return the value of a space parameter. + Returns the value of a space parameter. </description> </method> <method name="space_is_active" qualifiers="const"> @@ -913,7 +925,7 @@ <argument index="0" name="space" type="RID"> </argument> <description> - Return whether the space is active. + Returns whether the space is active. </description> </method> <method name="space_set_active"> @@ -924,7 +936,7 @@ <argument index="1" name="active" type="bool"> </argument> <description> - Mark a space as active. It will not have an effect, unless it is assigned to an area or body. + Marks a space as active. It will not have an effect, unless it is assigned to an area or body. </description> </method> <method name="space_set_param"> @@ -937,7 +949,7 @@ <argument index="2" name="value" type="float"> </argument> <description> - Set the value for a space parameter. A list of available parameters is on the SPACE_PARAM_* constants. + Sets the value for a space parameter. A list of available parameters is on the SPACE_PARAM_* constants. </description> </method> </methods> @@ -952,8 +964,10 @@ Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. </constant> <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="3"> + Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="4"> + Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="5"> Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. @@ -977,7 +991,7 @@ This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks. </constant> <constant name="SHAPE_CONVEX_POLYGON" value="6"> - This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the method [method CollisionPolygon2D.set_polygon], polygons modified with [method shape_set_data] do not verify that the points supplied form, in fact, a convex polygon. + This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the method [method CollisionPolygon2D.set_polygon], polygons modified with [method shape_set_data] do not verify that the points supplied form is a convex polygon. </constant> <constant name="SHAPE_CONCAVE_POLYGON" value="7"> This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks. diff --git a/doc/classes/Physics2DServerSW.xml b/doc/classes/Physics2DServerSW.xml index a8645c0b96..67fd7a21d8 100644 --- a/doc/classes/Physics2DServerSW.xml +++ b/doc/classes/Physics2DServerSW.xml @@ -4,7 +4,7 @@ Software implementation of [Physics2DServer]. </brief_description> <description> - Software implementation of [Physics2DServer]. This class exposes no new methods or properties and should not be used, as [Physics2DServer] automatically selects the best implementation available. + This class exposes no new methods or properties and should not be used, as [Physics2DServer] automatically selects the best implementation available. </description> <tutorials> </tutorials> diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml index 78d12e0b73..d838ff2317 100644 --- a/doc/classes/Physics2DShapeQueryParameters.xml +++ b/doc/classes/Physics2DShapeQueryParameters.xml @@ -129,7 +129,7 @@ <argument index="0" name="transform" type="Transform2D"> </argument> <description> - Set the transormation matrix of the shape. This is necessary to set its position/rotation/scale. + Set the transformation matrix of the shape. This is necessary to set its position/rotation/scale. </description> </method> </methods> diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml index 145f5a0163..12c1abccc6 100644 --- a/doc/classes/PhysicsServer.xml +++ b/doc/classes/PhysicsServer.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PhysicsServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Server interface for low level physics access. </brief_description> <description> + Everything related to physics in 3D. </description> <tutorials> </tutorials> @@ -19,6 +21,7 @@ <argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )"> </argument> <description> + Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. </description> </method> <method name="area_attach_object_instance_id"> @@ -29,6 +32,7 @@ <argument index="1" name="id" type="int"> </argument> <description> + Assigns the area to a descendant of [Object], so it can exist in the node tree. </description> </method> <method name="area_clear_shapes"> @@ -37,12 +41,14 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later. </description> </method> <method name="area_create"> <return type="RID"> </return> <description> + Creates an [Area]. </description> </method> <method name="area_get_object_instance_id" qualifiers="const"> @@ -51,6 +57,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Gets the instance ID of the object the area is assigned to. </description> </method> <method name="area_get_param" qualifiers="const"> @@ -61,6 +68,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.AreaParameter"> </argument> <description> + Returns an area parameter value. A list of available parameters is on the AREA_PARAM_* constants. </description> </method> <method name="area_get_shape" qualifiers="const"> @@ -71,6 +79,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Returns the [RID] of the nth shape of an area. </description> </method> <method name="area_get_shape_count" qualifiers="const"> @@ -79,6 +88,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Returns the number of shapes assigned to an area. </description> </method> <method name="area_get_shape_transform" qualifiers="const"> @@ -89,6 +99,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Returns the transform matrix of a shape within an area. </description> </method> <method name="area_get_space" qualifiers="const"> @@ -97,6 +108,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Returns the space assigned to the area. </description> </method> <method name="area_get_space_override_mode" qualifiers="const"> @@ -105,6 +117,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Returns the space override mode for the area. </description> </method> <method name="area_get_transform" qualifiers="const"> @@ -113,6 +126,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + Returns the transform matrix for an area. </description> </method> <method name="area_is_ray_pickable" qualifiers="const"> @@ -121,6 +135,7 @@ <argument index="0" name="area" type="RID"> </argument> <description> + If [code]true[/code] area collides with rays. </description> </method> <method name="area_remove_shape"> @@ -131,6 +146,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Removes a shape from an area. It does not delete the shape, so it can be reassigned later. </description> </method> <method name="area_set_collision_layer"> @@ -141,6 +157,7 @@ <argument index="1" name="layer" type="int"> </argument> <description> + Assigns the area to one or many physics layers. </description> </method> <method name="area_set_collision_mask"> @@ -151,6 +168,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> + Sets which physics layers the area will monitor. </description> </method> <method name="area_set_monitor_callback"> @@ -163,6 +181,12 @@ <argument index="2" name="method" type="String"> </argument> <description> + Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: + 1: AREA_BODY_ADDED or AREA_BODY_REMOVED, depending on whether the object entered or exited the area. + 2: [RID] of the object that entered/exited the area. + 3: Instance ID of the object that entered/exited the area. + 4: The shape index of the object that entered/exited the area. + 5: The shape index of the area where the object entered/exited. </description> </method> <method name="area_set_param"> @@ -175,6 +199,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> + Sets the value for an area parameter. A list of available parameters is on the AREA_PARAM_* constants. </description> </method> <method name="area_set_ray_pickable"> @@ -185,6 +210,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + Sets object pickable with rays. </description> </method> <method name="area_set_shape"> @@ -197,6 +223,7 @@ <argument index="2" name="shape" type="RID"> </argument> <description> + Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [RID]. </description> </method> <method name="area_set_shape_transform"> @@ -209,6 +236,7 @@ <argument index="2" name="transform" type="Transform"> </argument> <description> + Sets the transform matrix for an area shape. </description> </method> <method name="area_set_space"> @@ -219,6 +247,7 @@ <argument index="1" name="space" type="RID"> </argument> <description> + Assigns a space to the area. </description> </method> <method name="area_set_space_override_mode"> @@ -229,6 +258,7 @@ <argument index="1" name="mode" type="int" enum="PhysicsServer.AreaSpaceOverrideMode"> </argument> <description> + Sets the space override mode for the area. The modes are described in the constants AREA_SPACE_OVERRIDE_*. </description> </method> <method name="area_set_transform"> @@ -239,6 +269,7 @@ <argument index="1" name="transform" type="Transform"> </argument> <description> + Sets the transform matrix for an area. </description> </method> <method name="body_add_collision_exception"> @@ -249,6 +280,7 @@ <argument index="1" name="excepted_body" type="RID"> </argument> <description> + Adds a body to the list of bodies exempt from collisions. </description> </method> <method name="body_add_shape"> @@ -261,6 +293,7 @@ <argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )"> </argument> <description> + Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. </description> </method> <method name="body_apply_impulse"> @@ -273,6 +306,7 @@ <argument index="2" name="impulse" type="Vector3"> </argument> <description> + Gives the body a push at a [code]position[/code] in the direction of the [code]impulse[/code]. </description> </method> <method name="body_apply_torque_impulse"> @@ -283,6 +317,7 @@ <argument index="1" name="impulse" type="Vector3"> </argument> <description> + Gives the body a push to rotate it. </description> </method> <method name="body_attach_object_instance_id"> @@ -293,6 +328,7 @@ <argument index="1" name="id" type="int"> </argument> <description> + Assigns the area to a descendant of [Object], so it can exist in the node tree. </description> </method> <method name="body_clear_shapes"> @@ -301,6 +337,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Removes all shapes from a body. </description> </method> <method name="body_create"> @@ -311,6 +348,7 @@ <argument index="1" name="init_sleeping" type="bool" default="false"> </argument> <description> + Creates a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time. </description> </method> <method name="body_get_axis_lock" qualifiers="const"> @@ -319,6 +357,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Gets the information, which Axis is locked if any. The can be any calue from the constants BODY_AXIS_LOCK* </description> </method> <method name="body_get_collision_layer" qualifiers="const"> @@ -327,6 +366,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the physics layer or layers a body belongs to. </description> </method> <method name="body_get_collision_mask" qualifiers="const"> @@ -335,6 +375,16 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the physics layer or layers a body can collide with. +- </description> +- </method> +- <method name="body_get_direct_state"> +- <return type="PhysicsDirectBodyState"> +- </return> +- <argument index="0" name="body" type="RID"> +- </argument> +- <description> + Returns the [PhysicsDirectBodyState] of the body. </description> </method> <method name="body_get_max_contacts_reported" qualifiers="const"> @@ -343,6 +393,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the maximum contacts that can be reported. See [method body_set_max_contacts_reported]. </description> </method> <method name="body_get_mode" qualifiers="const"> @@ -351,6 +402,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the body mode. </description> </method> <method name="body_get_object_instance_id" qualifiers="const"> @@ -359,6 +411,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Gets the instance ID of the object the area is assigned to. </description> </method> <method name="body_get_param" qualifiers="const"> @@ -369,6 +422,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.BodyParameter"> </argument> <description> + Returns the value of a body parameter. A list of available parameters is on the BODY_PARAM_* constants. </description> </method> <method name="body_get_shape" qualifiers="const"> @@ -379,6 +433,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Returns the [RID] of the nth shape of a body. </description> </method> <method name="body_get_shape_count" qualifiers="const"> @@ -387,6 +442,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the number of shapes assigned to a body. </description> </method> <method name="body_get_shape_transform" qualifiers="const"> @@ -397,6 +453,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Returns the transform matrix of a body shape. </description> </method> <method name="body_get_space" qualifiers="const"> @@ -405,6 +462,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns the [RID] of the space assigned to a body. </description> </method> <method name="body_get_state" qualifiers="const"> @@ -415,6 +473,7 @@ <argument index="1" name="state" type="int" enum="PhysicsServer.BodyState"> </argument> <description> + Returns a body state. </description> </method> <method name="body_is_continuous_collision_detection_enabled" qualifiers="const"> @@ -423,6 +482,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + If [code]true[/code] the continuous collision detection mode is enabled. </description> </method> <method name="body_is_omitting_force_integration" qualifiers="const"> @@ -431,6 +491,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + Returns whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_is_ray_pickable" qualifiers="const"> @@ -439,6 +500,7 @@ <argument index="0" name="body" type="RID"> </argument> <description> + If [code]true[/code] the body can be detected by rays </description> </method> <method name="body_remove_collision_exception"> @@ -449,6 +511,8 @@ <argument index="1" name="excepted_body" type="RID"> </argument> <description> + Removes a body from the list of bodies exempt from collisions. + Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. </description> </method> <method name="body_remove_shape"> @@ -459,6 +523,7 @@ <argument index="1" name="shape_idx" type="int"> </argument> <description> + Removes a shape from a body. The shape is not deleted, so it can be reused afterwards. </description> </method> <method name="body_set_axis_lock"> @@ -469,6 +534,7 @@ <argument index="1" name="axis" type="int" enum="PhysicsServer.BodyAxisLock"> </argument> <description> + Locks velocity along one axis to 0 and only allows rotation along this axis, can also be set to disabled which disables this functionality. </description> </method> <method name="body_set_axis_velocity"> @@ -479,6 +545,7 @@ <argument index="1" name="axis_velocity" type="Vector3"> </argument> <description> + Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. </description> </method> <method name="body_set_collision_layer"> @@ -489,6 +556,7 @@ <argument index="1" name="layer" type="int"> </argument> <description> + Sets the physics layer or layers a body belongs to. </description> </method> <method name="body_set_collision_mask"> @@ -499,6 +567,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> + Sets the physics layer or layers a body can collide with. </description> </method> <method name="body_set_enable_continuous_collision_detection"> @@ -509,6 +578,8 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + If [code]true[/code] the continuous collision detection mode is enabled. + Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. </description> </method> <method name="body_set_force_integration_callback"> @@ -523,6 +594,7 @@ <argument index="3" name="userdata" type="Variant" default="null"> </argument> <description> + Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]). </description> </method> <method name="body_set_max_contacts_reported"> @@ -533,6 +605,7 @@ <argument index="1" name="amount" type="int"> </argument> <description> + Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. </description> </method> <method name="body_set_mode"> @@ -543,6 +616,7 @@ <argument index="1" name="mode" type="int" enum="PhysicsServer.BodyMode"> </argument> <description> + Sets the body mode, from one of the constants BODY_MODE*. </description> </method> <method name="body_set_omit_force_integration"> @@ -553,6 +627,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + Sets whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_set_param"> @@ -565,6 +640,7 @@ <argument index="2" name="value" type="float"> </argument> <description> + Sets a body parameter. A list of available parameters is on the BODY_PARAM_* constants. </description> </method> <method name="body_set_ray_pickable"> @@ -575,6 +651,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + Sets the body pickable with rays if [code]enabled[/code] is set. </description> </method> <method name="body_set_shape"> @@ -587,6 +664,7 @@ <argument index="2" name="shape" type="RID"> </argument> <description> + Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [RID]. </description> </method> <method name="body_set_shape_transform"> @@ -599,6 +677,7 @@ <argument index="2" name="transform" type="Transform"> </argument> <description> + Sets the transform matrix for a body shape. </description> </method> <method name="body_set_space"> @@ -609,6 +688,7 @@ <argument index="1" name="space" type="RID"> </argument> <description> + Assigns a space to the body (see [method create_space]). </description> </method> <method name="body_set_state"> @@ -621,6 +701,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> + Sets a body state (see BODY_STATE* constants). </description> </method> <method name="cone_twist_joint_get_param" qualifiers="const"> @@ -631,6 +712,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.ConeTwistJointParam"> </argument> <description> + Gets a cone_twist_joint parameter (see CONE_TWIST_JOINT* constants). </description> </method> <method name="cone_twist_joint_set_param"> @@ -643,6 +725,7 @@ <argument index="2" name="value" type="float"> </argument> <description> + Sets a cone_twist_joint parameter (see CONE_TWIST_JOINT* constants). </description> </method> <method name="free_rid"> @@ -651,6 +734,7 @@ <argument index="0" name="rid" type="RID"> </argument> <description> + Destroys any of the objects created by PhysicsServer. If the [RID] passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console. </description> </method> <method name="generic_6dof_joint_get_flag"> @@ -662,7 +746,8 @@ </argument> <argument index="2" name="flag" type="int" enum="PhysicsServer.G6DOFJointAxisFlag"> </argument> - <description> + <description> + Gets a generic_6_DOF_joint flag (see G6DOF_JOINT_FLAG* constants). </description> </method> <method name="generic_6dof_joint_get_param"> @@ -675,6 +760,7 @@ <argument index="2" name="param" type="int" enum="PhysicsServer.G6DOFJointAxisParam"> </argument> <description> + Gets a generic_6_DOF_joint parameter (see G6DOF_JOINT* constants without the G6DOF_JOINT_FLAG*). </description> </method> <method name="generic_6dof_joint_set_flag"> @@ -689,6 +775,7 @@ <argument index="3" name="enable" type="bool"> </argument> <description> + Sets a generic_6_DOF_joint flag (see G6DOF_JOINT_FLAG* constants). </description> </method> <method name="generic_6dof_joint_set_param"> @@ -703,6 +790,7 @@ <argument index="3" name="value" type="float"> </argument> <description> + Sets a generic_6_DOF_joint parameter (see G6DOF_JOINT* constants without the G6DOF_JOINT_FLAG*). </description> </method> <method name="get_process_info"> @@ -711,6 +799,7 @@ <argument index="0" name="process_info" type="int" enum="PhysicsServer.ProcessInfo"> </argument> <description> + Returns an Info defined by the [ProcessInfo] input given. </description> </method> <method name="hinge_joint_get_flag" qualifiers="const"> @@ -721,6 +810,7 @@ <argument index="1" name="flag" type="int" enum="PhysicsServer.HingeJointFlag"> </argument> <description> + Gets a hinge_joint flag (see HINGE_JOINT_FLAG* constants). </description> </method> <method name="hinge_joint_get_param" qualifiers="const"> @@ -731,6 +821,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.HingeJointParam"> </argument> <description> + Gets a hinge_joint parameter (see HINGE_JOINT* constants without the HINGE_JOINT_FLAG*). </description> </method> <method name="hinge_joint_set_flag"> @@ -743,6 +834,7 @@ <argument index="2" name="enabled" type="bool"> </argument> <description> + Sets a hinge_joint flag (see HINGE_JOINT_FLAG* constants). </description> </method> <method name="hinge_joint_set_param"> @@ -755,6 +847,7 @@ <argument index="2" name="value" type="float"> </argument> <description> + Sets a hinge_joint parameter (see HINGE_JOINT* constants without the HINGE_JOINT_FLAG*). </description> </method> <method name="joint_create_cone_twist"> @@ -769,6 +862,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> + Creates a [ConeTwistJoint]. </description> </method> <method name="joint_create_generic_6dof"> @@ -783,6 +877,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> + Creates a [Generic6DOFJoint]. </description> </method> <method name="joint_create_hinge"> @@ -797,6 +892,7 @@ <argument index="3" name="hinge_B" type="Transform"> </argument> <description> + Creates a [HingeJoint]. </description> </method> <method name="joint_create_pin"> @@ -811,6 +907,7 @@ <argument index="3" name="local_B" type="Vector3"> </argument> <description> + Creates a [PinJoint]. </description> </method> <method name="joint_create_slider"> @@ -825,6 +922,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> + Creates a [SliderJoint]. </description> </method> <method name="joint_get_solver_priority" qualifiers="const"> @@ -833,6 +931,7 @@ <argument index="0" name="joint" type="RID"> </argument> <description> + Gets the priority value of the Joint. </description> </method> <method name="joint_get_type" qualifiers="const"> @@ -841,6 +940,7 @@ <argument index="0" name="joint" type="RID"> </argument> <description> + Returns the type of the Joint. </description> </method> <method name="joint_set_solver_priority"> @@ -851,6 +951,7 @@ <argument index="1" name="priority" type="int"> </argument> <description> + Sets the priority value of the Joint. </description> </method> <method name="pin_joint_get_local_a" qualifiers="const"> @@ -859,6 +960,7 @@ <argument index="0" name="joint" type="RID"> </argument> <description> + Returns position of the joint in the local space of body a of the joint. </description> </method> <method name="pin_joint_get_local_b" qualifiers="const"> @@ -867,6 +969,7 @@ <argument index="0" name="joint" type="RID"> </argument> <description> + Returns position of the joint in the local space of body b of the joint. </description> </method> <method name="pin_joint_get_param" qualifiers="const"> @@ -877,6 +980,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.PinJointParam"> </argument> <description> + Gets a pin_joint parameter (see PIN_JOINT* constants). </description> </method> <method name="pin_joint_set_local_a"> @@ -887,6 +991,7 @@ <argument index="1" name="local_A" type="Vector3"> </argument> <description> + Sets position of the joint in the local space of body a of the joint. </description> </method> <method name="pin_joint_set_local_b"> @@ -897,6 +1002,7 @@ <argument index="1" name="local_B" type="Vector3"> </argument> <description> + Sets position of the joint in the local space of body b of the joint. </description> </method> <method name="pin_joint_set_param"> @@ -909,6 +1015,7 @@ <argument index="2" name="value" type="float"> </argument> <description> + Sets a pin_joint parameter (see PIN_JOINT* constants). </description> </method> <method name="set_active"> @@ -917,6 +1024,7 @@ <argument index="0" name="active" type="bool"> </argument> <description> + Activates or deactivates the 3D physics engine. </description> </method> <method name="shape_create"> @@ -925,6 +1033,7 @@ <argument index="0" name="type" type="int" enum="PhysicsServer.ShapeType"> </argument> <description> + Creates a shape of type SHAPE_*. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape]. </description> </method> <method name="shape_get_data" qualifiers="const"> @@ -933,6 +1042,7 @@ <argument index="0" name="shape" type="RID"> </argument> <description> + Returns the shape data. </description> </method> <method name="shape_get_type" qualifiers="const"> @@ -941,6 +1051,7 @@ <argument index="0" name="shape" type="RID"> </argument> <description> + Returns the type of shape (see SHAPE_* constants). </description> </method> <method name="shape_set_data"> @@ -951,6 +1062,7 @@ <argument index="1" name="data" type="Variant"> </argument> <description> + Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type]. </description> </method> <method name="slider_joint_get_param" qualifiers="const"> @@ -961,6 +1073,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.SliderJointParam"> </argument> <description> + Gets a slider_joint parameter (see SLIDER_JOINT* constants). </description> </method> <method name="slider_joint_set_param"> @@ -973,12 +1086,14 @@ <argument index="2" name="value" type="float"> </argument> <description> + Gets a slider_joint parameter (see SLIDER_JOINT* constants). </description> </method> <method name="space_create"> <return type="RID"> </return> <description> + Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space]. </description> </method> <method name="space_get_direct_state"> @@ -987,6 +1102,7 @@ <argument index="0" name="space" type="RID"> </argument> <description> + Returns the state of a space, a [PhysicsDirectSpaceState]. This object can be used to make collision/intersection queries. </description> </method> <method name="space_get_param" qualifiers="const"> @@ -997,6 +1113,7 @@ <argument index="1" name="param" type="int" enum="PhysicsServer.SpaceParameter"> </argument> <description> + Returns the value of a space parameter. </description> </method> <method name="space_is_active" qualifiers="const"> @@ -1005,6 +1122,7 @@ <argument index="0" name="space" type="RID"> </argument> <description> + Returns whether the space is active. </description> </method> <method name="space_set_active"> @@ -1015,6 +1133,7 @@ <argument index="1" name="active" type="bool"> </argument> <description> + Marks a space as active. It will not have an effect, unless it is assigned to an area or body. </description> </method> <method name="space_set_param"> @@ -1027,169 +1146,256 @@ <argument index="2" name="value" type="float"> </argument> <description> + Sets the value for a space parameter. A list of available parameters is on the SPACE_PARAM_* constants. </description> </method> </methods> <constants> <constant name="JOINT_PIN" value="0"> + The [Joint] is a [PinJoint]. </constant> <constant name="JOINT_HINGE" value="1"> + The [Joint] is a [HingeJoint]. </constant> <constant name="JOINT_SLIDER" value="2"> + The [Joint] is a [SliderJoint]. </constant> <constant name="JOINT_CONE_TWIST" value="3"> + The [Joint] is a [ConeTwistJoint]. </constant> <constant name="JOINT_6DOF" value="4"> + The [Joint] is a [Generic6DOFJoint]. </constant> <constant name="PIN_JOINT_BIAS" value="0"> + The strength with which the pinned objects try to stay in positional relation to each other. + The higher, the stronger. </constant> <constant name="PIN_JOINT_DAMPING" value="1"> + The strength with which the pinned objects try to stay in velocity relation to each other. + The higher, the stronger. </constant> <constant name="PIN_JOINT_IMPULSE_CLAMP" value="2"> + If above 0, this value is the maximum value for an impulse that this Joint puts on it's ends. </constant> <constant name="HINGE_JOINT_BIAS" value="0"> + The speed with wich the two bodies get pulled together when they move in different directions. </constant> <constant name="HINGE_JOINT_LIMIT_UPPER" value="1"> + The maximum rotation across the Hinge. </constant> <constant name="HINGE_JOINT_LIMIT_LOWER" value="2"> + The minimum rotation across the Hinge. </constant> <constant name="HINGE_JOINT_LIMIT_BIAS" value="3"> + The speed with which the rotation across the axis perpendicular to the hinge gets corrected. </constant> <constant name="HINGE_JOINT_LIMIT_SOFTNESS" value="4"> </constant> <constant name="HINGE_JOINT_LIMIT_RELAXATION" value="5"> + The lower this value, the more the rotation gets slowed down. </constant> <constant name="HINGE_JOINT_MOTOR_TARGET_VELOCITY" value="6"> + Target speed for the motor. </constant> <constant name="HINGE_JOINT_MOTOR_MAX_IMPULSE" value="7"> + Maximum acceleration for the motor. </constant> <constant name="HINGE_JOINT_FLAG_USE_LIMIT" value="0"> + If [code]true[/code] the Hinge has a maximum and a minimum rotation. </constant> <constant name="HINGE_JOINT_FLAG_ENABLE_MOTOR" value="1"> + If [code]true[/code] a motor turns the Hinge </constant> <constant name="SLIDER_JOINT_LINEAR_LIMIT_UPPER" value="0"> + The maximum difference between the pivot points on their x-axis before damping happens. </constant> <constant name="SLIDER_JOINT_LINEAR_LIMIT_LOWER" value="1"> + The minimum difference between the pivot points on their x-axis before damping happens. </constant> <constant name="SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS" value="2"> + A factor applied to the movement accross the slider axis once the limits get surpassed. The lower, the slower the movement. </constant> <constant name="SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION" value="3"> + The amount of restitution once the limits are surpassed. The lower, the more velocityenergy gets lost. </constant> <constant name="SLIDER_JOINT_LINEAR_LIMIT_DAMPING" value="4"> + The amount of damping once the slider limits are surpassed. </constant> <constant name="SLIDER_JOINT_LINEAR_MOTION_SOFTNESS" value="5"> + A factor applied to the movement accross the slider axis as long as the slider is in the limits. The lower, the slower the movement. </constant> <constant name="SLIDER_JOINT_LINEAR_MOTION_RESTITUTION" value="6"> + The amount of restitution inside the slider limits. </constant> <constant name="SLIDER_JOINT_LINEAR_MOTION_DAMPING" value="7"> + The amount of damping inside the slider limits. </constant> <constant name="SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS" value="8"> + A factor applied to the movement accross axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION" value="9"> + The amount of restitution when movement is accross axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING" value="10"> + The amount of damping when movement is accross axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_ANGULAR_LIMIT_UPPER" value="11"> + The upper limit of rotation in the slider. </constant> <constant name="SLIDER_JOINT_ANGULAR_LIMIT_LOWER" value="12"> + The lower limit of rotation in the slider. </constant> <constant name="SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS" value="13"> + A factor applied to the all rotation once the limit is surpassed. </constant> <constant name="SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION" value="14"> + The amount of restitution of the rotation when the limit is surpassed. </constant> <constant name="SLIDER_JOINT_ANGULAR_LIMIT_DAMPING" value="15"> + The amount of damping of the rotation when the limit is surpassed. </constant> <constant name="SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS" value="16"> + A factor that gets applied to the all rotation in the limits. </constant> <constant name="SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION" value="17"> + The amount of restitution of the rotation in the limits. </constant> <constant name="SLIDER_JOINT_ANGULAR_MOTION_DAMPING" value="18"> + The amount of damping of the rotation in the limits. </constant> <constant name="SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS" value="19"> + A factor that gets applied to the all rotation across axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION" value="20"> + The amount of restitution of the rotation across axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING" value="21"> + The amount of damping of the rotation across axes orthogonal to the slider. </constant> <constant name="SLIDER_JOINT_MAX" value="22"> + End flag of SLIDER_JOINT_* constants, used internally. </constant> <constant name="CONE_TWIST_JOINT_SWING_SPAN" value="0"> + Swing is rotation from side to side, around the axis perpendicular to the twist axis. + The swing span defines, how much rotation will not get corrected allong the swing axis. + Could be defined as looseness in the [ConeTwistJoint]. + If below 0.05, this behaviour is locked. Default value: [code]PI/4[/code]. </constant> <constant name="CONE_TWIST_JOINT_TWIST_SPAN" value="1"> + Twist is the rotation around the twist axis, this value defined how far the joint can twist. + Twist is locked if below 0.05. </constant> <constant name="CONE_TWIST_JOINT_BIAS" value="2"> + The speed with which the swing or twist will take place. + The higher, the faster. </constant> <constant name="CONE_TWIST_JOINT_SOFTNESS" value="3"> + The ease with which the Joint twists, if it's too low, it takes more force to twist the joint. </constant> <constant name="CONE_TWIST_JOINT_RELAXATION" value="4"> + Defines, how fast the swing- and twist-speed-difference on both sides gets synced. </constant> <constant name="G6DOF_JOINT_LINEAR_LOWER_LIMIT" value="0"> + The minimum difference between the pivot points' axes. </constant> <constant name="G6DOF_JOINT_LINEAR_UPPER_LIMIT" value="1"> + The maximum difference between the pivot points' axes. </constant> <constant name="G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS" value="2"> + A factor that gets applied to the movement accross the axes. The lower, the slower the movement. </constant> <constant name="G6DOF_JOINT_LINEAR_RESTITUTION" value="3"> + The amount of restitution on the axes movement. The lower, the more velocity-energy gets lost. </constant> <constant name="G6DOF_JOINT_LINEAR_DAMPING" value="4"> + The amount of damping that happens at the linear motion across the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_LOWER_LIMIT" value="5"> + The minimum rotation in negative direction to break loose and rotate arround the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_UPPER_LIMIT" value="6"> + The minimum rotation in positive direction to break loose and rotate arround the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS" value="7"> + A factor that gets multiplied onto all rotations accross the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_DAMPING" value="8"> + The amount of rotational damping accross the axes. The lower, the more dampening occurs. </constant> <constant name="G6DOF_JOINT_ANGULAR_RESTITUTION" value="9"> + The amount of rotational restitution accross the axes. The lower, the more restitution occurs. </constant> <constant name="G6DOF_JOINT_ANGULAR_FORCE_LIMIT" value="10"> + The maximum amount of force that can occur, when rotating arround the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_ERP" value="11"> + When correcting the crossing of limits in rotation accross the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower. </constant> <constant name="G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY" value="12"> + Target speed for the motor at the axes. </constant> <constant name="G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT" value="13"> + Maximum acceleration for the motor at the axes. </constant> <constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT" value="0"> + If [code]set[/code] there is linear motion possible within the given limits. </constant> <constant name="G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT" value="1"> + If [code]set[/code] there is rotational motion possible. </constant> <constant name="G6DOF_JOINT_FLAG_ENABLE_MOTOR" value="2"> + If [code]set[/code] there is a rotational motor across these axes. </constant> <constant name="SHAPE_PLANE" value="0"> + The [Shape] is a [PlaneShape]. </constant> <constant name="SHAPE_RAY" value="1"> + The [Shape] is a [RayShape]. </constant> <constant name="SHAPE_SPHERE" value="2"> + The [Shape] is a [SphereShape]. </constant> <constant name="SHAPE_BOX" value="3"> + The [Shape] is a [BoxShape]. </constant> <constant name="SHAPE_CAPSULE" value="4"> + The [Shape] is a [CapsuleShape]. </constant> <constant name="SHAPE_CONVEX_POLYGON" value="5"> + The [Shape] is a [ConvexPolygonShape]. </constant> <constant name="SHAPE_CONCAVE_POLYGON" value="6"> + The [Shape] is a [ConcavePolygonShape]. </constant> <constant name="SHAPE_HEIGHTMAP" value="7"> + The [Shape] is a [HeightMapShape]. </constant> <constant name="SHAPE_CUSTOM" value="8"> + This constant is used internally by the engine. Any attempt to create this kind of shape results in an error. </constant> <constant name="AREA_PARAM_GRAVITY" value="0"> + Constant to set/get gravity strength in an area. </constant> <constant name="AREA_PARAM_GRAVITY_VECTOR" value="1"> + Constant to set/get gravity vector/center in an area. </constant> <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="2"> + Constant to set/get whether the gravity vector of an area is a direction, or a center point. </constant> <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="3"> + Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance. </constant> <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="4"> + This constant was used to set/get the falloff factor for point gravity. It has been superseded by AREA_PARAM_GRAVITY_DISTANCE_SCALE. </constant> <constant name="AREA_PARAM_LINEAR_DAMP" value="5"> + Constant to set/get the linear dampening factor of an area. </constant> <constant name="AREA_PARAM_ANGULAR_DAMP" value="6"> + Constant to set/get the angular dampening factor of an area. </constant> <constant name="AREA_PARAM_PRIORITY" value="7"> + Constant to set/get the priority (order of processing) of an area. </constant> <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0"> This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. @@ -1207,70 +1413,102 @@ This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. </constant> <constant name="BODY_MODE_STATIC" value="0"> + Constant for static bodies. </constant> <constant name="BODY_MODE_KINEMATIC" value="1"> + Constant for kinematic bodies. </constant> <constant name="BODY_MODE_RIGID" value="2"> + Constant for rigid bodies. </constant> <constant name="BODY_MODE_CHARACTER" value="3"> + Constant for rigid bodies in character mode. In this mode, a body can not rotate, and only its linear velocity is affected by physics. </constant> <constant name="BODY_PARAM_BOUNCE" value="0"> + Constant to set/get a body's bounce factor. </constant> <constant name="BODY_PARAM_FRICTION" value="1"> + Constant to set/get a body's friction. </constant> <constant name="BODY_PARAM_MASS" value="2"> + Constant to set/get a body's mass. </constant> <constant name="BODY_PARAM_GRAVITY_SCALE" value="3"> + Constant to set/get a body's gravity multiplier. </constant> <constant name="BODY_PARAM_ANGULAR_DAMP" value="5"> + Constant to set/get a body's angular dampening factor. </constant> <constant name="BODY_PARAM_LINEAR_DAMP" value="4"> + Constant to set/get a body's linear dampening factor. </constant> <constant name="BODY_PARAM_MAX" value="6"> + This is the last ID for body parameters. Any attempt to set this property is ignored. Any attempt to get it returns 0. </constant> <constant name="BODY_STATE_TRANSFORM" value="0"> + Constant to set/get the current transform matrix of the body. </constant> <constant name="BODY_STATE_LINEAR_VELOCITY" value="1"> + Constant to set/get the current linear velocity of the body. </constant> <constant name="BODY_STATE_ANGULAR_VELOCITY" value="2"> + Constant to set/get the current angular velocity of the body. </constant> <constant name="BODY_STATE_SLEEPING" value="3"> + Constant to sleep/wake up a body, or to get whether it is sleeping. </constant> <constant name="BODY_STATE_CAN_SLEEP" value="4"> + Constant to set/get whether the body can sleep. </constant> <constant name="AREA_BODY_ADDED" value="0"> + The value of the first parameter and area callback function receives, when an object enters one of its shapes. </constant> <constant name="AREA_BODY_REMOVED" value="1"> + The value of the first parameter and area callback function receives, when an object exits one of its shapes. </constant> <constant name="INFO_ACTIVE_OBJECTS" value="0"> + Constant to get the number of objects that are not sleeping. </constant> <constant name="INFO_COLLISION_PAIRS" value="1"> + Constant to get the number of possible collisions. </constant> <constant name="INFO_ISLAND_COUNT" value="2"> + Constant to get the number of space regions where a collision could occur. </constant> <constant name="SPACE_PARAM_CONTACT_RECYCLE_RADIUS" value="0"> + Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. </constant> <constant name="SPACE_PARAM_CONTACT_MAX_SEPARATION" value="1"> + Constant to set/get the maximum distance a shape can be from another before they are considered separated. </constant> <constant name="SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION" value="2"> + Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. </constant> <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="3"> + Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="4"> + Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="5"> + Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. </constant> <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO" value="6"> </constant> <constant name="SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS" value="7"> + Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. </constant> <constant name="BODY_AXIS_LOCK_DISABLED" value="0"> + The [Body] can rotate and move freely. </constant> <constant name="BODY_AXIS_LOCK_X" value="1"> + The [Body] cannot move across x axis can only rotate across x axis. </constant> <constant name="BODY_AXIS_LOCK_Y" value="2"> + The [Body] cannot move across y axis can only rotate across y axis. </constant> <constant name="BODY_AXIS_LOCK_Z" value="3"> + The [Body] cannot move across z axis can only rotate across z axis. </constant> </constants> </class> diff --git a/doc/classes/PhysicsServerSW.xml b/doc/classes/PhysicsServerSW.xml index 7bffc23258..53e1c0057e 100644 --- a/doc/classes/PhysicsServerSW.xml +++ b/doc/classes/PhysicsServerSW.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PhysicsServerSW" inherits="PhysicsServer" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Software implementation of [PhysicsServer]. </brief_description> <description> + This class exposes no new methods or properties and should not be used, as [PhysicsServer] automatically selects the best implementation available. </description> <tutorials> </tutorials> diff --git a/doc/classes/PinJoint.xml b/doc/classes/PinJoint.xml index 22aa35a0a4..1cc381b1b3 100644 --- a/doc/classes/PinJoint.xml +++ b/doc/classes/PinJoint.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PinJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Pin Joint for 3D Shapes. </brief_description> <description> + Pin Joint for 3D Rigid Bodies. It pins 2 bodies (rigid or static) together. </description> <tutorials> </tutorials> @@ -30,18 +32,28 @@ </methods> <members> <member name="params/bias" type="float" setter="set_param" getter="get_param"> + The force with wich the pinned objects stay in positional relation to each other. + The higher, the stronger. </member> <member name="params/damping" type="float" setter="set_param" getter="get_param"> + The force with wich the pinned objects stay in velocity relation to each other. + The higher, the stronger. </member> <member name="params/impulse_clamp" type="float" setter="set_param" getter="get_param"> + If above 0, this value is the maximum value for an impulse that this Joint produces. </member> </members> <constants> <constant name="PARAM_BIAS" value="0"> + The force with wich the pinned objects stay in positional relation to each other. + The higher, the stronger. </constant> <constant name="PARAM_DAMPING" value="1"> + The force with wich the pinned objects stay in velocity relation to each other. + The higher, the stronger. </constant> <constant name="PARAM_IMPULSE_CLAMP" value="2"> + If above 0, this value is the maximum value for an impulse that this Joint produces. </constant> </constants> </class> diff --git a/doc/classes/PinJoint2D.xml b/doc/classes/PinJoint2D.xml index 826a1684a4..009b0ec2f2 100644 --- a/doc/classes/PinJoint2D.xml +++ b/doc/classes/PinJoint2D.xml @@ -28,6 +28,7 @@ </methods> <members> <member name="softness" type="float" setter="set_softness" getter="get_softness"> + The higher this value, the more the bond to the pinned partner can flex. </member> </members> <constants> 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..3782a98e3e 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"> @@ -183,7 +180,7 @@ The ray's destination point, relative to the RayCast's [code]position[/code]. </member> <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer"> - The RayCast's collison layer(s). Only bodies in the same collision layer(s) will be detected. + The RayCast's collision layer(s). Only bodies in the same collision layer(s) will be detected. </member> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled"> If [code]true[/code], collisions will be reported. Default value: [code]false[/code]. diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 5520abe050..74ee0a8911 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"> @@ -195,7 +195,7 @@ The ray's destination point, relative to the RayCast's [code]position[/code]. </member> <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer"> - The RayCast2D's collison layer(s). Only bodies in the same collision layer(s) will be detected. + The RayCast2D's collision layer(s). Only bodies in the same collision layer(s) will be detected. </member> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled"> If [code]true[/code], collisions will be reported. Default value: [code]false[/code]. 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/SliderJoint.xml b/doc/classes/SliderJoint.xml index 617390b6a4..adea8658d1 100644 --- a/doc/classes/SliderJoint.xml +++ b/doc/classes/SliderJoint.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SliderJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Piston kind of slider between two bodies in 3D. </brief_description> <description> + Slides across the x-axis of the [Pivot] object. </description> <tutorials> </tutorials> @@ -30,96 +32,144 @@ </methods> <members> <member name="angular_limit/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping of the rotation when the limit is surpassed. + A lower damping value allows a rotation initiated by body A to travel to body B slower. </member> <member name="angular_limit/lower_angle" type="float" setter="_set_lower_limit_angular" getter="_get_lower_limit_angular"> + The lower limit of rotation in the slider. </member> <member name="angular_limit/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution of the rotation when the limit is surpassed. + Does not affect damping. </member> <member name="angular_limit/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the all rotation once the limit is surpassed. + Makes all rotation slower when between 0 and 1. </member> <member name="angular_limit/upper_angle" type="float" setter="_set_upper_limit_angular" getter="_get_upper_limit_angular"> + The upper limit of rotation in the slider. </member> <member name="angular_motion/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping of the rotation in the limits. </member> <member name="angular_motion/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution of the rotation in the limits. </member> <member name="angular_motion/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the all rotation in the limits. </member> <member name="angular_ortho/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping of the rotation across axes orthogonal to the slider. </member> <member name="angular_ortho/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution of the rotation across axes orthogonal to the slider. </member> <member name="angular_ortho/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the all rotation across axes orthogonal to the slider. </member> <member name="linear_limit/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping that happens once the limit defined by [member linear_limit/lower_distance] and [member linear_limit/upper_distance] is surpassed. </member> <member name="linear_limit/lower_distance" type="float" setter="set_param" getter="get_param"> + The minimum difference between the pivot points on their x-axis before damping happens. </member> <member name="linear_limit/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution once the limits are surpassed. The lower, the more velocity-energy gets lost. </member> <member name="linear_limit/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the movement accross the slider axis once the limits get surpassed. The lower, the slower the movement. </member> <member name="linear_limit/upper_distance" type="float" setter="set_param" getter="get_param"> + The maximum difference between the pivot points on their x-axis before damping happens. </member> <member name="linear_motion/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping inside the slider limits. </member> <member name="linear_motion/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution inside the slider limits. </member> <member name="linear_motion/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the movement accross the slider axis as long as the slider is in the limits. The lower, the slower the movement. </member> <member name="linear_ortho/damping" type="float" setter="set_param" getter="get_param"> + The amount of damping when movement is accross axes orthogonal to the slider. </member> <member name="linear_ortho/restitution" type="float" setter="set_param" getter="get_param"> + The amount of restitution when movement is accross axes orthogonal to the slider. </member> <member name="linear_ortho/softness" type="float" setter="set_param" getter="get_param"> + A factor applied to the movement accross axes orthogonal to the slider. </member> </members> <constants> <constant name="PARAM_LINEAR_LIMIT_UPPER" value="0"> + The maximum difference between the pivot points on their x-axis before damping happens. </constant> <constant name="PARAM_LINEAR_LIMIT_LOWER" value="1"> + The minimum difference between the pivot points on their x-axis before damping happens. </constant> <constant name="PARAM_LINEAR_LIMIT_SOFTNESS" value="2"> + A factor applied to the movement accross the slider axis once the limits get surpassed. The lower, the slower the movement. </constant> <constant name="PARAM_LINEAR_LIMIT_RESTITUTION" value="3"> + The amount of restitution once the limits are surpassed. The lower, the more velocityenergy gets lost. </constant> <constant name="PARAM_LINEAR_LIMIT_DAMPING" value="4"> + The amount of damping once the slider limits are surpassed. </constant> <constant name="PARAM_LINEAR_MOTION_SOFTNESS" value="5"> + A factor applied to the movement accross the slider axis as long as the slider is in the limits. The lower, the slower the movement. </constant> <constant name="PARAM_LINEAR_MOTION_RESTITUTION" value="6"> + The amount of restitution inside the slider limits. </constant> <constant name="PARAM_LINEAR_MOTION_DAMPING" value="7"> + The amount of damping inside the slider limits. </constant> <constant name="PARAM_LINEAR_ORTHOGONAL_SOFTNESS" value="8"> + A factor applied to the movement accross axes orthogonal to the slider. </constant> <constant name="PARAM_LINEAR_ORTHOGONAL_RESTITUTION" value="9"> + The amount of restitution when movement is accross axes orthogonal to the slider. </constant> <constant name="PARAM_LINEAR_ORTHOGONAL_DAMPING" value="10"> + The amount of damping when movement is accross axes orthogonal to the slider. </constant> <constant name="PARAM_ANGULAR_LIMIT_UPPER" value="11"> + The upper limit of rotation in the slider. </constant> <constant name="PARAM_ANGULAR_LIMIT_LOWER" value="12"> + The lower limit of rotation in the slider. </constant> <constant name="PARAM_ANGULAR_LIMIT_SOFTNESS" value="13"> + A factor applied to the all rotation once the limit is surpassed. </constant> <constant name="PARAM_ANGULAR_LIMIT_RESTITUTION" value="14"> + The amount of restitution of the rotation when the limit is surpassed. </constant> <constant name="PARAM_ANGULAR_LIMIT_DAMPING" value="15"> + The amount of damping of the rotation when the limit is surpassed. </constant> <constant name="PARAM_ANGULAR_MOTION_SOFTNESS" value="16"> + A factor applied to the all rotation in the limits. </constant> <constant name="PARAM_ANGULAR_MOTION_RESTITUTION" value="17"> + The amount of restitution of the rotation in the limits. </constant> <constant name="PARAM_ANGULAR_MOTION_DAMPING" value="18"> + The amount of damping of the rotation in the limits. </constant> <constant name="PARAM_ANGULAR_ORTHOGONAL_SOFTNESS" value="19"> + A factor applied to the all rotation across axes orthogonal to the slider. </constant> <constant name="PARAM_ANGULAR_ORTHOGONAL_RESTITUTION" value="20"> + The amount of restitution of the rotation across axes orthogonal to the slider. </constant> <constant name="PARAM_ANGULAR_ORTHOGONAL_DAMPING" value="21"> + The amount of damping of the rotation across axes orthogonal to the slider. </constant> <constant name="PARAM_MAX" value="22"> + End flag of PARAM_* constants, used internally. </constant> </constants> </class> diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index 54eb82fbff..abb0bfa246 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -209,7 +209,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Makes the node ignore its parents tranformations. Node tranformations are only in global space. + Makes the node ignore its parents transformations. Node transformations are only in global space. </description> </method> <method name="set_gizmo"> @@ -234,7 +234,7 @@ <return type="void"> </return> <description> - Reset all tranformations for this node. Set its [Transform3D] to identity matrix. + Reset all transformations for this node. Set its [Transform3D] to identity matrix. </description> </method> <method name="set_ignore_transform_notification"> @@ -329,7 +329,7 @@ <argument index="0" name="local_point" type="Vector3"> </argument> <description> - Tranforms [Vector3] "local_point" from this node's local space to world space. + Transforms [Vector3] "local_point" from this node's local space to world space. </description> </method> <method name="to_local" qualifiers="const"> @@ -338,7 +338,7 @@ <argument index="0" name="global_point" type="Vector3"> </argument> <description> - Tranforms [Vector3] "global_point" from world space to this node's local space. + Transforms [Vector3] "global_point" from world space to this node's local space. </description> </method> <method name="translate"> 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/StyleBoxFlat.xml b/doc/classes/StyleBoxFlat.xml index b09b9f0679..756b7f9225 100644 --- a/doc/classes/StyleBoxFlat.xml +++ b/doc/classes/StyleBoxFlat.xml @@ -14,12 +14,12 @@ [codeblock] height = 30 corner_radius_top_left = 50 - corner_raidus_bottom_left = 100 + corner_radius_bottom_left = 100 [/codeblock] The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will [b]never[/b] be more than the height. Result: [codeblock] corner_radius_top_left: 10 - corner_raidus_bottom_left: 20 + corner_radius_bottom_left: 20 [/codeblock] </description> <tutorials> @@ -268,7 +268,7 @@ </methods> <members> <member name="anti_aliasing" type="bool" setter="set_anti_aliased" getter="is_anti_aliased"> - Anti Aliasing draws a small ring around edges. This ring fades to transparent. As a result edges look much smoother. This is only noticable when using rounded corners. + Anti Aliasing draws a small ring around edges. This ring fades to transparent. As a result edges look much smoother. This is only noticeable when using rounded corners. </member> <member name="anti_aliasing_size" type="int" setter="set_aa_size" getter="get_aa_size"> This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect. diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml index ffe99eb82b..ad02064862 100644 --- a/doc/classes/TabContainer.xml +++ b/doc/classes/TabContainer.xml @@ -16,14 +16,14 @@ <return type="bool"> </return> <description> - Return whether the tabs should be visible or hidden. + Returns [code]true[/code] if the tabs are visible. </description> </method> <method name="get_current_tab" qualifiers="const"> <return type="int"> </return> <description> - Return the current tab index that is being shown. + Returns the current tab index that is being shown. </description> </method> <method name="get_current_tab_control" qualifiers="const"> @@ -42,14 +42,14 @@ <return type="int"> </return> <description> - Return the previous tab index that was being shown. + Returns the previous tab index that was being shown. </description> </method> <method name="get_tab_align" qualifiers="const"> <return type="int" enum="TabContainer.TabAlign"> </return> <description> - Return tab alignment, from the ALIGN_* enum. + Returns the tab alignment.See the ALIGN_* constants. </description> </method> <method name="get_tab_control" qualifiers="const"> @@ -58,14 +58,14 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Return the current tab control that is being shown. + Returns the current tab control that is being shown. </description> </method> <method name="get_tab_count" qualifiers="const"> <return type="int"> </return> <description> - Return the amount of tabs. + Returns the amount of tabs. </description> </method> <method name="get_tab_disabled" qualifiers="const"> @@ -74,6 +74,7 @@ <argument index="0" name="tab_idx" type="int"> </argument> <description> + Returns [code]true[/code] if the tab at index [code]tab_idx[/code] is disabled. </description> </method> <method name="get_tab_icon" qualifiers="const"> @@ -82,6 +83,7 @@ <argument index="0" name="tab_idx" type="int"> </argument> <description> + Returns the [Texture] for the tab at index [code]tab_idx[/code] or null if the tab has no [Texture]. </description> </method> <method name="get_tab_title" qualifiers="const"> @@ -90,7 +92,7 @@ <argument index="0" name="tab_idx" type="int"> </argument> <description> - Return the title for the tab. Tab titles are by default the children node name, but this can be overridden. + Returns the title for the tab at index [code]tab_idx[/code]. Tab titles are by default the children node name, but this can be overridden. </description> </method> <method name="set_current_tab"> @@ -127,6 +129,7 @@ <argument index="1" name="disabled" type="bool"> </argument> <description> + Set tab at index [code]tab_idx[/code] disabled. </description> </method> <method name="set_tab_icon"> @@ -137,7 +140,7 @@ <argument index="1" name="icon" type="Texture"> </argument> <description> - Set an icon for a tab. + Set an icon for a tab at index [code]tab_idx[/code]. </description> </method> <method name="set_tab_title"> @@ -148,7 +151,7 @@ <argument index="1" name="title" type="String"> </argument> <description> - Set a title for the tab. Tab titles are by default the children node name, but this can be overridden. + Set a title for the tab at index [code]tab_idx[/code]. Tab titles are by default the children node name, but this can be overridden. </description> </method> <method name="set_tabs_visible"> @@ -157,16 +160,19 @@ <argument index="0" name="visible" type="bool"> </argument> <description> - Set whether the tabs should be visible or hidden. + If [code]true[/code] all the tabs will be visible. </description> </method> </methods> <members> <member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab"> + The current tab. </member> <member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="TabContainer.TabAlign"> + The alignment of all the tabs of the tab container. See the [code]ALIGN_*[/code] constants. </member> <member name="tabs_visible" type="bool" setter="set_tabs_visible" getter="are_tabs_visible"> + If [code]true[/code] all tabs that are children of the TabContainer will be visible. </member> </members> <signals> 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/TouchScreenButton.xml b/doc/classes/TouchScreenButton.xml index 8a96fa1454..51cb7f86f2 100644 --- a/doc/classes/TouchScreenButton.xml +++ b/doc/classes/TouchScreenButton.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TouchScreenButton" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Button for touch screen devices. </brief_description> <description> + Button for touch screen devices. You can set it to be visible on all screens, or only on touch devices. </description> <tutorials> </tutorials> @@ -13,36 +15,42 @@ <return type="String"> </return> <description> + Returns the button's action. </description> </method> <method name="get_bitmask" qualifiers="const"> <return type="BitMap"> </return> <description> + Returns the button's bitmask. </description> </method> <method name="get_shape" qualifiers="const"> <return type="Shape2D"> </return> <description> + Returns the button's shape. </description> </method> <method name="get_texture" qualifiers="const"> <return type="Texture"> </return> <description> + Returns the button's texture for the normal state. </description> </method> <method name="get_texture_pressed" qualifiers="const"> <return type="Texture"> </return> <description> + Returns the button's texture for the pressed state. </description> </method> <method name="get_visibility_mode" qualifiers="const"> <return type="int" enum="TouchScreenButton.VisibilityMode"> </return> <description> + Sets the button's visibility mode. See [code]VISIBILITY_*[/code] constants. </description> </method> <method name="is_passby_press_enabled" qualifiers="const"> @@ -55,6 +63,7 @@ <return type="bool"> </return> <description> + Returns [code]true[/code] if this button is currently pressed. </description> </method> <method name="is_shape_centered" qualifiers="const"> @@ -75,6 +84,7 @@ <argument index="0" name="action" type="String"> </argument> <description> + Sets the button's action. </description> </method> <method name="set_bitmask"> @@ -83,6 +93,7 @@ <argument index="0" name="bitmask" type="BitMap"> </argument> <description> + Sets the button's [BitMap] bitmask. </description> </method> <method name="set_passby_press"> @@ -91,6 +102,7 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> + If [code]true[/code] passby presses are enabled for this button. </description> </method> <method name="set_shape"> @@ -99,6 +111,7 @@ <argument index="0" name="shape" type="Shape2D"> </argument> <description> + Sets the button's shape. </description> </method> <method name="set_shape_centered"> @@ -107,6 +120,7 @@ <argument index="0" name="bool" type="bool"> </argument> <description> + If [code]true[/code] the button's shape is centered. </description> </method> <method name="set_shape_visible"> @@ -115,6 +129,7 @@ <argument index="0" name="bool" type="bool"> </argument> <description> + If [code]true[/code] the button's shape is visible. </description> </method> <method name="set_texture"> @@ -123,6 +138,7 @@ <argument index="0" name="texture" type="Texture"> </argument> <description> + Sets the button's [Texture] for the normal state. </description> </method> <method name="set_texture_pressed"> @@ -131,6 +147,7 @@ <argument index="0" name="texture_pressed" type="Texture"> </argument> <description> + Sets the button's [Texture] for the pressed state. </description> </method> <method name="set_visibility_mode"> @@ -139,43 +156,57 @@ <argument index="0" name="mode" type="int" enum="TouchScreenButton.VisibilityMode"> </argument> <description> + Sets the button's visibility mode. See the [code]VISIBILITY_*[/code] constants. </description> </method> </methods> <members> <member name="action" type="String" setter="set_action" getter="get_action"> + The button's action. Actions can be handled with [InputEventAction]. </member> <member name="bitmask" type="BitMap" setter="set_bitmask" getter="get_bitmask"> + The button's bitmask. </member> <member name="normal" type="Texture" setter="set_texture" getter="get_texture"> + The button's texture for the normal state. </member> <member name="passby_press" type="bool" setter="set_passby_press" getter="is_passby_press_enabled"> + If [code]true[/code] passby presses are enabled. </member> <member name="pressed" type="Texture" setter="set_texture_pressed" getter="get_texture_pressed"> + The button's texture for the pressed state. </member> <member name="shape" type="Shape2D" setter="set_shape" getter="get_shape"> + The button's shape. </member> <member name="shape_centered" type="bool" setter="set_shape_centered" getter="is_shape_centered"> + If [code]true[/code] the button's shape is centered. </member> <member name="shape_visible" type="bool" setter="set_shape_visible" getter="is_shape_visible"> + If [code]true[/code] the button's shape is visible. </member> <member name="visibility_mode" type="int" setter="set_visibility_mode" getter="get_visibility_mode" enum="TouchScreenButton.VisibilityMode"> + The button's visibility mode. See [code]VISIBILITY_*[/code] constants. </member> </members> <signals> <signal name="pressed"> <description> + Emitted when the button is pressed (down). </description> </signal> <signal name="released"> <description> + Emitted when the button is released (up). </description> </signal> </signals> <constants> <constant name="VISIBILITY_ALWAYS" value="0"> + Always visible. </constant> <constant name="VISIBILITY_TOUCHSCREEN_ONLY" value="1"> + Visible on touch screens only. </constant> </constants> </class> diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml index 6780de1943..cd80d568e7 100644 --- a/doc/classes/Transform.xml +++ b/doc/classes/Transform.xml @@ -68,7 +68,7 @@ <return type="Transform"> </return> <description> - Returns the inverse of the transfrom, under the assumption that the transformation is composed of rotation, scaling and translation. + Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation. </description> </method> <method name="interpolate_with"> @@ -104,7 +104,7 @@ <return type="Transform"> </return> <description> - Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors. + Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors. </description> </method> <method name="rotated"> diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 0e39505ac3..76b9b0e845 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -112,7 +112,7 @@ <return type="Transform2D"> </return> <description> - Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors. + Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors. </description> </method> <method name="rotated"> 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..23229aec4a 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -12,7 +12,7 @@ tween.start() [/codeblock] Some of the methods of this class require a property name. You can get the property name by hovering over the property in the inspector of the editor. - Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transision and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best. + Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best. </description> <tutorials> </tutorials> @@ -135,7 +135,7 @@ <argument index="7" name="arg5" type="Variant" default="null"> </argument> <description> - Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [methog Object.call_deferred). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. + Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [method Object.call_deferred]). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. </description> </method> <method name="interpolate_method"> @@ -158,7 +158,7 @@ <argument index="7" name="delay" type="float" default="0"> </argument> <description> - Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. + Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description. </description> </method> @@ -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"> @@ -346,7 +346,7 @@ <argument index="8" name="delay" type="float" default="0"> </argument> <description> - Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values. + Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values. [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description. </description> </method> @@ -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/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index bac7d1e3b0..5387ec30b3 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -22,7 +22,7 @@ <return type="int"> </return> <description> - Get the amount of miliseconds to store in buffer while playing. + Get the amount of milliseconds to store in buffer while playing. </description> </method> <method name="get_stream" qualifiers="const"> @@ -126,7 +126,7 @@ <argument index="0" name="msec" type="int"> </argument> <description> - Set the amount of miliseconds to buffer during playback. + Set the amount of milliseconds to buffer during playback. </description> </method> <method name="set_expand"> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 2cf36ba69b..58626356bf 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -192,14 +192,14 @@ <return type="Variant"> </return> <description> - Returs the drag data from the GUI, that was previously returned by [method Control.get_drag_data]. + Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data]. </description> </method> <method name="gui_has_modal_stack" qualifiers="const"> <return type="bool"> </return> <description> - Returs whether there are shown modals on-screen. + Returns whether there are shown modals on-screen. </description> </method> <method name="has_transparent_background" qualifiers="const"> 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/VisualScript.xml b/doc/classes/VisualScript.xml index e44547cd8f..8961ff1564 100644 --- a/doc/classes/VisualScript.xml +++ b/doc/classes/VisualScript.xml @@ -4,7 +4,7 @@ A script implemented in the Visual Script programming environment. </brief_description> <description> - A script implemented in the Visual Script programming environment. The script exends the functionality of all objects that instance it. + A script implemented in the Visual Script programming environment. The script extends the functionality of all objects that instance it. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes. You are most likely to use this class via the Visual Script editor or when writing plugins for it. </description> diff --git a/doc/classes/VisualScriptClassConstant.xml b/doc/classes/VisualScriptClassConstant.xml index 70e7de5dd9..0377fa8f09 100644 --- a/doc/classes/VisualScriptClassConstant.xml +++ b/doc/classes/VisualScriptClassConstant.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> - A Visual Script node representing a constant from a class. + Gets a constant from a given class. </brief_description> <description> - A Visual Script node representing a constant from the classes, such as [@GlobalScope.TYPE_INT]. + This node returns a constant from a given class, such as [@GlobalScope.TYPE_INT]. See the given class' documentation for available constants. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]value[/code] </description> <tutorials> </tutorials> @@ -42,10 +46,10 @@ </methods> <members> <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> - The type to get the constant from. + The constant's parent class. </member> <member name="constant" type="String" setter="set_class_constant" getter="get_class_constant"> - The name of the constant to return. + The constant to return. See the given class for its available constants. </member> </members> <constants> diff --git a/doc/classes/VisualScriptConstant.xml b/doc/classes/VisualScriptConstant.xml index 508087a928..2a704adecf 100644 --- a/doc/classes/VisualScriptConstant.xml +++ b/doc/classes/VisualScriptConstant.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> - A Visual Script node which returns a constant value. + Gets a contant's value. </brief_description> <description> - A Visual Script node which returns the specified constant value. + This node returns a constant's value. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]get[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptEmitSignal.xml b/doc/classes/VisualScriptEmitSignal.xml index 844b5a40ec..8d132ed321 100644 --- a/doc/classes/VisualScriptEmitSignal.xml +++ b/doc/classes/VisualScriptEmitSignal.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> - A Visual Script node which emits a specified signal. + Emits a specified signal. </brief_description> <description> - A Visual Script node which emits a specified signal when it is executed. + Emits a specified signal when it is executed. + [b]Input Ports:[/b] + - Sequence: [code]emit[/code] + [b]Output Ports:[/b] + - Sequence </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptIterator.xml b/doc/classes/VisualScriptIterator.xml index 74309fcf00..1f9a4fddde 100644 --- a/doc/classes/VisualScriptIterator.xml +++ b/doc/classes/VisualScriptIterator.xml @@ -1,8 +1,17 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Steps through items in a given input. </brief_description> <description> + This node steps through each item in a given input. Input can be any sequence data type, such as an [Array] or [String]. When each item has been processed, execution passed out the [code]exit[/code] Sequence port. + [b]Input Ports:[/b] + - Sequence: [code]for (elem) in (input)[/code] + - Data (variant): [code]input[/code] + [b]Output Ports:[/b] + - Sequence: [code]each[/code] + - Sequence: [code]exit[/code] + - Data (variant): [code]elem[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptLocalVar.xml b/doc/classes/VisualScriptLocalVar.xml index 7db550d5fe..bca19d06d5 100644 --- a/doc/classes/VisualScriptLocalVar.xml +++ b/doc/classes/VisualScriptLocalVar.xml @@ -1,8 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Gets a local variable's value. </brief_description> <description> + This node returns a local variable's value. "Var Name" must be supplied, with an optional type. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]get[/code] </description> <tutorials> </tutorials> @@ -40,8 +46,10 @@ </methods> <members> <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type"> + The local variable's type. </member> <member name="var_name" type="String" setter="set_var_name" getter="get_var_name"> + The local variable's name. </member> </members> <constants> diff --git a/doc/classes/VisualScriptLocalVarSet.xml b/doc/classes/VisualScriptLocalVarSet.xml index 6e69f13383..67a5efa33e 100644 --- a/doc/classes/VisualScriptLocalVarSet.xml +++ b/doc/classes/VisualScriptLocalVarSet.xml @@ -1,8 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Changes a local variable's value. </brief_description> <description> + The node changes a local variable's value to the given input. The new value is also provided on an output Data port. + [b]Input Ports:[/b] + - Sequence + - Data (variant): [code]set[/code] + [b]Output Ports:[/b] + - Sequence + - Data (variant): [code]get[/code] </description> <tutorials> </tutorials> @@ -40,8 +48,10 @@ </methods> <members> <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type"> + The local variable's type. </member> <member name="var_name" type="String" setter="set_var_name" getter="get_var_name"> + The local variable's name. </member> </members> <constants> diff --git a/doc/classes/VisualScriptMathConstant.xml b/doc/classes/VisualScriptMathConstant.xml index 1ef7d71e10..86744e5caf 100644 --- a/doc/classes/VisualScriptMathConstant.xml +++ b/doc/classes/VisualScriptMathConstant.xml @@ -1,8 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Commonly used mathematical constants. </brief_description> <description> + Provides common math constants, such as Pi or Euler's constant, on an output Data port. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]get[/code] </description> <tutorials> </tutorials> @@ -26,24 +32,33 @@ </methods> <members> <member name="constant" type="int" setter="set_math_constant" getter="get_math_constant" enum="VisualScriptMathConstant.MathConstant"> + The math constant. </member> </members> <constants> <constant name="MATH_CONSTANT_ONE" value="0"> + Unity: [code]1[/code] </constant> <constant name="MATH_CONSTANT_PI" value="1"> + Pi: [code]3.141593[/code] </constant> <constant name="MATH_CONSTANT_2PI" value="2"> + Pi times two: [code]6.283185[/code] </constant> <constant name="MATH_CONSTANT_HALF_PI" value="3"> + Pi divided by two: [code]1.570796[/code] </constant> <constant name="MATH_CONSTANT_E" value="4"> + Natural log: [code]2.718282[/code] </constant> <constant name="MATH_CONSTANT_SQRT2" value="5"> + Square root of two: [code]1.414214[/code] </constant> <constant name="MATH_CONSTANT_INF" value="6"> + Infinity: [code]inf[/code] </constant> <constant name="MATH_CONSTANT_NAN" value="7"> + Not a number: [code]nan[/code] </constant> <constant name="MATH_CONSTANT_MAX" value="8"> </constant> diff --git a/doc/classes/VisualScriptOperator.xml b/doc/classes/VisualScriptOperator.xml index 7e85af8af2..de08075af2 100644 --- a/doc/classes/VisualScriptOperator.xml +++ b/doc/classes/VisualScriptOperator.xml @@ -7,9 +7,7 @@ - Data (variant): [code]A[/code] - Data (variant): [code]B[/code] [b]Output Ports:[/b] - - Sequence: [code]true[/code] - - Sequence: [code]false[/code] - - Sequence: [code]done[/code] + - Data (variant): [code]result[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptReturn.xml b/doc/classes/VisualScriptReturn.xml index 55c53e17a0..ad18e96230 100644 --- a/doc/classes/VisualScriptReturn.xml +++ b/doc/classes/VisualScriptReturn.xml @@ -1,8 +1,15 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Exits a function and returns an optional value. </brief_description> <description> + Ends the execution of a function and returns control to the calling function. Optionally, it can return a [Variant] value. + [b]Input Ports:[/b] + - Sequence + - Data (variant): [code]result[/code] (optional) + [b]Output Ports:[/b] + none </description> <tutorials> </tutorials> @@ -40,8 +47,10 @@ </methods> <members> <member name="return_enabled" type="bool" setter="set_enable_return_value" getter="is_return_value_enabled"> + If [code]true[/code] the [code]return[/code] input port is available. </member> <member name="return_type" type="int" setter="set_return_type" getter="get_return_type" enum="Variant.Type"> + The return value's data type. </member> </members> <constants> diff --git a/doc/classes/VisualScriptSelf.xml b/doc/classes/VisualScriptSelf.xml index a60f7eee03..723b138722 100644 --- a/doc/classes/VisualScriptSelf.xml +++ b/doc/classes/VisualScriptSelf.xml @@ -1,8 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Outputs a reference to the current instance. </brief_description> <description> + Provides a reference to the node running the visual script. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (object): [code]instance[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptSequence.xml b/doc/classes/VisualScriptSequence.xml index a60c9e782b..4ea4203407 100644 --- a/doc/classes/VisualScriptSequence.xml +++ b/doc/classes/VisualScriptSequence.xml @@ -1,8 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Executes a series of Sequence ports. </brief_description> <description> + Steps through a series of one or more output Sequence ports. The [code]current[/code] data port outputs the currently executing item. + [b]Input Ports:[/b] + - Sequence: [code]in order[/code] + [b]Output Ports:[/b] + - Sequence: [code]1[/code] + - Sequence: [code]2 - n[/code] (optional) + - Data (int): [code]current[/code] </description> <tutorials> </tutorials> @@ -26,6 +34,7 @@ </methods> <members> <member name="steps" type="int" setter="set_steps" getter="get_steps"> + The number of steps in the sequence. </member> </members> <constants> diff --git a/doc/classes/VisualScriptSwitch.xml b/doc/classes/VisualScriptSwitch.xml index 95ed737372..2540ae54cc 100644 --- a/doc/classes/VisualScriptSwitch.xml +++ b/doc/classes/VisualScriptSwitch.xml @@ -1,8 +1,19 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Branches program flow based on a given input's value. </brief_description> <description> + Branches the flow based on an input's value. Use "Case Count" in the Inspector to set the number of branches and each comparison's optional type. + [b]Input Ports:[/b] + - Sequence: [code]'input' is[/code] + - Data (variant): [code]=[/code] + - Data (variant): [code]=[/code] (optional) + - Data (variant): [code]input[/code] + [b]Output Ports:[/b] + - Sequence + - Sequence (optional) + - Sequence: [code]done[/code] </description> <tutorials> </tutorials> 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..4bc6a49e91 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -18,6 +18,26 @@ <description> </description> </method> + <method name="force_sync"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="request_frame_drawn_callback"> + <return type="void"> + </return> + <argument index="0" name="where" type="Object"> + </argument> + <argument index="1" name="method" type="String"> + </argument> + <argument index="2" name="userdata" type="Variant"> + </argument> + <description> + Schedules a callback to the corresponding named 'method' on 'where' after a frame has been drawn. + The callback method must use only 1 argument which will be called with 'userdata'. + </description> + </method> <method name="texture_create"> <return type="RID"> </return> diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml index 1071a40c3b..23629881d3 100644 --- a/doc/classes/WeakRef.xml +++ b/doc/classes/WeakRef.xml @@ -4,7 +4,7 @@ Holds an [Object], but does not contribute to the reference count if the object is a reference. </brief_description> <description> - A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GDScript.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to eachother. Without weakrefs, using these classes could lead to memory leaks, since both references keep eachother from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released. + A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GDScript.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released. </description> <tutorials> </tutorials> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index c4dff588b0..0c67e3be4c 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -14,14 +14,14 @@ for arg in sys.argv[1:]: input_list.append(arg) if len(input_list) < 1: - print 'usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)' - print 'example: makerst.py "../../modules/" "../classes" path_to/some_class.xml' + print('usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)') + print('example: makerst.py "../../modules/" "../classes" path_to/some_class.xml') sys.exit(0) def validate_tag(elem, tag): if elem.tag != tag: - print "Tag mismatch, expected '" + tag + "', got " + elem.tag + print("Tag mismatch, expected '" + tag + "', got " + elem.tag) sys.exit(255) @@ -41,7 +41,7 @@ def make_class_list(class_list, columns): f = codecs.open('class_list.rst', 'wb', 'utf-8') prev = 0 col_max = len(class_list) / columns + 1 - print ('col max is ', col_max) + print(('col max is ', col_max)) col_count = 0 row_count = 0 last_initial = '' @@ -300,11 +300,6 @@ def make_method( if declare or pp == None: - # span.attrib["class"]="funcdecl" - # a=ET.SubElement(span,"a") - # a.attrib["name"]=name+"_"+m.attrib["name"] - # a.text=name+"::"+m.attrib["name"] - s = ' **' + m.attrib['name'] + '** ' else: s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` ' @@ -446,6 +441,7 @@ def make_rst_class(node): f.write(make_heading('Signals', '-')) for m in list(events): make_method(f, node.attrib['name'], m, True, name, True) + f.write('\n') d = m.find('description') if d == None or d.text.strip() == '': continue @@ -507,8 +503,8 @@ for path in input_list: for subdir, dirs, _ in os.walk(path): if 'doc_classes' in dirs: doc_dir = os.path.join(subdir, 'doc_classes') - class_file_name = [f for f in os.listdir(doc_dir) if f.endswith('.xml')][0] - file_list.append(os.path.join(doc_dir, class_file_name)) + class_file_names = [f for f in os.listdir(doc_dir) if f.endswith('.xml')] + file_list += [os.path.join(doc_dir, f) for f in class_file_names] elif not os.path.isfile(path): file_list += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml')] elif os.path.isfile(path) and path.endswith('.xml'): @@ -519,7 +515,7 @@ for file in file_list: doc = tree.getroot() if 'version' not in doc.attrib: - print "Version missing from 'doc'" + print("Version missing from 'doc'") sys.exit(255) version = doc.attrib['version'] diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index eaf0b06664..6117c91a6a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -379,6 +379,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in sh->owner = p_light_intance; sh->alloc_tick = tick; sh->version = p_light_version; + li->shadow_atlases.insert(p_atlas); //make new key key = new_quadrant << ShadowAtlas::QUADRANT_SHIFT; @@ -414,6 +415,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in sh->owner = p_light_intance; sh->alloc_tick = tick; sh->version = p_light_version; + li->shadow_atlases.insert(p_atlas); //make new key uint32_t key = new_quadrant << ShadowAtlas::QUADRANT_SHIFT; @@ -2140,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); @@ -2349,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) { @@ -2379,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); @@ -2398,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); } @@ -5024,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/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 91159e3381..5fe7b53a7d 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -838,6 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n"; + actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n"; 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..2c6dd5552e 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_GGX(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_GGX_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_GGX_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 specular_brdf_NL = cNdotL * D * F * G; - float speci = cNdotL * D * F * vis; - - 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; @@ -2063,5 +2104,3 @@ FRAGMENT_SHADER_CODE } - - 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/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 8d6e78dbee..0bc4201ba3 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -164,7 +164,7 @@ Error DirAccessWindows::make_dir(String p_dir) { p_dir = fix_path(p_dir); if (p_dir.is_rel_path()) - p_dir = get_current_dir().plus_file(p_dir); + p_dir = current_dir.plus_file(p_dir); p_dir = p_dir.replace("/", "\\"); diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index b832b993bb..54eb695178 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -64,6 +64,8 @@ private: float transition; Mode mode; + LineEdit *value_edit; + void _notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { @@ -144,14 +146,11 @@ private: } } - String txt = String::num(exp, 2); if (mode == MODE_DISABLED) { - txt = TTR("Disabled"); + f->draw(ci, Point2(5, 5 + f->get_ascent()), TTR("Disabled"), color); } else if (mode == MODE_MULTIPLE) { - txt += " - " + TTR("All Selection"); + f->draw(ci, Point2(5, 5 + f->get_ascent() + value_edit->get_size().height), TTR("All Selection"), color); } - - f->draw(ci, Point2(10, 10 + f->get_ascent()), txt, color); } } @@ -163,6 +162,8 @@ private: if (mode == MODE_DISABLED) return; + value_edit->release_focus(); + float rel = mm->get_relative().x; if (rel == 0) return; @@ -187,24 +188,28 @@ private: if (sg) val = -val; - transition = val; - update(); - //emit_signal("variant_changed"); - emit_signal("transition_changed", transition); + force_transition(val); } } + void _edit_value_changed(const String &p_value_str) { + + force_transition(p_value_str.to_float()); + } + public: static void _bind_methods() { //ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj); ClassDB::bind_method("_gui_input", &AnimationCurveEdit::_gui_input); + ClassDB::bind_method("_edit_value_changed", &AnimationCurveEdit::_edit_value_changed); ADD_SIGNAL(MethodInfo("transition_changed")); } void set_mode(Mode p_mode) { mode = p_mode; + value_edit->set_visible(mode != MODE_DISABLED); update(); } @@ -218,7 +223,8 @@ public: } void set_transition(float p_transition) { - transition = p_transition; + transition = Math::stepify(p_transition, 0.01); + value_edit->set_text(String::num(transition)); update(); } @@ -229,9 +235,8 @@ public: void force_transition(float p_value) { if (mode == MODE_DISABLED) return; - transition = p_value; + set_transition(p_value); emit_signal("transition_changed", p_value); - update(); } AnimationCurveEdit() { @@ -239,6 +244,11 @@ public: transition = 1.0; set_default_cursor_shape(CURSOR_HSPLIT); mode = MODE_DISABLED; + + value_edit = memnew(LineEdit); + value_edit->hide(); + value_edit->connect("text_entered", this, "_edit_value_changed"); + add_child(value_edit); } }; @@ -1101,7 +1111,7 @@ void AnimationKeyEditor::_track_editor_draw() { Color select_color = color; select_color.a = 0.1; Color invalid_path_color = get_color("error_color", "Editor"); - Color track_select_color = get_color("accent", "Editor"); + Color track_select_color = get_color("highlighted_font_color", "Editor"); Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons"); Ref<Texture> move_up_icon = get_icon("MoveUp", "EditorIcons"); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index cb94ea72d1..20ffbde378 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -694,7 +694,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { inherits = doc->class_list[inherits].inherits; if (inherits != "") { - class_desc->add_text(" , "); + class_desc->add_text(" < "); } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ff415c83f1..aca2f59134 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); } } @@ -3153,12 +3156,19 @@ void EditorNode::_add_to_recent_scenes(const String &p_scene) { void EditorNode::_open_recent_scene(int p_idx) { String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); - Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); - ERR_FAIL_INDEX(p_idx, rc.size()); + if (p_idx == recent_scenes->get_item_count() - 1) { + + EditorSettings::get_singleton()->erase(base + "/_recent_scenes"); + call_deferred("_update_recent_scenes"); + } else { + + Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); + ERR_FAIL_INDEX(p_idx, rc.size()); - String path = "res://" + rc[p_idx]; - load_scene(path); + String path = "res://" + rc[p_idx]; + load_scene(path); + } } void EditorNode::_update_recent_scenes() { @@ -3166,10 +3176,15 @@ void EditorNode::_update_recent_scenes() { String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); recent_scenes->clear(); + for (int i = 0; i < rc.size(); i++) { recent_scenes->add_item(rc[i], i); } + + recent_scenes->add_separator(); + recent_scenes->add_shortcut(ED_SHORTCUT("editor/clear_recent", TTR("Clear Recent Scenes"))); + recent_scenes->set_as_minsize(); } void EditorNode::_quick_opened() { @@ -4510,6 +4525,7 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_set_main_scene_state", &EditorNode::_set_main_scene_state); ClassDB::bind_method("_update_scene_tabs", &EditorNode::_update_scene_tabs); ClassDB::bind_method("_discard_changes", &EditorNode::_discard_changes); + ClassDB::bind_method("_update_recent_scenes", &EditorNode::_update_recent_scenes); ClassDB::bind_method("_prepare_history", &EditorNode::_prepare_history); ClassDB::bind_method("_select_history", &EditorNode::_select_history); 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/editor_themes.cpp b/editor/editor_themes.cpp index 0436ac78df..3fc1dcb0bd 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -350,6 +350,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("contrast_color_2", "Editor", contrast_color_2); theme->set_color("font_color", "Editor", font_color); + theme->set_color("highlighted_font_color", "Editor", font_color_hl); theme->set_color("disabled_font_color", "Editor", font_color_disabled); theme->set_color("mono_color", "Editor", mono_color); diff --git a/editor/icons/icon_GUI_unchecked.svg b/editor/icons/icon_GUI_unchecked.svg index 4adf3dd61e..59df40954f 100644 --- a/editor/icons/icon_GUI_unchecked.svg +++ b/editor/icons/icon_GUI_unchecked.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m4 2a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-8zm0.80078 2h6.3984a0.8 0.8 0 0 1 0.80078 0.80078v6.3984a0.8 0.8 0 0 1 -0.80078 0.80078h-6.3984a0.8 0.8 0 0 1 -0.80078 -0.80078v-6.3984a0.8 0.8 0 0 1 0.80078 -0.80078z" fill="#e0e0e0" fill-opacity=".78431"/> -</g> +<path d="m4 2a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-8zm0.80078 2h6.3984a0.8 0.8 0 0 1 0.80078 0.80078v6.3984a0.8 0.8 0 0 1 -0.80078 0.80078h-6.3984a0.8 0.8 0 0 1 -0.80078 -0.80078v-6.3984a0.8 0.8 0 0 1 0.80078 -0.80078z" fill="#e0e0e0" fill-opacity=".78431"/> </svg> diff --git a/editor/icons/icon_a_r_v_r_anchor.svg b/editor/icons/icon_a_r_v_r_anchor.svg new file mode 100644 index 0000000000..1a8398a1be --- /dev/null +++ b/editor/icons/icon_a_r_v_r_anchor.svg @@ -0,0 +1,3 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<path d="m7 1v2h-2v2h2v3.2656l-2.5527-1.2773c-0.15005-0.075253-0.31662-0.11152-0.48438-0.10547-0.36536 0.013648-0.69415 0.2256-0.85742 0.55273-0.24709 0.49403-0.046823 1.0948 0.44727 1.3418l4.4473 2.2227 4.4473-2.2227c0.49409-0.24697 0.69435-0.84777 0.44726-1.3418-0.24697-0.49409-0.84777-0.69435-1.3418-0.44727l-2.5527 1.2773v-3.2656h2v-2h-2v-2zm-3 11v1c0 0.55228 0.44772 1 1 1-0.55228 0-1 0.44772-1 1v1h1v-1h1v1h1v-1c0-0.55228-0.44772-1-1-1 0.55228 0 1-0.44772 1-1v-1h-1v1h-1v-1zm5 0v4h1v-1h1v1h1v-1c-8.34e-4 -0.17579-0.047991-0.34825-0.13672-0.5 0.088728-0.15175 0.13588-0.32421 0.13672-0.5v-1c0-0.55228-0.44772-1-1-1h-1zm1 1h1v1h-1z" fill="#fc9c9c"/> +</svg> diff --git a/editor/icons/icon_a_r_v_r_camera.svg b/editor/icons/icon_a_r_v_r_camera.svg index a02b4d983c..5bf815bcef 100644 --- a/editor/icons/icon_a_r_v_r_camera.svg +++ b/editor/icons/icon_a_r_v_r_camera.svg @@ -1,3 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<path d="m2 1c-0.55401 0-1 0.446-1 1v7c0 0.554 0.44599 1 1 1h4l1-2c0.24699-0.494 0.44772-1 1-1s0.75301 0.506 1 1l1 2h4c0.55401 0 1-0.446 1-1v-7c0-0.554-0.44599-1-1-1h-12zm2 3a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2 2 2 0 0 1 2 -2zm8 0a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2 2 2 0 0 1 2 -2zm-8 7v4h2c0.502 4e-4 0.9265-0.37144 0.99219-0.86914 0.0059-0.047 0.0085325-0.094025 0.0078125-0.14062v-2.9902h-1v3h-1v-3h-1zm5 0v4h1v-1h1v1h1v-1c-7.73e-4 -0.1811-0.05073-0.35867-0.14453-0.51367 0.08369-0.1462 0.14453-0.30573 0.14453-0.48633v-1c0-0.5523-0.4485-1.0293-1-1h-2zm1 1h1v1h-1v-1z" fill="#fc9c9c"/> +<path d="m9.5 0a3 3 0 0 0 -2.9883 2.7773 3 3 0 0 0 -2.0117 -0.77734 3 3 0 0 0 -3 3 3 3 0 0 0 2 2.8242v2.1758c0 0.554 0.44599 1 1 1h6c0.55401 0 1-0.446 1-1v-1l3 2v-6l-3 2v-1.7695a3 3 0 0 0 1 -2.2305 3 3 0 0 0 -3 -3zm-5.5 12v1c0 0.55228 0.44772 1 1 1-0.55228 0-1 0.44772-1 1v1h1v-1h1v1h1v-1c0-0.55228-0.44772-1-1-1 0.55228 0 1-0.44772 1-1v-1h-1v1h-1v-1h-1zm5 0v1 3h1v-1h1v1h1v-1c-8.34e-4 -0.17579-0.047991-0.34825-0.13672-0.5 0.088728-0.15175 0.13588-0.32421 0.13672-0.5v-1c0-0.55228-0.44772-1-1-1h-1-1zm1 1h1v1h-1v-1z" fill="#fc9c9c"/> </svg> diff --git a/editor/icons/icon_a_r_v_r_controller.svg b/editor/icons/icon_a_r_v_r_controller.svg new file mode 100644 index 0000000000..a61f99ffdf --- /dev/null +++ b/editor/icons/icon_a_r_v_r_controller.svg @@ -0,0 +1,3 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<path d="m2 1c-0.554 0-1 0.446-1 1v6c0 0.554 0.446 1 1 1h12c0.554 0 1-0.446 1-1v-6c0-0.554-0.446-1-1-1h-12zm2 1h2v2h2v2h-2v2h-2v-2h-2v-2h2v-2zm9 1c0.55228 0 1 0.44772 1 1s-0.44772 1-1 1-1-0.44772-1-1 0.44772-1 1-1zm-2 2c0.55228 0 1 0.44772 1 1s-0.44772 1-1 1-1-0.44772-1-1 0.44772-1 1-1zm-7 7v1c0 0.55228 0.44772 1 1 1-0.55228 0-1 0.44772-1 1v1h1v-1h1v1h1v-1c0-0.55228-0.44772-1-1-1 0.55228 0 1-0.44772 1-1v-1h-1v1h-1v-1h-1zm5 0v1 3h1v-1h1v1h1v-1c-8.34e-4 -0.17579-0.047991-0.34825-0.13672-0.5 0.088728-0.15175 0.13588-0.32421 0.13672-0.5v-1c0-0.55228-0.44772-1-1-1h-1-1zm1 1h1v1h-1v-1z" fill="#fc9c9c"/> +</svg> diff --git a/editor/icons/icon_a_r_v_r_origin.svg b/editor/icons/icon_a_r_v_r_origin.svg new file mode 100644 index 0000000000..53a149cec6 --- /dev/null +++ b/editor/icons/icon_a_r_v_r_origin.svg @@ -0,0 +1,3 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<path d="m7 1v3h2v-3h-2zm-4 4v2h3v-2h-3zm5 0c-0.55228 0-1 0.44772-1 1s0.44772 1 1 1 1-0.44772 1-1-0.44772-1-1-1zm2 0v2h3v-2h-3zm-3 3v3h2v-3h-2zm-3 4v1c0 0.55228 0.44772 1 1 1-0.55228 0-1 0.44772-1 1v1h1v-1h1v1h1v-1c0-0.55228-0.44772-1-1-1 0.55228 0 1-0.44772 1-1v-1h-1v1h-1v-1h-1zm5 0v1 3h1v-1h1v1h1v-1c-8.34e-4 -0.17579-0.047991-0.34825-0.13672-0.5 0.088728-0.15175 0.13588-0.32421 0.13672-0.5v-1c0-0.55228-0.44772-1-1-1h-1-1zm1 1h1v1h-1v-1z" fill="#fc9c9c"/> +</svg> diff --git a/editor/icons/icon_animated_sprite.svg b/editor/icons/icon_animated_sprite.svg index fe7fde5a39..6fdf8a7a40 100644 --- a/editor/icons/icon_animated_sprite.svg +++ b/editor/icons/icon_animated_sprite.svg @@ -1,7 +1,7 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)" fill="#a5b7f3"> -<path transform="translate(0 1036.4)" d="m10.5 0a5.5 5.5 0 0 0 -5.3301 4.1699 5.5 5.5 0 0 1 1.3301 -0.16992 5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1 -0.16992 1.3301 5.5 5.5 0 0 0 4.1699 -5.3301 5.5 5.5 0 0 0 -5.5 -5.5z" fill-opacity=".39216"/> -<path transform="translate(0 1036.4)" d="m8.5 2a5.5 5.5 0 0 0 -4.7559 2.748 5.5 5.5 0 0 1 2.7559 -0.74805 5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1 -0.74414 2.752 5.5 5.5 0 0 0 2.7441 -4.752 5.5 5.5 0 0 0 -5.5 -5.5z" fill-opacity=".58824"/> -<path transform="translate(0 1036.4)" d="m6.5 4a5.5 5.5 0 0 0 -5.5 5.5 5.5 5.5 0 0 0 5.5 5.5 5.5 5.5 0 0 0 5.5 -5.5 5.5 5.5 0 0 0 -5.5 -5.5zm-2.5 4a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm5 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm-5 3h5a2.5 2 0 0 1 -1.25 1.7324 2.5 2 0 0 1 -2.5 0 2.5 2 0 0 1 -1.25 -1.7324z"/> +<g fill="#a5b7f3"> +<path d="m7 0c-1.108 0-2 0.89199-2 2h7c1.108 0 2 0.89199 2 2v6c1.108 0 2-0.89199 2-2v-6c0-1.108-0.89199-2-2-2z" fill-opacity=".39216"/> +<path d="m5 2c-1.108 0-2 0.89199-2 2h7c1.108 0 2 0.89199 2 2v7c1.108 0 2-0.89199 2-2v-7c0-1.108-0.89199-2-2-2h-7z" fill-opacity=".58824"/> +<path d="m3 4c-1.108 0-2 0.89199-2 2v7c0 1.108 0.89199 2 2 2h7c1.108 0 2-0.89199 2-2v-7c0-1.108-0.89199-2-2-2h-7zm0 4c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm7 0c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm-6 4h5a2.5 2 0 0 1 -1.25 1.7324 2.5 2 0 0 1 -2.5 0 2.5 2 0 0 1 -1.25 -1.7324z"/> </g> </svg> diff --git a/editor/icons/icon_animated_sprite_3d.svg b/editor/icons/icon_animated_sprite_3d.svg index 658ba3e5c2..ccc836832c 100644 --- a/editor/icons/icon_animated_sprite_3d.svg +++ b/editor/icons/icon_animated_sprite_3d.svg @@ -1,7 +1,7 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)" fill="#fc9c9c"> -<path transform="translate(0 1036.4)" d="m10.5 0a5.5 5.5 0 0 0 -5.3301 4.1699 5.5 5.5 0 0 1 1.3301 -0.16992 5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1 -0.16992 1.3301 5.5 5.5 0 0 0 4.1699 -5.3301 5.5 5.5 0 0 0 -5.5 -5.5z" fill-opacity=".39216"/> -<path transform="translate(0 1036.4)" d="m8.5 2a5.5 5.5 0 0 0 -4.7559 2.748 5.5 5.5 0 0 1 2.7559 -0.74805 5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1 -0.74414 2.752 5.5 5.5 0 0 0 2.7441 -4.752 5.5 5.5 0 0 0 -5.5 -5.5z" fill-opacity=".58824"/> -<path transform="translate(0 1036.4)" d="m6.5 4a5.5 5.5 0 0 0 -5.5 5.5 5.5 5.5 0 0 0 5.5 5.5 5.5 5.5 0 0 0 5.5 -5.5 5.5 5.5 0 0 0 -5.5 -5.5zm-2.5 4a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm5 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm-5 3h5a2.5 2 0 0 1 -1.25 1.7324 2.5 2 0 0 1 -2.5 0 2.5 2 0 0 1 -1.25 -1.7324z"/> +<g fill="#fc9c9c"> +<path d="m7 0c-1.108 0-2 0.89199-2 2h7c1.108 0 2 0.89199 2 2v6c1.108 0 2-0.89199 2-2v-6c0-1.108-0.89199-2-2-2z" fill-opacity=".39216"/> +<path d="m5 2c-1.108 0-2 0.89199-2 2h7c1.108 0 2 0.89199 2 2v7c1.108 0 2-0.89199 2-2v-7c0-1.108-0.89199-2-2-2h-7z" fill-opacity=".58824"/> +<path d="m3 4c-1.108 0-2 0.89199-2 2v7c0 1.108 0.89199 2 2 2h7c1.108 0 2-0.89199 2-2v-7c0-1.108-0.89199-2-2-2h-7zm0 4c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm7 0c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm-6 4h5a2.5 2 0 0 1 -1.25 1.7324 2.5 2 0 0 1 -2.5 0 2.5 2 0 0 1 -1.25 -1.7324z"/> </g> </svg> diff --git a/editor/icons/icon_center_container.svg b/editor/icons/icon_center_container.svg index 446e9e0f9c..fc0abc5c28 100644 --- a/editor/icons/icon_center_container.svg +++ b/editor/icons/icon_center_container.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2h-10zm0 2h10v10h-10v-10zm3 1l2 2 2-2h-4zm-2 2v4l2-2-2-2zm8 0l-2 2 2 2v-4zm-4 4l-2 2h4l-2-2z" fill="#a5efac"/> -</g> +<path d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2h-10zm0 2h10v10h-10v-10zm3 1l2 2 2-2h-4zm-2 2v4l2-2-2-2zm8 0l-2 2 2 2v-4zm-4 4l-2 2h4l-2-2z" fill="#a5efac"/> </svg> diff --git a/editor/icons/icon_color_pick.svg b/editor/icons/icon_color_pick.svg index 893afb4eb4..5c21eeba8b 100644 --- a/editor/icons/icon_color_pick.svg +++ b/editor/icons/icon_color_pick.svg @@ -1,5 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m13.051 0.97852a2 2 0 0 0 -1.4434 0.58594l-1.4141 1.4141-1.416-1.4141-1.4141 1.4141 1.4141 1.4141-7.0703 7.0723-0.35352 1.7676-0.35352 1.7676 1.7676-0.35352 1.7676-0.35352 7.0723-7.0703 1.4141 1.4141 1.4141-1.4141-1.4141-1.416 1.4141-1.4141a2 2 0 0 0 0 -2.8281 2 2 0 0 0 -1.3848 -0.58594zm-3.5664 4.1211l1.416 1.416-7.0723 7.0703-0.70703-0.70703-0.70703-0.70703 7.0703-7.0723z" fill="#e0e0e0" fill-opacity=".99608"/> +<path transform="translate(0 1036.4)" d="m8 1c-1.108 0-2 0.892-2 2v2h-1v2h1v5a2 2 0 0 0 1 1.7285v1.2715h2v-1.2695a2 2 0 0 0 1 -1.7305v-5h1v-2h-1v-2c0-1.108-0.892-2-2-2zm-1 6h2v5a1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1v-5z" fill="#e0e0e0"/> </g> </svg> diff --git a/editor/icons/icon_color_picker.svg b/editor/icons/icon_color_picker.svg index 272dfeca48..55c55fe205 100644 --- a/editor/icons/icon_color_picker.svg +++ b/editor/icons/icon_color_picker.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m13.051 0.97852a2 2 0 0 0 -1.4434 0.58594l-1.4141 1.4141-1.416-1.4141-1.4141 1.4141 1.4141 1.4141-7.0703 7.0723-0.35352 1.7676-0.35352 1.7676 1.7676-0.35352 1.7676-0.35352 7.0723-7.0703 1.4141 1.4141 1.4141-1.4141-1.4141-1.416 1.4141-1.4141a2 2 0 0 0 0 -2.8281 2 2 0 0 0 -1.3848 -0.58594zm-3.5664 4.1211l1.416 1.416-7.0723 7.0703-0.70703-0.70703-0.70703-0.70703 7.0703-7.0723z" fill="#a5efac"/> -</g> +<path d="m8 1c-1.108 0-2 0.892-2 2v2h-1v2h1v5a2 2 0 0 0 1 1.7285v1.2715h2v-1.2695a2 2 0 0 0 1 -1.7305v-5h1v-2h-1v-2c0-1.108-0.892-2-2-2zm-1 6h2v5a1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1v-5z" fill="#a5efac"/> </svg> diff --git a/editor/icons/icon_color_picker_button.svg b/editor/icons/icon_color_picker_button.svg index 5d734a5b20..d8de02b298 100644 --- a/editor/icons/icon_color_picker_button.svg +++ b/editor/icons/icon_color_picker_button.svg @@ -1,7 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m13.051 0.97852a2 2 0 0 0 -1.4434 0.58594l-1.4141 1.4141-1.416-1.4141-1.4141 1.4141 1.4141 1.4141-7.0703 7.0723-0.35352 1.7676-0.35352 1.7676 1.7676-0.35352 1.7676-0.35352 7.0723-7.0703 1.4141 1.4141 1.4141-1.4141-1.4141-1.416 1.4141-1.4141a2 2 0 0 0 0 -2.8281 2 2 0 0 0 -1.3848 -0.58594zm-3.5664 4.1211 1.416 1.416-7.0723 7.0703-0.70703-0.70703-0.70703-0.70703 7.0703-7.0723z" fill="#a5efac"/> -<path transform="translate(0 1036.4)" d="m1 3v6.3438l4.9492-4.9512-1.3926-1.3926h-3.5566zm14 6.4863l-1.5137 1.5137h-0.92969l-0.94922-0.94922-2.9492 2.9492h6.3418v-3.5137z" fill="#a5efac"/> -<path transform="translate(0 1036.4)" d="m10.658 11l-2 2h6.3418v-2h-1.5137-0.92969-1.8984z" fill-opacity=".078431"/> -</g> +<path d="m13 1c-1.108 0-2 0.892-2 2v2h-1v2h1v5a2 2 0 0 0 1 1.7285v1.2715h2v-1.2695a2 2 0 0 0 1 -1.7305v-5h1v-2h-1v-2c0-1.108-0.892-2-2-2zm-9 1v3.1328l-1.4453-0.96484-1.1094 1.6641 3 2c0.3359 0.2239 0.77347 0.2239 1.1094 0l3-2-1.1094-1.6641-1.4453 0.96484v-3.1328h-2zm8 5h2v5a1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1v-5zm-8.5 3c-0.831 0-1.5 0.669-1.5 1.5v0.5 1h-1v2h8v-2h-1v-1-0.5c0-0.831-0.669-1.5-1.5-1.5h-3z" fill="#a5efac"/> </svg> diff --git a/editor/icons/icon_connection_and_groups.svg b/editor/icons/icon_connection_and_groups.svg deleted file mode 100644 index 67a73f02b3..0000000000 --- a/editor/icons/icon_connection_and_groups.svg +++ /dev/null @@ -1,5 +0,0 @@ -<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m2 0v1 5 1h12v-1-6h-11-1zm1 1h10v5h-10v-5zm2.5 1a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm5 0a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm-0.5 7a2 2 0 0 0 -2 2v1h-6v1h6v1a2 2 0 0 0 2 2h2v-1h2v-1h-2v-3h2v-1h-2v-1h-2z" fill="#e0e0e0"/> -</g> -</svg> diff --git a/editor/icons/icon_control_layout.svg b/editor/icons/icon_control_layout.svg new file mode 100644 index 0000000000..4bf60cf751 --- /dev/null +++ b/editor/icons/icon_control_layout.svg @@ -0,0 +1,3 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<path d="m1 1v14h14v-14zm2 2h3v3h-3zm5 0h5v3h-5zm-5 5h3v5h-3zm5 0h5v5h-5z" fill="#a5efac"/> +</svg> diff --git a/editor/icons/icon_edit.svg b/editor/icons/icon_edit.svg index b1bce158c4..1805aab54f 100644 --- a/editor/icons/icon_edit.svg +++ b/editor/icons/icon_edit.svg @@ -1,5 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path d="m1.7071 1047.8-0.70711 3.5356l3.5355-0.7071 7.7782-7.7782-2.8284-2.8284zm9.1924-9.1924 2.8284 2.8285 1.4142-1.4142-2.8284-2.8285z" fill="#e0e0e0"/> +<path transform="translate(0 1036.4)" d="m7 1c-0.554 0-1 0.446-1 1v2h4v-2c0-0.554-0.446-1-1-1h-2zm-1 4v7l2 3 2-3v-7h-4zm1 1h1v5h-1v-5z" fill="#e0e0e0"/> </g> </svg> diff --git a/editor/icons/icon_edit_key.svg b/editor/icons/icon_edit_key.svg index 2959900d04..443a9a0455 100644 --- a/editor/icons/icon_edit_key.svg +++ b/editor/icons/icon_edit_key.svg @@ -1,6 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)" fill="#e0e0e0"> -<path d="m1.7071 1047.8-0.70711 3.5356l3.5355-0.7071 7.7782-7.7782-2.8284-2.8284zm9.1924-9.1924 2.8284 2.8285 1.4142-1.4142-2.8284-2.8285z"/> -<ellipse cx="3.5" cy="1039.9" rx="2.5" ry="2.5"/> +<g transform="translate(0 -1036.4)"> +<path transform="translate(0 1036.4)" d="m12 1c-0.554 0-1 0.446-1 1v2h4v-2c0-0.554-0.446-1-1-1h-2zm-7 3c-0.195 0-0.38964 0.07519-0.53906 0.22461l-3.2363 3.2363c-0.29884 0.29884-0.29884 0.77929 0 1.0781l3.2363 3.2363c0.29884 0.29884 0.77929 0.29884 1.0781 0l3.2363-3.2363c0.29884-0.29884 0.29884-0.77929 0-1.0781l-3.2363-3.2363c-0.14942-0.14942-0.34406-0.22461-0.53906-0.22461zm6 1v7l2 3 2-3v-7h-4zm1 1h1v5h-1v-5z" fill="#e0e0e0"/> </g> </svg> diff --git a/editor/icons/icon_groups.svg b/editor/icons/icon_groups.svg index 37e40749b8..55cf3c48eb 100644 --- a/editor/icons/icon_groups.svg +++ b/editor/icons/icon_groups.svg @@ -1,7 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<rect x="1" y="1040.4" width="14" height="8" fill="none" stroke="#e0e0e0" stroke-linejoin="round" stroke-width="2"/> -<ellipse cx="5" cy="1044.4" rx="2" ry="2" fill="#e0e0e0"/> -<ellipse cx="11" cy="1044.4" rx="2" ry="2" fill="#e0e0e0"/> +<path transform="translate(0 1036.4)" d="m2 1a1.0001 1.0001 0 0 0 -1 1v12a1.0001 1.0001 0 0 0 1 1h12a1.0001 1.0001 0 0 0 1 -1v-12a1.0001 1.0001 0 0 0 -1 -1h-12zm1 2h10v10h-10v-10zm5 2a3 3 0 0 0 -3 3 3 3 0 0 0 3 3 3 3 0 0 0 3 -3 3 3 0 0 0 -3 -3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </g> </svg> diff --git a/editor/icons/icon_key_move_enabled.svg b/editor/icons/icon_key_position.svg index 203b697ad2..203b697ad2 100644 --- a/editor/icons/icon_key_move_enabled.svg +++ b/editor/icons/icon_key_position.svg diff --git a/editor/icons/icon_key_rotate_enabled.svg b/editor/icons/icon_key_rotation.svg index 0f975631b2..0f975631b2 100644 --- a/editor/icons/icon_key_rotate_enabled.svg +++ b/editor/icons/icon_key_rotation.svg diff --git a/editor/icons/icon_key_scale_enabled.svg b/editor/icons/icon_key_scale.svg index eaa12fdf0e..eaa12fdf0e 100644 --- a/editor/icons/icon_key_scale_enabled.svg +++ b/editor/icons/icon_key_scale.svg diff --git a/editor/icons/icon_kinematic_body.svg b/editor/icons/icon_kinematic_body.svg index 393e21a529..6f8d69fa53 100644 --- a/editor/icons/icon_kinematic_body.svg +++ b/editor/icons/icon_kinematic_body.svg @@ -1,5 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m4 4v1h1v-1h-1zm1 1v1h-1v1h-1v1h-1v1 2h1v-2h1v1 1h1v-1h5v1h1v-2h1v2h1v-2-1h-1v-1h-1v-1h-1v-1h-1v1h-3v-1h-1zm5 0h1v-1h-1v1zm0 6h-2v1h2v-1zm-5 0v1h2v-1h-2zm0-4h1v1h-1v-1zm4 0h1v1h-1v-1z" fill="#fc9c9c" fill-opacity=".99608"/> +<path transform="translate(0 1036.4)" d="m6 1c-0.55401 0-1 0.44599-1 1v3c0 0.55401 0.44599 1 1 1h1v0.99023a1.0001 1.0001 0 0 0 -0.31641 0.0625l-2.0508 0.68359-0.68359-2.0508a1.0001 1.0001 0 0 0 -0.99023 -0.69727 1.0001 1.0001 0 0 0 -0.9082 1.3281l1 3a1.0001 1.0001 0 0 0 1.2656 0.63281l1.6836-0.56055v0.61133c0 0.040884 0.018715 0.075662 0.023438 0.11523l-4.5781 3.0527a1.0001 1.0001 0 1 0 1.1094 1.6641l5.0566-3.3711 1.4941 2.9863a1.0001 1.0001 0 0 0 1.2109 0.50195l3-1a1.0001 1.0001 0 1 0 -0.63281 -1.8965l-2.1777 0.72461-0.97461-1.9512c0.2759-0.17764 0.46875-0.47227 0.46875-0.82617v-1h1.3828l0.72266 1.4473a1.0001 1.0001 0 1 0 1.7891 -0.89453l-1-2a1.0001 1.0001 0 0 0 -0.89453 -0.55273h-3v-1h1c0.55401 0 1-0.44599 1-1v-3c0-0.55401-0.44599-1-1-1h-4zm0 2h1v2h-1v-2z" fill="#fc9c9c" fill-opacity=".99608"/> </g> </svg> diff --git a/editor/icons/icon_kinematic_body_2d.svg b/editor/icons/icon_kinematic_body_2d.svg index e269efd12a..51026e5f28 100644 --- a/editor/icons/icon_kinematic_body_2d.svg +++ b/editor/icons/icon_kinematic_body_2d.svg @@ -1,5 +1,7 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m4 4v1h1v-1h-1zm1 1v1h-1v1h-1v1h-1v1 2h1v-2h1v1 1h1v-1h5v1h1v-2h1v2h1v-2-1h-1v-1h-1v-1h-1v-1h-1v1h-3v-1h-1zm5 0h1v-1h-1v1zm0 6h-2v1h2v-1zm-5 0v1h2v-1h-2zm0-4h1v1h-1v-1zm4 0h1v1h-1v-1z" fill="#a5b7f3" fill-opacity=".98824"/> +<g transform="translate(.49212 -.0044019)" fill="#a5b7f5" fill-opacity=".98824"> +<path transform="translate(0 1036.4)" d="m6 1c-0.55401 0-1 0.44599-1 1v3c0 0.55401 0.44599 1 1 1h1v0.99023a1.0001 1.0001 0 0 0 -0.31641 0.0625l-2.0508 0.68359-0.68359-2.0508a1.0001 1.0001 0 0 0 -0.99023 -0.69727 1.0001 1.0001 0 0 0 -0.9082 1.3281l1 3a1.0001 1.0001 0 0 0 1.2656 0.63281l1.6836-0.56055v0.61133c0 0.04088 0.018715 0.07566 0.023437 0.11523l-4.5781 3.0527a1.0001 1.0001 0 1 0 1.1094 1.6641l5.0566-3.3711 1.4941 2.9863a1.0001 1.0001 0 0 0 1.2109 0.50195l3-1a1.0001 1.0001 0 1 0 -0.63281 -1.8965l-2.1777 0.72461-0.97461-1.9512c0.2759-0.17764 0.46875-0.47227 0.46875-0.82617v-1h1.3828l0.72266 1.4473a1.0001 1.0001 0 1 0 1.7891 -0.89453l-1-2a1.0001 1.0001 0 0 0 -0.89453 -0.55273h-3v-1h1c0.55401 0 1-0.44599 1-1v-3c0-0.55401-0.44599-1-1-1zm0 2h1v2h-1z" fill="#a5b7f5" fill-opacity=".98824"/> +</g> </g> </svg> diff --git a/editor/icons/icon_multi_edit.svg b/editor/icons/icon_multi_edit.svg index 36f62006e0..9a1cfe8e16 100644 --- a/editor/icons/icon_multi_edit.svg +++ b/editor/icons/icon_multi_edit.svg @@ -1,5 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m12.314 0.85742l-1.4141 1.4141 2.8281 2.8281 1.4141-1.4141-2.8281-2.8281zm-11.314 0.14258v2h2v-2h-2zm4 0v2h2v-2h-2zm4.4844 2.6855l-7.7773 7.7793-0.70703 3.5352 3.5352-0.70703 7.7793-7.7773-2.8301-2.8301zm-8.4844 1.3145v2h2v-2h-2z" fill="#e0e0e0"/> +<path transform="translate(0 1036.4)" d="m2 1c-0.554 0-1 0.446-1 1v2h4v-2c0-0.554-0.446-1-1-1h-2zm-1 4v7l2 3 2-3v-7h-4zm1 1h1v5h-1v-5zm8 1v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2z" fill="#e0e0e0"/> </g> </svg> diff --git a/editor/icons/icon_shader.svg b/editor/icons/icon_shader.svg new file mode 100644 index 0000000000..659d81519a --- /dev/null +++ b/editor/icons/icon_shader.svg @@ -0,0 +1,12 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<g> +<path d="m2 1c-0.55226 1e-4 -0.99994 0.4477-1 1v12c5.52e-5 0.5523 0.44774 0.9999 1 1h12c0.55226-1e-4 0.99994-0.4477 1-1v-8l-5-5zm1 2h6v3c0 0.554 0.44599 1 1 1h3v6h-10z" fill="#e0e0e0"/> +<path d="m10 11h2v1h-2z" fill="#9f70ff"/> +<path d="m4 6h2v1h-2z" fill="#ffeb70"/> +<path d="m8 8h4v1h-4z" fill="#9dff70"/> +<path d="m7 6h1v1h-1z" fill="#70deff"/> +<path d="m4 11h5v1h-5z" fill="#ff70ac"/> +<path d="m4 4h3v1h-3z" fill="#ff7070"/> +<path d="m4 8h3v1h-3z" fill="#70ffb9"/> +</g> +</svg> diff --git a/editor/icons/icon_connect.svg b/editor/icons/icon_signals.svg index 97859370b7..97859370b7 100644 --- a/editor/icons/icon_connect.svg +++ b/editor/icons/icon_signals.svg diff --git a/editor/icons/icon_signals_and_groups.svg b/editor/icons/icon_signals_and_groups.svg new file mode 100644 index 0000000000..5dedbaa433 --- /dev/null +++ b/editor/icons/icon_signals_and_groups.svg @@ -0,0 +1,5 @@ +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<g transform="translate(0 -1036.4)"> +<path transform="translate(0 1036.4)" d="m6 0c-0.55228 0-1 0.4477-1 1s0.44772 1 1 1c4.4301 0 8 3.5699 8 8 0 0.5523 0.44772 1 1 1s1-0.4477 1-1c0-5.511-4.489-10-10-10zm0 4c-0.55228 0-1 0.4477-1 1s0.44772 1 1 1c2.221 0 4 1.779 4 4 0 0.5523 0.44772 1 1 1s1-0.4477 1-1c0-3.3018-2.6981-6-6-6zm-5 4a1.0001 1.0001 0 0 0 -1 1v6a1.0001 1.0001 0 0 0 1 1h6a1.0001 1.0001 0 0 0 1 -1v-6a1.0001 1.0001 0 0 0 -1 -1h-6zm1 2h4v4h-4v-4z" fill="#e0e0e0"/> +</g> +</svg> diff --git a/editor/icons/icon_sprite.svg b/editor/icons/icon_sprite.svg index 4feea4d265..09fc2f0979 100644 --- a/editor/icons/icon_sprite.svg +++ b/editor/icons/icon_sprite.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-4 5a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm8 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm-7 3h6a3 3 0 0 1 -1.5 2.5977 3 3 0 0 1 -3 0 3 3 0 0 1 -1.5 -2.5977z" fill="#a5b7f3"/> -</g> +<path d="m5 1c-2.216 0-4 1.784-4 4v6c0 2.216 1.784 4 4 4h6c2.216 0 4-1.784 4-4v-6c0-2.216-1.784-4-4-4h-6zm-1 5c0.554 0 1 0.446 1 1v2c0 0.554-0.446 1-1 1s-1-0.446-1-1v-2c0-0.554 0.446-1 1-1zm8 0c0.554 0 1 0.446 1 1v2c0 0.554-0.446 1-1 1s-1-0.446-1-1v-2c0-0.554 0.446-1 1-1zm-1.8887 5.1074a1.0001 1.0001 0 0 1 0.7168 1.7207c-0.74987 0.74987-1.7676 1.1719-2.8281 1.1719s-2.0783-0.422-2.8281-1.1719a1.0001 1.0001 0 0 1 0.69727 -1.7168 1.0001 1.0001 0 0 1 0.7168 0.30273c0.37534 0.37535 0.88325 0.58594 1.4141 0.58594s1.0387-0.21059 1.4141-0.58594a1.0001 1.0001 0 0 1 0.69727 -0.30664z" fill="#a5b7f6" fill-opacity=".98824"/> </svg> diff --git a/editor/icons/icon_sprite_3d.svg b/editor/icons/icon_sprite_3d.svg index 0d5caae501..eb163e3f43 100644 --- a/editor/icons/icon_sprite_3d.svg +++ b/editor/icons/icon_sprite_3d.svg @@ -1,5 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-4 5a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm8 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm-7 3h6a3 3 0 0 1 -1.5 2.5977 3 3 0 0 1 -3 0 3 3 0 0 1 -1.5 -2.5977z" fill="#fc9c9c" fill-opacity=".99608"/> +<g fill="#fc9c9c"> +<path d="m5 1c-2.216 0-4 1.784-4 4v6c0 2.216 1.784 4 4 4h6c2.216 0 4-1.784 4-4v-6c0-2.216-1.784-4-4-4zm-1 5c0.554 0 1 0.446 1 1v2c0 0.554-0.446 1-1 1s-1-0.446-1-1v-2c0-0.554 0.446-1 1-1zm8 0c0.554 0 1 0.446 1 1v2c0 0.554-0.446 1-1 1s-1-0.446-1-1v-2c0-0.554 0.446-1 1-1zm-1.8887 5.1074a1.0001 1.0001 0 0 1 0.7168 1.7207c-0.74987 0.74987-1.7676 1.1719-2.8281 1.1719s-2.0783-0.422-2.8281-1.1719a1.0001 1.0001 0 0 1 0.69727 -1.7168 1.0001 1.0001 0 0 1 0.7168 0.30273c0.37534 0.37535 0.88325 0.58594 1.4141 0.58594s1.0387-0.21059 1.4141-0.58594a1.0001 1.0001 0 0 1 0.69727 -0.30664z" fill="#fc9c9c"/> </g> </svg> diff --git a/editor/icons/icon_sprite_frames.svg b/editor/icons/icon_sprite_frames.svg index e797819892..8123cbd6b4 100644 --- a/editor/icons/icon_sprite_frames.svg +++ b/editor/icons/icon_sprite_frames.svg @@ -1,5 +1,3 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m6 1a5 5 0 0 0 -5 5 5 5 0 0 0 5 5 5 5 0 0 0 5 -5 5 5 0 0 0 -5 -5zm-3 4a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm6 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1 1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1zm4 2v2h2v-2h-2zm-5.0039 0.49219a0.50005 0.50005 0 0 1 0.35742 0.86133c-0.61785 0.6179-1.4924 0.89648-2.3535 0.89648s-1.7357-0.27858-2.3535-0.89648a0.50005 0.50005 0 0 1 0.34766 -0.85742 0.50005 0.50005 0 0 1 0.35938 0.15039c0.38215 0.3822 1.0076 0.60352 1.6465 0.60352s1.2643-0.22132 1.6465-0.60352a0.50005 0.50005 0 0 1 0.34961 -0.1543zm2.0039 2.5078v2h2v-2h-2zm3 0v2h2v-2h-2zm-6 3v2h2v-2h-2zm3 0v2h2v-2h-2zm3 0v2h2v-2h-2z" fill="#e0e0e0"/> -</g> +<path d="m3 1c-1.108 0-2 0.89199-2 2v6c0 1.108 0.89199 2 2 2h6c1.108 0 2-0.89199 2-2v-6c0-1.108-0.89199-2-2-2h-6zm10 0v2h2v-2h-2zm-10 4c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm6 0c0.554 0 1 0.446 1 1v1c0 0.554-0.446 1-1 1s-1-0.446-1-1v-1c0-0.554 0.446-1 1-1zm4 0v2h2v-2h-2zm-9 4h2 2a2 1 0 0 1 -1 0.86523 2 1 0 0 1 -2 0 2 1 0 0 1 -1 -0.86523zm9 0v2h2v-2h-2zm-12 4v2h2v-2h-2zm4 0v2h2v-2h-2zm4 0v2h2v-2h-2zm4 0v2h2v-2h-2z" fill="#e0e0e0"/> </svg> diff --git a/editor/icons/icon_viewport_sprite.svg b/editor/icons/icon_viewport_sprite.svg deleted file mode 100644 index 4b8bbeaeba..0000000000 --- a/editor/icons/icon_viewport_sprite.svg +++ /dev/null @@ -1,7 +0,0 @@ -<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<rect x="20" y="1042.4" width="1" height="1" fill="#fefeff"/> -<rect x="29" y="1042.4" width="1" height="1" fill="#fefeff"/> -<path transform="translate(0 1036.4)" d="m3 2c-0.5304 8.01e-5 -1.0391 0.21085-1.4141 0.58594-0.37509 0.37501-0.58586 0.88366-0.58594 1.4141v8c8.03e-5 0.5304 0.21085 1.0391 0.58594 1.4141 0.37501 0.37509 0.88366 0.58586 1.4141 0.58594h10c1.1046 0 2-0.89543 2-2v-8c0-1.1046-0.89543-2-2-2h-10zm0 1h10c0.55228 9.6e-6 0.99999 0.44772 1 1v8c-1e-5 0.55228-0.44772 0.99999-1 1h-10c-0.55228-1e-5 -0.99999-0.44772-1-1v-8c9.6e-6 -0.55228 0.44772-0.99999 1-1zm1 3v2h2v-2h-2zm6 0v2h2v-2h-2zm-6 3v1h8v-1h-8z" fill="#a5b7f3" fill-opacity=".98824"/> -</g> -</svg> diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 7edaf0e5af..20392a67a7 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -56,10 +56,10 @@ void NodeDock::_bind_methods() { void NodeDock::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - connections_button->set_icon(get_icon("Connect", "EditorIcons")); + connections_button->set_icon(get_icon("Signals", "EditorIcons")); groups_button->set_icon(get_icon("Groups", "EditorIcons")); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - connections_button->set_icon(get_icon("Connect", "EditorIcons")); + connections_button->set_icon(get_icon("Signals", "EditorIcons")); groups_button->set_icon(get_icon("Groups", "EditorIcons")); } } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index bdfe380211..2b9c625aa4 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -557,7 +557,7 @@ void AnimationPlayerEditor::_animation_blend() { String current = animation->get_item_text(animation->get_selected()); - blend_editor.dialog->popup_centered(Size2(400, 400)); + blend_editor.dialog->popup_centered(Size2(400, 400) * EDSCALE); blend_editor.tree->set_hide_root(true); blend_editor.tree->set_column_min_width(0, 10); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4b216d63f5..3f64e75bc8 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2806,12 +2806,16 @@ void CanvasItemEditor::_notification(int p_what) { unlock_button->set_icon(get_icon("Unlock", "EditorIcons")); group_button->set_icon(get_icon("Group", "EditorIcons")); ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons")); + key_loc_button->set_icon(get_icon("KeyPosition", "EditorIcons")); + key_rot_button->set_icon(get_icon("KeyRotation", "EditorIcons")); + key_scale_button->set_icon(get_icon("KeyScale", "EditorIcons")); key_insert_button->set_icon(get_icon("Key", "EditorIcons")); zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons")); zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons")); zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons")); + presets_menu->set_icon(get_icon("ControlLayout", "EditorIcons")); PopupMenu *p = presets_menu->get_popup(); p->clear(); @@ -3949,30 +3953,24 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_hb->add_child(memnew(VSeparator)); animation_hb->hide(); - key_loc_button = memnew(Button("loc")); + key_loc_button = memnew(Button); key_loc_button->set_toggle_mode(true); key_loc_button->set_flat(true); key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); - key_loc_button->add_color_override("font_color", Color(1, 0.6, 0.6)); - key_loc_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6)); key_loc_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_POS)); animation_hb->add_child(key_loc_button); - key_rot_button = memnew(Button("rot")); + key_rot_button = memnew(Button); key_rot_button->set_toggle_mode(true); key_rot_button->set_flat(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); - key_rot_button->add_color_override("font_color", Color(1, 0.6, 0.6)); - key_rot_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6)); key_rot_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_ROT)); animation_hb->add_child(key_rot_button); - key_scale_button = memnew(Button("scl")); + key_scale_button = memnew(Button); key_scale_button->set_toggle_mode(true); key_scale_button->set_flat(true); key_scale_button->set_focus_mode(FOCUS_NONE); - key_scale_button->add_color_override("font_color", Color(1, 0.6, 0.6)); - key_scale_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6)); key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 477d440f28..84808cb876 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; } @@ -1407,8 +1409,10 @@ void ScriptEditor::_update_members_overview() { void ScriptEditor::_update_help_overview_visibility() { int selected = tab_container->get_current_tab(); - if (selected < 0 || selected >= tab_container->get_child_count()) + if (selected < 0 || selected >= tab_container->get_child_count()) { + help_overview->set_visible(false); return; + } Node *current = tab_container->get_child(tab_container->get_current_tab()); EditorHelp *se = Object::cast_to<EditorHelp>(current); @@ -1425,6 +1429,7 @@ void ScriptEditor::_update_help_overview_visibility() { } void ScriptEditor::_update_help_overview() { + help_overview->clear(); int selected = tab_container->get_current_tab(); if (selected < 0 || selected >= tab_container->get_child_count()) @@ -1436,8 +1441,6 @@ void ScriptEditor::_update_help_overview() { return; } - help_overview->clear(); - Vector<Pair<String, int> > sections = se->get_sections(); for (int i = 0; i < sections.size(); i++) { help_overview->add_item(sections[i].first); @@ -1445,9 +1448,6 @@ void ScriptEditor::_update_help_overview() { } } -void _help_overview_selected(int p_idx) { -} - void ScriptEditor::_update_script_colors() { bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_enabled"); @@ -1593,6 +1593,8 @@ void ScriptEditor::_update_script_names() { _update_members_overview(); _update_help_overview(); + _update_members_overview_visibility(); + _update_help_overview_visibility(); _update_script_colors(); } @@ -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/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 32973db6ec..a65b8b20da 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2576,6 +2576,7 @@ void SpatialEditorViewport::reset() { cursor.y_rot = 0.5; cursor.distance = 4; cursor.region_select = false; + cursor.pos = Vector3(); _update_name(); } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 3b6eeb61d6..dc7acd9fdc 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -43,10 +43,10 @@ void SpriteFramesEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_ENTER_TREE) { - load->set_icon(get_icon("Folder", "EditorIcons")); - _delete->set_icon(get_icon("Del", "EditorIcons")); + load->set_icon(get_icon("Load", "EditorIcons")); + _delete->set_icon(get_icon("Remove", "EditorIcons")); new_anim->set_icon(get_icon("New", "EditorIcons")); - remove_anim->set_icon(get_icon("Del", "EditorIcons")); + remove_anim->set_icon(get_icon("Remove", "EditorIcons")); } if (p_what == NOTIFICATION_READY) { @@ -667,7 +667,7 @@ SpriteFramesEditor::SpriteFramesEditor() { VBoxContainer *vbc_animlist = memnew(VBoxContainer); split->add_child(vbc_animlist); - vbc_animlist->set_custom_minimum_size(Size2(150, 0)); + vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE); //vbc_animlist->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *sub_vb = memnew(VBoxContainer); @@ -678,12 +678,13 @@ SpriteFramesEditor::SpriteFramesEditor() { sub_vb->add_child(hbc_animlist); new_anim = memnew(Button); + new_anim->set_flat(true); hbc_animlist->add_child(new_anim); + new_anim->set_h_size_flags(SIZE_EXPAND_FILL); new_anim->connect("pressed", this, "_animation_add"); - hbc_animlist->add_spacer(); - remove_anim = memnew(Button); + remove_anim->set_flat(true); hbc_animlist->add_child(remove_anim); remove_anim->connect("pressed", this, "_animation_remove"); @@ -720,6 +721,7 @@ SpriteFramesEditor::SpriteFramesEditor() { //animations = memnew( ItemList ); load = memnew(Button); + load->set_flat(true); load->set_tooltip(TTR("Load Resource")); hbc->add_child(load); @@ -736,14 +738,15 @@ SpriteFramesEditor::SpriteFramesEditor() { hbc->add_child(empty2); move_up = memnew(Button); - move_up->set_text(TTR("Up")); + move_up->set_text(TTR("Move (Before)")); hbc->add_child(move_up); move_down = memnew(Button); - move_down->set_text(TTR("Down")); + move_down->set_text(TTR("Move (After)")); hbc->add_child(move_down); _delete = memnew(Button); + _delete->set_flat(true); hbc->add_child(_delete); file = memnew(EditorFileDialog); @@ -818,7 +821,7 @@ SpriteFramesEditorPlugin::SpriteFramesEditorPlugin(EditorNode *p_node) { editor = p_node; frames_editor = memnew(SpriteFramesEditor); - frames_editor->set_custom_minimum_size(Size2(0, 300)); + frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); button = editor->add_bottom_panel_item("SpriteFrames", frames_editor); button->hide(); } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index e5b6f8e406..d8a87e738f 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -733,8 +733,12 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) { ERR_FAIL_COND(platform.is_null()); Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0); - if (err != OK) + if (err != OK) { + error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted: ") + platform->get_name()); + error_dialog->show(); + error_dialog->popup_centered_minsize(Size2(300, 80)); ERR_PRINT("Failed to export project"); + } } void ProjectExportDialog::_bind_methods() { @@ -940,6 +944,12 @@ ProjectExportDialog::ProjectExportDialog() { export_error2->add_color_override("font_color", get_color("error_color", "Editor")); export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " "); + error_dialog = memnew(AcceptDialog); + error_dialog->set_title("Error"); + error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " "); + main_vb->add_child(error_dialog); + error_dialog->hide(); + LinkButton *download_templates = memnew(LinkButton); download_templates->set_text(TTR("Manage Export Templates")); export_templates_error->add_child(download_templates); diff --git a/editor/project_export.h b/editor/project_export.h index 61de0f739a..288b0c290f 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -72,6 +72,7 @@ private: Button *button_export; bool updating; + AcceptDialog *error_dialog; ConfirmationDialog *delete_confirm; OptionButton *export_filter; 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/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 91ef9e36f3..723d7b14ff 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1189,7 +1189,7 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p ERR_FAIL_COND(!remaps.has(key)); PoolStringArray r = remaps[key]; - ERR_FAIL_INDEX(idx, remaps.size()); + ERR_FAIL_INDEX(idx, r.size()); r.remove(idx); remaps[key] = r; diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 6dcd5e54ec..a6e0af05b2 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -215,9 +215,9 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { bool has_groups = p_node->has_persistent_groups(); if (has_connections && has_groups) { - item->add_button(0, get_icon("ConnectionAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connection(s) and group(s)\nClick to show signals dock.")); + item->add_button(0, get_icon("SignalsAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connection(s) and group(s)\nClick to show signals dock.")); } else if (has_connections) { - item->add_button(0, get_icon("Connect", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connections.\nClick to show signals dock.")); + item->add_button(0, get_icon("Signals", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connections.\nClick to show signals dock.")); } else if (has_groups) { item->add_button(0, get_icon("Groups", "EditorIcons"), BUTTON_GROUPS, false, TTR("Node is in group(s).\nClick to show groups dock.")); } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 3c1889e829..3f8d93d976 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -298,11 +298,11 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi } } -void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 size) { +void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size) { ERR_FAIL_COND(!spatial_node); CubeMesh cubem; - cubem.set_size(size); + cubem.set_size(p_size); Ref<ArrayMesh> m = memnew(ArrayMesh); m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), cubem.surface_get_arrays(0)); m->surface_set_material(0, p_material); diff --git a/main/SCsub b/main/SCsub index 1f97cd1be0..ae63b94864 100644 --- a/main/SCsub +++ b/main/SCsub @@ -16,7 +16,7 @@ def make_splash(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef BOOT_SPLASH_H\n") g.write("#define BOOT_SPLASH_H\n") - g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n") + g.write('static const Color boot_splash_bg_color = Color::html("#232323");\n') g.write("static const unsigned char boot_splash_png[] = {\n") for i in range(len(buf)): g.write(byte_to_str(buf[i]) + ",\n") diff --git a/main/main.cpp b/main/main.cpp index e06f423bfc..68e518ae3d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -45,6 +45,7 @@ #include "input_map.h" #include "io/resource_loader.h" #include "scene/main/scene_tree.h" +#include "servers/arvr_server.h" #include "servers/audio_server.h" #include "io/resource_loader.h" @@ -82,6 +83,7 @@ static InputMap *input_map = NULL; static bool _start_success = false; static ScriptDebugger *script_debugger = NULL; AudioServer *audio_server = NULL; +ARVRServer *arvr_server = NULL; static MessageQueue *message_queue = NULL; static Performance *performance = NULL; @@ -162,6 +164,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 +260,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 +293,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 +502,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 +701,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; @@ -934,11 +941,14 @@ Error Main::setup2(Thread::ID p_main_tid_override) { OS::get_singleton()->set_window_position(init_custom_pos); } - //right moment to create and initialize the audio server + // right moment to create and initialize the audio server audio_server = memnew(AudioServer); audio_server->init(); + // also init our arvr_server from here + arvr_server = memnew(ARVRServer); + OS::get_singleton()->set_use_vsync(use_vsync); register_core_singletons(); @@ -1770,6 +1780,11 @@ void Main::cleanup() { memdelete(audio_server); } + if (arvr_server) { + // cleanup now before we pull the rug from underneath... + memdelete(arvr_server); + } + unregister_driver_types(); unregister_module_types(); unregister_scene_types(); diff --git a/main/splash.png b/main/splash.png Binary files differindex 894a7d7aba..34be46557f 100644 --- a/main/splash.png +++ b/main/splash.png diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 6592d0ae1d..ba4163aab7 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -12,6 +12,8 @@ gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp") gdn_env.Append(CPPPATH=['#modules/gdnative/include/']) +SConscript("nativearvr/SCsub") + def _spaced(e): return e if e[-1] == '*' else e + ' ' @@ -22,6 +24,7 @@ def _build_gdnative_api_struct_header(api): '#define GODOT_GDNATIVE_API_STRUCT_H', '', '#include <gdnative/gdnative.h>', + '#include <nativearvr/godot_nativearvr.h>', '#include <nativescript/godot_nativescript.h>', '', '#define GDNATIVE_API_INIT(options) do { extern const godot_gdnative_api_struct *_gdnative_wrapper_api_struct; _gdnative_wrapper_api_struct = options->api_struct; } while (0)', diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py index 9f57b9bb74..df3556249d 100644 --- a/modules/gdnative/config.py +++ b/modules/gdnative/config.py @@ -1,8 +1,12 @@ - def can_build(platform): return True - def configure(env): env.use_ptrcall = True + +def get_doc_classes(): + return ["GDNative", "GDNativeLibrary", "NativeScript", "ARVRInterfaceGDNative"] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml new file mode 100644 index 0000000000..74f71ff603 --- /dev/null +++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build"> + <brief_description> + GDNative wrapper for an ARVR interface + </brief_description> + <description> + This is a wrapper class for GDNative implementations of the ARVR interface. To use a GDNative ARVR interface simply instantiate this object and set your GDNative library containing the ARVR interface implementation. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="set_gdnative_library"> + <return type="void"> + </return> + <argument index="0" name="library" type="GDNativeLibrary"> + </argument> + <description> + Bind this GDNative library to our interface. The library must be a GDNative ARVR Interface for this to work. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index ba813c4564..ba813c4564 100644 --- a/doc/classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml diff --git a/doc/classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index c3561856cc..361c89e6b3 100644 --- a/doc/classes/GDNativeLibrary.xml +++ b/modules/gdnative/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/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml index b040cfd966..b040cfd966 100644 --- a/doc/classes/NativeScript.xml +++ b/modules/gdnative/doc_classes/NativeScript.xml diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 373b98dc8b..3fc04a5498 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -199,10 +199,7 @@ void GDNative::_bind_methods() { ClassDB::bind_method(D_METHOD("initialize"), &GDNative::initialize); ClassDB::bind_method(D_METHOD("terminate"), &GDNative::terminate); - // TODO(karroffel): get_native_(raw_)call_types binding? - - // TODO(karroffel): make this a varargs function? - ClassDB::bind_method(D_METHOD("call_native", "procedure_name", "arguments"), &GDNative::call_native); + ClassDB::bind_method(D_METHOD("call_native", "calling_type", "procedure_name", "arguments"), &GDNative::call_native); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); } @@ -239,10 +236,7 @@ bool GDNative::initialize() { } void *library_init; - err = OS::get_singleton()->get_dynamic_library_symbol_handle( - native_handle, - init_symbol, - library_init); + err = get_symbol(init_symbol, library_init); if (err || !library_init) { OS::get_singleton()->close_dynamic_library(native_handle); @@ -277,11 +271,8 @@ bool GDNative::terminate() { } void *library_terminate; - Error error = OS::get_singleton()->get_dynamic_library_symbol_handle( - native_handle, - terminate_symbol, - library_terminate); - if (error) { + Error error = get_symbol(terminate_symbol, library_terminate); + if (error || !library_terminate) { OS::get_singleton()->close_dynamic_library(native_handle); native_handle = NULL; return true; @@ -313,10 +304,6 @@ void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, nat native_calls.insert(p_call_type, p_callback); } -void GDNativeCallRegistry::register_native_raw_call_type(StringName p_raw_call_type, native_raw_call_cb p_callback) { - native_raw_calls.insert(p_raw_call_type, p_callback); -} - Vector<StringName> GDNativeCallRegistry::get_native_call_types() { Vector<StringName> call_types; call_types.resize(native_calls.size()); @@ -329,18 +316,6 @@ Vector<StringName> GDNativeCallRegistry::get_native_call_types() { return call_types; } -Vector<StringName> GDNativeCallRegistry::get_native_raw_call_types() { - Vector<StringName> call_types; - call_types.resize(native_raw_calls.size()); - - size_t idx = 0; - for (Map<StringName, native_raw_call_cb>::Element *E = native_raw_calls.front(); E; E = E->next(), idx++) { - call_types[idx] = E->key(); - } - - return call_types; -} - Variant GDNative::call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments) { Map<StringName, native_call_cb>::Element *E = GDNativeCallRegistry::singleton->native_calls.find(p_native_call_type); @@ -349,20 +324,34 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced return Variant(); } - String procedure_name = p_procedure_name; - godot_variant result = E->get()(native_handle, (godot_string *)&procedure_name, (godot_array *)&p_arguments); + void *procedure_handle; + + Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( + native_handle, + p_procedure_name, + procedure_handle); + + if (err != OK || procedure_handle == NULL) { + return Variant(); + } + + godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments); return *(Variant *)&result; } -void GDNative::call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return) { +Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) { - Map<StringName, native_raw_call_cb>::Element *E = GDNativeCallRegistry::singleton->native_raw_calls.find(p_raw_call_type); - if (!E) { - ERR_PRINT((String("No handler for native raw call type \"" + p_raw_call_type) + "\" found").utf8().get_data()); - return; + if (native_handle == NULL) { + ERR_PRINT("No valid library handle, can't get symbol from GDNative object"); + return ERR_CANT_OPEN; } - String procedure_name = p_procedure_name; - E->get()(native_handle, (godot_string *)&procedure_name, data, num_args, args, r_return); + Error result = OS::get_singleton()->get_dynamic_library_symbol_handle( + native_handle, + p_procedure_name, + r_handle, + true); + + return result; } diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index 7bbad842eb..e44cc55a79 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -100,8 +100,7 @@ public: _FORCE_INLINE_ void set_singleton_gdnative(bool p_singleton) { singleton_gdnative = p_singleton; } }; -typedef godot_variant (*native_call_cb)(void *, godot_string *, godot_array *); -typedef void (*native_raw_call_cb)(void *, godot_string *, void *, int, void **, void *); +typedef godot_variant (*native_call_cb)(void *, godot_array *); struct GDNativeCallRegistry { static GDNativeCallRegistry *singleton; @@ -111,17 +110,13 @@ struct GDNativeCallRegistry { } inline GDNativeCallRegistry() - : native_calls(), - native_raw_calls() {} + : native_calls() {} Map<StringName, native_call_cb> native_calls; - Map<StringName, native_raw_call_cb> native_raw_calls; void register_native_call_type(StringName p_call_type, native_call_cb p_callback); - void register_native_raw_call_type(StringName p_raw_call_type, native_raw_call_cb p_callback); Vector<StringName> get_native_call_types(); - Vector<StringName> get_native_raw_call_types(); }; class GDNative : public Reference { @@ -149,7 +144,8 @@ public: bool terminate(); Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array()); - void call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return); + + Error get_symbol(StringName p_procedure_name, void *&r_handle); }; #endif // GDNATIVE_H diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 4d3c024a8f..31b021b751 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -5229,6 +5229,85 @@ "arguments": [ ["godot_object *", "p_instance"] ] + }, + { + "name": "godot_arvr_register_interface", + "return_type": "void", + "arguments": [ + ["const godot_arvr_interface_gdnative *", "p_interface"] + ] + }, + { + "name": "godot_arvr_get_worldscale", + "return_type": "godot_real", + "arguments": [] + }, + { + "name": "godot_arvr_get_reference_frame", + "return_type": "godot_transform", + "arguments": [] + }, + { + "name": "godot_arvr_blit", + "return_type": "void", + "arguments": [ + ["int", "p_eye"], + ["godot_rid *", "p_render_target"], + ["godot_rect2 *", "p_screen_rect"] + ] + }, + { + "name": "godot_arvr_get_texid", + "return_type": "godot_int", + "arguments": [ + ["godot_rid *", "p_render_target"] + ] + }, + { + "name": "godot_arvr_add_controller", + "return_type": "godot_int", + "arguments": [ + ["char *", "p_device_name"], + ["godot_int", "p_hand"], + ["godot_bool", "p_tracks_orientation"], + ["godot_bool", "p_tracks_position"] + ] + }, + { + "name": "godot_arvr_remove_controller", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"] + ] + }, + { + "name": "godot_arvr_set_controller_transform", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_transform *", "p_transform"], + ["godot_bool", "p_tracks_orientation"], + ["godot_bool", "p_tracks_position"] + ] + }, + { + "name": "godot_arvr_set_controller_button", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_int", "p_button"], + ["godot_bool", "p_is_pressed"] + ] + }, + { + "name": "godot_arvr_set_controller_axis", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_int", "p_exis"], + ["godot_real", "p_value"], + ["godot_bool", "p_can_be_negative"] + ] } ] } diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 2d8726e5db..25d45db306 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -47,7 +47,7 @@ extern "C" { #define GDAPI GDCALLINGCONV #endif #else -#define GDCALLINGCONV __attribute__((sysv_abi, visibility("default"))) +#define GDCALLINGCONV __attribute__((sysv_abi)) #define GDAPI GDCALLINGCONV #endif @@ -255,7 +255,7 @@ godot_dictionary GDAPI godot_get_global_constants(); ////// GDNative procedure types typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *); typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *); -typedef godot_variant (*godot_gdnative_procedure_fn)(void *, godot_array *); +typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *); ////// System Functions diff --git a/modules/gdnative/include/nativearvr/godot_nativearvr.h b/modules/gdnative/include/nativearvr/godot_nativearvr.h new file mode 100644 index 0000000000..1a8970d396 --- /dev/null +++ b/modules/gdnative/include/nativearvr/godot_nativearvr.h @@ -0,0 +1,78 @@ +/*************************************************************************/ +/* godot_nativearvr.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_NATIVEARVR_H +#define GODOT_NATIVEARVR_H + +#include <gdnative/gdnative.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + void *(*constructor)(godot_object *); + void (*destructor)(void *); + godot_string (*get_name)(const void *); + godot_int (*get_capabilities)(const void *); + godot_bool (*get_anchor_detection_is_enabled)(const void *); + void (*set_anchor_detection_is_enabled)(void *, godot_bool); + godot_bool (*is_stereo)(const void *); + godot_bool (*is_initialized)(const void *); + godot_bool (*initialize)(void *); + void (*uninitialize)(void *); + godot_vector2 (*get_recommended_render_targetsize)(const void *); + godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *); + void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real); + void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *); + void (*process)(void *); +} godot_arvr_interface_gdnative; + +void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface); + +// helper functions to access ARVRServer data +godot_real GDAPI godot_arvr_get_worldscale(); +godot_transform GDAPI godot_arvr_get_reference_frame(); + +// helper functions for rendering +void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect); +godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target); + +// helper functions for updating ARVR controllers +godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position); +void GDAPI godot_arvr_remove_controller(godot_int p_controller_id); +void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); +void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed); +void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative); + +#ifdef __cplusplus +} +#endif + +#endif /* !GODOT_NATIVEARVR_H */ diff --git a/modules/gdnative/nativearvr/SCsub b/modules/gdnative/nativearvr/SCsub new file mode 100644 index 0000000000..ecc5996108 --- /dev/null +++ b/modules/gdnative/nativearvr/SCsub @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import os +import methods + +Import('env') +Import('env_modules') + +env_arvr_gdnative = env_modules.Clone() + +env_arvr_gdnative.Append(CPPPATH=['#modules/gdnative/include/']) +env_arvr_gdnative.add_source_files(env.modules_sources, '*.cpp') + diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp new file mode 100644 index 0000000000..ff8bda162f --- /dev/null +++ b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp @@ -0,0 +1,386 @@ +/*************************************************************************/ +/* arvr_interface_gdnative.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "arvr_interface_gdnative.h" +#include "main/input_default.h" +#include "servers/arvr/arvr_positional_tracker.h" +#include "servers/visual/visual_server_global.h" + +ARVRInterfaceGDNative::ARVRInterfaceGDNative() { + // testing + printf("Construct gdnative interface\n"); + + // we won't have our data pointer until our library gets set + data = NULL; + + interface = NULL; +} + +ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { + printf("Destruct gdnative interface\n"); + + if (is_initialized()) { + uninitialize(); + }; + + // cleanup after ourselves + cleanup(); +} + +void ARVRInterfaceGDNative::cleanup() { + if (interface != NULL) { + interface->destructor(data); + data = NULL; + interface = NULL; + } +} + +void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p_interface) { + // this should only be called once, just being paranoid.. + if (interface) { + cleanup(); + } + + // bind to our interface + interface = p_interface; + + // Now we do our constructing... + data = interface->constructor((godot_object *)this); +} + +StringName ARVRInterfaceGDNative::get_name() const { + + ERR_FAIL_COND_V(interface == NULL, StringName()); + + godot_string result = interface->get_name(data); + + StringName name = *(String *)&result; + + godot_string_destroy(&result); + + return name; +} + +int ARVRInterfaceGDNative::get_capabilities() const { + int capabilities; + + ERR_FAIL_COND_V(interface == NULL, 0); // 0 = None + + capabilities = interface->get_capabilities(data); + + return capabilities; +} + +bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const { + bool enabled; + + ERR_FAIL_COND_V(interface == NULL, false); + + enabled = interface->get_anchor_detection_is_enabled(data); + + return enabled; +} + +void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) { + + ERR_FAIL_COND(interface == NULL); + + interface->set_anchor_detection_is_enabled(data, p_enable); +} + +bool ARVRInterfaceGDNative::is_stereo() { + bool stereo; + + ERR_FAIL_COND_V(interface == NULL, false); + + stereo = interface->is_stereo(data); + + return stereo; +} + +bool ARVRInterfaceGDNative::is_initialized() { + bool initialized; + + ERR_FAIL_COND_V(interface == NULL, false); + + initialized = interface->is_initialized(data); + + return initialized; +} + +bool ARVRInterfaceGDNative::initialize() { + bool initialized; + + ERR_FAIL_COND_V(interface == NULL, false); + + initialized = interface->initialize(data); + + if (initialized) { + // if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if ((arvr_server != NULL) && (arvr_server->get_primary_interface() == NULL)) { + arvr_server->set_primary_interface(this); + }; + }; + + return initialized; +} + +void ARVRInterfaceGDNative::uninitialize() { + ERR_FAIL_COND(interface == NULL); + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if (arvr_server != NULL) { + // Whatever happens, make sure this is no longer our primary interface + arvr_server->clear_primary_interface_if(this); + } + + interface->uninitialize(data); +} + +Size2 ARVRInterfaceGDNative::get_recommended_render_targetsize() { + + ERR_FAIL_COND_V(interface == NULL, Size2()); + + godot_vector2 result = interface->get_recommended_render_targetsize(data); + Vector2 *vec = (Vector2 *)&result; + + return *vec; +} + +Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) { + Transform *ret; + + ERR_FAIL_COND_V(interface == NULL, Transform()); + + godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); + + ret = (Transform *)&t; + + return *ret; +} + +CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { + CameraMatrix cm; + + ERR_FAIL_COND_V(interface == NULL, CameraMatrix()); + + interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far); + + return cm; +} + +void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { + + ERR_FAIL_COND(interface == NULL); + + interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect); +} + +void ARVRInterfaceGDNative::process() { + ERR_FAIL_COND(interface == NULL); + + interface->process(data); +} + +///////////////////////////////////////////////////////////////////////////////////// +// some helper callbacks + +extern "C" { + +void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) { + Ref<ARVRInterfaceGDNative> new_interface; + new_interface.instance(); + new_interface->set_interface((godot_arvr_interface_gdnative * const)p_interface); + ARVRServer::get_singleton()->add_interface(new_interface); +} + +godot_real GDAPI godot_arvr_get_worldscale() { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 1.0); + + return arvr_server->get_world_scale(); +} + +godot_transform GDAPI godot_arvr_get_reference_frame() { + godot_transform reference_frame; + Transform *reference_frame_ptr = (Transform *)&reference_frame; + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if (arvr_server != NULL) { + *reference_frame_ptr = arvr_server->get_reference_frame(); + } else { + godot_transform_new_identity(&reference_frame); + } + + return reference_frame; +} + +void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect) { + // blits out our texture as is, handy for preview display of one of the eyes that is already rendered with lens distortion on an external HMD + ARVRInterface::Eyes eye = (ARVRInterface::Eyes)p_eye; + RID *render_target = (RID *)p_render_target; + Rect2 screen_rect = *(Rect2 *)p_rect; + + if (eye == ARVRInterface::EYE_LEFT) { + screen_rect.size.x /= 2.0; + } else if (p_eye == ARVRInterface::EYE_RIGHT) { + screen_rect.size.x /= 2.0; + screen_rect.position.x += screen_rect.size.x; + } + + VSG::rasterizer->set_current_render_target(RID()); + VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); +} + +godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) { + // In order to send off our textures to display on our hardware we need the opengl texture ID instead of the render target RID + // This is a handy function to expose that. + RID *render_target = (RID *)p_render_target; + + RID eye_texture = VSG::storage->render_target_get_texture(*render_target); + uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); + + return texid; +} + +godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 0); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL_V(input, 0); + + ARVRPositionalTracker *new_tracker = memnew(ARVRPositionalTracker); + new_tracker->set_name(p_device_name); + new_tracker->set_type(ARVRServer::TRACKER_CONTROLLER); + if (p_hand == 1) { + new_tracker->set_hand(ARVRPositionalTracker::TRACKER_LEFT_HAND); + } else if (p_hand == 2) { + new_tracker->set_hand(ARVRPositionalTracker::TRACKER_RIGHT_HAND); + } + + // also register as joystick... + int joyid = input->get_unused_joy_id(); + if (joyid != -1) { + new_tracker->set_joy_id(joyid); + input->joy_connection_changed(joyid, true, p_device_name, ""); + } + + if (p_tracks_orientation) { + Basis orientation; + new_tracker->set_orientation(orientation); + } + if (p_tracks_position) { + Vector3 position; + new_tracker->set_position(position); + } + + // add our tracker to our server and remember its pointer + arvr_server->add_tracker(new_tracker); + + // note, this ID is only unique within controllers! + return new_tracker->get_tracker_id(); +} + +void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + ARVRPositionalTracker *remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (remove_tracker != NULL) { + // unset our joystick if applicable + int joyid = remove_tracker->get_joy_id(); + if (joyid != -1) { + input->joy_connection_changed(joyid, false, "", ""); + remove_tracker->set_joy_id(-1); + } + + // remove our tracker from our server + arvr_server->remove_tracker(remove_tracker); + memdelete(remove_tracker); + } +} + +void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker != NULL) { + Transform *transform = (Transform *)p_transform; + if (p_tracks_orientation) { + tracker->set_orientation(transform->basis); + } + if (p_tracks_position) { + tracker->set_position(transform->origin); + } + } +} + +void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker != NULL) { + int joyid = tracker->get_joy_id(); + if (joyid != -1) { + input->joy_button(joyid, p_button, p_is_pressed); + } + } +} + +void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker != NULL) { + int joyid = tracker->get_joy_id(); + if (joyid != -1) { + InputDefault::JoyAxis jx; + jx.min = p_can_be_negative ? -1 : 0; + jx.value = p_value; + input->joy_axis(joyid, p_axis, jx); + } + } +} +} diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.h b/modules/gdnative/nativearvr/arvr_interface_gdnative.h new file mode 100644 index 0000000000..e45b51e070 --- /dev/null +++ b/modules/gdnative/nativearvr/arvr_interface_gdnative.h @@ -0,0 +1,86 @@ +/*************************************************************************/ +/* arvr_interface_gdnative.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef ARVR_INTERFACE_GDNATIVE_H +#define ARVR_INTERFACE_GDNATIVE_H + +#include "modules/gdnative/gdnative.h" +#include "servers/arvr/arvr_interface.h" + +/** + @authors Hinsbart & Karroffel & Mux213 + + This subclass of our AR/VR interface forms a bridge to GDNative. +*/ + +class ARVRInterfaceGDNative : public ARVRInterface { + GDCLASS(ARVRInterfaceGDNative, ARVRInterface) + + void cleanup(); + +protected: + const godot_arvr_interface_gdnative *interface; + void *data; + +public: + /** general interface information **/ + ARVRInterfaceGDNative(); + ~ARVRInterfaceGDNative(); + + void set_interface(const godot_arvr_interface_gdnative *p_interface); + + virtual StringName get_name() const; + virtual int get_capabilities() const; + + virtual bool is_initialized(); + virtual bool initialize(); + virtual void uninitialize(); + + /** specific to AR **/ + virtual bool get_anchor_detection_is_enabled() const; + virtual void set_anchor_detection_is_enabled(bool p_enable); + + /** rendering and internal **/ + virtual Size2 get_recommended_render_targetsize(); + virtual bool is_stereo(); + virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); + + // we expose a PoolVector<float> version of this function to GDNative + PoolVector<float> _get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); + + // and a CameraMatrix version to ARVRServer + virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); + + virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect); + + virtual void process(); +}; + +#endif // ARVR_INTERFACE_GDNATIVE_H diff --git a/modules/gdnative/nativearvr/config.py b/modules/gdnative/nativearvr/config.py new file mode 100644 index 0000000000..4d1bdfe4d1 --- /dev/null +++ b/modules/gdnative/nativearvr/config.py @@ -0,0 +1,5 @@ +def can_build(platform): + return True + +def configure(env): + pass diff --git a/modules/gdnative/nativearvr/register_types.cpp b/modules/gdnative/nativearvr/register_types.cpp new file mode 100644 index 0000000000..c7d7847a21 --- /dev/null +++ b/modules/gdnative/nativearvr/register_types.cpp @@ -0,0 +1,39 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "register_types.h" +#include "arvr_interface_gdnative.h" + +void register_nativearvr_types() { + ClassDB::register_class<ARVRInterfaceGDNative>(); +} + +void unregister_nativearvr_types() { +} diff --git a/modules/gdnative/nativearvr/register_types.h b/modules/gdnative/nativearvr/register_types.h new file mode 100644 index 0000000000..5e7557c7e9 --- /dev/null +++ b/modules/gdnative/nativearvr/register_types.h @@ -0,0 +1,32 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +void register_nativearvr_types(); +void unregister_nativearvr_types(); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index b9bd65af53..52379560b3 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -137,7 +137,6 @@ bool NativeScript::can_instance() const { #endif } -// TODO(karroffel): implement this Ref<Script> NativeScript::get_base_script() const { NativeScriptDesc *script_data = get_script_desc(); @@ -1010,17 +1009,12 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) { if (!library_script_users.has(lib_path)) library_script_users.insert(lib_path, Set<NativeScript *>()); - void *args[1] = { - (void *)&lib_path - }; + void *proc_ptr; + + gdn->get_symbol(_init_call_name, proc_ptr); + + ((void (*)(godot_string *))proc_ptr)((godot_string *)&lib_path); - // here the library registers all the classes and stuff. - gdn->call_native_raw(_init_call_type, - _init_call_name, - NULL, - 1, - args, - NULL); } else { // already initialized. Nice. } @@ -1053,13 +1047,13 @@ void NativeScriptLanguage::call_libraries_cb(const StringName &name) { // library_gdnatives is modified only from the main thread, so it's safe not to use mutex here for (Map<String, Ref<GDNative> >::Element *L = library_gdnatives.front(); L; L = L->next()) { if (L->get()->is_initialized()) { - L->get()->call_native_raw( - _noarg_call_type, - name, - NULL, - 0, - NULL, - NULL); + + void *proc_ptr; + Error err = L->get()->get_symbol(name, proc_ptr); + + if (!err) { + ((void (*)())proc_ptr)(); + } } } } @@ -1142,12 +1136,11 @@ void NativeReloadNode::_notification(int p_what) { }; // here the library registers all the classes and stuff. - L->get()->call_native_raw(NSL->_init_call_type, - NSL->_init_call_name, - NULL, - 1, - args, - NULL); + + void *proc_ptr; + L->get()->get_symbol("godot_nativescript_init", proc_ptr); + + ((void (*)(void *))proc_ptr)((void *)&L->key()); for (Map<String, Set<NativeScript *> >::Element *U = NSL->library_script_users.front(); U; U = U->next()) { for (Set<NativeScript *>::Element *S = U->get().front(); S; S = S->next()) { diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp index b846710ab8..d734bba810 100644 --- a/modules/gdnative/nativescript/register_types.cpp +++ b/modules/gdnative/nativescript/register_types.cpp @@ -38,53 +38,6 @@ NativeScriptLanguage *native_script_language; -typedef void (*native_script_init_fn)(void *); - -void init_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int p_num_args, void **args, void *r_ret) { - if (p_handle == NULL) { - ERR_PRINT("No valid library handle, can't call nativescript init procedure"); - return; - } - - void *library_proc; - Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( - p_handle, - *(String *)p_proc_name, - library_proc, - true); // we print our own message - if (err != OK) { - ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data()); - return; - } - - native_script_init_fn fn = (native_script_init_fn)library_proc; - - fn(args[0]); -} - -typedef void (*native_script_empty_callback)(); - -void noarg_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int p_num_args, void **args, void *r_ret) { - if (p_handle == NULL) { - ERR_PRINT("No valid library handle, can't call nativescript callback"); - return; - } - - void *library_proc; - Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( - p_handle, - *(String *)p_proc_name, - library_proc, - true); - if (err != OK) { - // it's fine if thread callbacks are not present in the library. - return; - } - - native_script_empty_callback fn = (native_script_empty_callback)library_proc; - fn(); -} - ResourceFormatLoaderNativeScript *resource_loader_gdns = NULL; ResourceFormatSaverNativeScript *resource_saver_gdns = NULL; @@ -95,9 +48,6 @@ void register_nativescript_types() { ScriptServer::register_language(native_script_language); - GDNativeCallRegistry::singleton->register_native_raw_call_type(native_script_language->_init_call_type, init_call_cb); - GDNativeCallRegistry::singleton->register_native_raw_call_type(native_script_language->_noarg_call_type, noarg_call_cb); - resource_saver_gdns = memnew(ResourceFormatSaverNativeScript); ResourceSaver::add_resource_format_saver(resource_saver_gdns); diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 059cd197d1..8e5f58524b 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -35,6 +35,7 @@ #include "io/resource_loader.h" #include "io/resource_saver.h" +#include "nativearvr/register_types.h" #include "nativescript/register_types.h" #include "core/engine.h" @@ -127,57 +128,12 @@ static void editor_init_callback() { #endif -godot_variant cb_standard_varcall(void *handle, godot_string *p_procedure, godot_array *p_args) { - if (handle == NULL) { - ERR_PRINT("No valid library handle, can't call standard varcall procedure"); - godot_variant ret; - godot_variant_new_nil(&ret); - return ret; - } - - void *library_proc; - Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( - handle, - *(String *)p_procedure, - library_proc, - true); // we roll our own message - if (err != OK) { - ERR_PRINT((String("GDNative procedure \"" + *(String *)p_procedure) + "\" does not exists and can't be called").utf8().get_data()); - godot_variant ret; - godot_variant_new_nil(&ret); - return ret; - } +godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) { godot_gdnative_procedure_fn proc; - proc = (godot_gdnative_procedure_fn)library_proc; + proc = (godot_gdnative_procedure_fn)p_procedure_handle; - return proc(NULL, p_args); -} - -void cb_singleton_call( - void *p_handle, - godot_string *p_proc_name, - void *p_data, - int p_num_args, - void **p_args, - void *r_return) { - if (p_handle == NULL) { - ERR_PRINT("No valid library handle, can't call singleton procedure"); - return; - } - - void *singleton_proc; - Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( - p_handle, - *(String *)p_proc_name, - singleton_proc); - - if (err != OK) { - return; - } - - void (*singleton_procedure_ptr)() = (void (*)())singleton_proc; - singleton_procedure_ptr(); + return proc(p_args); } GDNativeCallRegistry *GDNativeCallRegistry::singleton; @@ -200,8 +156,7 @@ void register_gdnative_types() { GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); - GDNativeCallRegistry::singleton->register_native_raw_call_type("gdnative_singleton_call", cb_singleton_call); - + register_nativearvr_types(); register_nativescript_types(); // run singletons @@ -223,13 +178,16 @@ void register_gdnative_types() { continue; } - singleton_gdnatives[i]->call_native_raw( - "gdnative_singleton_call", + void *proc_ptr; + Error err = singleton_gdnatives[i]->get_symbol( "godot_gdnative_singleton", - NULL, - 0, - NULL, - NULL); + proc_ptr); + + if (err != OK) { + ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_active_library_path()) + "\" found").utf8().get_data()); + } else { + ((void (*)())proc_ptr)(); + } } } @@ -249,6 +207,7 @@ void unregister_gdnative_types() { } singleton_gdnatives.clear(); + unregister_nativearvr_types(); unregister_nativescript_types(); memdelete(GDNativeCallRegistry::singleton); 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/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 7103dcee41..9a6c8f0cd6 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -705,9 +705,9 @@ MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) { real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 4, i); const Color &elem = p_array[i]; raw[0] = elem.r; - raw[4] = elem.g; - raw[8] = elem.b; - raw[12] = elem.a; + raw[1] = elem.g; + raw[2] = elem.b; + raw[3] = elem.a; #endif } @@ -737,7 +737,7 @@ MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) { real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 2, i); const Vector2 &elem = p_array[i]; raw[0] = elem.x; - raw[4] = elem.y; + raw[1] = elem.y; #endif } @@ -767,8 +767,8 @@ MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) { real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 3, i); const Vector3 &elem = p_array[i]; raw[0] = elem.x; - raw[4] = elem.y; - raw[8] = elem.z; + raw[1] = elem.y; + raw[2] = elem.z; #endif } 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/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 27ea310780..5c252bda86 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -129,7 +129,6 @@ AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() { Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() { Ref<AudioStreamPlaybackOGGVorbis> ovs; - printf("instance at %p, data %p\n", this, data); ERR_FAIL_COND_V(data == NULL, ovs); @@ -208,8 +207,6 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { break; } } - - printf("create at %p, data %p\n", this, data); } PoolVector<uint8_t> AudioStreamOGGVorbis::get_data() const { diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 972be5f5a4..1980f86114 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -65,6 +65,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX "decimals", "stepify", "lerp", + "inverse_lerp", + "range_lerp", "dectime", "randomize", "randi", @@ -194,9 +196,12 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) { case COLORN: return 2; case MATH_LERP: + case MATH_INVERSE_LERP: case MATH_DECTIME: case LOGIC_CLAMP: return 3; + case MATH_RANGE_LERP: + return 5; case FUNC_MAX: { } } @@ -297,7 +302,26 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const return PropertyInfo(Variant::REAL, "to"); else return PropertyInfo(Variant::REAL, "weight"); - + } break; + case MATH_INVERSE_LERP: { + if (p_idx == 0) + return PropertyInfo(Variant::REAL, "from"); + else if (p_idx == 1) + return PropertyInfo(Variant::REAL, "to"); + else + return PropertyInfo(Variant::REAL, "value"); + } break; + case MATH_RANGE_LERP: { + if (p_idx == 0) + return PropertyInfo(Variant::REAL, "value"); + else if (p_idx == 1) + return PropertyInfo(Variant::REAL, "istart"); + else if (p_idx == 2) + return PropertyInfo(Variant::REAL, "istop"); + else if (p_idx == 3) + return PropertyInfo(Variant::REAL, "ostart"); + else + return PropertyInfo(Variant::REAL, "ostop"); } break; case MATH_DECTIME: { if (p_idx == 0) @@ -495,6 +519,8 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons } break; case MATH_STEPIFY: case MATH_LERP: + case MATH_INVERSE_LERP: + case MATH_RANGE_LERP: case MATH_DECTIME: { t = Variant::REAL; @@ -795,6 +821,22 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in VALIDATE_ARG_NUM(2); *r_return = Math::lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); } break; + case VisualScriptBuiltinFunc::MATH_INVERSE_LERP: { + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return = Math::inverse_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); + } break; + case VisualScriptBuiltinFunc::MATH_RANGE_LERP: { + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + VALIDATE_ARG_NUM(3); + VALIDATE_ARG_NUM(4); + *r_return = Math::range_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2], (double)*p_inputs[3], (double)*p_inputs[4]); + } break; case VisualScriptBuiltinFunc::MATH_DECTIME: { VALIDATE_ARG_NUM(0); @@ -1203,6 +1245,8 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(MATH_DECIMALS); BIND_ENUM_CONSTANT(MATH_STEPIFY); BIND_ENUM_CONSTANT(MATH_LERP); + BIND_ENUM_CONSTANT(MATH_INVERSE_LERP); + BIND_ENUM_CONSTANT(MATH_RANGE_LERP); BIND_ENUM_CONSTANT(MATH_DECTIME); BIND_ENUM_CONSTANT(MATH_RANDOMIZE); BIND_ENUM_CONSTANT(MATH_RAND); @@ -1282,6 +1326,8 @@ void register_visual_script_builtin_func_node() { VisualScriptLanguage::singleton->add_register_func("functions/built_in/decimals", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DECIMALS>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/stepify", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_STEPIFY>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LERP>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/inverse_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_INVERSE_LERP>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/range_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANGE_LERP>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/dectime", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DECTIME>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/randomize", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDOMIZE>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/rand", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAND>); diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index 97ab307039..af24f16a2f 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -64,6 +64,8 @@ public: MATH_DECIMALS, MATH_STEPIFY, MATH_LERP, + MATH_INVERSE_LERP, + MATH_RANGE_LERP, MATH_DECTIME, MATH_RANDOMIZE, MATH_RAND, diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 5a34fc3cd9..d3cd839cf3 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -532,6 +532,7 @@ String VisualScriptOperator::get_text() const { L"A or B", //OP_OR, L"A xor B", //OP_XOR, L"not A", //OP_NOT, + L"A in B", //OP_IN, }; return op_names[op]; diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 053dfa631a..59fefc498f 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -191,6 +191,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC protected void onMainPause() {} protected void onMainResume() {} protected void onMainDestroy() {} + protected boolean onMainBackPressed() { return false; } protected void onGLDrawFrame(GL10 gl) {} protected void onGLSurfaceChanged(GL10 gl, int width, int height) {} // singletons will always miss first onGLSurfaceChanged call @@ -767,9 +768,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC */ @Override public void onBackPressed() { + boolean shouldQuit = true; + + for(int i=0;i<singleton_count;i++) { + if (singletons[i].onMainBackPressed()) { + shouldQuit = false; + } + } System.out.printf("** BACK REQUEST!\n"); - if (mView != null) { + if (shouldQuit && mView != null) { mView.queueEvent(new Runnable() { @Override public void run() { diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index 3c2ad7cc59..b807b952d4 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -285,13 +285,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { @Override public boolean onKeyDown(final int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { - queueEvent(new Runnable() { - @Override - public void run() { - GodotLib.back(); - } - }); - + activity.onBackPressed(); // press 'back' button should not terminate program //normal handle 'back' event in game logic return true; diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java index 04669a3b0c..ac424ab9f8 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -88,79 +88,48 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) { //Log.d(TAG, "beforeTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",after: " + after); - for (int i=0;i<count;i++){ - mView.queueEvent(new Runnable() { - @Override - public void run() { + mView.queueEvent(new Runnable() { + @Override + public void run() { + for (int i = 0; i < count; ++i) { GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); } - }); - } + } + }); } @Override public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) { //Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before); - for (int i=start;i<start+count;i++){ - final int ch = pCharSequence.charAt(i); - mView.queueEvent(new Runnable() { - @Override - public void run() { + mView.queueEvent(new Runnable() { + @Override + public void run() { + for (int i = start; i < start + count; ++i) { + final int ch = pCharSequence.charAt(i); GodotLib.key(0, ch, true); GodotLib.key(0, ch, false); } - }); - } - + } + }); } @Override public boolean onEditorAction(final TextView pTextView, final int pActionID, final KeyEvent pKeyEvent) { if (this.mEdit == pTextView && this.isFullScreenEdit()) { - // user press the action button, delete all old text and insert new text - for (int i = this.mOriginText.length(); i > 0; i--) { - mView.queueEvent(new Runnable() { - @Override - public void run() { - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); - } - }); + final String characters = pKeyEvent.getCharacters(); - /* - if (BuildConfig.DEBUG) { - Log.d(TAG, "deleteBackward"); - } - */ - } - String text = pTextView.getText().toString(); - - /* If user input nothing, translate "\n" to engine. */ - if (text.compareTo("") == 0) { - text = "\n"; - } - - if ('\n' != text.charAt(text.length() - 1)) { - text += '\n'; - } - - for(int i = 0; i < text.length(); i++) { - final int ch = text.codePointAt(i); - mView.queueEvent(new Runnable() { - @Override - public void run() { + mView.queueEvent(new Runnable() { + @Override + public void run() { + for (int i = 0; i < characters.length(); i++) { + final int ch = characters.codePointAt(i); GodotLib.key(0, ch, true); GodotLib.key(0, ch, false); } - }); - } - /* - if (BuildConfig.DEBUG) { - Log.d(TAG, "insertText(" + insertText + ")"); - } - */ + } + }); } if (pActionID == EditorInfo.IME_ACTION_DONE) { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 6819a7e20f..0b193f5882 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -602,21 +602,10 @@ struct TST { TST tst; -struct JAndroidPointerEvent { - - Vector<OS_Android::TouchPos> points; - int pointer; - int what; -}; - -static List<JAndroidPointerEvent> pointer_events; -static List<Ref<InputEvent> > key_events; -static List<OS_Android::JoypadEvent> joy_events; static bool initialized = false; static int step = 0; static bool resized = false; static bool resized_reload = false; -static bool go_back_request = false; static Size2 new_size; static Vector3 accelerometer; static Vector3 magnetometer; @@ -624,8 +613,6 @@ static Vector3 gyroscope; static HashMap<String, JNISingleton *> jni_singletons; static jobject godot_io; -static Vector<int> joy_device_ids; - typedef void (*GFXInitFunc)(void *ud, bool gl2); static jmethodID _on_video_init = 0; @@ -998,7 +985,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *en } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj) { - go_back_request = true; + os_android->main_loop_request_go_back(); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jobject obj) { @@ -1023,36 +1010,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job //__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_id()); - while (pointer_events.size()) { - - JAndroidPointerEvent jpe = pointer_events.front()->get(); - os_android->process_touch(jpe.what, jpe.pointer, jpe.points); - - pointer_events.pop_front(); - } - - while (key_events.size()) { - - Ref<InputEvent> event = key_events.front()->get(); - os_android->process_event(event); - - key_events.pop_front(); - }; - - while (joy_events.size()) { - - OS_Android::JoypadEvent event = joy_events.front()->get(); - os_android->process_joy_event(event); - - joy_events.pop_front(); - } - - if (go_back_request) { - - os_android->main_loop_request_go_back(); - go_back_request = false; - } - os_android->process_accelerometer(accelerometer); os_android->process_magnetometer(magnetometer); @@ -1083,12 +1040,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jo points.push_back(tp); } - JAndroidPointerEvent jpe; - jpe.pointer = pointer; - jpe.points = points; - jpe.what = ev; + os_android->process_touch(ev, pointer, points); - pointer_events.push_back(jpe); /* if (os_android) os_android->process_touch(ev,pointer,points); @@ -1358,7 +1311,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env jevent.index = p_button; jevent.pressed = p_pressed; - joy_events.push_back(jevent); + os_android->process_joy_event(jevent); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jobject obj, jint p_device, jint p_axis, jfloat p_value) { @@ -1369,7 +1322,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jevent.index = p_axis; jevent.value = p_value; - joy_events.push_back(jevent); + os_android->process_joy_event(jevent); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) { @@ -1390,7 +1343,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j hat |= InputDefault::HAT_MASK_DOWN; } jevent.hat = hat; - joy_events.push_back(jevent); + + os_android->process_joy_event(jevent); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jobject obj, jint p_device, jboolean p_connected, jstring p_name) { @@ -1403,6 +1357,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged( JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) { Ref<InputEventKey> ievent; + ievent.instance(); int val = p_unicode_char; int scancode = android_get_keysym(p_scancode); ievent->set_scancode(scancode); @@ -1421,10 +1376,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobj ievent->set_unicode(KEY_ENTER); } else if (p_scancode == 4) { - go_back_request = true; + os_android->main_loop_request_go_back(); } - key_events.push_back(ievent); + os_android->process_event(ievent); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jobject obj, jfloat x, jfloat y, jfloat z) { 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/iphone/export/export.cpp b/platform/iphone/export/export.cpp index c91781ce1d..5216dc5d6a 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -397,7 +397,7 @@ Error EditorExportPlatformIOS::_codesign(String p_file, void *p_userdata) { codesign_args.push_back("-s"); codesign_args.push_back(data->preset->get(data->debug ? "application/code_sign_identity_debug" : "application/code_sign_identity_release")); codesign_args.push_back(p_file); - return OS::get_singleton()->execute("/usr/bin/codesign", codesign_args, true); + return OS::get_singleton()->execute("codesign", codesign_args, true); } return OK; } @@ -608,7 +608,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p archive_args.push_back("archive"); archive_args.push_back("-archivePath"); archive_args.push_back(archive_path); - err = OS::get_singleton()->execute("/usr/bin/xcodebuild", archive_args, true); + err = OS::get_singleton()->execute("xcodebuild", archive_args, true); ERR_FAIL_COND_V(err, err); ep.step("Code-signing dylibs", 3); @@ -628,7 +628,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p export_args.push_back(dest_dir + "export_options.plist"); export_args.push_back("-exportPath"); export_args.push_back(dest_dir); - err = OS::get_singleton()->execute("/usr/bin/xcodebuild", export_args, true); + err = OS::get_singleton()->execute("xcodebuild", export_args, true); ERR_FAIL_COND_V(err, err); #else print_line(".ipa can only be built on macOS. Leaving XCode project without building the package."); 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/osx/export/export.cpp b/platform/osx/export/export.cpp index 0ba0ddec7d..8a6f1dc04c 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -244,7 +244,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese args.push_back(p_path); String str; - Error err = OS::get_singleton()->execute("/usr/bin/codesign", args, true, NULL, &str, NULL, true); + Error err = OS::get_singleton()->execute("codesign", args, true, NULL, &str, NULL, true); ERR_FAIL_COND_V(err != OK, err); print_line("codesign: " + str); @@ -271,7 +271,7 @@ Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const Strin args.push_back(p_app_path_name); String str; - Error err = OS::get_singleton()->execute("/usr/bin/hdiutil", args, true, NULL, &str, NULL, true); + Error err = OS::get_singleton()->execute("hdiutil", args, true, NULL, &str, NULL, true); ERR_FAIL_COND_V(err != OK, err); print_line("hdiutil returned: " + str); 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/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index 57f8e965de..76bb5d5723 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -50,7 +50,7 @@ static _WinTranslatePair _vk_to_keycode[] = { { KEY_CONTROL, VK_CONTROL }, //(0x11) - { KEY_MENU, VK_MENU }, //(0x12) + { KEY_ALT, VK_MENU }, //(0x12) { KEY_PAUSE, VK_PAUSE }, //(0x13) 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..bc18d0c1f0 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++) { @@ -1939,7 +1939,7 @@ Error OS_X11::shell_open(String p_uri) { Error ok; List<String> args; args.push_back(p_uri); - ok = execute("/usr/bin/xdg-open", args, false); + ok = execute("xdg-open", args, false); if (ok == OK) return OK; ok = execute("gnome-open", args, false); @@ -2003,7 +2003,7 @@ String OS_X11::get_system_dir(SystemDir p_dir) const { String pipe; List<String> arg; arg.push_back(xdgparam); - Error err = const_cast<OS_X11 *>(this)->execute("/usr/bin/xdg-user-dir", arg, true, NULL, &pipe); + Error err = const_cast<OS_X11 *>(this)->execute("xdg-user-dir", arg, true, NULL, &pipe); if (err != OK) return "."; return pipe.strip_edges(); @@ -2053,7 +2053,7 @@ void OS_X11::alert(const String &p_alert, const String &p_title) { args.push_back(p_title); args.push_back(p_alert); - execute("/usr/bin/xmessage", args, true); + execute("xmessage", args, true); } void OS_X11::set_icon(const Ref<Image> &p_icon) { @@ -2236,12 +2236,12 @@ Error OS_X11::move_to_trash(const String &p_path) { List<String> args; args.push_back("-p"); args.push_back(trashcan); - Error err = execute("/bin/mkdir", args, true); + Error err = execute("mkdir", args, true); if (err == OK) { List<String> args2; args2.push_back(p_path); args2.push_back(trashcan); - err = execute("/bin/mv", args2, true); + err = execute("mv", args2, true); } return err; 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/3d/particles.cpp b/scene/3d/particles.cpp index 80c706898d..73749cacb3 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -462,8 +462,6 @@ void ParticlesMaterial::finish_shaders() { void ParticlesMaterial::_update_shader() { - print_line("updating shader"); - dirty_materials.remove(&element); MaterialKey mk = _compute_key(); @@ -913,9 +911,7 @@ void ParticlesMaterial::_queue_shader_change() { if (material_mutex) material_mutex->lock(); - print_line("queuing change"); if (!element.in_list()) { - print_line("not in list, adding"); dirty_materials.add(&element); } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 05963acf56..c4cfce5d72 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -529,12 +529,12 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f if (&cd == &playback.current) { - if (!backwards && cd.pos < len && next_pos == len /*&& playback.blend.empty()*/) { + if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) { //playback finished end_notify = true; } - if (backwards && cd.pos > 0 && next_pos == 0 /*&& playback.blend.empty()*/) { + if (backwards && cd.pos >= 0 && next_pos == 0 /*&& playback.blend.empty()*/) { //playback finished end_notify = true; } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index e58cbe373b..dbd7c1bbc0 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -40,12 +40,15 @@ void ColorPicker::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { //sample->set_texture(get_icon("color_sample")); + btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); + bt_add_preset->set_icon(get_icon("add_preset")); _update_controls(); } break; case NOTIFICATION_ENTER_TREE: { btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); + bt_add_preset->set_icon(get_icon("add_preset")); _update_color(); } break; @@ -601,7 +604,6 @@ ColorPicker::ColorPicker() preset->connect("draw", this, "_update_presets"); bt_add_preset = memnew(Button); - bt_add_preset->set_icon(get_icon("add_preset")); bt_add_preset->set_tooltip(TTR("Add current color as a preset")); bt_add_preset->connect("pressed", this, "_add_preset_pressed"); bbc->add_child(bt_add_preset); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 0d3cccc2b5..946a8c47a3 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -284,7 +284,6 @@ void GraphEdit::_notification(int p_what) { zoom_reset->set_icon(get_icon("reset")); zoom_plus->set_icon(get_icon("more")); snap_button->set_icon(get_icon("snap")); - //zoom_icon->set_texture( get_icon("Zoom", "EditorIcons")); } if (p_what == NOTIFICATION_DRAW) { 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..ce439fece6 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); @@ -882,7 +884,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png)); theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png)); theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png)); - theme->set_icon("SnapGrid", "GraphEdit", make_icon(icon_snap_grid_png)); + theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_grid_png)); theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index ec41630258..66df7dfda8 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -43,8 +43,6 @@ void Shader::set_code(const String &p_code) { String type = ShaderLanguage::get_shader_type(p_code); - print_line("mode: " + type); - if (type == "canvas_item") { mode = MODE_CANVAS_ITEM; } else if (type == "particles") { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index b8a0a7864e..f4a9abc1ea 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -765,7 +765,7 @@ void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("set_border_blend", "blend"), &StyleBoxFlat::set_border_blend); ClassDB::bind_method(D_METHOD("get_border_blend"), &StyleBoxFlat::get_border_blend); - ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_botton_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); + ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_bottom_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); ClassDB::bind_method(D_METHOD("set_corner_radius_all", "radius"), &StyleBoxFlat::set_corner_radius_all); ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius); diff --git a/servers/arvr/arvr_script_interface.cpp b/servers/arvr/arvr_script_interface.cpp deleted file mode 100644 index 2755605a14..0000000000 --- a/servers/arvr/arvr_script_interface.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "arvr_script_interface.h" - -ARVRScriptInterface::ARVRScriptInterface() { - // testing - printf("Construct script interface"); -} - -ARVRScriptInterface::~ARVRScriptInterface() { - if (is_initialized()) { - uninitialize(); - }; - - // testing - printf("Destruct script interface"); -} - -StringName ARVRScriptInterface::get_name() const { - if (get_script_instance() && get_script_instance()->has_method("get_name")) { - return get_script_instance()->call("get_name"); - } else { - // just return something for now - return "ARVR Script interface"; - } -} - -int ARVRScriptInterface::get_capabilities() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_capabilities")), ARVRInterface::ARVR_NONE); - return get_script_instance()->call("get_capabilities"); -}; - -ARVRInterface::Tracking_status ARVRScriptInterface::get_tracking_status() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_tracking_status")), ARVRInterface::ARVR_NOT_TRACKING); - int status = get_script_instance()->call("get_tracking_status"); - return (ARVRInterface::Tracking_status)status; -} - -bool ARVRScriptInterface::get_anchor_detection_is_enabled() const { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_anchor_detection_is_enabled")), false); - return get_script_instance()->call("get_anchor_detection_is_enabled"); -}; - -void ARVRScriptInterface::set_anchor_detection_is_enabled(bool p_enable) { - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("set_anchor_detection_is_enabled"))); - get_script_instance()->call("set_anchor_detection_is_enabled"); -}; - -bool ARVRScriptInterface::is_stereo() { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("is_stereo")), false); - return get_script_instance()->call("is_stereo"); -} - -bool ARVRScriptInterface::is_initialized() { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("is_initialized")), false); - return get_script_instance()->call("is_initialized"); -} - -bool ARVRScriptInterface::initialize() { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("initialize")), false); - return get_script_instance()->call("initialize"); -} - -void ARVRScriptInterface::uninitialize() { - ARVRServer *arvr_server = ARVRServer::get_singleton(); - if (arvr_server != NULL) { - // Whatever happens, make sure this is no longer our primary interface - arvr_server->clear_primary_interface_if(this); - } - - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("uninitialize"))); - get_script_instance()->call("uninitialize"); -} - -Size2 ARVRScriptInterface::get_recommended_render_targetsize() { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_recommended_render_targetsize")), Size2()); - return get_script_instance()->call("get_recommended_render_targetsize"); -} - -Transform ARVRScriptInterface::get_transform_for_eye(Eyes p_eye, const Transform &p_cam_transform) { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_transform_for_eye")), Transform()); - return get_script_instance()->call("get_transform_for_eye", p_eye, p_cam_transform); -} - -// Suggestion from Reduz, as we can't return a CameraMatrix, return a PoolVector with our 16 floats -PoolVector<float> ARVRScriptInterface::_get_projection_for_eye(Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { - ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("_get_projection_for_eye")), PoolVector<float>()); - return get_script_instance()->call("_get_projection_for_eye", p_eye, p_aspect, p_z_near, p_z_far); -} - -CameraMatrix ARVRScriptInterface::get_projection_for_eye(Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { - CameraMatrix cm; - int i = 0; - int j = 0; - - PoolVector<float> cm_as_floats = _get_projection_for_eye(p_eye, p_aspect, p_z_near, p_z_far); - - for (int k = 0; k < cm_as_floats.size() && i < 4; k++) { - cm.matrix[i][j] = cm_as_floats[k]; - j++; - if (j == 4) { - j = 0; - i++; - }; - }; - - return cm; -} - -void ARVRScriptInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("commit_for_eye"))); - get_script_instance()->call("commit_for_eye"); -} - -void ARVRScriptInterface::process() { - ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("process"))); - get_script_instance()->call("process"); -} - -void ARVRScriptInterface::_bind_methods() { - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_capabilities")); - - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "is_initialized")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "initialize")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("uninitialize")); - - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_tracking_status")); - - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_anchor_detection_is_enabled")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_anchor_detection_is_enabled", PropertyInfo(Variant::BOOL, "enabled"))); - - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "is_stereo")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::VECTOR2, "get_recommended_render_targetsize")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::TRANSFORM, "get_transform_for_eye", PropertyInfo(Variant::INT, "eye"), PropertyInfo(Variant::TRANSFORM, "cam_transform"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("_get_projection_for_eye")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("commit_for_eye", PropertyInfo(Variant::INT, "eye"), PropertyInfo(Variant::_RID, "render_target"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("process")); -} diff --git a/servers/arvr/arvr_script_interface.h b/servers/arvr/arvr_script_interface.h deleted file mode 100644 index b1393b4fdb..0000000000 --- a/servers/arvr/arvr_script_interface.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SCRIPT_INTERFACE_H -#define SCRIPT_INTERFACE_H - -#include "arvr_interface.h" - -/** - @authors Hinsbart & Karroffel - - This subclass of our AR/VR interface forms a bridge to GDNative. -*/ - -class ARVRScriptInterface : public ARVRInterface { - GDCLASS(ARVRScriptInterface, ARVRInterface); - -protected: - static void _bind_methods(); - -public: - /** general interface information **/ - ARVRScriptInterface(); - ~ARVRScriptInterface(); - - virtual StringName get_name() const; - virtual int get_capabilities() const; - - virtual bool is_initialized(); - virtual bool initialize(); - virtual void uninitialize(); - - ARVRInterface::Tracking_status get_tracking_status() const; /* get the status of our current tracking */ - - /** specific to AR **/ - virtual bool get_anchor_detection_is_enabled() const; - virtual void set_anchor_detection_is_enabled(bool p_enable); - - /** rendering and internal **/ - virtual Size2 get_recommended_render_targetsize(); - virtual bool is_stereo(); - virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); - - // we expose a PoolVector<float> version of this function to GDNative - PoolVector<float> _get_projection_for_eye(Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); - - // and a CameraMatrix version to ARVRServer - virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); - - virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect); - - virtual void process(); -}; - -#endif // SCRIPT_INTERFACE_H 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/physics/joints/pin_joint_sw.h b/servers/physics/joints/pin_joint_sw.h index ee9272ce06..f6c11c49b0 100644 --- a/servers/physics/joints/pin_joint_sw.h +++ b/servers/physics/joints/pin_joint_sw.h @@ -86,8 +86,8 @@ public: void set_pos_a(const Vector3 &p_pos) { m_pivotInA = p_pos; } void set_pos_b(const Vector3 &p_pos) { m_pivotInB = p_pos; } - Vector3 get_position_a() { return m_pivotInB; } - Vector3 get_position_b() { return m_pivotInA; } + Vector3 get_position_a() { return m_pivotInA; } + Vector3 get_position_b() { return m_pivotInB; } PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_b, const Vector3 &p_pos_b); ~PinJointSW(); diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index db1270633f..627ba8ea15 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -110,21 +110,48 @@ public: void set_shape_metadata(int p_index, const Variant &p_metadata); _FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } - _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const { return shapes[p_index].shape; } - _FORCE_INLINE_ const Transform2D &get_shape_transform(int p_index) const { return shapes[p_index].xform; } - _FORCE_INLINE_ const Transform2D &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } - _FORCE_INLINE_ const Rect2 &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } - _FORCE_INLINE_ const Variant &get_shape_metadata(int p_index) const { return shapes[p_index].metadata; } + _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const { + ERR_FAIL_INDEX_V(p_index, shapes.size(), NULL); + return shapes[p_index].shape; + } + _FORCE_INLINE_ const Transform2D &get_shape_transform(int p_index) const { + ERR_FAIL_INDEX_V(p_index, shapes.size(), Transform2D()); + return shapes[p_index].xform; + } + _FORCE_INLINE_ const Transform2D &get_shape_inv_transform(int p_index) const { + ERR_FAIL_INDEX_V(p_index, shapes.size(), Transform2D()); + return shapes[p_index].xform_inv; + } + _FORCE_INLINE_ const Rect2 &get_shape_aabb(int p_index) const { + ERR_FAIL_INDEX_V(p_index, shapes.size(), Rect2()); + return shapes[p_index].aabb_cache; + } + _FORCE_INLINE_ const Variant &get_shape_metadata(int p_index) const { + ERR_FAIL_INDEX_V(p_index, shapes.size(), Variant()); + return shapes[p_index].metadata; + } _FORCE_INLINE_ Transform2D get_transform() const { return transform; } _FORCE_INLINE_ Transform2D get_inv_transform() const { return inv_transform; } _FORCE_INLINE_ Space2DSW *get_space() const { return space; } - _FORCE_INLINE_ void set_shape_as_disabled(int p_idx, bool p_disabled) { shapes[p_idx].disabled = p_disabled; } - _FORCE_INLINE_ bool is_shape_set_as_disabled(int p_idx) const { return shapes[p_idx].disabled; } + _FORCE_INLINE_ void set_shape_as_disabled(int p_idx, bool p_disabled) { + ERR_FAIL_INDEX(p_idx, shapes.size()); + shapes[p_idx].disabled = p_disabled; + } + _FORCE_INLINE_ bool is_shape_set_as_disabled(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, shapes.size(), false); + return shapes[p_idx].disabled; + } - _FORCE_INLINE_ void set_shape_as_one_way_collision(int p_idx, bool p_one_way_collision) { shapes[p_idx].one_way_collision = p_one_way_collision; } - _FORCE_INLINE_ bool is_shape_set_as_one_way_collision(int p_idx) const { return shapes[p_idx].one_way_collision; } + _FORCE_INLINE_ void set_shape_as_one_way_collision(int p_idx, bool p_one_way_collision) { + ERR_FAIL_INDEX(p_idx, shapes.size()); + shapes[p_idx].one_way_collision = p_one_way_collision; + } + _FORCE_INLINE_ bool is_shape_set_as_one_way_collision(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, shapes.size(), false); + return shapes[p_idx].one_way_collision; + } void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; } _FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; } diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 845a3443b7..7a9328e30f 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -32,7 +32,6 @@ #include "arvr/arvr_interface.h" #include "arvr/arvr_positional_tracker.h" -#include "arvr/arvr_script_interface.h" #include "arvr_server.h" #include "audio/audio_effect.h" #include "audio/audio_stream.h" @@ -74,10 +73,14 @@ static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsag } ShaderTypes *shader_types = NULL; -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())); @@ -89,12 +92,13 @@ void register_server_types() { ClassDB::register_virtual_class<ARVRInterface>(); ClassDB::register_class<ARVRPositionalTracker>(); - ClassDB::register_class<ARVRScriptInterface>(); ClassDB::register_virtual_class<AudioStream>(); 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>(); { @@ -144,9 +148,5 @@ void register_server_types() { void unregister_server_types() { - //@TODO move this into iPhone/Android implementation? just have this here for testing... - // mobile_interface = NULL; - memdelete(shader_types); - memdelete(arvr_server); } diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 47a5f4c7f3..979b2ed8ec 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1445,7 +1445,9 @@ 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("request_frame_drawn_callback", "where", "method", "userdata"), &VisualServer::request_frame_drawn_callback); 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)); //ClassDB::bind_method(D_METHOD("texture_allocate"),&VisualServer::texture_allocate,DEFVAL( TEXTURE_FLAGS_DEFAULT ) ); diff --git a/thirdparty/README.md b/thirdparty/README.md index c081ad29b6..335fcdd80b 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -73,7 +73,7 @@ Use UI font if exists, because it has tight vertial metrix and good for UI. ## freetype - Upstream: https://www.freetype.org -- Version: 2.8 +- Version: 2.8.1 - License: FreeType License (BSD-like) Files extracted from upstream source: @@ -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/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h index 1bf6e8f534..2fbe80b9b4 100644 --- a/thirdparty/freetype/include/freetype/config/ftoption.h +++ b/thirdparty/freetype/include/freetype/config/ftoption.h @@ -107,20 +107,17 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ + /* Uncomment the line below if you want to activate LCD rendering */ + /* technology similar to ClearType in this build of the library. This */ + /* technology triples the resolution in the direction color subpixels. */ + /* To mitigate color fringes inherent to this technology, you also need */ + /* to explicitly set up LCD filtering. */ /* */ /* Note that this feature is covered by several Microsoft patents */ /* and should not be activated in any default build of the library. */ - /* */ - /* This macro has no impact on the FreeType API, only on its */ - /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ - /* the original size in case this macro isn't defined; however, each */ - /* triplet of subpixels has R=G=B. */ - /* */ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ + /* When this macro is not defined, FreeType offers alternative LCD */ + /* rendering technology that produces excellent output without LCD */ + /* filtering. */ /* */ /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ @@ -327,7 +324,7 @@ FT_BEGIN_HEADER /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ + /* `post' table, but will not synthesize a missing Unicode charmap. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ diff --git a/thirdparty/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h index 2989fbb5e1..b0c261799a 100644 --- a/thirdparty/freetype/include/freetype/freetype.h +++ b/thirdparty/freetype/include/freetype/freetype.h @@ -575,7 +575,8 @@ FT_BEGIN_HEADER /* <Note> */ /* When a new face is created (either through @FT_New_Face or */ /* @FT_Open_Face), the library looks for a Unicode charmap within */ - /* the list and automatically activates it. */ + /* the list and automatically activates it. If there is no Unicode */ + /* charmap, FreeType doesn't set an `active' charmap. */ /* */ /* <Also> */ /* See @FT_CharMapRec for the publicly accessible fields of a given */ @@ -1529,7 +1530,13 @@ FT_BEGIN_HEADER /* values of the corresponding fields in @FT_FaceRec. Some values */ /* like ascender or descender are rounded for historical reasons; */ /* more precise values (for outline fonts) can be derived by scaling */ - /* the corresponding @FT_FaceRec values manually. */ + /* the corresponding @FT_FaceRec values manually, with code similar */ + /* to the following. */ + /* */ + /* { */ + /* scaled_ascender = FT_MulFix( face->root.ascender, */ + /* size_metrics->y_scale ); */ + /* } */ /* */ /* Note that due to glyph hinting and the selected rendering mode */ /* these values are usually not exact; consequently, they must be */ @@ -1774,7 +1781,7 @@ FT_BEGIN_HEADER /* and add it to `origin_x'> */ /* */ /* origin_x += slot->advance.x; */ - /* origin_x += slot->rsb_delta - slot->lsb_relta; */ + /* origin_x += slot->rsb_delta - slot->lsb_delta; */ /* endfor */ /* } */ /* */ @@ -1794,9 +1801,9 @@ FT_BEGIN_HEADER /* */ /* <load glyph with `FT_Load_Glyph'> */ /* */ - /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */ + /* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */ /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */ + /* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */ /* origin_x += 64; */ /* */ /* prev_rsb_delta = slot->rsb_delta; */ @@ -3124,11 +3131,13 @@ FT_BEGIN_HEADER /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ /* */ /* <Note> */ - /* The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can */ - /* be filtered to reduce color-fringes by using */ - /* @FT_Library_SetLcdFilter (not active in the default builds). It */ - /* is up to the caller to either call `FT_Library_SetLcdFilter' (if */ - /* available) or do the filtering itself. */ + /* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */ + /* `ftoption.h', which enables patented ClearType-style rendering, */ + /* the LCD-optimized glyph bitmaps should be filtered to reduce color */ + /* fringes inherent to this technology. You can either set up LCD */ + /* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */ + /* or do the filtering yourself. The default FreeType LCD rendering */ + /* technology does not require filtering. */ /* */ /* The selected render mode only affects vector glyphs of a font. */ /* Embedded bitmaps often have a different pixel mode like */ @@ -4327,6 +4336,9 @@ FT_BEGIN_HEADER /* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */ /* from zero. */ /* */ + /* <Note> */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); @@ -4345,6 +4357,9 @@ FT_BEGIN_HEADER /* <Return> */ /* `a' rounded towards plus infinity. */ /* */ + /* <Note> */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); @@ -4442,7 +4457,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 8 -#define FREETYPE_PATCH 0 +#define FREETYPE_PATCH 1 /*************************************************************************/ diff --git a/thirdparty/freetype/include/freetype/ftautoh.h b/thirdparty/freetype/include/freetype/ftautoh.h index abd540f0b5..2bb675ae46 100644 --- a/thirdparty/freetype/include/freetype/ftautoh.h +++ b/thirdparty/freetype/include/freetype/ftautoh.h @@ -404,12 +404,12 @@ FT_BEGIN_HEADER * activate the warp hinting code in the auto-hinter, this property * switches warping on and off. * - * Warping only works in `light' auto-hinting mode. The idea of the - * code is to slightly scale and shift a glyph along the non-hinted - * dimension (which is usually the horizontal axis) so that as much of - * its segments are aligned (more or less) to the grid. To find out a - * glyph's optimal scaling and shifting value, various parameter - * combinations are tried and scored. + * Warping only works in `normal' auto-hinting mode replacing it. + * The idea of the code is to slightly scale and shift a glyph along + * the non-hinted dimension (which is usually the horizontal axis) so + * that as much of its segments are aligned (more or less) to the grid. + * To find out a glyph's optimal scaling and shifting value, various + * parameter combinations are tried and scored. * * By default, warping is off. The example below shows how to switch on * warping (omitting the error handling). @@ -437,7 +437,7 @@ FT_BEGIN_HEADER * * Since warping is a global property of the auto-hinter it is best to * change its value before rendering any face. Otherwise, you should - * reload all faces that get auto-hinted in `light' hinting mode. + * reload all faces that get auto-hinted in `normal' hinting mode. * */ diff --git a/thirdparty/freetype/include/freetype/fterrdef.h b/thirdparty/freetype/include/freetype/fterrdef.h index cabbac8273..6a6dc85b87 100644 --- a/thirdparty/freetype/include/freetype/fterrdef.h +++ b/thirdparty/freetype/include/freetype/fterrdef.h @@ -233,6 +233,8 @@ "invalid PostScript (post) table" ) FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, "found FDEF or IDEF opcode in glyf bytecode" ) + FT_ERRORDEF_( Missing_Bitmap, 0x9D, + "missing bitmap in strike" ) /* CFF, CID, and Type 1 errors */ diff --git a/thirdparty/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h index 42769fa7bf..ae382c419f 100644 --- a/thirdparty/freetype/include/freetype/fterrors.h +++ b/thirdparty/freetype/include/freetype/fterrors.h @@ -38,15 +38,15 @@ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in `ftoption.h' in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2, however). See the file */ + /* with standard builds of FreeType~2, however). See the file */ /* `ftmoderr.h' for more details. */ /* */ /* *Error* *Message* *Strings* */ /* */ /* Error definitions are set up with special macros that allow client */ /* applications to build a table of error message strings. The */ - /* strings are not included in a normal build of FreeType 2 to */ - /* save space (most client applications do not use them). */ + /* strings are not included in a normal build of FreeType~2 to save */ + /* space (most client applications do not use them). */ /* */ /* To do so, you have to define the following macros before including */ /* this file. */ diff --git a/thirdparty/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h index 79879a7ac7..db1a2c8ba5 100644 --- a/thirdparty/freetype/include/freetype/ftglyph.h +++ b/thirdparty/freetype/include/freetype/ftglyph.h @@ -231,6 +231,12 @@ FT_BEGIN_HEADER /* <Return> */ /* FreeType error code. 0~means success. */ /* */ + /* <Note> */ + /* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */ + /* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */ + /* (which are in 26.6 fixed-point format) must be in the range */ + /* ]-32768;32768[. */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ); @@ -566,6 +572,9 @@ FT_BEGIN_HEADER /* <Note> */ /* The result is undefined if either `a' or `b' is zero. */ /* */ + /* Since the function uses wrap-around arithmetic, results become */ + /* meaningless if the arguments are very large. */ + /* */ FT_EXPORT( void ) FT_Matrix_Multiply( const FT_Matrix* a, FT_Matrix* b ); diff --git a/thirdparty/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h index 1a049ef16d..1c789e5a44 100644 --- a/thirdparty/freetype/include/freetype/ftimage.h +++ b/thirdparty/freetype/include/freetype/ftimage.h @@ -1064,24 +1064,24 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* FreeType used to provide an area of memory called the `render */ - /* pool' available to all registered rasters. This was not thread */ - /* safe however and now FreeType never allocates this pool. NULL */ - /* is always passed in as pool_base. */ + /* pool' available to all registered rasterizers. This was not */ + /* thread safe, however, and now FreeType never allocates this pool. */ /* */ - /* This function is called each time the render pool changes, or just */ - /* after a new raster object is created. */ + /* This function is called after a new raster object is created. */ /* */ /* <Input> */ /* raster :: A handle to the new raster object. */ /* */ - /* pool_base :: The address in memory of the render pool. */ + /* pool_base :: Previously, the address in memory of the render pool. */ + /* Set this to NULL. */ /* */ - /* pool_size :: The size in bytes of the render pool. */ + /* pool_size :: Previously, the size in bytes of the render pool. */ + /* Set this to 0. */ /* */ /* <Note> */ - /* Rasters should ignore the render pool and rely on dynamic or stack */ - /* allocation if they want to (a handle to the memory allocator is */ - /* passed to the raster constructor). */ + /* Rasterizers should rely on dynamic or stack allocation if they */ + /* want to (a handle to the memory allocator is passed to the */ + /* rasterizer constructor). */ /* */ typedef void (*FT_Raster_ResetFunc)( FT_Raster raster, diff --git a/thirdparty/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h index 680bd90c89..bdaf9af906 100644 --- a/thirdparty/freetype/include/freetype/ftlcdfil.h +++ b/thirdparty/freetype/include/freetype/ftlcdfil.h @@ -44,9 +44,16 @@ FT_BEGIN_HEADER * Reduce color fringes of subpixel-rendered bitmaps. * * @description: - * Subpixel rendering exploits the color-striped structure of LCD - * pixels, increasing the available resolution in the direction of the - * stripe (usually horizontal RGB) by a factor of~3. Since these + * Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your + * `ftoption.h', which enables patented ClearType-style rendering, + * the LCD-optimized glyph bitmaps should be filtered to reduce color + * fringes inherent to this technology. The default FreeType LCD + * rendering uses different technology, and API described below, + * although available, does nothing. + * + * ClearType-style LCD rendering exploits the color-striped structure of + * LCD pixels, increasing the available resolution in the direction of + * the stripe (usually horizontal RGB) by a factor of~3. Since these * subpixels are color pixels, using them unfiltered creates severe * color fringes. Use the @FT_Library_SetLcdFilter API to specify a * low-pass filter, which is then applied to subpixel-rendered bitmaps @@ -54,12 +61,6 @@ FT_BEGIN_HEADER * the higher resolution to reduce color fringes, making the glyph image * slightly blurrier. Positional improvements will remain. * - * Note that no filter is active by default, and that this function is - * *not* implemented in default builds of the library. You need to - * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file - * in order to activate it and explicitly call @FT_Library_SetLcdFilter - * to enable it. - * * A filter should have two properties: * * 1) It should be normalized, meaning the sum of the 5~components diff --git a/thirdparty/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h index ad97c6e4c3..a1656eec0e 100644 --- a/thirdparty/freetype/include/freetype/ftmac.h +++ b/thirdparty/freetype/include/freetype/ftmac.h @@ -35,11 +35,12 @@ FT_BEGIN_HEADER -/* gcc-3.4.1 and later can warn about functions tagged as deprecated */ + /* gcc-3.1 and later can warn about functions tagged as deprecated */ #ifndef FT_DEPRECATED_ATTRIBUTE -#if defined(__GNUC__) && \ - ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#if defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 4 ) || \ + ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) ) +#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated )) #else #define FT_DEPRECATED_ATTRIBUTE #endif diff --git a/thirdparty/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h index c41b80ea67..80ac98d612 100644 --- a/thirdparty/freetype/include/freetype/ftmm.h +++ b/thirdparty/freetype/include/freetype/ftmm.h @@ -178,7 +178,8 @@ FT_BEGIN_HEADER /* strid :: The entry in `name' table identifying this instance. */ /* */ /* psid :: The entry in `name' table identifying a PostScript name */ - /* for this instance. */ + /* for this instance. Value 0xFFFF indicates a missing */ + /* entry. */ /* */ typedef struct FT_Var_Named_Style_ { @@ -195,7 +196,7 @@ FT_BEGIN_HEADER /* FT_MM_Var */ /* */ /* <Description> */ - /* A structure to model the axes and space of a Adobe MM, TrueType */ + /* A structure to model the axes and space of an Adobe MM, TrueType */ /* GX, or OpenType variation font. */ /* */ /* Some fields are specific to one format and not to the others. */ @@ -321,6 +322,11 @@ FT_BEGIN_HEADER /* <Return> */ /* FreeType error code. 0~means success. */ /* */ + /* <Note> */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -351,6 +357,11 @@ FT_BEGIN_HEADER /* <Return> */ /* FreeType error code. 0~means success. */ /* */ + /* <Note> */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -415,6 +426,11 @@ FT_BEGIN_HEADER /* <Return> */ /* FreeType error code. 0~means success. */ /* */ + /* <Note> */ + /* To reset all axes to the default values, call the function with */ + /* `num_coords' set to zero and `coords' set to NULL (new feature in */ + /* FreeType version 2.8.1). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -479,6 +495,50 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_VAR_AXIS_FLAG_XXX */ + /* */ + /* <Description> */ + /* A list of bit flags used in the return value of */ + /* @FT_Get_Var_Axis_Flags. */ + /* */ + /* <Values> */ + /* FT_VAR_AXIS_FLAG_HIDDEN :: */ + /* The variation axis should not be exposed to user interfaces. */ + /* */ +#define FT_VAR_AXIS_FLAG_HIDDEN 1 + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Var_Axis_Flags */ + /* */ + /* <Description> */ + /* Get the `flags' field of an OpenType Variation Axis Record. */ + /* */ + /* Not meaningful for Adobe MM fonts (`*flags' is always zero). */ + /* */ + /* <Input> */ + /* master :: The variation descriptor. */ + /* */ + /* axis_index :: The index of the requested variation axis. */ + /* */ + /* <Output> */ + /* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */ + /* possible values. */ + /* */ + /* <Return> */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ); + /* */ diff --git a/thirdparty/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h index 07f73ebb1b..56f56a9603 100644 --- a/thirdparty/freetype/include/freetype/ftoutln.h +++ b/thirdparty/freetype/include/freetype/ftoutln.h @@ -385,6 +385,9 @@ FT_BEGIN_HEADER /* @FT_Outline_Embolden, which uses the same strength in both */ /* directions. */ /* */ + /* <Since> */ + /* 2.4.10 */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_EmboldenXY( FT_Outline* outline, FT_Pos xstrength, diff --git a/thirdparty/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h index c9ac9d8246..8b35f03d88 100644 --- a/thirdparty/freetype/include/freetype/internal/ftcalc.h +++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h @@ -399,16 +399,42 @@ FT_BEGIN_HEADER #endif /* 0 */ -#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) -#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) -#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) -#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) -#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) +#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */ +#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */ +#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */ +#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */ #define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) + /* + * The following macros have two purposes. + * + * . Tag places where overflow is expected and harmless. + * + * . Avoid run-time sanitizer errors. + * + * Use with care! + */ +#define ADD_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) +#define SUB_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) +#define MUL_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) +#define NEG_LONG( a ) \ + (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) ) + +#define ADD_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) +#define SUB_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) +#define MUL_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) +#define NEG_INT32( a ) \ + (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) ) + FT_END_HEADER diff --git a/thirdparty/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h index 558409166d..4231be238a 100644 --- a/thirdparty/freetype/include/freetype/internal/ftobjs.h +++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h @@ -36,6 +36,7 @@ #include FT_INTERNAL_AUTOHINT_H #include FT_INTERNAL_SERVICE_H #include FT_INTERNAL_PIC_H +#include FT_INTERNAL_CALC_H #ifdef FT_CONFIG_OPTION_INCREMENTAL #include FT_INCREMENTAL_H @@ -85,13 +86,29 @@ FT_BEGIN_HEADER /* we use FT_TYPEOF to suppress signedness compilation warnings */ #define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n ) #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) + /* specialized versions (for signed values) */ + /* that don't produce run-time errors due to integer overflow */ +#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) ) +#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) ) + +#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) ) +#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) ) + /* * character classification functions -- since these are used to parse @@ -856,11 +873,6 @@ FT_BEGIN_HEADER /* */ /* auto_hinter :: The auto-hinter module interface. */ /* */ - /* raster_pool :: The raster object's render pool. This can */ - /* ideally be changed dynamically at run-time. */ - /* */ - /* raster_pool_size :: The size of the render pool in bytes. */ - /* */ /* debug_hooks :: An array of four function pointers that allow */ /* debuggers to hook into a font format's */ /* interpreter. Currently, only the TrueType */ @@ -869,9 +881,6 @@ FT_BEGIN_HEADER /* lcd_filter :: If subpixel rendering is activated, the */ /* selected LCD filter mode. */ /* */ - /* lcd_extra :: If subpixel rendering is activated, the number */ - /* of extra pixels needed for the LCD filter. */ - /* */ /* lcd_weights :: If subpixel rendering is activated, the LCD */ /* filter weights, if any. */ /* */ @@ -903,15 +912,10 @@ FT_BEGIN_HEADER FT_Renderer cur_renderer; /* current outline renderer */ FT_Module auto_hinter; - FT_Byte* raster_pool; /* scan-line conversion */ - /* render pool */ - FT_ULong raster_pool_size; /* size of render pool in bytes */ - FT_DebugHook_Func debug_hooks[4]; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING FT_LcdFilter lcd_filter; - FT_Int lcd_extra; /* number of extra pixels */ FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif diff --git a/thirdparty/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h index 32eb2fdc26..b7d3bac0f1 100644 --- a/thirdparty/freetype/include/freetype/tttags.h +++ b/thirdparty/freetype/include/freetype/tttags.h @@ -106,6 +106,12 @@ FT_BEGIN_HEADER #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +/* used by "Keyboard.dfont" on legacy Mac OS X */ +#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) + +/* used by "LastResort.dfont" on legacy Mac OS X */ +#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) + FT_END_HEADER diff --git a/thirdparty/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c index a00c3a0765..fedeacf797 100644 --- a/thirdparty/freetype/src/autofit/afblue.c +++ b/thirdparty/freetype/src/autofit/afblue.c @@ -592,9 +592,6 @@ { AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 }, { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP }, @@ -606,6 +603,9 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_LAO_BOTTOM, 0 }, @@ -701,6 +701,9 @@ { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_TIFINAGH, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_THAI_BOTTOM, 0 }, @@ -710,9 +713,6 @@ { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_TIFINAGH, 0 }, - { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_VAI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, diff --git a/thirdparty/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat index 454923e9ca..f62eb82a1a 100644 --- a/thirdparty/freetype/src/autofit/afblue.dat +++ b/thirdparty/freetype/src/autofit/afblue.dat @@ -872,11 +872,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KNDA - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KHMR { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -892,6 +887,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_KNDA + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LAO { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -1027,6 +1027,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TFNG + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_TIFINAGH, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_THAI { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -1038,11 +1043,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_TFNG - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_TIFINAGH, 0 } - { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_VAII { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_VAI_BOTTOM, 0 } diff --git a/thirdparty/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h index e227dbf50b..99ef51cd4a 100644 --- a/thirdparty/freetype/src/autofit/afblue.h +++ b/thirdparty/freetype/src/autofit/afblue.h @@ -344,9 +344,9 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_GURU = 116, AF_BLUE_STRINGSET_HEBR = 122, AF_BLUE_STRINGSET_KALI = 126, - AF_BLUE_STRINGSET_KNDA = 132, - AF_BLUE_STRINGSET_KHMR = 135, - AF_BLUE_STRINGSET_KHMS = 141, + AF_BLUE_STRINGSET_KHMR = 132, + AF_BLUE_STRINGSET_KHMS = 138, + AF_BLUE_STRINGSET_KNDA = 141, AF_BLUE_STRINGSET_LAO = 144, AF_BLUE_STRINGSET_LATN = 150, AF_BLUE_STRINGSET_LATB = 157, @@ -367,8 +367,8 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_TAML = 222, AF_BLUE_STRINGSET_TAVT = 225, AF_BLUE_STRINGSET_TELU = 228, - AF_BLUE_STRINGSET_THAI = 231, - AF_BLUE_STRINGSET_TFNG = 239, + AF_BLUE_STRINGSET_TFNG = 231, + AF_BLUE_STRINGSET_THAI = 234, AF_BLUE_STRINGSET_VAII = 242, af_blue_2_1 = 245, #ifdef AF_CONFIG_OPTION_CJK diff --git a/thirdparty/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c index 61e29cdeda..897533d148 100644 --- a/thirdparty/freetype/src/autofit/afcjk.c +++ b/thirdparty/freetype/src/autofit/afcjk.c @@ -2272,13 +2272,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2304,9 +2298,9 @@ { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/thirdparty/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c index f1ff0baef8..1b21c06c2c 100644 --- a/thirdparty/freetype/src/autofit/afhints.c +++ b/thirdparty/freetype/src/autofit/afhints.c @@ -507,15 +507,15 @@ return FT_THROW( Invalid_Argument ); seg = &axis->segments[idx]; - *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox - : seg->first->oy; + *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx + : seg->first->fy; if ( seg->edge ) *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); else *is_blue = FALSE; if ( *is_blue ) - *blue_offset = seg->edge->blue_edge->cur; + *blue_offset = seg->edge->blue_edge->org; else *blue_offset = 0; diff --git a/thirdparty/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c index 11fa523c83..02b3b8bbd3 100644 --- a/thirdparty/freetype/src/autofit/aflatin.c +++ b/thirdparty/freetype/src/autofit/aflatin.c @@ -1690,9 +1690,11 @@ if ( prev_max_on_coord > max_on_coord ) max_on_coord = prev_max_on_coord; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( min_pos + - max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( min_pos + + max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( max_pos - + min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) @@ -1720,9 +1722,11 @@ if ( max_pos > prev_max_pos ) prev_max_pos = max_pos; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( prev_min_pos + - prev_max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( prev_min_pos + + prev_max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( prev_max_pos - + prev_min_pos ) >> 1 ); } else { @@ -1733,8 +1737,9 @@ if ( prev_max_pos > max_pos ) max_pos = prev_max_pos; - segment->last = point; - segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->last = point; + segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->delta = (FT_Short)( ( max_pos - min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) @@ -3492,13 +3497,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { axis = &metrics->axis[AF_DIMENSION_HORZ]; error = af_latin_hints_detect_features( hints, @@ -3528,9 +3527,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/thirdparty/freetype/src/autofit/aflatin2.c b/thirdparty/freetype/src/autofit/aflatin2.c index 0607278b1e..fb42445116 100644 --- a/thirdparty/freetype/src/autofit/aflatin2.c +++ b/thirdparty/freetype/src/autofit/aflatin2.c @@ -2340,13 +2340,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2366,9 +2360,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/thirdparty/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c index 78c4368b61..067ebd17f6 100644 --- a/thirdparty/freetype/src/autofit/afloader.c +++ b/thirdparty/freetype/src/autofit/afloader.c @@ -483,8 +483,8 @@ FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x ); - loader->pp2.x = FT_PIX_ROUND( pp2x ); + loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); + loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; @@ -498,8 +498,8 @@ FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); - loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); + loader->pp1.x = FT_PIX_ROUND( pp1x ); + loader->pp2.x = FT_PIX_ROUND( pp2x ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; diff --git a/thirdparty/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h index 7547a9e6f9..cb815dbb40 100644 --- a/thirdparty/freetype/src/autofit/afscript.h +++ b/thirdparty/freetype/src/autofit/afscript.h @@ -187,12 +187,6 @@ HINTING_BOTTOM_TO_TOP, "\xEA\xA4\x8D \xEA\xA4\x80" ) /* ꤍ ꤀ */ - SCRIPT( knda, KNDA, - "Kannada", - HB_SCRIPT_KANNADA, - HINTING_BOTTOM_TO_TOP, - "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */ - /* only digit zero has a simple shape in the Khmer script */ SCRIPT( khmr, KHMR, "Khmer", @@ -206,6 +200,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧡ ᧪ */ + SCRIPT( knda, KNDA, + "Kannada", + HB_SCRIPT_KANNADA, + HINTING_BOTTOM_TO_TOP, + "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */ + /* only digit zero has a simple shape in the Lao script */ SCRIPT( lao, LAO, "Lao", @@ -330,18 +330,18 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ౦ ౧ */ - SCRIPT( thai, THAI, - "Thai", - HB_SCRIPT_THAI, - HINTING_BOTTOM_TO_TOP, - "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */ - SCRIPT( tfng, TFNG, "Tifinagh", HB_SCRIPT_TIFINAGH, HINTING_BOTTOM_TO_TOP, "\xE2\xB5\x94" ) /* ⵔ */ + SCRIPT( thai, THAI, + "Thai", + HB_SCRIPT_THAI, + HINTING_BOTTOM_TO_TOP, + "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */ + SCRIPT( vaii, VAII, "Vai", HB_SCRIPT_VAI, diff --git a/thirdparty/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c index da92fad3ed..d259964217 100644 --- a/thirdparty/freetype/src/autofit/afshaper.c +++ b/thirdparty/freetype/src/autofit/afshaper.c @@ -18,6 +18,7 @@ #include <ft2build.h> #include FT_FREETYPE_H +#include FT_ADVANCES_H #include "afglobal.h" #include "aftypes.h" #include "afshaper.h" diff --git a/thirdparty/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h index a5e13d8944..281559eea2 100644 --- a/thirdparty/freetype/src/autofit/afstyles.h +++ b/thirdparty/freetype/src/autofit/afstyles.h @@ -255,13 +255,6 @@ AF_BLUE_STRINGSET_KALI, AF_COVERAGE_DEFAULT ) - STYLE( knda_dflt, KNDA_DFLT, - "Kannada default style", - AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_KNDA, - AF_BLUE_STRINGSET_KNDA, - AF_COVERAGE_DEFAULT ) - STYLE( khmr_dflt, KHMR_DFLT, "Khmer default style", AF_WRITING_SYSTEM_LATIN, @@ -276,6 +269,13 @@ AF_BLUE_STRINGSET_KHMS, AF_COVERAGE_DEFAULT ) + STYLE( knda_dflt, KNDA_DFLT, + "Kannada default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_KNDA, + AF_BLUE_STRINGSET_KNDA, + AF_COVERAGE_DEFAULT ) + STYLE( lao_dflt, LAO_DFLT, "Lao default style", AF_WRITING_SYSTEM_LATIN, @@ -420,13 +420,6 @@ AF_BLUE_STRINGSET_TELU, AF_COVERAGE_DEFAULT ) - STYLE( thai_dflt, THAI_DFLT, - "Thai default style", - AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_THAI, - AF_BLUE_STRINGSET_THAI, - AF_COVERAGE_DEFAULT ) - STYLE( tfng_dflt, TFNG_DFLT, "Tifinagh default style", AF_WRITING_SYSTEM_LATIN, @@ -434,6 +427,13 @@ AF_BLUE_STRINGSET_TFNG, AF_COVERAGE_DEFAULT ) + STYLE( thai_dflt, THAI_DFLT, + "Thai default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_THAI, + AF_BLUE_STRINGSET_THAI, + AF_COVERAGE_DEFAULT ) + STYLE( vaii_dflt, VAII_DFLT, "Vai default style", AF_WRITING_SYSTEM_LATIN, diff --git a/thirdparty/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c index 88c88c4c1b..e567a0453e 100644 --- a/thirdparty/freetype/src/base/ftbitmap.c +++ b/thirdparty/freetype/src/base/ftbitmap.c @@ -226,7 +226,7 @@ } /* otherwise allocate new buffer */ - if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) ) + if ( FT_QALLOC_MULT( buffer, bitmap->rows + ypixels, new_pitch ) ) return error; /* new rows get added at the top of the bitmap, */ @@ -534,8 +534,7 @@ (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) return FT_THROW( Invalid_Argument ); - if ( target->rows * (FT_ULong)target_pitch > old_size && - FT_QREALLOC( target->buffer, + if ( FT_QREALLOC( target->buffer, old_size, target->rows * (FT_UInt)target_pitch ) ) return error; diff --git a/thirdparty/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c index f0525502f3..00d63c6e6b 100644 --- a/thirdparty/freetype/src/base/ftcalc.c +++ b/thirdparty/freetype/src/base/ftcalc.c @@ -68,14 +68,15 @@ #define FT_COMPONENT trace_calc - /* transfer sign leaving a positive number */ -#define FT_MOVE_SIGN( x, s ) \ - FT_BEGIN_STMNT \ - if ( x < 0 ) \ - { \ - x = -x; \ - s = -s; \ - } \ + /* transfer sign, leaving a positive number; */ + /* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */ +#define FT_MOVE_SIGN( x, x_unsigned, s ) \ + FT_BEGIN_STMNT \ + if ( x < 0 ) \ + { \ + x_unsigned = 0U - (x_unsigned); \ + s = -s; \ + } \ FT_END_STMNT /* The following three functions are available regardless of whether */ @@ -86,7 +87,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL; + return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; } @@ -95,7 +96,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return ( a + 0xFFFFL ) & ~0xFFFFL; + return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; } @@ -179,20 +180,20 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? ( a * b + ( c >> 1 ) ) / c : 0x7FFFFFFFUL; d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -208,20 +209,20 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? a * b / c : 0x7FFFFFFFUL; d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -257,18 +258,18 @@ FT_Long q_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b : 0x7FFFFFFFUL; q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } @@ -422,14 +423,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -455,7 +456,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -470,14 +471,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -498,7 +499,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -575,12 +576,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( a + ( b >> 8 ) <= 8190UL ) a = ( a * b + 0x8000UL ) >> 16; else @@ -594,7 +595,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; #endif /* 0 */ @@ -614,12 +615,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( b == 0 ) { /* check for division by 0 */ @@ -647,7 +648,7 @@ q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } @@ -666,13 +667,19 @@ if ( !a || !b ) return; - xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx ); - xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy ); - yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx ); - yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = ADD_LONG( FT_MulFix( a->xx, b->xx ), + FT_MulFix( a->xy, b->yx ) ); + xy = ADD_LONG( FT_MulFix( a->xx, b->xy ), + FT_MulFix( a->xy, b->yy ) ); + yx = ADD_LONG( FT_MulFix( a->yx, b->xx ), + FT_MulFix( a->yy, b->yx ) ); + yy = ADD_LONG( FT_MulFix( a->yx, b->xy ), + FT_MulFix( a->yy, b->yy ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -722,13 +729,19 @@ if ( !a || !b ) return; - xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val ); - xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val ); - yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val ); - yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = ADD_LONG( FT_MulDiv( a->xx, b->xx, val ), + FT_MulDiv( a->xy, b->yx, val ) ); + xy = ADD_LONG( FT_MulDiv( a->xx, b->xy, val ), + FT_MulDiv( a->xy, b->yy, val ) ); + yx = ADD_LONG( FT_MulDiv( a->yx, b->xx, val ), + FT_MulDiv( a->yy, b->yx, val ) ); + yy = ADD_LONG( FT_MulDiv( a->yx, b->xy, val ), + FT_MulDiv( a->yy, b->yy, val ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -747,11 +760,10 @@ if ( !vector || !matrix ) return; - xz = FT_MulDiv( vector->x, matrix->xx, val ) + - FT_MulDiv( vector->y, matrix->xy, val ); - - yz = FT_MulDiv( vector->x, matrix->yx, val ) + - FT_MulDiv( vector->y, matrix->yy, val ); + xz = ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ), + FT_MulDiv( vector->y, matrix->xy, val ) ); + yz = ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ), + FT_MulDiv( vector->y, matrix->yy, val ) ); vector->x = xz; vector->y = yz; @@ -770,12 +782,12 @@ FT_Int sx = 1, sy = 1, shift; - FT_MOVE_SIGN( x_, sx ); - FT_MOVE_SIGN( y_, sy ); - x = (FT_UInt32)x_; y = (FT_UInt32)y_; + FT_MOVE_SIGN( x_, x, sx ); + FT_MOVE_SIGN( y_, y, sy ); + /* trivial cases */ if ( x == 0 ) { @@ -913,11 +925,13 @@ FT_Int result; - if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL && - (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL ) + /* we silently ignore overflow errors, since such large values */ + /* lead to even more (harmless) rendering errors later on */ + if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && + ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { - FT_Long z1 = in_x * out_y; - FT_Long z2 = in_y * out_x; + FT_Long z1 = MUL_LONG( in_x, out_y ); + FT_Long z2 = MUL_LONG( in_y, out_x ); if ( z1 > z2 ) diff --git a/thirdparty/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c index 9bfb330508..3f78a8c36b 100644 --- a/thirdparty/freetype/src/base/ftglyph.c +++ b/thirdparty/freetype/src/base/ftglyph.c @@ -408,12 +408,28 @@ goto Exit; /* copy advance while converting 26.6 to 16.16 format */ + if ( slot->advance.x >= 0x8000L * 64 || + slot->advance.x <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance width too large\n" )); + error = FT_THROW( Invalid_Argument ); + goto Exit2; + } + if ( slot->advance.y >= 0x8000L * 64 || + slot->advance.y <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance height too large\n" )); + error = FT_THROW( Invalid_Argument ); + goto Exit2; + } + glyph->advance.x = slot->advance.x * 1024; glyph->advance.y = slot->advance.y * 1024; /* now import the image from the glyph slot */ error = clazz->glyph_init( glyph, slot ); + Exit2: /* if an error occurred, destroy the glyph */ if ( error ) FT_Done_Glyph( glyph ); diff --git a/thirdparty/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c index 611b39f570..60c813fd9e 100644 --- a/thirdparty/freetype/src/base/ftlcdfil.c +++ b/thirdparty/freetype/src/base/ftlcdfil.c @@ -29,141 +29,107 @@ /* define USE_LEGACY to implement the legacy filter */ #define USE_LEGACY +#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) + /* FIR filter used by the default and light filters */ FT_BASE( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; + + /* take care of bitmap flow */ + if ( pitch > 0 ) + origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place FIR filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 4 ) + if ( mode == FT_RENDER_MODE_LCD && width >= 2 ) { - FT_Byte* line = bitmap->buffer; - + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - /* `fir' and `pix' must be at least 32 bit wide, since the sum of */ - /* the values in `weights' can exceed 0xFF */ + /* `fir' must be at least 32 bit wide, since the sum of */ + /* the values in `weights' can exceed 0xFF */ - for ( ; height > 0; height--, line += bitmap->pitch ) + for ( ; height > 0; height--, line -= pitch ) { - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, xx; + FT_UInt fir[5]; + FT_UInt val, xx; - val1 = line[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; + val = line[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; - val1 = line[1]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; + val = line[1]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; for ( xx = 2; xx < width; xx++ ) { - FT_UInt val, pix; - - val = line[xx]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; - } + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; - { - FT_UInt pix; - - - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; - - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 1] = (FT_Byte)pix; + line[xx - 2] = FT_SHIFTCLAMP( fir[0] ); } + + line[xx - 2] = FT_SHIFTCLAMP( fir[1] ); + line[xx - 1] = FT_SHIFTCLAMP( fir[2] ); } } /* vertical in-place FIR filter */ - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 ) + else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 ) { - FT_Byte* column = bitmap->buffer; - FT_Int pitch = bitmap->pitch; - + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, yy; + FT_UInt fir[5]; + FT_UInt val, yy; - val1 = col[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; - col += pitch; + val = col[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - val1 = col[0]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; - col += pitch; + val = col[0]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - for ( yy = 2; yy < height; yy++ ) + for ( yy = 2; yy < height; yy++, col -= pitch ) { - FT_UInt val, pix; - - val = col[0]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; - col += pitch; - } - - { - FT_UInt pix; - + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; - - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-pitch] = (FT_Byte)pix; + col[pitch * 2] = FT_SHIFTCLAMP( fir[0] ); } + + col[pitch * 2] = FT_SHIFTCLAMP( fir[1] ); + col[pitch] = FT_SHIFTCLAMP( fir[2] ); } } } @@ -177,9 +143,10 @@ FT_Render_Mode mode, FT_Byte* weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; - FT_Int pitch = bitmap->pitch; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; static const unsigned int filters[3][3] = { @@ -191,33 +158,31 @@ FT_UNUSED( weights ); + /* take care of bitmap flow */ + if ( pitch > 0 ) + origin += pitch * (FT_Int)( height - 1 ); + /* horizontal in-place intra-pixel filter */ if ( mode == FT_RENDER_MODE_LCD && width >= 3 ) { - FT_Byte* line = bitmap->buffer; + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - - for ( ; height > 0; height--, line += pitch ) + for ( ; height > 0; height--, line -= pitch ) { FT_UInt xx; for ( xx = 0; xx < width; xx += 3 ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = line[xx]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = line[xx + 1]; r += filters[1][0] * p; @@ -237,31 +202,24 @@ } else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 ) { - FT_Byte* column = bitmap->buffer; - + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { - FT_Byte* col = column; - FT_Byte* col_end = col + (FT_Int)height * pitch; + FT_Byte* col = column - 2 * pitch; - for ( ; col < col_end; col += 3 * pitch ) + for ( ; height > 0; height -= 3, col -= 3 * pitch ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = col[0]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = col[pitch]; r += filters[1][0] * p; @@ -275,7 +233,7 @@ col[0] = (FT_Byte)( r / 65536 ); col[pitch] = (FT_Byte)( g / 65536 ); - col[2 * pitch] = (FT_Byte)( b / 65536 ); + col[pitch * 2] = (FT_Byte)( b / 65536 ); } } } @@ -296,7 +254,6 @@ ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; return FT_Err_Ok; } @@ -319,7 +276,6 @@ { case FT_LCD_FILTER_NONE: library->lcd_filter_func = NULL; - library->lcd_extra = 0; break; case FT_LCD_FILTER_DEFAULT: @@ -327,7 +283,6 @@ default_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; case FT_LCD_FILTER_LIGHT: @@ -335,7 +290,6 @@ light_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; #ifdef USE_LEGACY @@ -343,7 +297,6 @@ case FT_LCD_FILTER_LEGACY: case FT_LCD_FILTER_LEGACY1: library->lcd_filter_func = _ft_lcd_filter_legacy; - library->lcd_extra = 0; break; #endif diff --git a/thirdparty/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c index 4b92066da3..4e76585e5f 100644 --- a/thirdparty/freetype/src/base/ftmac.c +++ b/thirdparty/freetype/src/base/ftmac.c @@ -1005,7 +1005,7 @@ /* accepts an FSRef instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, diff --git a/thirdparty/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c index 2cb56a39be..43877ece45 100644 --- a/thirdparty/freetype/src/base/ftmm.c +++ b/thirdparty/freetype/src/base/ftmm.c @@ -158,7 +158,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service ); @@ -194,7 +194,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -266,7 +266,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -313,7 +313,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -402,4 +402,28 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ) + { + FT_UShort* axis_flags; + + + if ( !master || !flags ) + return FT_THROW( Invalid_Argument ); + + if ( axis_index >= master->num_axis ) + return FT_THROW( Invalid_Argument ); + + /* the axis flags array immediately follows the data of `master' */ + axis_flags = (FT_UShort*)&( master[1] ); + *flags = axis_flags[axis_index]; + + return FT_Err_Ok; + } + + /* END */ diff --git a/thirdparty/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c index 539116e85c..6db8136cfc 100644 --- a/thirdparty/freetype/src/base/ftobjs.c +++ b/thirdparty/freetype/src/base/ftobjs.c @@ -579,34 +579,42 @@ if ( vertical ) { metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); - right = FT_PIX_CEIL( metrics->vertBearingX + metrics->width ); - bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingX, + metrics->width ) ); + bottom = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingY, + metrics->height ) ); metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - metrics->width = right - metrics->vertBearingX; - metrics->height = bottom - metrics->vertBearingY; + metrics->width = SUB_LONG( right, + metrics->vertBearingX ); + metrics->height = SUB_LONG( bottom, + metrics->vertBearingY ); } else { metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - right = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width ); - bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->horiBearingX, + metrics->width ) ); + bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY, + metrics->height ) ); metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); - metrics->width = right - metrics->horiBearingX; - metrics->height = metrics->horiBearingY - bottom; + metrics->width = SUB_LONG( right, + metrics->horiBearingX ); + metrics->height = SUB_LONG( metrics->horiBearingY, + bottom ); } - metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); - metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); + metrics->horiAdvance = FT_PIX_ROUND_LONG( metrics->horiAdvance ); + metrics->vertAdvance = FT_PIX_ROUND_LONG( metrics->vertAdvance ); } #endif /* GRID_FIT_METRICS */ @@ -4549,7 +4557,7 @@ if ( !clazz ) return FT_THROW( Invalid_Argument ); - /* check freetype version */ + /* check FreeType version */ if ( clazz->module_requires > FREETYPE_VER_FIXED ) return FT_THROW( Invalid_Version ); @@ -4973,10 +4981,6 @@ goto Fail; #endif - /* we don't use raster_pool anymore. */ - library->raster_pool_size = 0; - library->raster_pool = NULL; - library->version_major = FREETYPE_MAJOR; library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; diff --git a/thirdparty/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c index 464a066dcc..9ceb9cf1ba 100644 --- a/thirdparty/freetype/src/base/ftoutln.c +++ b/thirdparty/freetype/src/base/ftoutln.c @@ -1088,7 +1088,8 @@ v_cur.x = points[n].x >> xshift; v_cur.y = points[n].y >> yshift; - area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + area = ADD_LONG( area, + ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); v_prev = v_cur; } diff --git a/thirdparty/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c index f7b81375dd..f5ad2874d8 100644 --- a/thirdparty/freetype/src/base/ftrfork.c +++ b/thirdparty/freetype/src/base/ftrfork.c @@ -271,7 +271,13 @@ if ( FT_STREAM_SKIP( 4 ) ) /* mbz */ goto Exit; - if ( ref[j].res_id < 0 || temp < 0 ) + /* + * According to Inside Macintosh: More Macintosh Toolbox, + * "Resource IDs" (1-46), there are some reserved IDs. + * However, FreeType2 is not a font synthesizer, no need + * to check the acceptable resource ID. + */ + if ( temp < 0 ) { error = FT_THROW( Invalid_Table ); goto Exit; @@ -281,7 +287,7 @@ FT_TRACE3(( " [%d]:" " resource_id=0x%04x, offset=0x%08x\n", - j, ref[j].res_id, ref[j].offset )); + j, (FT_UShort)ref[j].res_id, ref[j].offset )); } if ( sort_by_res_id ) diff --git a/thirdparty/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c index 66dae6037a..5cf386f48d 100644 --- a/thirdparty/freetype/src/base/ftsynth.c +++ b/thirdparty/freetype/src/base/ftsynth.c @@ -123,7 +123,7 @@ /* * XXX: overflow check for 16-bit system, for compatibility - * with FT_GlyphSlot_Embolden() since freetype-2.1.10. + * with FT_GlyphSlot_Embolden() since FreeType 2.1.10. * unfortunately, this function return no informations * about the cause of error. */ diff --git a/thirdparty/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c index dccc209f4d..7bd5bee87c 100644 --- a/thirdparty/freetype/src/base/ftutil.c +++ b/thirdparty/freetype/src/base/ftutil.c @@ -135,7 +135,7 @@ ft_mem_free( memory, block ); block = NULL; } - else if ( new_count > FT_INT_MAX/item_size ) + else if ( new_count > FT_INT_MAX / item_size ) { error = FT_THROW( Array_Too_Large ); } @@ -143,13 +143,15 @@ { FT_ASSERT( !block ); - block = ft_mem_alloc( memory, new_count*item_size, &error ); + block = memory->alloc( memory, new_count * item_size ); + if ( block == NULL ) + error = FT_THROW( Out_Of_Memory ); } else { FT_Pointer block2; - FT_Long cur_size = cur_count*item_size; - FT_Long new_size = new_count*item_size; + FT_Long cur_size = cur_count * item_size; + FT_Long new_size = new_count * item_size; block2 = memory->realloc( memory, cur_size, new_size, block ); diff --git a/thirdparty/freetype/src/bdf/bdfdrivr.c b/thirdparty/freetype/src/bdf/bdfdrivr.c index a2242be014..fb77810007 100644 --- a/thirdparty/freetype/src/bdf/bdfdrivr.c +++ b/thirdparty/freetype/src/bdf/bdfdrivr.c @@ -373,7 +373,7 @@ THE SOFTWARE. /* we have a bdf font: let's construct the face object */ face->bdffont = font; - /* BDF could not have multiple face in single font file. + /* BDF cannot have multiple faces in a single font file. * XXX: non-zero face_index is already invalid argument, but * Type1, Type42 driver has a convention to return * an invalid argument error when the font could be @@ -437,46 +437,156 @@ THE SOFTWARE. { FT_Bitmap_Size* bsize = bdfface->available_sizes; FT_Short resolution_x = 0, resolution_y = 0; + long value; FT_ZERO( bsize ); + /* sanity checks */ + if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF ) + { + font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n", + font->font_ascent )); + } + if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF ) + { + font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n", + font->font_descent )); + } + bsize->height = (FT_Short)( font->font_ascent + font->font_descent ); prop = bdf_get_font_property( font, "AVERAGE_WIDTH" ); if ( prop ) - bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 ); + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative average width\n" )); +#endif + if ( prop->value.l > 0x7FFFL * 10 - 5 || + prop->value.l < -( 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); + } else - bsize->width = (FT_Short)( bsize->height * 2/3 ); + { + /* this is a heuristical value */ + bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative point size\n" )); +#endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = - (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L ); + if ( prop->value.l > 0x504C2L || /* 0x7FFF * 72270/7200 */ + prop->value.l < -0x504C2L ) + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); + } + else if ( font->point_size ) + { + if ( font->point_size > 0x7FFF ) + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = (FT_Pos)font->point_size << 6; + } else - bsize->size = bsize->width << 6; + { + /* this is a heuristical value */ + bsize->size = bsize->width * 64; + } prop = bdf_get_font_property( font, "PIXEL_SIZE" ); if ( prop ) - bsize->y_ppem = (FT_Short)prop->value.l << 6; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative pixel size\n" )); +#endif + if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + } prop = bdf_get_font_property( font, "RESOLUTION_X" ); if ( prop ) - resolution_x = (FT_Short)prop->value.l; + value = prop->value.l; + else + value = (long)font->resolution_x; + if ( value ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( value < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" )); +#endif + if ( value > 0x7FFF || value < -0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)value ); + } prop = bdf_get_font_property( font, "RESOLUTION_Y" ); if ( prop ) - resolution_y = (FT_Short)prop->value.l; + value = prop->value.l; + else + value = (long)font->resolution_y; + if ( value ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( value < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" )); +#endif + if ( value > 0x7FFF || value < -0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)value ); + } if ( bsize->y_ppem == 0 ) { bsize->y_ppem = bsize->size; if ( resolution_y ) - bsize->y_ppem = bsize->y_ppem * resolution_y / 72; + bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 ); } if ( resolution_x && resolution_y ) - bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y; + bsize->x_ppem = FT_MulDiv( bsize->y_ppem, + resolution_x, + resolution_y ); else bsize->x_ppem = bsize->y_ppem; } @@ -545,7 +655,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } { @@ -566,12 +680,6 @@ THE SOFTWARE. } error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( bdfface->num_charmaps ) - bdfface->charmap = bdfface->charmaps[0]; -#endif } goto Exit; diff --git a/thirdparty/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c index 7fd95a7385..bf10887fd4 100644 --- a/thirdparty/freetype/src/bdf/bdflib.c +++ b/thirdparty/freetype/src/bdf/bdflib.c @@ -704,7 +704,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( ULONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = ULONG_MAX; + break; + } + } return v; } @@ -729,7 +737,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( LONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = LONG_MAX; + break; + } + } return ( !neg ) ? v : -v; } @@ -746,7 +762,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (unsigned short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( USHRT_MAX - 9 ) / 10 ) + v = (unsigned short)( v * 10 + a2i[(int)*s] ); + else + { + v = USHRT_MAX; + break; + } + } return v; } @@ -771,7 +795,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( SHRT_MAX - 9 ) / 10 ) + v = (short)( v * 10 + a2i[(int)*s] ); + else + { + v = SHRT_MAX; + break; + } + } return (short)( ( !neg ) ? v : -v ); } diff --git a/thirdparty/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c index 289bd5c430..e804776ab4 100644 --- a/thirdparty/freetype/src/cache/ftcbasic.c +++ b/thirdparty/freetype/src/cache/ftcbasic.c @@ -304,10 +304,18 @@ if ( anode ) *anode = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32'. + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -377,11 +385,18 @@ if ( anode ) *anode = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; @@ -487,10 +502,18 @@ *ansbit = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32'. + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -562,11 +585,18 @@ *ansbit = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; diff --git a/thirdparty/freetype/src/cff/cf2blues.c b/thirdparty/freetype/src/cff/cf2blues.c index 250f89e0df..c491f2f9e5 100644 --- a/thirdparty/freetype/src/cff/cf2blues.c +++ b/thirdparty/freetype/src/cff/cf2blues.c @@ -194,8 +194,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( blueValues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { @@ -243,8 +243,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( otherBlues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { @@ -301,7 +301,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -319,7 +319,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) blues->zone[i].csFlatEdge = flatFamilyEdge; @@ -342,7 +342,7 @@ /* adjust edges of top zone upward by twice darkening amount */ flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -408,8 +408,8 @@ /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */ /* 10ppem Arial */ - blues->boost = cf2_floatToFixed( .6 ) - - FT_MulDiv( cf2_floatToFixed ( .6 ), + blues->boost = cf2_doubleToFixed( .6 ) - + FT_MulDiv( cf2_doubleToFixed ( .6 ), blues->scale, blues->blueScale ); if ( blues->boost > 0x7FFF ) @@ -489,17 +489,18 @@ if ( blues->zone[i].bottomZone && cf2_hint_isBottom( bottomHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - bottomHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + bottomHintEdge->csCoord && bottomHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* bottom edge captured by bottom zone */ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >= + else if ( SUB_INT32( blues->zone[i].csTopEdge, + bottomHintEdge->csCoord ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ @@ -514,7 +515,7 @@ dsNew = cf2_fixedRound( bottomHintEdge->dsCoord ); } - dsMove = dsNew - bottomHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, bottomHintEdge->dsCoord ); captured = TRUE; break; @@ -523,17 +524,18 @@ if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - topHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + topHintEdge->csCoord && topHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* top edge captured by top zone */ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >= + else if ( SUB_INT32( topHintEdge->csCoord, + blues->zone[i].csBottomEdge ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ @@ -548,7 +550,7 @@ dsNew = cf2_fixedRound( topHintEdge->dsCoord ); } - dsMove = dsNew - topHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, topHintEdge->dsCoord ); captured = TRUE; break; @@ -561,13 +563,14 @@ /* move both edges and flag them `locked' */ if ( cf2_hint_isValid( bottomHintEdge ) ) { - bottomHintEdge->dsCoord += dsMove; + bottomHintEdge->dsCoord = ADD_INT32( bottomHintEdge->dsCoord, + dsMove ); cf2_hint_lock( bottomHintEdge ); } if ( cf2_hint_isValid( topHintEdge ) ) { - topHintEdge->dsCoord += dsMove; + topHintEdge->dsCoord = ADD_INT32( topHintEdge->dsCoord, dsMove ); cf2_hint_lock( topHintEdge ); } } diff --git a/thirdparty/freetype/src/cff/cf2blues.h b/thirdparty/freetype/src/cff/cf2blues.h index 96fb60f38d..a6bcd9de57 100644 --- a/thirdparty/freetype/src/cff/cf2blues.h +++ b/thirdparty/freetype/src/cff/cf2blues.h @@ -111,7 +111,7 @@ FT_BEGIN_HEADER * Constant used for hint adjustment and for synthetic em box hint * placement. */ -#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 ) +#define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 ) /* shared typedef is in cf2glue.h */ diff --git a/thirdparty/freetype/src/cff/cf2fixed.h b/thirdparty/freetype/src/cff/cf2fixed.h index 2e4b5032fa..a041184bda 100644 --- a/thirdparty/freetype/src/cff/cf2fixed.h +++ b/thirdparty/freetype/src/cff/cf2fixed.h @@ -63,10 +63,10 @@ FT_BEGIN_HEADER ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) #define cf2_fixedRound( x ) \ ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) ) -#define cf2_floatToFixed( f ) \ +#define cf2_doubleToFixed( f ) \ ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) #define cf2_fixedAbs( x ) \ - ( (x) < 0 ? -(x) : (x) ) + ( (x) < 0 ? NEG_INT32( x ) : (x) ) #define cf2_fixedFloor( x ) \ ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) ) #define cf2_fixedFraction( x ) \ diff --git a/thirdparty/freetype/src/cff/cf2font.c b/thirdparty/freetype/src/cff/cf2font.c index a86e3619b4..4ac71a8d71 100644 --- a/thirdparty/freetype/src/cff/cf2font.c +++ b/thirdparty/freetype/src/cff/cf2font.c @@ -117,7 +117,7 @@ return; /* protect against range problems and divide by zero */ - if ( emRatio < cf2_floatToFixed( .01 ) ) + if ( emRatio < cf2_doubleToFixed( .01 ) ) return; if ( stemDarkened ) @@ -447,7 +447,7 @@ /* choose a constant for StdHW that depends on font contrast */ stdHW = cf2_getStdHW( decoder ); - if ( stdHW > 0 && font->stdVW > 2 * stdHW ) + if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) ) font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); else { diff --git a/thirdparty/freetype/src/cff/cf2ft.c b/thirdparty/freetype/src/cff/cf2ft.c index eb8472f119..c6c00d1623 100644 --- a/thirdparty/freetype/src/cff/cf2ft.c +++ b/thirdparty/freetype/src/cff/cf2ft.c @@ -267,8 +267,8 @@ if ( *hinted ) { - *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64; - *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64; + *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64; + *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64; } else { diff --git a/thirdparty/freetype/src/cff/cf2hints.c b/thirdparty/freetype/src/cff/cf2hints.c index c8f7dfeba6..656eb2cff1 100644 --- a/thirdparty/freetype/src/cff/cf2hints.c +++ b/thirdparty/freetype/src/cff/cf2hints.c @@ -74,8 +74,8 @@ /* cross product of pt1 position from origin with pt2 position from */ /* pt1; we reduce the precision so that the result fits into 32 bits */ - return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) - - ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 ); + return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) - + ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 ); } @@ -105,7 +105,7 @@ stemHintArray, indexStemHint ); - width = stemHint->max - stemHint->min; + width = SUB_INT32( stemHint->max, stemHint->min ); if ( width == cf2_intToFixed( -21 ) ) { @@ -185,11 +185,11 @@ /* darkening. Bottoms are not changed; tops are incremented by twice */ /* `darkenY'. */ if ( cf2_hint_isTop( hint ) ) - hint->csCoord += 2 * font->darkenY; + hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY ); - hint->csCoord += hintOrigin; - hint->scale = scale; - hint->index = indexStemHint; /* index in original stem hint array */ + hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin ); + hint->scale = scale; + hint->index = indexStemHint; /* index in original stem hint array */ /* if original stem hint has been used, use the same position */ if ( hint->flags != 0 && stemHint->used ) @@ -314,6 +314,7 @@ /* start linear search from last hit */ CF2_UInt i = hintmap->lastIndex; + FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES ); /* search up */ @@ -330,9 +331,10 @@ if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) { /* special case for points below first edge: use uniform scale */ - return FT_MulFix( csCoord - hintmap->edge[0].csCoord, - hintmap->scale ) + - hintmap->edge[0].dsCoord; + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, + hintmap->edge[0].csCoord ), + hintmap->scale ), + hintmap->edge[0].dsCoord ); } else { @@ -340,9 +342,10 @@ * Note: entries with duplicate csCoord are allowed. * Use edge[i], the highest entry where csCoord >= entry[i].csCoord */ - return FT_MulFix( csCoord - hintmap->edge[i].csCoord, - hintmap->edge[i].scale ) + - hintmap->edge[i].dsCoord; + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, + hintmap->edge[i].csCoord ), + hintmap->edge[i].scale ), + hintmap->edge[i].dsCoord ); } } } @@ -437,14 +440,16 @@ /* is there room to move up? */ /* there is if we are at top of array or the next edge is at or */ /* beyond proposed move up? */ - if ( j >= hintmap->count - 1 || + if ( j >= hintmap->count - 1 || hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + moveUp + upMinCounter ) + ADD_INT32( hintmap->edge[j].dsCoord, + moveUp + upMinCounter ) ) { /* there is room to move up; is there also room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { /* move smaller absolute amount */ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ @@ -455,9 +460,10 @@ else { /* is there room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { move = moveDown; /* true if non-optimum move */ @@ -491,9 +497,11 @@ } /* move the edge(s) */ - hintmap->edge[i].dsCoord += move; + hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord, + move ); if ( isPair ) - hintmap->edge[j].dsCoord += move; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + move ); } /* assert there are no overlaps in device space */ @@ -507,18 +515,20 @@ { if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) hintmap->edge[i - 1].scale = - FT_DivFix( - hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, - hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); + FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord, + hintmap->edge[i - 1].dsCoord ), + SUB_INT32( hintmap->edge[i].csCoord, + hintmap->edge[i - 1].csCoord ) ); } if ( isPair ) { if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) hintmap->edge[j - 1].scale = - FT_DivFix( - hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, - hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); + FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord, + hintmap->edge[j - 1].dsCoord ), + SUB_INT32( hintmap->edge[j].csCoord, + hintmap->edge[j - 1].csCoord ) ); i += 1; /* skip upper edge on next loop */ } @@ -539,15 +549,18 @@ /* is there room to move up? */ if ( hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) + ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp + CF2_MIN_COUNTER ) ) { /* there is more room now, move edge up */ - hintmap->edge[j].dsCoord += hintMove->moveUp; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp ); if ( cf2_hint_isPair( &hintmap->edge[j] ) ) { FT_ASSERT( j > 0 ); - hintmap->edge[j - 1].dsCoord += hintMove->moveUp; + hintmap->edge[j - 1].dsCoord = + ADD_INT32( hintmap->edge[j - 1].dsCoord, hintMove->moveUp ); } } } @@ -635,18 +648,19 @@ { /* Use hint map to position the center of stem, and nominal scale */ /* to position the two edges. This preserves the stem width. */ - CF2_Fixed midpoint = cf2_hintmap_map( - hintmap->initialHintMap, - ( secondHintEdge->csCoord + - firstHintEdge->csCoord ) / 2 ); - CF2_Fixed halfWidth = FT_MulFix( - ( secondHintEdge->csCoord - - firstHintEdge->csCoord ) / 2, - hintmap->scale ); - - - firstHintEdge->dsCoord = midpoint - halfWidth; - secondHintEdge->dsCoord = midpoint + halfWidth; + CF2_Fixed midpoint = + cf2_hintmap_map( + hintmap->initialHintMap, + ADD_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ); + CF2_Fixed halfWidth = + FT_MulFix( SUB_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2, + hintmap->scale ); + + + firstHintEdge->dsCoord = SUB_INT32( midpoint, halfWidth ); + secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth ); } else firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap, @@ -715,7 +729,7 @@ /* insert first edge */ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ - hintmap->count += 1; + hintmap->count += 1; if ( isPair ) { @@ -781,7 +795,7 @@ cf2_arrstack_size( hStemHintArray ) + cf2_arrstack_size( vStemHintArray ) ); if ( !cf2_hintmask_isValid( hintMask ) ) - return; /* too many stem hints */ + return; /* too many stem hints */ } /* begin by clearing the map */ @@ -797,7 +811,7 @@ /* Defense-in-depth. Should never return here. */ if ( bitCount > hintMask->bitCount ) - return; + return; /* synthetic embox hints get highest priority */ if ( font->blues.doEmBoxHints ) @@ -1063,7 +1077,7 @@ cf2_fixedAbs( glyphpath->yOffset ) ); /* .1 character space unit */ - glyphpath->snapThreshold = cf2_floatToFixed( 0.1f ); + glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 ); glyphpath->moveIsPending = TRUE; glyphpath->pathIsOpen = FALSE; @@ -1095,16 +1109,20 @@ FT_Vector pt; /* hinted point in upright DS */ - pt.x = FT_MulFix( glyphpath->scaleX, x ) + - FT_MulFix( glyphpath->scaleC, y ); + pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), + FT_MulFix( glyphpath->scaleC, y ) ); pt.y = cf2_hintmap_map( hintmap, y ); - ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) + - glyphpath->fractionalTranslation.x; - ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) + - glyphpath->fractionalTranslation.y; + ppt->x = ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.a, pt.x ), + ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.c, pt.y ), + glyphpath->fractionalTranslation.x ) ); + ppt->y = ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.b, pt.x ), + ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.d, pt.y ), + glyphpath->fractionalTranslation.y ) ); } @@ -1154,12 +1172,12 @@ CF2_Fixed denominator, s; - u.x = CF2_CS_SCALE( u2->x - u1->x ); - u.y = CF2_CS_SCALE( u2->y - u1->y ); - v.x = CF2_CS_SCALE( v2->x - v1->x ); - v.y = CF2_CS_SCALE( v2->y - v1->y ); - w.x = CF2_CS_SCALE( v1->x - u1->x ); - w.y = CF2_CS_SCALE( v1->y - u1->y ); + u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) ); + u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) ); + v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) ); + v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) ); + w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) ); + w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) ); denominator = cf2_perp( u, v ); @@ -1168,8 +1186,11 @@ s = FT_DivFix( cf2_perp( w, v ), denominator ); - intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x ); - intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y ); + intersection->x = ADD_INT32( u1->x, + FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) ); + intersection->y = ADD_INT32( u1->y, + FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) ); + /* * Special case snapping for horizontal and vertical lines. @@ -1180,25 +1201,29 @@ * */ - if ( u1->x == u2->x && - cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold ) + if ( u1->x == u2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + u1->x ) ) < glyphpath->snapThreshold ) intersection->x = u1->x; - if ( u1->y == u2->y && - cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold ) + if ( u1->y == u2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + u1->y ) ) < glyphpath->snapThreshold ) intersection->y = u1->y; - if ( v1->x == v2->x && - cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold ) + if ( v1->x == v2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + v1->x ) ) < glyphpath->snapThreshold ) intersection->x = v1->x; - if ( v1->y == v2->y && - cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold ) + if ( v1->y == v2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + v1->y ) ) < glyphpath->snapThreshold ) intersection->y = v1->y; /* limit the intersection distance from midpoint of u2 and v1 */ - if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) > - glyphpath->miterLimit || - cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) > - glyphpath->miterLimit ) + if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) > + glyphpath->miterLimit || + cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) > + glyphpath->miterLimit ) return FALSE; return TRUE; @@ -1446,16 +1471,16 @@ CF2_Fixed* x, CF2_Fixed* y ) { - CF2_Fixed dx = x2 - x1; - CF2_Fixed dy = y2 - y1; + CF2_Fixed dx = SUB_INT32( x2, x1 ); + CF2_Fixed dy = SUB_INT32( y2, y1 ); /* note: negative offsets don't work here; negate deltas to change */ /* quadrants, below */ if ( glyphpath->font->reverseWinding ) { - dx = -dx; - dy = -dy; + dx = NEG_INT32( dx ); + dy = NEG_INT32( dy ); } *x = *y = 0; @@ -1464,8 +1489,9 @@ return; /* add momentum for this path element */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* note: allow mixed integer and fixed multiplication here */ if ( dx >= 0 ) @@ -1474,13 +1500,13 @@ { /* first quadrant, +x +y */ - if ( dx > 2 * dy ) + if ( dx > MUL_INT32( 2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( dy > 2 * dx ) + else if ( dy > MUL_INT32( 2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1489,9 +1515,9 @@ else { /* +x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1499,24 +1525,24 @@ { /* fourth quadrant, +x -y */ - if ( dx > -2 * dy ) + if ( dx > MUL_INT32( -2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( -dy > 2 * dx ) + else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else { /* +x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1527,13 +1553,13 @@ { /* second quadrant, -x +y */ - if ( -dx > 2 * dy ) + if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( dy > -2 * dx ) + else if ( dy > MUL_INT32( -2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1542,9 +1568,9 @@ else { /* -x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } @@ -1552,24 +1578,24 @@ { /* third quadrant, -x -y */ - if ( -dx > -2 * dy ) + if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( -dy > -2 * dx ) + else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else { /* -x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } @@ -1675,10 +1701,10 @@ &yOffset ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset; - P0.y = glyphpath->currentCS.y + yOffset; - P1.x = x + xOffset; - P1.y = y + yOffset; + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset ); + P1.x = ADD_INT32( x, xOffset ); + P1.y = ADD_INT32( y, yOffset ); if ( glyphpath->moveIsPending ) { @@ -1753,19 +1779,20 @@ &yOffset3 ); /* add momentum from the middle segment */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset1; - P0.y = glyphpath->currentCS.y + yOffset1; - P1.x = x1 + xOffset1; - P1.y = y1 + yOffset1; + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 ); + P1.x = ADD_INT32( x1, xOffset1 ); + P1.y = ADD_INT32( y1, yOffset1 ); /* note: preserve angle of final segment by using offset3 at both ends */ - P2.x = x2 + xOffset3; - P2.y = y2 + yOffset3; - P3.x = x3 + xOffset3; - P3.y = y3 + yOffset3; + P2.x = ADD_INT32( x2, xOffset3 ); + P2.y = ADD_INT32( y2, yOffset3 ); + P3.x = ADD_INT32( x3, xOffset3 ); + P3.y = ADD_INT32( y3, yOffset3 ); if ( glyphpath->moveIsPending ) { diff --git a/thirdparty/freetype/src/cff/cf2intrp.c b/thirdparty/freetype/src/cff/cf2intrp.c index 40bd9059a1..a816280748 100644 --- a/thirdparty/freetype/src/cff/cf2intrp.c +++ b/thirdparty/freetype/src/cff/cf2intrp.c @@ -304,10 +304,12 @@ CF2_StemHintRec stemhint; - stemhint.min = - position += cf2_stack_getReal( opStack, i ); - stemhint.max = - position += cf2_stack_getReal( opStack, i + 1 ); + stemhint.min = + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i ) ); + stemhint.max = + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i + 1 ) ); stemhint.used = FALSE; stemhint.maxDS = @@ -348,7 +350,8 @@ { vals[i + 2] = vals[i]; if ( readFromStack[i] ) - vals[i + 2] += cf2_stack_getReal( opStack, idx++ ); + vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack, + idx++ ) ); } if ( isHFlex ) @@ -356,31 +359,34 @@ if ( doConditionalLastRead ) { - FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > - cf2_fixedAbs( vals[11] - *curY ) ); + FT_Bool lastIsX = (FT_Bool)( + cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) > + cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) ); CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); if ( lastIsX ) { - vals[12] = vals[10] + lastVal; + vals[12] = ADD_INT32( vals[10], lastVal ); vals[13] = *curY; } else { vals[12] = *curX; - vals[13] = vals[11] + lastVal; + vals[13] = ADD_INT32( vals[11], lastVal ); } } else { if ( readFromStack[10] ) - vals[12] = vals[10] + cf2_stack_getReal( opStack, idx++ ); + vals[12] = ADD_INT32( vals[10], + cf2_stack_getReal( opStack, idx++ ) ); else vals[12] = *curX; if ( readFromStack[11] ) - vals[13] = vals[11] + cf2_stack_getReal( opStack, idx ); + vals[13] = ADD_INT32( vals[11], + cf2_stack_getReal( opStack, idx ) ); else vals[13] = *curY; } @@ -426,7 +432,10 @@ for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, cf2_stack_getReal( opStack, delta++ ) ); + sum = ADD_INT32( sum, + FT_MulFix( *weight++, + cf2_stack_getReal( opStack, + delta++ ) ) ); /* store blended result */ cf2_stack_setReal( opStack, i + base, sum ); @@ -759,7 +768,8 @@ FT_TRACE4(( " vmoveto\n" )); if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -767,7 +777,7 @@ if ( font->decoder->width_only ) goto exit; - curY += cf2_stack_popFixed( opStack ); + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -783,8 +793,10 @@ for ( idx = 0; idx < count; idx += 2 ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -810,9 +822,9 @@ if ( isX ) - curX += v; + curX = ADD_INT32( curX, v ); else - curY += v; + curY = ADD_INT32( curY, v ); isX = !isX; @@ -835,13 +847,15 @@ while ( idx + 6 <= count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; + CF2_Fixed x1, y1, x2, y2, x3, y3; + + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -852,8 +866,10 @@ if ( op1 == cf2_cmdRCURVELINE ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); } @@ -1129,7 +1145,10 @@ arg = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); } continue; /* do not clear the stack */ @@ -1144,7 +1163,9 @@ summand2 = cf2_stack_popFixed( opStack ); summand1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, summand1 + summand2 ); + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); } continue; /* do not clear the stack */ @@ -1159,7 +1180,8 @@ subtrahend = cf2_stack_popFixed( opStack ); minuend = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, minuend - subtrahend ); + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, subtrahend ) ); } continue; /* do not clear the stack */ @@ -1174,7 +1196,8 @@ divisor = cf2_stack_popFixed( opStack ); dividend = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, divisor ) ); } continue; /* do not clear the stack */ @@ -1187,7 +1210,10 @@ arg = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, -arg ); + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, -arg ); } continue; /* do not clear the stack */ @@ -1257,7 +1283,8 @@ arg2 = cf2_stack_popFixed( opStack ); arg1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, cond1 <= cond2 ? arg1 : arg2 ); + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); } continue; /* do not clear the stack */ @@ -1291,7 +1318,8 @@ factor2 = cf2_stack_popFixed( opStack ); factor1 = cf2_stack_popFixed( opStack ); - cf2_stack_pushFixed( opStack, FT_MulFix( factor1, factor2 ) ); + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); } continue; /* do not clear the stack */ @@ -1305,7 +1333,9 @@ arg = cf2_stack_popFixed( opStack ); if ( arg > 0 ) { - FT_Fixed root = arg; + /* use a start value that doesn't make */ + /* the algorithm's addition overflow */ + FT_Fixed root = arg < 10 ? arg : arg >> 1; FT_Fixed new_root; @@ -1369,7 +1399,8 @@ if ( size > 0 ) { - /* for `cf2_stack_getReal', index 0 is bottom of stack */ + /* for `cf2_stack_getReal', */ + /* index 0 is bottom of stack */ CF2_UInt gr_idx; @@ -1381,7 +1412,8 @@ gr_idx = size - 1 - (CF2_UInt)idx; cf2_stack_pushFixed( opStack, - cf2_stack_getReal( opStack, gr_idx ) ); + cf2_stack_getReal( opStack, + gr_idx ) ); } } continue; /* do not clear the stack */ @@ -1416,7 +1448,8 @@ cf2_stack_count( opStack ) == 5 ) { if ( !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); } /* width is defined or default after this */ @@ -1564,7 +1597,8 @@ FT_TRACE4(( " rmoveto\n" )); if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1572,8 +1606,8 @@ if ( font->decoder->width_only ) goto exit; - curY += cf2_stack_popFixed( opStack ); - curX += cf2_stack_popFixed( opStack ); + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1583,7 +1617,8 @@ FT_TRACE4(( " hmoveto\n" )); if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); /* width is defined or default after this */ haveWidth = TRUE; @@ -1591,7 +1626,7 @@ if ( font->decoder->width_only ) goto exit; - curX += cf2_stack_popFixed( opStack ); + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); @@ -1607,8 +1642,10 @@ while ( idx + 6 < count ) { - curX += cf2_stack_getReal( opStack, idx + 0 ); - curY += cf2_stack_getReal( opStack, idx + 1 ); + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); idx += 2; @@ -1616,13 +1653,15 @@ while ( idx < count ) { - CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2; + CF2_Fixed x1, y1, x2, y2, x3, y3; + + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1656,18 +1695,18 @@ if ( ( count - idx ) & 1 ) { - x1 = cf2_stack_getReal( opStack, idx ) + curX; + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX ); idx++; } else x1 = curX; - y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); x3 = x2; - y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1701,17 +1740,17 @@ if ( ( count - idx ) & 1 ) { - y1 = cf2_stack_getReal( opStack, idx ) + curY; + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY ); idx++; } else y1 = curY; - x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); @@ -1750,15 +1789,15 @@ if ( alternate ) { - x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX; + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); y1 = curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2; + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); if ( count - idx == 5 ) { - x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2; + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); idx++; } @@ -1770,14 +1809,14 @@ else { x1 = curX; - y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2; + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); if ( count - idx == 5 ) { - y3 = cf2_stack_getReal( opStack, idx + 4 ) + y2; + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 ); idx++; } diff --git a/thirdparty/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c index 940804850e..20f3a2c28e 100644 --- a/thirdparty/freetype/src/cff/cffgload.c +++ b/thirdparty/freetype/src/cff/cffgload.c @@ -20,6 +20,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_CALC_H #include FT_OUTLINE_H #include FT_CFF_DRIVER_H @@ -1450,8 +1451,8 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x += args[-2]; - y += args[-1]; + x = ADD_LONG( x, args[-2] ); + y = ADD_LONG( y, args[-1] ); args = stack; break; @@ -1460,7 +1461,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - y += args[-1]; + y = ADD_LONG( y, args[-1] ); args = stack; break; @@ -1469,7 +1470,7 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; - x += args[-1]; + x = ADD_LONG( x, args[-1] ); args = stack; break; @@ -1486,8 +1487,8 @@ args -= num_args & ~1; while ( args < decoder->top ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); args += 2; } @@ -1519,9 +1520,9 @@ while ( args < decoder->top ) { if ( phase ) - x += args[0]; + x = ADD_LONG( x, args[0] ); else - y += args[0]; + y = ADD_LONG( y, args[0] ); if ( cff_builder_add_point1( builder, x, y ) ) goto Fail; @@ -1552,15 +1553,18 @@ args -= nargs; while ( args < decoder->top ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args += 6; } args = stack; @@ -1589,7 +1593,7 @@ if ( nargs & 1 ) { - x += args[0]; + x = ADD_LONG( x, args[0] ); args++; nargs--; } @@ -1599,13 +1603,16 @@ while ( args < decoder->top ) { - y += args[0]; + y = ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; + + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 1 ); + args += 4; } args = stack; @@ -1633,7 +1640,7 @@ args -= nargs; if ( nargs & 1 ) { - y += args[0]; + y = ADD_LONG( y, args[0] ); args++; nargs--; } @@ -1643,13 +1650,16 @@ while ( args < decoder->top ) { - x += args[0]; + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; + + x = ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); + args += 4; } args = stack; @@ -1688,26 +1698,30 @@ nargs -= 4; if ( phase ) { - x += args[0]; + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; + + y = ADD_LONG( y, args[3] ); if ( nargs == 1 ) - x += args[4]; + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } else { - y += args[0]; + y = ADD_LONG( y, args[0] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; + + x = ADD_LONG( x, args[3] ); if ( nargs == 1 ) - y += args[4]; + y = ADD_LONG( y, args[4] ); cff_builder_add_point( builder, x, y, 1 ); } args += 4; @@ -1740,23 +1754,27 @@ /* first, add the line segments */ while ( num_lines > 0 ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); + args += 2; num_lines--; } /* then the curve */ - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args = stack; } break; @@ -1785,23 +1803,27 @@ /* first, add the curves */ while ( num_curves > 0 ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); cff_builder_add_point( builder, x, y, 1 ); + args += 6; num_curves--; } /* then the final line */ - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 1 ); + args = stack; } break; @@ -1824,33 +1846,33 @@ start_y = y; /* first control point */ - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x += args[2]; - y += args[3]; + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x += args[4]; + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x += args[5]; + x = ADD_LONG( x, args[5] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x += args[6]; - y += args[7]; + x = ADD_LONG( x, args[6] ); + y = ADD_LONG( y, args[7] ); cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start */ - x += args[8]; - y = start_y; + x = ADD_LONG( x, args[8] ); + y = start_y; cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1873,32 +1895,32 @@ start_y = y; /* first control point */ - x += args[0]; + x = ADD_LONG( x, args[0] ); cff_builder_add_point( builder, x, y, 0 ); /* second control point */ - x += args[1]; - y += args[2]; + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ - x += args[3]; + x = ADD_LONG( x, args[3] ); cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ - x += args[4]; + x = ADD_LONG( x, args[4] ); cff_builder_add_point( builder, x, y, 0 ); /* fourth control point */ - x += args[5]; - y = start_y; + x = ADD_LONG( x, args[5] ); + y = start_y; cff_builder_add_point( builder, x, y, 0 ); /* ending point, with y-value the same as the start point's */ /* y-value -- we don't add this point, though */ - x += args[6]; + x = ADD_LONG( x, args[6] ); cff_builder_add_point( builder, x, y, 1 ); args = stack; @@ -1934,8 +1956,8 @@ /* grab up to the last argument */ for ( count = 5; count > 0; count-- ) { - dx += temp[0]; - dy += temp[1]; + dx = ADD_LONG( dx, temp[0] ); + dy = ADD_LONG( dy, temp[1] ); temp += 2; } @@ -1949,8 +1971,8 @@ for ( count = 5; count > 0; count-- ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) ); args += 2; @@ -1959,13 +1981,13 @@ /* is last operand an x- or y-delta? */ if ( horizontal ) { - x += args[0]; - y = start_y; + x = ADD_LONG( x, args[0] ); + y = start_y; } else { - x = start_x; - y += args[0]; + x = start_x; + y = ADD_LONG( y, args[0] ); } cff_builder_add_point( builder, x, y, 1 ); @@ -1987,8 +2009,8 @@ for ( count = 6; count > 0; count-- ) { - x += args[0]; - y += args[1]; + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, (FT_Bool)( count == 4 || count == 1 ) ); args += 2; @@ -2066,21 +2088,26 @@ FT_TRACE4(( " abs\n" )); if ( args[0] < 0 ) - args[0] = -args[0]; + { + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + else + args[0] = -args[0]; + } args++; break; case cff_op_add: FT_TRACE4(( " add\n" )); - args[0] += args[1]; + args[0] = ADD_LONG( args[0], args[1] ); args++; break; case cff_op_sub: FT_TRACE4(( " sub\n" )); - args[0] -= args[1]; + args[0] = SUB_LONG( args[0], args[1] ); args++; break; @@ -2094,6 +2121,8 @@ case cff_op_neg: FT_TRACE4(( " neg\n" )); + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; args[0] = -args[0]; args++; break; @@ -2350,12 +2379,13 @@ FT_TRACE4(( " hsbw (invalid op)\n" )); - decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 ); + decoder->glyph_width = + ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); decoder->builder.left_bearing.x = args[0]; decoder->builder.left_bearing.y = 0; - x = decoder->builder.pos_x + args[0]; + x = ADD_LONG( decoder->builder.pos_x, args[0] ); y = decoder->builder.pos_y; args = stack; break; @@ -2367,13 +2397,14 @@ FT_TRACE4(( " sbw (invalid op)\n" )); - decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 ); + decoder->glyph_width = + ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); decoder->builder.left_bearing.x = args[0]; decoder->builder.left_bearing.y = args[1]; - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y + args[1]; + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; @@ -2384,8 +2415,8 @@ FT_TRACE4(( " setcurrentpoint (invalid op)\n" )); - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y + args[1]; + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); args = stack; break; diff --git a/thirdparty/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c index 3beaeb1c8e..12420384af 100644 --- a/thirdparty/freetype/src/cff/cffload.c +++ b/thirdparty/freetype/src/cff/cffload.c @@ -1352,9 +1352,12 @@ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, - cff_parse_num( parser, - &parser->stack[delta++] ) * 65536 ); + sum = ADD_INT32( + sum, + FT_MulFix( + *weight++, + cff_parse_num( parser, + &parser->stack[delta++] ) * 65536 ) ); /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; diff --git a/thirdparty/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c index e1511bdbd1..9d7bf6d22c 100644 --- a/thirdparty/freetype/src/cff/cffparse.c +++ b/thirdparty/freetype/src/cff/cffparse.c @@ -20,6 +20,7 @@ #include "cffparse.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H #include "cfferrs.h" #include "cffpic.h" @@ -156,6 +157,22 @@ 1000000000L }; + /* maximum values allowed for multiplying */ + /* with the corresponding `power_tens' element */ + static const FT_Long power_ten_limits[] = + { + FT_LONG_MAX / 1L, + FT_LONG_MAX / 10L, + FT_LONG_MAX / 100L, + FT_LONG_MAX / 1000L, + FT_LONG_MAX / 10000L, + FT_LONG_MAX / 100000L, + FT_LONG_MAX / 1000000L, + FT_LONG_MAX / 10000000L, + FT_LONG_MAX / 100000000L, + FT_LONG_MAX / 1000000000L, + }; + /* read a real */ static FT_Fixed @@ -484,7 +501,15 @@ if ( scaling ) + { + if ( FT_ABS( val ) > power_ten_limits[scaling] ) + { + val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL; + goto Overflow; + } + val *= power_tens[scaling]; + } if ( val > 0x7FFF ) { @@ -1585,7 +1610,7 @@ val = 0; while ( num_args > 0 ) { - val += cff_parse_num( parser, data++ ); + val = ADD_LONG( val, cff_parse_num( parser, data++ ) ); switch ( field->size ) { case (8 / FT_CHAR_BIT): diff --git a/thirdparty/freetype/src/gxvalid/README b/thirdparty/freetype/src/gxvalid/README index 7201459aaf..200f66cb12 100644 --- a/thirdparty/freetype/src/gxvalid/README +++ b/thirdparty/freetype/src/gxvalid/README @@ -9,7 +9,7 @@ gxvalid: TrueType GX validator additional tables in TrueType font which are used by `QuickDraw GX Text', Apple Advanced Typography (AAT). In addition, gxvalid can validates `kern' tables which have been extended for AAT. Like the - otvalid module, gxvalid uses Freetype 2's validator framework + otvalid module, gxvalid uses FreeType 2's validator framework (ftvalid). You can link gxvalid with your program; before running your own layout diff --git a/thirdparty/freetype/src/pcf/README b/thirdparty/freetype/src/pcf/README index 10eff15fbe..09ea970eda 100644 --- a/thirdparty/freetype/src/pcf/README +++ b/thirdparty/freetype/src/pcf/README @@ -41,8 +41,8 @@ value given as argument into the corresponding glyph number. Known problems ************** -- dealing explicitly with encodings breaks the uniformity of freetype2 - api. +- dealing explicitly with encodings breaks the uniformity of FreeType 2 + API. - except for encodings properties, client applications have no visibility of the PCF_Face object. This means that applications diff --git a/thirdparty/freetype/src/pcf/pcfdrivr.c b/thirdparty/freetype/src/pcf/pcfdrivr.c index 9f4d36d111..169f75e950 100644 --- a/thirdparty/freetype/src/pcf/pcfdrivr.c +++ b/thirdparty/freetype/src/pcf/pcfdrivr.c @@ -387,7 +387,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } } @@ -409,12 +413,6 @@ THE SOFTWARE. } error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( pcfface->num_charmaps ) - pcfface->charmap = pcfface->charmaps[0]; -#endif } } diff --git a/thirdparty/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c index 3eacf2baf6..da216b05f4 100644 --- a/thirdparty/freetype/src/pcf/pcfread.c +++ b/thirdparty/freetype/src/pcf/pcfread.c @@ -1162,6 +1162,20 @@ THE SOFTWARE. accel->fontDescent, accel->maxOverlap )); + /* sanity checks */ + if ( FT_ABS( accel->fontAscent ) > 0x7FFF ) + { + accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n", + accel->fontAscent )); + } + if ( FT_ABS( accel->fontDescent ) > 0x7FFF ) + { + accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n", + accel->fontDescent )); + } + FT_TRACE5(( " minbounds:" )); error = pcf_get_metric( stream, format & ( ~PCF_FORMAT_MASK ), @@ -1496,8 +1510,16 @@ THE SOFTWARE. if ( face->accel.fontAscent + face->accel.fontDescent < 0 ) FT_TRACE0(( "pcf_load_font: negative height\n" )); #endif - bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + - face->accel.fontDescent ) ); + if ( FT_ABS( face->accel.fontAscent + + face->accel.fontDescent ) > 0x7FFF ) + { + bsize->height = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping height to value %d\n", + bsize->height )); + } + else + bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + + face->accel.fontDescent ) ); prop = pcf_find_property( face, "AVERAGE_WIDTH" ); if ( prop ) @@ -1506,10 +1528,20 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative average width\n" )); #endif - bsize->width = FT_ABS( (FT_Short)( ( prop->value.l ) + 5 ) / 10 ); + if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); } else + { + /* this is a heuristical value */ bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) @@ -1519,9 +1551,16 @@ THE SOFTWARE. FT_TRACE0(( "pcf_load_font: negative point size\n" )); #endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), - 64 * 7200, - 72270L ); + if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ + { + bsize->size = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); } prop = pcf_find_property( face, "PIXEL_SIZE" ); @@ -1531,7 +1570,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative pixel size\n" )); #endif - bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; } prop = pcf_find_property( face, "RESOLUTION_X" ); @@ -1541,7 +1587,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative X resolution\n" )); #endif - resolution_x = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)prop->value.l ); } prop = pcf_find_property( face, "RESOLUTION_Y" ); @@ -1551,7 +1604,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative Y resolution\n" )); #endif - resolution_y = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)prop->value.l ); } if ( bsize->y_ppem == 0 ) diff --git a/thirdparty/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c index 4b1703f51c..514af8050d 100644 --- a/thirdparty/freetype/src/pfr/pfrobjs.c +++ b/thirdparty/freetype/src/pfr/pfrobjs.c @@ -264,12 +264,6 @@ charmap.encoding = FT_ENCODING_UNICODE; error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); - -#if 0 - /* select default charmap */ - if ( pfrface->num_charmaps ) - pfrface->charmap = pfrface->charmaps[0]; -#endif } /* check whether we have loaded any kerning pairs */ diff --git a/thirdparty/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c index b092482194..d125b0834a 100644 --- a/thirdparty/freetype/src/psaux/psconv.c +++ b/thirdparty/freetype/src/psaux/psconv.c @@ -111,6 +111,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } num_limit = 0x7FFFFFFFL / base; @@ -215,6 +219,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } /* read the integer part */ diff --git a/thirdparty/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c index 7dd45135de..1250b53f5d 100644 --- a/thirdparty/freetype/src/psaux/t1decode.c +++ b/thirdparty/freetype/src/psaux/t1decode.c @@ -864,7 +864,9 @@ for ( mm = 1; mm < blend->num_designs; mm++ ) - tmp += FT_MulFix( *delta++, blend->weight_vector[mm] ); + tmp = ADD_LONG( tmp, + FT_MulFix( *delta++, + blend->weight_vector[mm] ) ); *values++ = tmp; } @@ -904,7 +906,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] += top[1]; /* XXX (over|under)flow */ + top[0] = ADD_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -915,7 +917,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] -= top[1]; /* XXX (over|under)flow */ + top[0] = SUB_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -1147,11 +1149,13 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->advance.x = top[1]; - builder->advance.y = 0; + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); - orig_x = x = builder->pos_x + top[0]; + builder->advance.x = top[1]; + builder->advance.y = 0; + + orig_x = x = ADD_LONG( builder->pos_x, top[0] ); orig_y = y = builder->pos_y; FT_UNUSED( orig_y ); @@ -1177,13 +1181,16 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->left_bearing.y += top[1]; - builder->advance.x = top[2]; - builder->advance.y = top[3]; + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; - x = builder->pos_x + top[0]; - y = builder->pos_y + top[1]; + x = ADD_LONG( builder->pos_x, top[0] ); + y = ADD_LONG( builder->pos_y, top[1] ); /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -1210,13 +1217,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; + x = ADD_LONG( x, top[0] ); goto Add_Line; case op_hmoveto: FT_TRACE4(( " hmoveto" )); - x += top[0]; + x = ADD_LONG( x, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1232,12 +1240,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; + x = ADD_LONG( x, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - y += top[3]; + + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1247,8 +1257,8 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); Add_Line: if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) ) @@ -1258,8 +1268,9 @@ case op_rmoveto: FT_TRACE4(( " rmoveto" )); - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1275,16 +1286,16 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[2]; - y += top[3]; + x = ADD_LONG( x, top[2] ); + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[4]; - y += top[5]; + x = ADD_LONG( x, top[4] ); + y = ADD_LONG( y, top[5] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1295,12 +1306,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - y += top[0]; + y = ADD_LONG( y, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[3]; + + x = ADD_LONG( x, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1310,13 +1323,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - y += top[0]; + y = ADD_LONG( y, top[0] ); goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); - y += top[0]; + y = ADD_LONG( y, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1473,7 +1487,7 @@ /* record vertical hint */ if ( hinter ) { - top[0] += orig_x; + top[0] = ADD_LONG( top[0], orig_x ); hinter->stem( hinter->hints, 0, top ); } break; @@ -1487,9 +1501,9 @@ FT_Pos dx = orig_x; - top[0] += dx; - top[2] += dx; - top[4] += dx; + top[0] = ADD_LONG( top[0], dx ); + top[2] = ADD_LONG( top[2], dx ); + top[4] = ADD_LONG( top[4], dx ); hinter->stem3( hinter->hints, 0, top ); } break; diff --git a/thirdparty/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c index 3ff8cb911b..44ba9ec6ab 100644 --- a/thirdparty/freetype/src/psnames/psmodule.c +++ b/thirdparty/freetype/src/psnames/psmodule.c @@ -23,8 +23,21 @@ #include "psmodule.h" + /* + * The file `pstables.h' with its arrays and its function + * `ft_get_adobe_glyph_index' is useful for other projects also (for + * example, `pdfium' is using it). However, if used as a C++ header, + * including it in two different source files makes it necessary to use + * `extern const' for the declaration of its arrays, otherwise the data + * would be duplicated as mandated by the C++ standard. + * + * For this reason, we use `DEFINE_PS_TABLES' to guard the function + * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array + * declarations and definitions. + */ #include "pstables.h" #define DEFINE_PS_TABLES +#define DEFINE_PS_TABLES_DATA #include "pstables.h" #include "psnamerr.h" diff --git a/thirdparty/freetype/src/psnames/pstables.h b/thirdparty/freetype/src/psnames/pstables.h index e0f5e30804..2a2b717d8f 100644 --- a/thirdparty/freetype/src/psnames/pstables.h +++ b/thirdparty/freetype/src/psnames/pstables.h @@ -19,7 +19,7 @@ /* This file has been generated automatically -- do not edit! */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -27,7 +27,7 @@ #endif #endif const char ft_standard_glyph_names[3696] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { '.','n','u','l','l', 0, @@ -451,7 +451,7 @@ 'R','o','m','a','n', 0, 'S','e','m','i','b','o','l','d', 0, } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -459,7 +459,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -467,7 +467,7 @@ #endif #endif const short ft_mac_names[FT_NUM_MAC_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351, @@ -490,7 +490,7 @@ 1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200, 209, 218, 225, 232, 239, 246 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -498,7 +498,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -506,7 +506,7 @@ #endif #endif const short ft_sid_names[FT_NUM_SID_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365, @@ -538,12 +538,12 @@ 3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586, 3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -551,7 +551,7 @@ #endif #endif const unsigned short t1_standard_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -571,12 +571,12 @@ 0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0, 0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -584,7 +584,7 @@ #endif #endif const unsigned short t1_expert_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -604,7 +604,7 @@ 347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362, 363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -619,7 +619,7 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -627,7 +627,7 @@ #endif #endif const unsigned char ft_adobe_glyph_list[55997L] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23, @@ -4131,7 +4131,7 @@ 182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128, 48, 90,235,225,244,225,235,225,238, 97,128, 48,186 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; diff --git a/thirdparty/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c index 1a83e9e477..185a7f6fc2 100644 --- a/thirdparty/freetype/src/raster/ftrend1.c +++ b/thirdparty/freetype/src/raster/ftrend1.c @@ -31,12 +31,7 @@ static FT_Error ft_raster1_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return FT_Err_Ok; } @@ -194,7 +189,7 @@ bitmap->rows = height; bitmap->pitch = (int)pitch; - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; diff --git a/thirdparty/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c index b9b296ea5f..560db4835a 100644 --- a/thirdparty/freetype/src/sfnt/pngshim.c +++ b/thirdparty/freetype/src/sfnt/pngshim.c @@ -49,18 +49,82 @@ } - /* Premultiplies data and converts RGBA bytes => native endian. */ + /* Premultiplies data and converts RGBA bytes => BGRA. */ static void premultiply_data( png_structp png, png_row_infop row_info, png_bytep data ) { - unsigned int i; + unsigned int i = 0, limit; + + /* The `vector_size' attribute was introduced in gcc 3.1, which */ + /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ + /* introduced in gcc 4.6 and clang 3.2, respectively. */ + /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */ +#if ( ( defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 5 ) || \ + ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \ + ( defined( __clang__ ) && \ + ( ( __clang_major__ >= 4 ) || \ + ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ + defined( __OPTIMIZE__ ) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + +#ifdef __clang__ + /* the clang documentation doesn't cover the two-argument case of */ + /* `__builtin_shufflevector'; however, it is is implemented since */ + /* version 2.8 */ +#define vector_shuffle __builtin_shufflevector +#else +#define vector_shuffle __builtin_shuffle +#endif - FT_UNUSED( png ); + typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); - for ( i = 0; i < row_info->rowbytes; i += 4 ) + /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ + limit = row_info->rowbytes - 16 + 1; + for ( ; i < limit; i += 16 ) + { + unsigned char* base = &data[i]; + + v82 s, s0, s1, a; + + /* clang <= 3.9 can't apply scalar values to vectors */ + /* (or rather, it needs a different syntax) */ + v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; + + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; + v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; + v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; + + + memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + s0 = s & n0xFF; /* R B R B R B R B */ + s1 = s >> n8; /* G A G A G A G A */ + + a = vector_shuffle( s1, ma ); /* A A A A A A A A */ + s1 |= o1; /* G 1 G 1 G 1 G 1 */ + s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ + + s0 *= a; + s1 *= a; + s0 += n0x80; + s1 += n0x80; + s0 = ( s0 + ( s0 >> n8 ) ) >> n8; + s1 = ( s1 + ( s1 >> n8 ) ) >> n8; + + s = s0 | ( s1 << n8 ); + memcpy( base, &s, 16 ); + } +#endif /* use `vector_size' */ + + FT_UNUSED( png ); + + limit = row_info->rowbytes; + for ( ; i < limit; i += 4 ) { unsigned char* base = &data[i]; unsigned int alpha = base[3]; diff --git a/thirdparty/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c index ac2e620e5d..69bf0a5c3d 100644 --- a/thirdparty/freetype/src/sfnt/sfobjs.c +++ b/thirdparty/freetype/src/sfnt/sfobjs.c @@ -787,6 +787,8 @@ tag != TTAG_OTTO && tag != TTAG_true && tag != TTAG_typ1 && + tag != TTAG_0xA5kbd && + tag != TTAG_0xA5lst && tag != 0x00020000UL ) { FT_TRACE2(( " not a font using the SFNT container format\n" )); @@ -1224,7 +1226,10 @@ goto Exit; } - if ( face->header.Units_Per_EM == 0 ) + /* OpenType 1.8.2 introduced limits to this value; */ + /* however, they make sense for older SFNT fonts also */ + if ( face->header.Units_Per_EM < 16 || + face->header.Units_Per_EM > 16384 ) { error = FT_THROW( Invalid_Table ); @@ -1464,7 +1469,8 @@ /* Polish the charmaps. */ /* */ /* Try to set the charmap encoding according to the platform & */ - /* encoding ID of each charmap. */ + /* encoding ID of each charmap. Emulate Unicode charmap if one */ + /* is missing. */ /* */ tt_face_build_cmaps( face ); /* ignore errors */ @@ -1472,7 +1478,10 @@ /* set the encoding fields */ { - FT_Int m; + FT_Int m; +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + FT_Bool has_unicode = FALSE; +#endif for ( m = 0; m < root->num_charmaps; m++ ) @@ -1483,14 +1492,34 @@ charmap->encoding = sfnt_find_encoding( charmap->platform_id, charmap->encoding_id ); -#if 0 - if ( !root->charmap && - charmap->encoding == FT_ENCODING_UNICODE ) - { - /* set 'root->charmap' to the first Unicode encoding we find */ - root->charmap = charmap; - } -#endif +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + if ( charmap->encoding == FT_ENCODING_UNICODE || + charmap->encoding == FT_ENCODING_MS_SYMBOL ) /* PUA */ + has_unicode = TRUE; + } + + /* synthesize Unicode charmap if one is missing */ + if ( !has_unicode ) + { + FT_CharMapRec cmaprec; + + + cmaprec.face = root; + cmaprec.platform_id = TT_PLATFORM_MICROSOFT; + cmaprec.encoding_id = TT_MS_ID_UNICODE_CS; + cmaprec.encoding = FT_ENCODING_UNICODE; + + + error = FT_CMap_New( (FT_CMap_Class)&tt_cmap_unicode_class_rec, + NULL, &cmaprec, NULL ); + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + goto Exit; + error = FT_Err_Ok; + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + } } diff --git a/thirdparty/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c index 5afa6ae4b7..b995e5c050 100644 --- a/thirdparty/freetype/src/sfnt/ttcmap.c +++ b/thirdparty/freetype/src/sfnt/ttcmap.c @@ -23,8 +23,10 @@ #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_STREAM_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "ttload.h" #include "ttcmap.h" +#include "ttpost.h" #include "sfntpic.h" @@ -3622,6 +3624,110 @@ #endif /* TT_CONFIG_CMAP_FORMAT_14 */ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** SYNTHETIC UNICODE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* This charmap is generated using postscript glyph names. */ + +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + FT_CALLBACK_DEF( const char * ) + tt_get_glyph_name( TT_Face face, + FT_UInt idx ) + { + FT_String* PSname; + + + tt_face_get_ps_name( face, idx, &PSname ); + + return PSname; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap_unicode_init( PS_Unicodes unicodes, + FT_Pointer pointer ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + FT_UNUSED( pointer ); + + + return psnames->unicodes_init( memory, + unicodes, + face->root.num_glyphs, + (PS_GetGlyphNameFunc)&tt_get_glyph_name, + (PS_FreeGlyphNameFunc)NULL, + (FT_Pointer)face ); + } + + + FT_CALLBACK_DEF( void ) + tt_cmap_unicode_done( PS_Unicodes unicodes ) + { + FT_Face face = FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + + + FT_FREE( unicodes->maps ); + unicodes->num_maps = 0; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap_unicode_char_index( PS_Unicodes unicodes, + FT_UInt32 char_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_index( unicodes, char_code ); + } + + + FT_CALLBACK_DEF( FT_UInt32 ) + tt_cmap_unicode_char_next( PS_Unicodes unicodes, + FT_UInt32 *pchar_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_next( unicodes, pchar_code ); + } + + + FT_DEFINE_TT_CMAP( + tt_cmap_unicode_class_rec, + + sizeof ( PS_UnicodesRec ), + + (FT_CMap_InitFunc) tt_cmap_unicode_init, /* init */ + (FT_CMap_DoneFunc) tt_cmap_unicode_done, /* done */ + (FT_CMap_CharIndexFunc)tt_cmap_unicode_char_index, /* char_index */ + (FT_CMap_CharNextFunc) tt_cmap_unicode_char_next, /* char_next */ + + (FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */ + (FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */ + (FT_CMap_VariantListFunc) NULL, /* variant_list */ + (FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */ + (FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */ + + ~0U, + (TT_CMap_ValidateFunc)NULL, /* validate */ + (TT_CMap_Info_GetFunc)NULL /* get_cmap_info */ + ) + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + #ifndef FT_CONFIG_OPTION_PIC static const TT_CMap_Class tt_cmap_classes[] = @@ -3801,8 +3907,10 @@ FT_CMap cmap = (FT_CMap)charmap; TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; - - return clazz->get_cmap_info( charmap, cmap_info ); + if ( clazz->get_cmap_info ) + return clazz->get_cmap_info( charmap, cmap_info ); + else + return FT_THROW( Invalid_CharMap_Format ); } diff --git a/thirdparty/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h index 83f12df241..f7de0437b0 100644 --- a/thirdparty/freetype/src/sfnt/ttcmap.h +++ b/thirdparty/freetype/src/sfnt/ttcmap.h @@ -141,6 +141,8 @@ FT_BEGIN_HEADER #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec; + FT_LOCAL( FT_Error ) tt_face_build_cmaps( TT_Face face ); diff --git a/thirdparty/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c index c97e5789ac..53d2436ae5 100644 --- a/thirdparty/freetype/src/sfnt/ttkern.c +++ b/thirdparty/freetype/src/sfnt/ttkern.c @@ -85,7 +85,7 @@ for ( nn = 0; nn < num_tables; nn++ ) { - FT_UInt num_pairs, length, coverage; + FT_UInt num_pairs, length, coverage, format; FT_Byte* p_next; FT_UInt32 mask = (FT_UInt32)1UL << nn; @@ -107,6 +107,12 @@ if ( p_next > p_limit ) /* handle broken table */ p_next = p_limit; + format = coverage >> 8; + + /* we currently only support format 0 kerning tables */ + if ( format != 0 ) + goto NextTable; + /* only use horizontal kerning tables */ if ( ( coverage & 3U ) != 0x0001 || p + 8 > p_next ) diff --git a/thirdparty/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c index 540d5f2546..69929c8d45 100644 --- a/thirdparty/freetype/src/sfnt/ttpost.c +++ b/thirdparty/freetype/src/sfnt/ttpost.c @@ -325,7 +325,6 @@ FT_UNUSED( post_limit ); - /* UNDOCUMENTED! This value appears only in the Apple TT specs. */ if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; @@ -408,7 +407,7 @@ /* now read postscript table */ if ( format == 0x00020000L ) error = load_format_20( face, stream, post_limit ); - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) error = load_format_25( face, stream, post_limit ); else error = FT_THROW( Invalid_File_Format ); @@ -447,7 +446,7 @@ FT_FREE( table->glyph_names ); table->num_names = 0; } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; @@ -543,7 +542,7 @@ *PSname = (FT_String*)table->glyph_names[name_index - 258]; } } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; diff --git a/thirdparty/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c index 0c76a55779..f41847b0af 100644 --- a/thirdparty/freetype/src/sfnt/ttsbit.c +++ b/thirdparty/freetype/src/sfnt/ttsbit.c @@ -448,6 +448,15 @@ metrics->max_advance = FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem ); + /* set the scale values (in 16.16 units) so advances */ + /* from the hmtx and vmtx table are scaled correctly */ + metrics->x_scale = FT_MulDiv( metrics->x_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + metrics->y_scale = FT_MulDiv( metrics->y_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + return error; } @@ -1439,10 +1448,17 @@ return FT_THROW( Invalid_Table ); NoBitmap: + if ( recurse_count ) + { + FT_TRACE4(( "tt_sbit_decoder_load_image:" + " missing subglyph sbit with glyph index %d\n", + glyph_index )); + return FT_THROW( Invalid_Composite ); + } + FT_TRACE4(( "tt_sbit_decoder_load_image:" " no sbit found for glyph index %d\n", glyph_index )); - - return FT_THROW( Invalid_Argument ); + return FT_THROW( Missing_Bitmap ); } diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c index e9a3ce7a7c..df645e66c9 100644 --- a/thirdparty/freetype/src/smooth/ftgrays.c +++ b/thirdparty/freetype/src/smooth/ftgrays.c @@ -141,6 +141,16 @@ #define FT_INT_MAX INT_MAX #define FT_ULONG_MAX ULONG_MAX +#define ADD_LONG( a, b ) \ + (long)( (unsigned long)(a) + (unsigned long)(b) ) +#define SUB_LONG( a, b ) \ + (long)( (unsigned long)(a) - (unsigned long)(b) ) +#define MUL_LONG( a, b ) \ + (long)( (unsigned long)(a) * (unsigned long)(b) ) +#define NEG_LONG( a ) \ + (long)( -(unsigned long)(a) ) + + #define ft_memset memset #define ft_setjmp setjmp @@ -264,6 +274,7 @@ typedef ptrdiff_t FT_PtrDist; #include "ftgrays.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H #include FT_OUTLINE_H #include "ftsmerrs.h" @@ -1135,7 +1146,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P1 to the line P0-P3. */ dx1 = arc[1].x - arc[0].x; dy1 = arc[1].y - arc[0].y; - s = FT_ABS( dy * dx1 - dx * dy1 ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) ); if ( s > s_limit ) goto Split; @@ -1143,7 +1154,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P2 to the line P0-P3. */ dx2 = arc[2].x - arc[0].x; dy2 = arc[2].y - arc[0].y; - s = FT_ABS( dy * dx2 - dx * dy2 ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) ); if ( s > s_limit ) goto Split; diff --git a/thirdparty/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c index 435854e673..963435de15 100644 --- a/thirdparty/freetype/src/smooth/ftsmooth.c +++ b/thirdparty/freetype/src/smooth/ftsmooth.c @@ -31,12 +31,7 @@ static FT_Error ft_smooth_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return 0; } @@ -111,9 +106,6 @@ FT_Pos y_shift = 0; FT_Pos x_left, y_top; FT_Pos width, height, pitch; -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Pos height_org, width_org; -#endif FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); @@ -124,7 +116,6 @@ #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Int lcd_extra = 0; FT_LcdFiveTapFilter lcd_weights = { 0 }; FT_Bool have_custom_weight = FALSE; FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL; @@ -152,13 +143,12 @@ { /* * A per-font filter is set. It always uses the default 5-tap - * in-place FIR filter that needs 2 extra pixels. + * in-place FIR filter. */ ft_memcpy( lcd_weights, slot->face->internal->lcd_weights, FT_LCD_FILTER_FIVE_TAPS ); lcd_filter_func = ft_lcd_filter_fir; - lcd_extra = 2; } else { @@ -172,7 +162,6 @@ slot->library->lcd_weights, FT_LCD_FILTER_FIVE_TAPS ); lcd_filter_func = slot->library->lcd_filter_func; - lcd_extra = slot->library->lcd_extra; } #endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ @@ -201,6 +190,45 @@ /* taking into account the origin shift */ FT_Outline_Get_CBox( outline, &cbox ); +#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + /* add minimal padding for LCD rendering */ + if ( hmul ) + { + cbox.xMax += 21; + cbox.xMin -= 21; + } + + if ( vmul ) + { + cbox.yMax += 21; + cbox.yMin -= 21; + } + +#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + + /* add minimal padding for LCD filter depending on specific weights */ + if ( lcd_filter_func ) + { + if ( hmul ) + { + cbox.xMax += lcd_weights[4] ? 43 + : lcd_weights[3] ? 22 : 0; + cbox.xMin -= lcd_weights[0] ? 43 + : lcd_weights[1] ? 22 : 0; + } + + if ( vmul ) + { + cbox.yMax += lcd_weights[4] ? 43 + : lcd_weights[3] ? 22 : 0; + cbox.yMin -= lcd_weights[0] ? 43 + : lcd_weights[1] ? 22 : 0; + } + } + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); @@ -215,11 +243,6 @@ width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - width_org = width; - height_org = height; -#endif - pitch = width; if ( hmul ) { @@ -230,26 +253,6 @@ if ( vmul ) height *= 3; -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - if ( lcd_filter_func ) - { - if ( hmul ) - { - x_shift += 64 * ( lcd_extra >> 1 ); - x_left -= lcd_extra >> 1; - width += 3 * lcd_extra; - pitch = FT_PAD_CEIL( width, 4 ); - } - - if ( vmul ) - { - y_shift += 64 * ( lcd_extra >> 1 ); - y_top += lcd_extra >> 1; - height += 3 * lcd_extra; - } - } -#endif - /* * XXX: on 16bit system, we return an error for huge bitmap * to prevent an overflow. @@ -353,57 +356,98 @@ #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* render outline into bitmap */ - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - /* expand it horizontally */ - if ( hmul ) + if ( hmul ) /* lcd */ { - FT_Byte* line = bitmap->buffer; - FT_UInt hh; + FT_Byte* line; + FT_Byte* temp; + FT_Int i, j; - for ( hh = height_org; hh > 0; hh--, line += pitch ) - { - FT_UInt xx; - FT_Byte* end = line + width; + /* Render 3 separate monochrome bitmaps, shifting the outline */ + /* by 1/3 pixel. */ + width /= 3; + FT_Outline_Translate( outline, 21, 0 ); - for ( xx = width_org; xx > 0; xx-- ) - { - FT_UInt pixel = line[xx-1]; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, -21, 0 ); + bitmap->buffer += width; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, -21, 0 ); + bitmap->buffer += width; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; - end[-3] = (FT_Byte)pixel; - end[-2] = (FT_Byte)pixel; - end[-1] = (FT_Byte)pixel; - end -= 3; + FT_Outline_Translate( outline, 21, 0 ); + bitmap->buffer -= 2 * width; + + /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ + /* XXX: It is more efficient to render every third byte above. */ + + if ( FT_ALLOC( temp, (FT_ULong)pitch ) ) + goto Exit; + + for ( i = 0; i < height; i++ ) + { + line = bitmap->buffer + i * pitch; + for ( j = 0; j < width; j++ ) + { + temp[3 * j ] = line[j]; + temp[3 * j + 1] = line[j + width]; + temp[3 * j + 2] = line[j + width + width]; } + FT_MEM_COPY( line, temp, pitch ); } - } - /* expand it vertically */ - if ( vmul ) + FT_FREE( temp ); + } + else if ( vmul ) /* lcd_v */ { - FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch; - FT_Byte* write = bitmap->buffer; - FT_UInt hh; + /* Render 3 separate monochrome bitmaps, shifting the outline */ + /* by 1/3 pixel. Triple the pitch to render on each third row. */ + bitmap->pitch *= 3; + bitmap->rows /= 3; + FT_Outline_Translate( outline, 0, 21 ); + bitmap->buffer += 2 * pitch; - for ( hh = height_org; hh > 0; hh-- ) - { - ft_memcpy( write, read, pitch ); - write += pitch; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; - ft_memcpy( write, read, pitch ); - write += pitch; + FT_Outline_Translate( outline, 0, -21 ); + bitmap->buffer -= pitch; - ft_memcpy( write, read, pitch ); - write += pitch; - read += pitch; - } + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 0, -21 ); + bitmap->buffer -= pitch; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 0, 21 ); + + bitmap->pitch /= 3; + bitmap->rows *= 3; + } + else /* grayscale */ + { + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ diff --git a/thirdparty/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c index b7a844a6c7..5e102c6151 100644 --- a/thirdparty/freetype/src/truetype/ttgload.c +++ b/thirdparty/freetype/src/truetype/ttgload.c @@ -87,7 +87,7 @@ /*************************************************************************/ /* */ /* Return the vertical metrics in font units for a given glyph. */ - /* See macro `TT_LOADER_SET_PP' below for explanations. */ + /* See function `tt_loader_set_pp' below for explanations. */ /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, @@ -825,7 +825,7 @@ /* compatibility mode, where no movement on the x axis means no reason */ /* to change bearings or advance widths. */ if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - !loader->exec->backward_compatibility ) ) + loader->exec->backward_compatibility ) ) { #endif loader->pp1 = zone->cur[zone->n_points - 4]; @@ -1686,7 +1686,7 @@ /***********************************************************************/ /* otherwise, load a composite! */ - else if ( loader->n_contours == -1 ) + else if ( loader->n_contours < 0 ) { FT_Memory memory = face->root.memory; @@ -1697,6 +1697,9 @@ FT_ListNode node, node2; + /* normalize the `n_contours' value */ + loader->n_contours = -1; + /* * We store the glyph index directly in the `node->data' pointer, * following the glib solution (cf. macro `GUINT_TO_POINTER') with a @@ -1991,12 +1994,6 @@ } } } - else - { - /* invalid composite count (negative but not -1) */ - error = FT_THROW( Invalid_Outline ); - goto Exit; - } /***********************************************************************/ /***********************************************************************/ @@ -2100,8 +2097,8 @@ } /* set glyph dimensions */ - glyph->metrics.width = bbox.xMax - bbox.xMin; - glyph->metrics.height = bbox.yMax - bbox.yMin; + glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin ); + glyph->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin ); /* Now take care of vertical metrics. In the case where there is */ /* no vertical information within the font (relatively common), */ @@ -2137,7 +2134,8 @@ /* table in the font. Otherwise, we use the */ /* values defined in the horizontal header. */ - height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin, + height = (FT_Short)FT_DivFix( SUB_LONG( bbox.yMax, + bbox.yMin ), y_scale ); if ( face->os2.version != 0xFFFFU ) advance = (FT_Pos)( face->os2.sTypoAscender - @@ -2339,13 +2337,19 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 ) { - subpixel_hinting_lean = TRUE; - grayscale_cleartype = !FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD || - load_flags & - FT_LOAD_TARGET_LCD_V ); - exec->vertical_lcd_lean = FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD_V ); + subpixel_hinting_lean = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + FT_RENDER_MODE_MONO ); + grayscale_cleartype = + FT_BOOL( subpixel_hinting_lean && + !( ( load_flags & + FT_LOAD_TARGET_LCD ) || + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ) ); + exec->vertical_lcd_lean = + FT_BOOL( subpixel_hinting_lean && + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ); } else { @@ -2621,7 +2625,64 @@ IS_DEFAULT_INSTANCE ) { error = load_sbit_image( size, glyph, glyph_index, load_flags ); - if ( !error ) + if ( FT_ERR_EQ( error, Missing_Bitmap ) ) + { + /* the bitmap strike is incomplete and misses the requested glyph; */ + /* if we have a bitmap-only font, return an empty glyph */ + if ( !FT_IS_SCALABLE( glyph->face ) ) + { + TT_Face face = (TT_Face)glyph->face; + FT_Short left_bearing = 0, top_bearing = 0; + FT_UShort advance_width = 0, advance_height = 0; + + + /* to return an empty glyph, however, we need metrics data */ + /* from the `hmtx' (or `vmtx') table; the assumption is that */ + /* empty glyphs are missing intentionally, representing */ + /* whitespace - not having at least horizontal metrics is */ + /* thus considered an error */ + if ( !face->horz_metrics_size ) + return error; + + /* we now construct an empty bitmap glyph */ + TT_Get_HMetrics( face, glyph_index, + &left_bearing, + &advance_width ); + TT_Get_VMetrics( face, glyph_index, + 0, + &top_bearing, + &advance_height ); + + glyph->outline.n_points = 0; + glyph->outline.n_contours = 0; + + glyph->metrics.width = 0; + glyph->metrics.height = 0; + + glyph->metrics.horiBearingX = left_bearing; + glyph->metrics.horiBearingY = 0; + glyph->metrics.horiAdvance = advance_width; + + glyph->metrics.vertBearingX = 0; + glyph->metrics.vertBearingY = top_bearing; + glyph->metrics.vertAdvance = advance_height; + + glyph->format = FT_GLYPH_FORMAT_BITMAP; + glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO; + + glyph->bitmap_left = 0; + glyph->bitmap_top = 0; + + return FT_Err_Ok; + } + } + else if ( error ) + { + /* return error if font is not scalable */ + if ( !FT_IS_SCALABLE( glyph->face ) ) + return error; + } + else { if ( FT_IS_SCALABLE( glyph->face ) ) { diff --git a/thirdparty/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c index 0cedb6bdfa..49aa53a687 100644 --- a/thirdparty/freetype/src/truetype/ttgxvar.c +++ b/thirdparty/freetype/src/truetype/ttgxvar.c @@ -60,8 +60,11 @@ #define FT_Stream_FTell( stream ) \ (FT_ULong)( (stream)->cursor - (stream)->base ) -#define FT_Stream_SeekSet( stream, off ) \ - ( (stream)->cursor = (stream)->base + (off) ) +#define FT_Stream_SeekSet( stream, off ) \ + (stream)->cursor = \ + ( (off) < (FT_ULong)( (stream)->limit - (stream)->base ) ) \ + ? (stream)->base + (off) \ + : (stream)->limit /*************************************************************************/ @@ -392,14 +395,14 @@ /* some macros we need */ - #define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) +#define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) - #define FT_fdot14ToFixed( x ) \ - ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) - #define FT_intToFixed( i ) \ - ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) - #define FT_fixedToInt( x ) \ - ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) +#define FT_fdot14ToFixed( x ) \ + ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) +#define FT_intToFixed( i ) \ + ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) +#define FT_fixedToInt( x ) \ + ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) static FT_Error @@ -1953,6 +1956,7 @@ GX_FVar_Head fvar_head; FT_Bool usePsName; FT_UInt num_instances; + FT_UShort* axis_flags; static const FT_Frame_Field fvar_fields[] = { @@ -2038,14 +2042,16 @@ /* in fvar's table of named instances */ num_instances = face->root.style_flags >> 16; - /* cannot overflow 32-bit arithmetic because of the size limits */ - /* used in the `fvar' table validity check in `sfnt_init_face' */ + /* prepare storage area for MM data; this cannot overflow */ + /* 32-bit arithmetic because of the size limits used in the */ + /* `fvar' table validity check in `sfnt_init_face' */ face->blend->mmvar_len = sizeof ( FT_MM_Var ) + + fvar_head.axisCount * sizeof ( FT_UShort ) + fvar_head.axisCount * sizeof ( FT_Var_Axis ) + num_instances * sizeof ( FT_Var_Named_Style ) + num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) + - 5 * fvar_head.axisCount; + fvar_head.axisCount * 5; if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) goto Exit; @@ -2062,8 +2068,12 @@ /* (or tuples, as called by Apple) */ mmvar->num_namedstyles = num_instances; + + /* alas, no public field in `FT_Var_Axis' for axis flags */ + axis_flags = + (FT_UShort*)&( mmvar[1] ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] ); mmvar->namedstyle = (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] ); @@ -2107,6 +2117,8 @@ a->name[3] = (FT_String)( ( a->tag ) & 0xFF ); a->name[4] = '\0'; + *axis_flags = axis_rec.flags; + if ( a->minimum > a->def || a->def > a->maximum ) { @@ -2118,13 +2130,17 @@ a->maximum = a->def; } - FT_TRACE5(( " \"%s\": minimum=%.5f, default=%.5f, maximum=%.5f\n", + FT_TRACE5(( " \"%s\":" + " minimum=%.5f, default=%.5f, maximum=%.5f," + " flags=0x%04X\n", a->name, a->minimum / 65536.0, a->def / 65536.0, - a->maximum / 65536.0 )); + a->maximum / 65536.0, + *axis_flags )); a++; + axis_flags++; } FT_TRACE5(( "\n" )); @@ -2136,8 +2152,16 @@ goto Exit; if ( fvar_head.instanceCount && !face->blend->avar_loaded ) + { + FT_ULong offset = FT_STREAM_POS(); + + ft_var_load_avar( face ); + if ( FT_STREAM_SEEK( offset ) ) + goto Exit; + } + ns = mmvar->namedstyle; nsc = face->blend->normalized_stylecoords; for ( i = 0; i < fvar_head.instanceCount; i++, ns++ ) @@ -2154,8 +2178,11 @@ for ( j = 0; j < fvar_head.axisCount; j++, c++ ) *c = FT_GET_LONG(); + /* valid psid values are 6, [256;32767], and 0xFFFF */ if ( usePsName ) ns->psid = FT_GET_USHORT(); + else + ns->psid = 0xFFFF; ft_var_to_normalized( face, fvar_head.axisCount, @@ -2171,7 +2198,7 @@ SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_Int found, dummy1, dummy2; - FT_UInt strid = 0xFFFFFFFFUL; + FT_UInt strid = ~0U; /* the default instance is missing in array the */ @@ -2230,13 +2257,15 @@ goto Exit; FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); + axis_flags = + (FT_UShort*)&( mmvar[1] ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] ); mmvar->namedstyle = (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] ); + next_coords = (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] ); - for ( n = 0; n < mmvar->num_namedstyles; n++ ) { mmvar->namedstyle[n].coords = next_coords; @@ -2281,7 +2310,10 @@ GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i, j; - FT_Bool is_default_instance = 1; + + FT_Bool is_default_instance = TRUE; + FT_Bool all_design_coords = FALSE; + FT_Memory memory = face->root.memory; enum @@ -2327,7 +2359,7 @@ } if ( coords[i] != 0 ) - is_default_instance = 0; + is_default_instance = FALSE; } FT_TRACE5(( "\n" )); @@ -2340,6 +2372,9 @@ { if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) goto Exit; + + /* the first time we have to compute all design coordinates */ + all_design_coords = TRUE; } if ( !blend->normalizedcoords ) @@ -2388,7 +2423,7 @@ if ( set_design_coords ) ft_var_to_design( face, - num_coords, + all_design_coords ? blend->num_axis : num_coords, blend->normalizedcoords, blend->coords ); @@ -2529,6 +2564,14 @@ blend = face->blend; + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + nc = num_coords; if ( num_coords > blend->num_axis ) { @@ -2626,7 +2669,7 @@ num_coords * sizeof ( FT_Fixed ) ); a = mmvar->axis + num_coords; - c = coords + num_coords; + c = blend->coords + num_coords; for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) *c = a->def; @@ -2636,7 +2679,7 @@ if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); - ft_var_to_normalized( face, num_coords, coords, normalized ); + ft_var_to_normalized( face, num_coords, blend->coords, normalized ); error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); @@ -2686,6 +2729,14 @@ blend = face->blend; + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + nc = num_coords; if ( num_coords > blend->num_axis ) { diff --git a/thirdparty/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c index af31408cbf..ddcc839bb3 100644 --- a/thirdparty/freetype/src/truetype/ttinterp.c +++ b/thirdparty/freetype/src/truetype/ttinterp.c @@ -65,11 +65,15 @@ TT_INTERPRETER_VERSION_40 ) #endif -#define PROJECT( v1, v2 ) \ - exc->func_project( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) +#define PROJECT( v1, v2 ) \ + exc->func_project( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) -#define DUALPROJ( v1, v2 ) \ - exc->func_dualproj( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) +#define DUALPROJ( v1, v2 ) \ + exc->func_dualproj( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) #define FAST_PROJECT( v ) \ exc->func_project( exc, (v)->x, (v)->y ) @@ -1676,7 +1680,10 @@ if ( SUBPIXEL_HINTING_INFINALITY && ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -1685,12 +1692,18 @@ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1705,7 +1718,10 @@ exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].y = ADD_LONG( zone->cur[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1741,12 +1757,18 @@ v = exc->GS.freeVector.x; if ( v != 0 ) - zone->org[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].x = ADD_LONG( zone->org[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); v = exc->GS.freeVector.y; if ( v != 0 ) - zone->org[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].y = ADD_LONG( zone->org[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); } @@ -1769,18 +1791,18 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode ) - zone->cur[point].x += distance; + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x += distance; + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += distance; + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1799,7 +1821,7 @@ exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y += distance; + zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1823,7 +1845,7 @@ { FT_UNUSED( exc ); - zone->org[point].x += distance; + zone->org[point].x = ADD_LONG( zone->org[point].x, distance ); } @@ -1835,7 +1857,7 @@ { FT_UNUSED( exc ); - zone->org[point].y += distance; + zone->org[point].y = ADD_LONG( zone->org[point].y, distance ); } @@ -1873,13 +1895,13 @@ if ( distance >= 0 ) { - val = distance + compensation; + val = ADD_LONG( distance, compensation ); if ( val < 0 ) val = 0; } else { - val = distance - compensation; + val = SUB_LONG( distance, compensation ); if ( val > 0 ) val = 0; } @@ -1915,13 +1937,14 @@ if ( distance >= 0 ) { - val = FT_PIX_ROUND( distance + compensation ); + val = FT_PIX_ROUND_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_ROUND( compensation - distance ); + val = NEG_LONG( FT_PIX_ROUND_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -1958,13 +1981,16 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ) + 32; + val = ADD_LONG( FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ), + 32 ); if ( val < 0 ) val = 32; } else { - val = -( FT_PIX_FLOOR( compensation - distance ) + 32 ); + val = NEG_LONG( ADD_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, + distance ) ), + 32 ) ); if ( val > 0 ) val = -32; } @@ -2001,13 +2027,13 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ); + val = FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_FLOOR( compensation - distance ); + val = NEG_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, distance ) ) ); if ( val > 0 ) val = 0; } @@ -2044,13 +2070,14 @@ if ( distance >= 0 ) { - val = FT_PIX_CEIL( distance + compensation ); + val = FT_PIX_CEIL_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_CEIL( compensation - distance ); + val = NEG_LONG( FT_PIX_CEIL_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -2087,13 +2114,14 @@ if ( distance >= 0 ) { - val = FT_PAD_ROUND( distance + compensation, 32 ); + val = FT_PAD_ROUND_LONG( ADD_LONG( distance, compensation ), 32 ); if ( val < 0 ) val = 0; } else { - val = -FT_PAD_ROUND( compensation - distance, 32 ); + val = NEG_LONG( FT_PAD_ROUND_LONG( SUB_LONG( compensation, distance ), + 32 ) ); if ( val > 0 ) val = 0; } @@ -2134,7 +2162,8 @@ if ( distance >= 0 ) { - val = ( distance - exc->phase + exc->threshold + compensation ) & + val = ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) & -exc->period; val += exc->phase; if ( val < 0 ) @@ -2142,8 +2171,9 @@ } else { - val = -( ( exc->threshold - exc->phase - distance + compensation ) & - -exc->period ); + val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) & + -exc->period ); val -= exc->phase; if ( val > 0 ) val = -exc->phase; @@ -2183,7 +2213,8 @@ if ( distance >= 0 ) { - val = ( ( distance - exc->phase + exc->threshold + compensation ) / + val = ( ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) / exc->period ) * exc->period; val += exc->phase; if ( val < 0 ) @@ -2191,8 +2222,9 @@ } else { - val = -( ( ( exc->threshold - exc->phase - distance + compensation ) / - exc->period ) * exc->period ); + val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) / + exc->period ) * exc->period ); val -= exc->phase; if ( val > 0 ) val = -exc->phase; @@ -2826,7 +2858,7 @@ static void Ins_ADD( FT_Long* args ) { - args[0] += args[1]; + args[0] = ADD_LONG( args[0], args[1] ); } @@ -2839,7 +2871,7 @@ static void Ins_SUB( FT_Long* args ) { - args[0] -= args[1]; + args[0] = SUB_LONG( args[0], args[1] ); } @@ -2882,7 +2914,8 @@ static void Ins_ABS( FT_Long* args ) { - args[0] = FT_ABS( args[0] ); + if ( args[0] < 0 ) + args[0] = NEG_LONG( args[0] ); } @@ -2895,7 +2928,7 @@ static void Ins_NEG( FT_Long* args ) { - args[0] = -args[0]; + args[0] = NEG_LONG( args[0] ); } @@ -4211,8 +4244,8 @@ p1 = exc->zp1.cur + aIdx2; p2 = exc->zp2.cur + aIdx1; - A = p1->x - p2->x; - B = p1->y - p2->y; + A = SUB_LONG( p1->x, p2->x ); + B = SUB_LONG( p1->y, p2->y ); /* If p1 == p2, SPvTL and SFvTL behave the same as */ /* SPvTCA[X] and SFvTCA[X], respectively. */ @@ -4227,9 +4260,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, Vec ); @@ -4770,7 +4803,7 @@ K = FAST_PROJECT( &exc->zp2.cur[L] ); - exc->func_move( exc, &exc->zp2, L, args[1] - K ); + exc->func_move( exc, &exc->zp2, L, SUB_LONG( args[1], K ) ); /* UNDOCUMENTED! The MS rasterizer does that with */ /* twilight points (confirmed by Greg Hitchcock) */ @@ -4894,12 +4927,12 @@ } { - FT_Vector* v1 = exc->zp1.org + p2; - FT_Vector* v2 = exc->zp2.org + p1; + FT_Vector* v1 = exc->zp1.org + p2; + FT_Vector* v2 = exc->zp2.org + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); /* If v1 == v2, SDPvTL behaves the same as */ /* SVTCA[X], respectively. */ @@ -4915,9 +4948,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.dualVector ); @@ -4927,8 +4960,8 @@ FT_Vector* v2 = exc->zp2.cur + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); if ( A == 0 && B == 0 ) { @@ -4939,9 +4972,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.projVector ); @@ -5392,7 +5425,7 @@ if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) ) #endif - exc->zp2.cur[point].x += dx; + exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; @@ -5406,7 +5439,7 @@ exc->iupx_called && exc->iupy_called ) ) #endif - exc->zp2.cur[point].y += dy; + exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y; @@ -5781,14 +5814,17 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - FT_ABS( distance - args[1] ) >= control_value_cutin ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin ) distance = args[1]; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, args[1] - distance ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( args[1], distance ) ); exc->GS.rp1 = exc->GS.rp0; exc->GS.rp2 = point; @@ -6027,8 +6063,10 @@ FT_Vector vec; - vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale ); - vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale ); + vec.x = FT_MulFix( SUB_LONG( vec1->x, vec2->x ), + exc->metrics.x_scale ); + vec.y = FT_MulFix( SUB_LONG( vec1->y, vec2->y ), + exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } @@ -6081,8 +6119,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6090,7 +6128,7 @@ org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, distance - org_dist ); + exc->func_move( exc, &exc->zp1, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp1 = exc->GS.rp0; @@ -6265,8 +6303,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6290,7 +6328,10 @@ } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, distance - cur_dist ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( distance, cur_dist ) ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) @@ -6314,7 +6355,10 @@ } if ( reverse_move ) - exc->func_move( exc, &exc->zp1, point, -( distance - cur_dist ) ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( cur_dist, distance ) ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -6380,7 +6424,7 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, -distance ); + exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) ); } exc->GS.loop--; @@ -6437,19 +6481,19 @@ /* Cramer's rule */ - dbx = exc->zp0.cur[b1].x - exc->zp0.cur[b0].x; - dby = exc->zp0.cur[b1].y - exc->zp0.cur[b0].y; + dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); + dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); - dax = exc->zp1.cur[a1].x - exc->zp1.cur[a0].x; - day = exc->zp1.cur[a1].y - exc->zp1.cur[a0].y; + dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); + day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); - dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x; - dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y; + dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); + dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); - discriminant = FT_MulDiv( dax, -dby, 0x40 ) + - FT_MulDiv( day, dbx, 0x40 ); - dotproduct = FT_MulDiv( dax, dbx, 0x40 ) + - FT_MulDiv( day, dby, 0x40 ); + discriminant = ADD_LONG( FT_MulDiv( dax, NEG_LONG( dby ), 0x40 ), + FT_MulDiv( day, dbx, 0x40 ) ); + dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), + FT_MulDiv( day, dby, 0x40 ) ); /* The discriminant above is actually a cross product of vectors */ /* da and db. Together with the dot product, they can be used as */ @@ -6459,30 +6503,29 @@ /* discriminant = |da||db|sin(angle) . */ /* We use these equations to reject grazing intersections by */ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ - if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) ) + if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) ) { - val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 ); + val = ADD_LONG( FT_MulDiv( dx, NEG_LONG( dby ), 0x40 ), + FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); /* XXX: Block in backward_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x; - exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y; + exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x ); + exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y ); } else { /* else, take the middle of the middles of A and B */ /* XXX: Block in backward_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x + - exc->zp1.cur[a1].x + - exc->zp0.cur[b0].x + - exc->zp0.cur[b1].x ) / 4; - exc->zp2.cur[point].y = ( exc->zp1.cur[a0].y + - exc->zp1.cur[a1].y + - exc->zp0.cur[b0].y + - exc->zp0.cur[b1].y ) / 4; + exc->zp2.cur[point].x = + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ), + ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4; + exc->zp2.cur[point].y = + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ), + ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4; } exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; @@ -6517,7 +6560,7 @@ distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2; exc->func_move( exc, &exc->zp1, p1, distance ); - exc->func_move( exc, &exc->zp0, p2, -distance ); + exc->func_move( exc, &exc->zp0, p2, NEG_LONG( distance ) ); } @@ -6590,9 +6633,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp1.orus[exc->GS.rp2].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp1.orus[exc->GS.rp2].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, + orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); @@ -6627,9 +6672,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp2.orus[point].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp2.orus[point].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, + orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); @@ -6668,7 +6715,7 @@ exc->func_move( exc, &exc->zp2, (FT_UShort)point, - new_dist - cur_dist ); + SUB_LONG( new_dist, cur_dist ) ); } Fail: @@ -6733,14 +6780,14 @@ FT_F26Dot6 dx; - dx = worker->curs[p].x - worker->orgs[p].x; + dx = SUB_LONG( worker->curs[p].x, worker->orgs[p].x ); if ( dx != 0 ) { for ( i = p1; i < p; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); for ( i = p + 1; i <= p2; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); } } @@ -6785,8 +6832,8 @@ org2 = worker->orgs[ref2].x; cur1 = worker->curs[ref1].x; cur2 = worker->curs[ref2].x; - delta1 = cur1 - org1; - delta2 = cur2 - org2; + delta1 = SUB_LONG( cur1, org1 ); + delta2 = SUB_LONG( cur2, org2 ); if ( cur1 == cur2 || orus1 == orus2 ) { @@ -6798,10 +6845,10 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else x = cur1; @@ -6822,20 +6869,23 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else { if ( !scale_valid ) { scale_valid = 1; - scale = FT_DivFix( cur2 - cur1, orus2 - orus1 ); + scale = FT_DivFix( SUB_LONG( cur2, cur1 ), + SUB_LONG( orus2, orus1 ) ); } - x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale ); + x = ADD_LONG( cur1, + FT_MulFix( SUB_LONG( worker->orus[i].x, orus1 ), + scale ) ); } worker->curs[i].x = x; } @@ -7310,7 +7360,11 @@ K |= 1 << 12; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL ) + /* Toggle the following flags only outside of monochrome mode. */ + /* Otherwise, instructions may behave weirdly and rendering results */ + /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ + /* Bold Italic'. */ + if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { /********************************/ /* HINTING FOR SUBPIXEL */ @@ -7345,7 +7399,7 @@ /* */ /* The only smoothing method FreeType supports unless someone sets */ /* FT_LOAD_TARGET_MONO. */ - if ( ( args[0] & 2048 ) != 0 ) + if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; /********************************/ @@ -7589,11 +7643,21 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Toggle backward compatibility according to what font says, except */ - /* when it's a `tricky' font that heavily relies on the interpreter to */ - /* render glyphs correctly, e.g. DFKai-SB. Backward compatibility */ - /* hacks may break it. */ + /* + * Toggle backward compatibility according to what font wants, except + * when + * + * 1) we have a `tricky' font that heavily relies on the interpreter to + * render glyphs correctly, for example DFKai-SB, or + * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested. + * + * In those cases, backward compatibility needs to be turned off to get + * correct rendering. The rendering is then completely up to the + * font's programming. + * + */ if ( SUBPIXEL_HINTING_MINIMAL && + exc->subpixel_hinting_lean && !FT_IS_TRICKY( &exc->face->root ) ) exc->backward_compatibility = !( exc->GS.instruct_control & 4 ); else @@ -7639,8 +7703,7 @@ FT_MAX( 50, exc->cvtSize / 10 ); else - exc->loopcall_counter_max = FT_MAX( 100, - 10 * exc->cvtSize ); + exc->loopcall_counter_max = 300 + 8 * exc->cvtSize; /* as a protection against an unreasonable number of CVT entries */ /* we assume at most 100 control values per glyph for the counter */ diff --git a/thirdparty/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h index 55e472091c..abbecfcee3 100644 --- a/thirdparty/freetype/src/truetype/ttinterp.h +++ b/thirdparty/freetype/src/truetype/ttinterp.h @@ -253,23 +253,38 @@ FT_BEGIN_HEADER #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* - * Modern TrueType fonts are usually rendered through Microsoft's - * collection of rendering techniques called ClearType (e.g., subpixel - * rendering and subpixel hinting). When ClearType was introduced, most - * fonts were not ready. Microsoft decided to implement a backward - * compatibility mode that employed several simple to complicated - * assumptions and tricks that modified the interpretation of the - * bytecode contained in these fonts to make them look ClearType-y - * somehow. Most (web)fonts that were released since then have come to - * rely on these hacks to render correctly, even some of Microsoft's - * flagship ClearType fonts (Calibri, Cambria, Segoe UI). + * FreeType supports ClearType-like hinting of TrueType fonts through + * the version 40 interpreter. This is achieved through several hacks + * in the base (v35) interpreter, as detailed below. * - * The minimal subpixel hinting code (interpreter version 40) employs a - * small list of font-agnostic hacks to bludgeon non-native-ClearType - * fonts (except tricky ones[1]) into submission. It will not try to - * toggle hacks for specific fonts for performance and complexity - * reasons. The focus is on modern (web)fonts rather than legacy fonts - * that were made for black-and-white rendering. + * ClearType is an umbrella term for several rendering techniques + * employed by Microsoft's various GUI and rendering toolkit + * implementations, most importantly: subpixel rendering for using the + * RGB subpixels of LCDs to approximately triple the perceived + * resolution on the x-axis and subpixel hinting for positioning stems + * on subpixel borders. TrueType programming is explicit, i.e., fonts + * must be programmed to take advantage of ClearType's possibilities. + * + * When ClearType was introduced, it seemed unlikely that all fonts + * would be reprogrammed, so Microsoft decided to implement a backward + * compatibility mode. It employs several simple to complicated + * assumptions and tricks, many of them font-dependent, that modify the + * interpretation of the bytecode contained in these fonts to retrofit + * them into a ClearType-y look. The quality of the results varies. + * Most (web)fonts that were released since then have come to rely on + * these hacks to render correctly, even some of Microsoft's flagship + * fonts (e.g., Calibri, Cambria, Segoe UI). + * + * FreeType's minimal subpixel hinting code (interpreter version 40) + * employs a small list of font-agnostic hacks loosely based on the + * public information available on Microsoft's compatibility mode[2]. + * The focus is on modern (web)fonts rather than legacy fonts that were + * made for monochrome rendering. It will not match ClearType rendering + * exactly. Unlike the `Infinality' code (interpreter version 38) that + * came before, it will not try to toggle hacks for specific fonts for + * performance and complexity reasons. It will fall back to version 35 + * behavior for tricky fonts[1] or when monochrome rendering is + * requested. * * Major hacks * @@ -347,7 +362,8 @@ FT_BEGIN_HEADER * */ - /* Using v40 implies subpixel hinting. Used to detect interpreter */ + /* Using v40 implies subpixel hinting, unless FT_RENDER_MODE_MONO has been + * requested. Used to detect interpreter */ /* version switches. `_lean' to differentiate from the Infinality */ /* `subpixel_hinting', which is managed differently. */ FT_Bool subpixel_hinting_lean; diff --git a/thirdparty/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c index 4db0f289f8..081fa2f1a5 100644 --- a/thirdparty/freetype/src/truetype/ttobjs.c +++ b/thirdparty/freetype/src/truetype/ttobjs.c @@ -576,9 +576,11 @@ /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ /* The 0x00020000 tag is completely undocumented; some fonts from */ /* Arphic made for Chinese Windows 3.1 have this. */ - if ( face->format_tag != 0x00010000L && /* MS fonts */ - face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ - face->format_tag != TTAG_true ) /* Mac fonts */ + if ( face->format_tag != 0x00010000L && /* MS fonts */ + face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ + face->format_tag != TTAG_true && /* Mac fonts */ + face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */ + face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */ { FT_TRACE2(( " not a TTF font\n" )); goto Bad_Format; @@ -1230,7 +1232,9 @@ /* <Input> */ /* size :: A handle to the target size object. */ /* */ - /* only_height :: Only recompute ascender, descender, and height. */ + /* only_height :: Only recompute ascender, descender, and height; */ + /* this flag is used for variation fonts where */ + /* `tt_size_reset' is used as an iterator function. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_size_reset( TT_Size size, @@ -1277,7 +1281,11 @@ size->ttmetrics.valid = TRUE; if ( only_height ) + { + /* we must not recompute the scaling values here since */ + /* `tt_size_reset' was already called (with only_height = 0) */ return FT_Err_Ok; + } if ( face->header.Flags & 8 ) { diff --git a/thirdparty/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c index 70ac15da4a..bcf6b34f67 100644 --- a/thirdparty/freetype/src/truetype/ttpload.c +++ b/thirdparty/freetype/src/truetype/ttpload.c @@ -247,13 +247,13 @@ if ( pos2 > face->glyf_len ) { /* We try to sanitize the last `loca' entry. */ - if ( gindex == face->num_locations - 1 ) + if ( gindex == face->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %ld,\n" + " too large size (%ld bytes) found for glyph index %ld,\n" " " - " truncating at the end of `glyf' table (0x%08lx)\n", - pos2, gindex + 1, face->glyf_len )); + " truncating at the end of `glyf' table to %ld bytes\n", + pos2 - pos1, gindex, face->glyf_len - pos1 )); pos2 = face->glyf_len; } else diff --git a/thirdparty/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c index f5c661f7de..f569d6bec3 100644 --- a/thirdparty/freetype/src/type1/t1load.c +++ b/thirdparty/freetype/src/type1/t1load.c @@ -329,8 +329,8 @@ for ( i = 0; i < mmaster.num_axis; i++ ) { mmvar->axis[i].name = mmaster.axis[i].name; - mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum); - mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum); + mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum ); + mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum ); mmvar->axis[i].def = ( mmvar->axis[i].minimum + mmvar->axis[i].maximum ) / 2; /* Does not apply. But this value is in range */ diff --git a/thirdparty/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c index 97c16b0fdf..5ac1292ae0 100644 --- a/thirdparty/freetype/src/type1/t1objs.c +++ b/thirdparty/freetype/src/type1/t1objs.c @@ -555,12 +555,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; -#endif } } diff --git a/thirdparty/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c index 87e5206b7f..1c4ebd768a 100644 --- a/thirdparty/freetype/src/type42/t42objs.c +++ b/thirdparty/freetype/src/type42/t42objs.c @@ -394,12 +394,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; -#endif } } Exit: diff --git a/thirdparty/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c index 9811fbb05a..4c47962319 100644 --- a/thirdparty/freetype/src/winfonts/winfnt.c +++ b/thirdparty/freetype/src/winfonts/winfnt.c @@ -859,10 +859,6 @@ NULL ); if ( error ) goto Fail; - - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; } /* set up remaining flags */ @@ -1095,7 +1091,7 @@ /* note: since glyphs are stored in columns and not in rows we */ /* can't use ft_glyphslot_set_bitmap */ - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) ) goto Exit; column = (FT_Byte*)bitmap->buffer; 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 */ |