diff --git a/.travis.yml b/.travis.yml index 6dd21dae0b4..13f91b99e83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,48 @@ language: cpp -compiler: - - gcc -before_install: - -before_script: - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo apt-get update -qq - - sudo apt-get install -qq scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev - - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi - -script: scons platform=x11 +sudo: required +dist: trusty + +compiler: + - gcc + - clang + +os: + - linux + - osx + +env: + - GODOT_TARGET=iphone + - GODOT_TARGET=osx + - GODOT_TARGET=x11 + - GODOT_TARGET=android + - GODOT_TARGET=windows + +matrix: + exclude: + - os: linux + env: GODOT_TARGET=iphone + - os: linux + env: GODOT_TARGET=osx + - os: linux + env: GODOT_TARGET=android + - os: osx + env: GODOT_TARGET=x11 + - os: osx + env: GODOT_TARGET=windows + - compiler: gcc + env: GODOT_TARGET=iphone + - compiler: clang + env: GODOT_TARGET=android + - compiler: clang + env: GODOT_TARGET=windows + + +before_script: + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; sudo apt-get install -y scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev libssl-dev libxinerama-dev libevdev-dev libudev-dev; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "windows" ]; then sudo apt-get update -qq; sudo apt-get install -y mingw32 mingw-w64; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then brew update; brew install android-sdk android-ndk; export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk; fi + +script: + - scons platform=$GODOT_TARGET CXX=$CXX diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 438db5d518d..f1edc3d7d7c 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -62,8 +62,8 @@ void _ResourceLoader::_bind_methods() { ObjectTypeDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); ObjectTypeDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); - ObjectTypeDB::bind_method(_MD("get_dependencies"),&_ResourceLoader::get_dependencies); - ObjectTypeDB::bind_method(_MD("has"),&_ResourceLoader::has); + ObjectTypeDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); + ObjectTypeDB::bind_method(_MD("has","path"),&_ResourceLoader::has); } _ResourceLoader::_ResourceLoader() { @@ -96,7 +96,7 @@ _ResourceSaver *_ResourceSaver::singleton=NULL; void _ResourceSaver::_bind_methods() { - ObjectTypeDB::bind_method(_MD("save","path","resource:Resource"),&_ResourceSaver::save, DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("save","path","resource:Resource","flags"),&_ResourceSaver::save,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_recognized_extensions","type"),&_ResourceSaver::get_recognized_extensions); BIND_CONSTANT(FLAG_RELATIVE_PATHS); @@ -812,7 +812,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); ObjectTypeDB::bind_method(_MD("get_system_time_msec"), &_OS::get_system_time_msec); - ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon); + ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon); ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec); ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec); @@ -851,9 +851,9 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); - ObjectTypeDB::bind_method(_MD("print_resources_by_type"),&_OS::print_resources_by_type); + ObjectTypeDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); - ObjectTypeDB::bind_method(_MD("native_video_play"),&_OS::native_video_play); + ObjectTypeDB::bind_method(_MD("native_video_play","path","volume","audio_track","subtitle_track"),&_OS::native_video_play); ObjectTypeDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing); ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 45fd4b50800..3f668dfade8 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -410,15 +410,15 @@ bool PHashTranslation::_set(const StringName& p_name, const Variant& p_value) { String name = p_name.operator String(); if (name=="hash_table") { hash_table=p_value; - print_line("translation: loaded hash table of size: "+itos(hash_table.size())); + //print_line("translation: loaded hash table of size: "+itos(hash_table.size())); } else if (name=="bucket_table") { bucket_table=p_value; - print_line("translation: loaded bucket table of size: "+itos(bucket_table.size())); + //print_line("translation: loaded bucket table of size: "+itos(bucket_table.size())); } else if (name=="strings") { strings=p_value; - print_line("translation: loaded string table of size: "+itos(strings.size())); + //print_line("translation: loaded string table of size: "+itos(strings.size())); } else if (name=="load_from") { - print_line("generating"); + //print_line("generating"); generate(p_value); } else return false; diff --git a/core/globals.cpp b/core/globals.cpp index b48f34d2dfd..a3f8b119462 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -137,7 +137,7 @@ bool Globals::_set(const StringName& p_name, const Variant& p_value) { props[p_name].order=last_order++; } } else { - props[p_name]=VariantContainer(p_value,last_order++ + registering_order?0:NO_ORDER_BASE); + props[p_name]=VariantContainer(p_value,last_order++ + (registering_order?0:NO_ORDER_BASE)); } } @@ -1391,11 +1391,11 @@ void Globals::_bind_methods() { ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); ObjectTypeDB::bind_method(_MD("save"),&Globals::save); - ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton); - ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object); - ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack); + ObjectTypeDB::bind_method(_MD("has_singleton","name"),&Globals::has_singleton); + ObjectTypeDB::bind_method(_MD("get_singleton","name"),&Globals::get_singleton_object); + ObjectTypeDB::bind_method(_MD("load_resource_pack","pack"),&Globals::_load_resource_pack); - ObjectTypeDB::bind_method(_MD("save_custom"),&Globals::_save_custom_bnd); + ObjectTypeDB::bind_method(_MD("save_custom","file"),&Globals::_save_custom_bnd); } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 7f74b616305..788fe7713c2 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -205,7 +205,7 @@ void ConfigFile::_bind_methods(){ ObjectTypeDB::bind_method(_MD("has_section_key","section","key"),&ConfigFile::has_section_key); ObjectTypeDB::bind_method(_MD("get_sections"),&ConfigFile::_get_sections); - ObjectTypeDB::bind_method(_MD("get_section_keys"),&ConfigFile::_get_section_keys); + ObjectTypeDB::bind_method(_MD("get_section_keys","section"),&ConfigFile::_get_section_keys); ObjectTypeDB::bind_method(_MD("load:Error","path"),&ConfigFile::load); ObjectTypeDB::bind_method(_MD("save:Error","path"),&ConfigFile::save); diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 1ff458f325f..4fb175e6396 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -385,15 +385,15 @@ void XMLParser::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_node_data"),&XMLParser::get_node_data); ObjectTypeDB::bind_method(_MD("get_node_offset"),&XMLParser::get_node_offset); ObjectTypeDB::bind_method(_MD("get_attribute_count"),&XMLParser::get_attribute_count); - ObjectTypeDB::bind_method(_MD("get_attribute_name"),&XMLParser::get_attribute_name); - ObjectTypeDB::bind_method(_MD("get_attribute_value"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("has_attribute"),&XMLParser::has_attribute); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value_safe"), &XMLParser::get_attribute_value_safe); + ObjectTypeDB::bind_method(_MD("get_attribute_name","idx"),&XMLParser::get_attribute_name); + ObjectTypeDB::bind_method(_MD("get_attribute_value","idx"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); + ObjectTypeDB::bind_method(_MD("has_attribute","name"),&XMLParser::has_attribute); + ObjectTypeDB::bind_method(_MD("get_named_attribute_value","name"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); + ObjectTypeDB::bind_method(_MD("get_named_attribute_value_safe","name"), &XMLParser::get_attribute_value_safe); ObjectTypeDB::bind_method(_MD("is_empty"),&XMLParser::is_empty); ObjectTypeDB::bind_method(_MD("get_current_line"),&XMLParser::get_current_line); ObjectTypeDB::bind_method(_MD("skip_section"),&XMLParser::skip_section); - ObjectTypeDB::bind_method(_MD("seek"),&XMLParser::seek); + ObjectTypeDB::bind_method(_MD("seek","pos"),&XMLParser::seek); ObjectTypeDB::bind_method(_MD("open","file"),&XMLParser::open); ObjectTypeDB::bind_method(_MD("open_buffer","buffer"),&XMLParser::open_buffer); diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index ce03f089e5f..e76f044df3a 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -187,7 +187,6 @@ Vector2 Vector2::snapped(const Vector2& p_by) const { Vector2 Vector2::clamped(real_t p_len) const { - return *this; real_t l = length(); Vector2 v = *this; if (l>0 && p_len* r_options,String& r_call_hint) { return ERR_UNAVAILABLE; } virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const=0; + virtual void add_global_constant(const StringName& p_variable,const Variant& p_value)=0; /* DEBUGGER FUNCTIONS */ diff --git a/core/translation.cpp b/core/translation.cpp index 8247cd1201a..de55224d5cf 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -626,7 +626,7 @@ bool TranslationServer::_load_translations(const String& p_from) { for(int i=0;i tr = ResourceLoader::load(r[i]); if (tr.is_valid()) add_translation(tr); @@ -670,10 +670,10 @@ void TranslationServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_locale","locale"),&TranslationServer::set_locale); ObjectTypeDB::bind_method(_MD("get_locale"),&TranslationServer::get_locale); - ObjectTypeDB::bind_method(_MD("translate"),&TranslationServer::translate); + ObjectTypeDB::bind_method(_MD("translate","message"),&TranslationServer::translate); - ObjectTypeDB::bind_method(_MD("add_translation"),&TranslationServer::add_translation); - ObjectTypeDB::bind_method(_MD("remove_translation"),&TranslationServer::remove_translation); + ObjectTypeDB::bind_method(_MD("add_translation","translation:Translation"),&TranslationServer::add_translation); + ObjectTypeDB::bind_method(_MD("remove_translation","translation:Translation"),&TranslationServer::remove_translation); ObjectTypeDB::bind_method(_MD("clear"),&TranslationServer::clear); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 39b3791e84c..1b95899729c 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -525,13 +525,13 @@ Converts the value of a variable to a String. - + - Converts the value of a String to a variable. + Converts the value of a String to a Variant. @@ -573,7 +573,7 @@ - + Hashes the variable passed and returns an integer. @@ -1849,6 +1849,8 @@ + + @@ -2412,7 +2414,7 @@ - Container and player of [Animaton] resources. + Container and player of [Animation] resources. An animation player is used for general purpose playback of [Animation] resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in diferent channels. @@ -3257,6 +3259,12 @@ + Set the space override mode. This mode controls how an area affects gravity and damp. + AREA_SPACE_OVERRIDE_DISABLED: This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + AREA_SPACE_OVERRIDE_COMBINE: This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + AREA_SPACE_OVERRIDE_COMBINE_REPLACE: This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + AREA_SPACE_OVERRIDE_REPLACE: This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + AREA_SPACE_OVERRIDE_REPLACE_COMBINE: This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. @@ -3481,133 +3489,162 @@ - General purpose area detection and influence for 2D Phisics. + General purpose area detection and influence for 2D physics. - General purpose area detection for 2D Phisics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). An Area2D can be set as a children to a RigidBody2D to generate a custom gravity field. For this, use SPACE_OVERRIDE_COMBINE and point gravity at the center of mass. + General purpose area detection for 2D physics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). For this, use any space override different from AREA_SPACE_OVERRIDE_DISABLE and point gravity at the center of mass. + Set the space override mode. This mode controls how an area affects gravity and damp. + AREA_SPACE_OVERRIDE_DISABLED: This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + AREA_SPACE_OVERRIDE_COMBINE: This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + AREA_SPACE_OVERRIDE_COMBINE_REPLACE: This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + AREA_SPACE_OVERRIDE_REPLACE: This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + AREA_SPACE_OVERRIDE_REPLACE_COMBINE: This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. + Return the space override mode. - When overriding space parameters, areas can have a center of gravity as a point. + When overriding space parameters, this method sets whether this area has a center of gravity. To set/get the location of the center of gravity, use [method set_gravity_vector]/[method get_gravity_vector]. - Return if gravity is a point. When overriding space parameters, areas can have a center of gravity as a point. + Return whether gravity is a point. A point gravity will attract objects towards it, as opposed to a gravity vector, which moves them in a given direction. + Set the falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance. + Return the falloff factor for point gravity. - Set gravity vector. If gravity is a point, this will be the attraction center. + Set the gravity vector. This vector does not have to be normalized. + If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center. + Return the gravity vector. If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center. + Set the gravity intensity. This is useful to alter the force of gravity without altering its direction. + This value multiplies the gravity vector, whether it is the given vector ([method set_gravity_vector]), or a calculated one (when using a center of gravity). + Return the gravity intensity. + Set the rate at which objects stop moving in this area, if there are not any other forces moving it. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops. + In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second. + Return the linear damp rate. + Set the rate at which objects stop spinning in this area, if there are not any other forces making it spin. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops. + In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second. + Return the angular damp rate. + Set the order in which the area is processed. Greater values mean the area gets processed first. This is useful for areas which have an space override different from AREA_SPACE_OVERRIDE_DISABLED or AREA_SPACE_OVERRIDE_COMBINE, as they replace values, and are thus order-dependent. + Areas with the same priority value get evaluated in an unpredictable order, and should be differentiated if evaluation order is to be important. + Return the processing order of this area. + Set the physics layers this area can scan for collisions. + Return the physics layers this area can scan for collisions. + Set the physics layers this area is in. + Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask]. + A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. + Return the physics layer this area is in. @@ -3616,6 +3653,7 @@ + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. @@ -3624,6 +3662,7 @@ + Return an individual bit on the collision mask. @@ -3632,6 +3671,7 @@ + Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier. @@ -3640,42 +3680,49 @@ + Return an individual bit on the layer mask. + Set whether this area can detect bodies/areas entering/exiting it. + Return whether this area detects bodies/areas entering/exiting it. + Set whether this area can be detected by other, monitoring, areas. Only areas need to be marked as monitorable. Bodies are always so. + Set whether this area can be detected by other, monitoring, areas. + Return a list of the bodies ([PhysicsBody2D]) that are totally or partially inside this area. + Return a list of the areas that are totally or partially inside this area. @@ -3684,6 +3731,7 @@ + Return whether the body passed is totally or partially inside this area. @@ -3692,6 +3740,7 @@ + Return whether the area passed is totally or partially inside this area. @@ -3700,6 +3749,7 @@ + This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area. @@ -3712,12 +3762,14 @@ + This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that repored the entering. + This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area. @@ -3730,12 +3782,14 @@ + This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. + This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area. @@ -3748,12 +3802,14 @@ + This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit. + This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area. @@ -3766,6 +3822,7 @@ + This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -3843,6 +3900,14 @@ Get whether this is a shared array instance. + + + + + + + + @@ -3850,6 +3915,12 @@ Append an element at the end of the array. + + + + + + @@ -4033,8 +4104,6 @@ - - Return the description of an audio sample. Mainly used for organization. @@ -4078,7 +4147,7 @@ - + Set the sample data for a given sample as an array of bytes. The length must be equal to the sample lenght expected in bytes or an error will be produced. @@ -5891,7 +5960,7 @@ - + @@ -5914,6 +5983,18 @@ + + + + + + + + + + + + Force the camera to update scroll immediately. @@ -6006,6 +6087,12 @@ Hide the CanvasItem currently visible. + + + + + + Queue the CanvasItem for update. NOTIFICATION_DRAW will be called on idle time to request redraw. @@ -6131,6 +6218,8 @@ + + Draw a texture at a given position. @@ -6969,7 +7058,7 @@ Base node for 2D collisionables. - CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionBody2D] and [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. + CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. @@ -6980,6 +7069,7 @@ + This method can be used to override normal input processing. The first parameter is the viewport where the event took place. The second holds the input event received, and the third the shape of this object where it happened. @@ -6995,7 +7085,7 @@ - Return the amount of shapes in the collision body. + Return the amount of shapes in the collision body. Because a [CollisionPolygon2D] can generate more than one [Shape2D], the amount returned does not have to match the sum of [CollisionShape2D] and [CollisionPolygon2D]. @@ -7022,6 +7112,7 @@ + Set whether a shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7048,6 +7139,7 @@ + Return whether a shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7066,25 +7158,28 @@ - Return the RID of the object. + Return the RID of this object. + Set whether this object is pickable. A pickable object can detect the mouse pointer enter/leave it and, if the mouse is inside it, report input events. + Return whether this object is pickable. + This event fires only once when the mouse pointer enters any shape of this object. @@ -7095,10 +7190,12 @@ + This signal triggers when an input event fires over a shape. The first parameter is the viewport where the event took place. The second holds the input event received, and the third the shape of this object where it happened. + This event fires only once when the mouse pointer exits all shapes of this object. @@ -7112,7 +7209,7 @@ - + @@ -7187,7 +7284,7 @@ - + Set whether the polygon is to be a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1). @@ -7201,7 +7298,7 @@ - + Set whether this polygon is a trigger. A trigger polygon detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7241,7 +7338,7 @@ - + @@ -7671,6 +7768,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7841,7 +7998,7 @@ - + @@ -8087,6 +8244,18 @@ Move the Control to a new position, relative to the top-left corner of the [i]window[/i] Control, and without changing current anchor mode. (see [method set_margin]). + + + + + + + + + + + + @@ -8123,6 +8292,18 @@ Returns the size of the Control, computed from all margins, however the size returned will [b]never be smaller than the minimum size reported by [method get_minimum_size][/b]. This means that even if end position of the Control rectangle is smaller than the begin position, the Control will still display and interact correctly. (see description, [method get_minimum_size], [method set_margin], [method set_anchor]). + + + + + + + + + + + + @@ -9539,7 +9720,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -10132,6 +10313,12 @@ This approximation makes straight segments between each point, then subdivides t + + + + + + @@ -10152,24 +10339,18 @@ This approximation makes straight segments between each point, then subdivides t - + - + - - - - - - - + @@ -10556,7 +10737,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -10618,6 +10799,8 @@ This approximation makes straight segments between each point, then subdivides t + + @@ -10856,9 +11039,9 @@ This approximation makes straight segments between each point, then subdivides t - + - + Return a kerning pair as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character. @@ -10969,6 +11152,18 @@ This approximation makes straight segments between each point, then subdivides t Draw character "char" into a canvas item using the font at a given "pos" position, with "modulate" color, and optionally kerning if "next" is apassed. clipping the width. "pos" specifies te baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character. + + + + + + + + + + + + @@ -11026,6 +11221,8 @@ This approximation makes straight segments between each point, then subdivides t + + @@ -11632,7 +11829,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11640,7 +11837,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11648,7 +11845,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11656,7 +11853,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -12172,7 +12369,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -13306,6 +13503,10 @@ returns:= "username=user&password=pass" + + + + @@ -13489,13 +13690,13 @@ returns:= "username=user&password=pass" - + - + @@ -14975,6 +15176,18 @@ returns:= "username=user&password=pass" + + + + + + + + + + + + @@ -14991,7 +15204,7 @@ returns:= "username=user&password=pass" - Set the path to the A node for the joint. Must be of type PhysicsBody2D. + Set the path to the A node for the joint. Must be of type [PhysicsBody2D]. @@ -15005,7 +15218,7 @@ returns:= "username=user&password=pass" - Set the path to the B node for the joint. Must be of type PhysicsBody2D. + Set the path to the B node for the joint. Must be of type [PhysicsBody2D]. @@ -15027,6 +15240,18 @@ returns:= "username=user&password=pass" + + + + + + + + + + + + @@ -15087,6 +15312,8 @@ returns:= "username=user&password=pass" + + @@ -15162,8 +15389,12 @@ returns:= "username=user&password=pass" + Kinematic body 2D node. + Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses: + Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc). + Kinematic Characters: KinematicBody2D also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. @@ -15172,6 +15403,7 @@ returns:= "username=user&password=pass" + Move the body in the given direction, stopping if there is an obstacle. @@ -15180,6 +15412,7 @@ returns:= "username=user&password=pass" + Move the body to the given position. This is not a teleport, and the body will stop if there is an obstacle. @@ -15188,66 +15421,82 @@ returns:= "username=user&password=pass" + Return true if there would be a collision if the body moved in the given direction. + Return the last movement done by the body. + Undo the last movement done by the body. + Return whether the body is colliding with another. + Return the point in space where the body is touching another. If there is no collision, this method will return (0,0), so collisions must be checked first with [method is_colliding]. + Return the normal of the surface the body collided with. This is useful to implement sliding along a surface. + Return the velocity of the body that collided with this one. + + + Return the body that collided with this one. + Return the shape index from the body that collided with this one. If there is no collision, this method will return 0, so collisions must be checked first with [method is_colliding]. + + + Return the metadata of the shape that collided with this body. If there is no collision, it will return 0, so collisions must be checked first with [method is_colliding]. Aditionally, this metadata can not be set with [method Object.set_meta], it must be set with [method Physics2DServer.body_set_shape_metadata]. + Set the collision margin for this object. A collision margin is an amount (in pixels) that all shapes will grow when computing collisions, to account for numerical imprecision. + Return the collision margin for this object. @@ -15552,7 +15801,7 @@ returns:= "username=user&password=pass" - + @@ -15568,7 +15817,7 @@ returns:= "username=user&password=pass" - + @@ -15905,6 +16154,8 @@ returns:= "username=user&password=pass" + + @@ -16269,6 +16520,8 @@ returns:= "username=user&password=pass" + + @@ -16857,9 +17110,9 @@ returns:= "username=user&password=pass" - + - + Create a new surface ([method get_surface_count] that will become surf_idx for this. @@ -17532,7 +17785,7 @@ returns:= "username=user&password=pass" - + Set the amount of instnces that is going to be drawn. Changing this number will erase all the existing instance transform and color data. @@ -17546,9 +17799,9 @@ returns:= "username=user&password=pass" - + - + Set the transform for a specific instance. @@ -17557,16 +17810,16 @@ returns:= "username=user&password=pass" - + Return the transform of a specific instance. - + - + Set the color of a specific instance. @@ -17575,14 +17828,14 @@ returns:= "username=user&password=pass" - + Get the color of a specific instance. - + Set the visibility AABB. If not provided, MultiMesh will not be visible. @@ -18283,8 +18536,11 @@ returns:= "username=user&password=pass" + + Add a child [Node]. Nodes can have as many children as they want, but every child must have a unique name. Children nodes are automatically deleted when the parent node is deleted, so deleting a whole scene is performed by deleting its topmost node. + The optional boolean argument enforces creating child node with human-readable names, based on the name of node being instanced instead of its type only. @@ -18426,7 +18682,7 @@ returns:= "username=user&password=pass" - + Add a node to a group. Groups are helpers to name and organize group of nodes, like for example: "Enemies", "Collectables", etc. A [Node] can be in any number of groups. Nodes can be assigned a group at any time, but will not be added to it until they are inside the scene tree (see [method is_inside_scene]). @@ -18877,7 +19133,7 @@ returns:= "username=user&password=pass" - + @@ -18885,7 +19141,7 @@ returns:= "username=user&password=pass" - + @@ -19354,7 +19610,7 @@ returns:= "username=user&password=pass" - + @@ -19519,7 +19775,7 @@ returns:= "username=user&password=pass" - + @@ -19527,13 +19783,13 @@ returns:= "username=user&password=pass" - + - + - + - + @@ -19760,7 +20016,7 @@ returns:= "username=user&password=pass" - + Notify the object of something. @@ -19898,6 +20154,8 @@ returns:= "username=user&password=pass" + + @@ -19908,7 +20166,7 @@ returns:= "username=user&password=pass" - + @@ -20236,7 +20494,7 @@ returns:= "username=user&password=pass" - + Select an item by index and make it the current item. @@ -20335,7 +20593,7 @@ returns:= "username=user&password=pass" - + @@ -20451,7 +20709,7 @@ returns:= "username=user&password=pass" - + @@ -20672,7 +20930,7 @@ returns:= "username=user&password=pass" - + @@ -20935,7 +21193,7 @@ returns:= "username=user&password=pass" - + Return the randomness for a specific variable of the particle system. Randomness produces small changes from the default each time a particle is emitted. @@ -20992,7 +21250,7 @@ returns:= "username=user&password=pass" - + @@ -21182,6 +21440,8 @@ returns:= "username=user&password=pass" + + @@ -21206,6 +21466,8 @@ returns:= "username=user&password=pass" + + @@ -22084,6 +22346,8 @@ This method controls whether the position between two cached points is interpola + + @@ -22498,11 +22762,11 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -22812,9 +23076,9 @@ This method controls whether the position between two cached points is interpola - + - + @@ -22822,15 +23086,15 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -22838,7 +23102,7 @@ This method controls whether the position between two cached points is interpola - + @@ -22866,7 +23130,7 @@ This method controls whether the position between two cached points is interpola - + @@ -22990,7 +23254,7 @@ This method controls whether the position between two cached points is interpola - + @@ -23029,11 +23293,20 @@ This method controls whether the position between two cached points is interpola - - + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. - + + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + + + This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + + + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + + + This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. @@ -23321,7 +23594,7 @@ This method controls whether the position between two cached points is interpola - Base class for differnt types of Physics bodies. + Base class for different types of Physics bodies. PhysicsBody is an abstract base class for implementing a physics body. All PhysicsBody types inherit from it. @@ -23357,32 +23630,40 @@ This method controls whether the position between two cached points is interpola + Base class for all objects affected by physics. + PhysicsBody2D is an abstract base class for implementing a physics body. All [i]x[/i]Body2D types inherit from it. + Set the physics layers this area is in. + Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask]. + A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. + Return the physics layer this area is in. + Set the physics layers this area can scan for collisions. + Return the physics layers this area can scan for collisions. @@ -23391,6 +23672,7 @@ This method controls whether the position between two cached points is interpola + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. @@ -23399,6 +23681,7 @@ This method controls whether the position between two cached points is interpola + Return an individual bit on the collision mask. @@ -23407,6 +23690,7 @@ This method controls whether the position between two cached points is interpola + Set/clear individual bits on the layer mask. This makes getting a body in/out of only one layer easier. @@ -23415,42 +23699,49 @@ This method controls whether the position between two cached points is interpola + Return an individual bit on the collision mask. + Set a direction in which bodies can go through this one. If this value is different from (0,0), any movement within 90 degrees of this vector is considered a valid movement. Set this direction to (0,0) to disable one-way collisions. + Return the direction used for one-way collision detection. + Set how far a body can go through this one, when it allows one-way collisions (see [method set_one_way_collision_detection]). + Return how far a body can go through this one, when it allows one-way collisions. + Adds a body to the collision exception list. This list contains bodies that this body will not collide with. + Removes a body from the collision exception list. @@ -23988,11 +24279,11 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -24052,8 +24343,6 @@ This method controls whether the position between two cached points is interpola - - @@ -24598,7 +24887,7 @@ This method controls whether the position between two cached points is interpola - + @@ -24765,11 +25054,20 @@ This method controls whether the position between two cached points is interpola - - + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. - + + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + + + This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + + + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + + + This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. @@ -25580,7 +25878,7 @@ This method controls whether the position between two cached points is interpola - + Set the checkstate status of the item at index "idx". @@ -26268,12 +26566,6 @@ This method controls whether the position between two cached points is interpola Return value mapped to 0 to 1 (unit) range. - - - - - - @@ -26321,11 +26613,17 @@ This method controls whether the position between two cached points is interpola - + + + + + + + @@ -26974,7 +27272,7 @@ This method controls whether the position between two cached points is interpola - Compiles and assign the regular expression pattern to use. The limit on the number of capturing groups can be specified or made unlimited if negative. + Compiles and assign the regular expression pattern to use. The limit on the number of capturing groups can be specified or made unlimited if negative. @@ -27125,7 +27423,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27314,7 +27612,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27322,7 +27620,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27408,7 +27706,7 @@ This method controls whether the position between two cached points is interpola - + Save a resource to disk, to a given path. @@ -27503,6 +27801,26 @@ This method controls whether the position between two cached points is interpola + + + + + + + + + + + + + + + + + + + + @@ -27554,7 +27872,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27667,7 +27985,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27687,10 +28005,14 @@ This method controls whether the position between two cached points is interpola - + + + + + @@ -28004,7 +28326,7 @@ This method controls whether the position between two cached points is interpola Rigid body 2D node. - Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid Body to Character or even Static. + Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid body, Kinematic, Character or Static. Character mode forbids the node from being rotated. This node can have a custom force integrator function, for writing complex physics motion behavior per node. As a warning, don't change this node position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior. @@ -28027,7 +28349,7 @@ This method controls whether the position between two cached points is interpola - Return the current body mode, see [set_mode]. + Return the current body mode, see [method set_mode]. @@ -28048,14 +28370,14 @@ This method controls whether the position between two cached points is interpola - Set the body mass given standard earth-weight (gravity 9.8). Not really useful for 2D since most measures for this node are in pixels. + Set the body weight given standard earth-weight (gravity 9.8). Not really useful for 2D since most measures for this node are in pixels. - Return the body mass given standard earth-weight (gravity 9.8). + Return the body weight given standard earth-weight (gravity 9.8). @@ -28076,7 +28398,7 @@ This method controls whether the position between two cached points is interpola - Set the body bounciness, from 0 (no bounce) to 1 (bounce). + Set the body bounciness, from 0 (no bounce) to 1 (full bounce). @@ -28090,36 +28412,42 @@ This method controls whether the position between two cached points is interpola + Set The gravity factor. This factor multiplies gravity intensity just for this body. + Return the gravity factor. + Set the linear damp for this body. If this value is different from -1, any linear damp derived from the world or areas will be overriden. + Return the linear damp for this body. + Set the angular damp for this body. If this value is different from -1, any angular damp derived from the world or areas will be overriden. + Return the angular damp for this body. @@ -28133,7 +28461,7 @@ This method controls whether the position between two cached points is interpola - Return the body linear velocity. This changes by physics granularity. See [set_linear_velocity]. + Return the body linear velocity. This changes by physics granularity. See [method set_linear_velocity]. @@ -28147,7 +28475,7 @@ This method controls whether the position between two cached points is interpola - Return the body angular velocity. This changes by physics granularity. See [set_angular_velocity]. + Return the body angular velocity. This changes by physics granularity. See [method set_angular_velocity]. @@ -28161,14 +28489,14 @@ This method controls whether the position between two cached points is interpola - Return the maximum contacts that can be reported. See [set_max_contacts_reported]. + Return the maximum contacts that can be reported. See [method set_max_contacts_reported]. - Set to true if the body shall not do any internal force integration at all (like gravity or air friction). Only the [_integrate_forces] will be able to integrate them if overrided. + Set to true if the body shall not do any internal force integration at all (like gravity or air friction). Only the [method _integrate_forces] will be able to integrate them if overrided. @@ -28182,7 +28510,7 @@ This method controls whether the position between two cached points is interpola - Enable contact monitoring. (the signals to notify when a body entered/exited collision). + Enable contact monitoring. This allows the body to emit signals when it collides with another. @@ -28196,19 +28524,22 @@ This method controls whether the position between two cached points is interpola + Set the continuous collision detection mode from the enum CCD_MODE_*. + Coninuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. The first is more precise, and misses less impacts by small, fast-moving objects. The second is faster to compute, but can miss small, fat-moving objects. + Return whether this body is using continuous collision detection. - 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). + 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. @@ -28217,31 +28548,35 @@ This method controls whether the position between two cached points is interpola - Apply a positioned impulse (which will be affected by the body mass and shape). + Apply a positioned impulse (which will be affected by the body mass and shape). This is the equivalent of hitting a billiard ball with a cue: a force that is applied once, and only once. + Set the applied force vector. This is the equivalent of pushing a box over the ground: the force applied is applied constantly. + Return the applied force vector. + Set whether a body is isleeping or not. Sleeping bodies are not affected by forces until a collision or an [method apply_impulse]/[method set_applied_force] wakes them up. Until then, they behave like a static body. + Return whether the body is sleeping. @@ -28249,13 +28584,14 @@ This method controls whether the position between two cached points is interpola Set the body ability to fall asleep when not moving. This saves an enormous amount of processor time when there are plenty of rigid bodies (non static) in a scene. + Sleeping bodies are not affected by forces until a collision or an [method apply_impulse]/[method set_applied_force] wakes them up. Until then, they behave like a static body. - Return true if the body has the ability to fall asleep when not moving. See [set_can_sleep]. + Return true if the body has the ability to fall asleep when not moving. See [method set_can_sleep]. @@ -28268,12 +28604,14 @@ This method controls whether the position between two cached points is interpola + Return whether the body would collide, if it tried to move in the given vector. This method allows two extra parameters: A margin, which increases slightly the size of the shapes involved in the collision detection, and an object of type [Physics2DTestMotionResult], which will store additional information about the collision (should there be one). + Return a list of the bodies colliding with this one. @@ -28282,7 +28620,7 @@ This method controls whether the position between two cached points is interpola - Emitted when a new body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + Emitted when a body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. @@ -28295,7 +28633,8 @@ This method controls whether the position between two cached points is interpola - Emitted when a new body sub-shape enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + Emitted when a body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work. + This signal not only receives the body that collided with this one, but also its [RID] (body_id), the shape index from the colliding body (body_shape), and the shape index from this body (local_shape) the other body collided with. @@ -28316,26 +28655,31 @@ This method controls whether the position between two cached points is interpola Emitted when a body shape exits contact with this one. Contact monitor and contacts reported must be enabled for this to work. + This signal not only receives the body that stopped colliding with this one, but also its [RID] (body_id), the shape index from the colliding body (body_shape), and the shape index from this body (local_shape) the other body stopped colliding with. - Static mode (does not move, can't be moved). + Static mode. The body behaves like a [StaticBody2D], and can only move by user code. + Kinematic body. The body behaves like a [KinematicBody2D], and can only move by user code. - Rigid body, can move and rotate. + Rigid body. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. - Character body, can move but not rotate. + Character body. This behaves like a rigid body, but can not rotate. + Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. + Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. + Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise. @@ -29276,7 +29620,7 @@ This method controls whether the position between two cached points is interpola - + @@ -29881,13 +30225,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -29901,13 +30245,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -29921,13 +30265,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -29941,13 +30285,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -29961,13 +30305,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -29981,13 +30325,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30414,6 +30758,8 @@ This method controls whether the position between two cached points is interpola + + @@ -30676,12 +31022,14 @@ This method controls whether the position between two cached points is interpola - + + + @@ -30757,6 +31105,8 @@ This method controls whether the position between two cached points is interpola + + @@ -30769,6 +31119,8 @@ This method controls whether the position between two cached points is interpola + + @@ -31323,6 +31675,12 @@ This method controls whether the position between two cached points is interpola + + + + + + @@ -31611,7 +31969,7 @@ This method controls whether the position between two cached points is interpola - + @@ -32444,7 +32802,7 @@ This method controls whether the position between two cached points is interpola - Set a constant linear velocity for the body. + Set a constant linear velocity for the body. This does not move the body, but affects other bodies touching it, as if it was moving. @@ -32458,7 +32816,7 @@ This method controls whether the position between two cached points is interpola - Return the constant linear velocity for the body. + Return the constant linear velocity for the body. This does not rotate the body, but affects other bodies touching it, as if it was rotating. @@ -32472,24 +32830,28 @@ This method controls whether the position between two cached points is interpola + Set the body friction, from 0 (frictionless) to 1 (full friction). + Return the body friction. + Set the body bounciness, from 0 (not bouncy) to 1 (bouncy). + Return the body bounciness. @@ -32540,6 +32902,178 @@ This method controls whether the position between two cached points is interpola Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an [Error] code, and a data array. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32671,7 +33205,7 @@ This method controls whether the position between two cached points is interpola - + @@ -33350,9 +33884,9 @@ This method controls whether the position between two cached points is interpola - + - + @@ -33505,7 +34039,7 @@ This method controls whether the position between two cached points is interpola - + Return the expand margin size (from enum MARGIN_*). Parts of the image below the size of the margin (and in the direction of the margin) will not expand. @@ -33546,7 +34080,7 @@ This method controls whether the position between two cached points is interpola - + @@ -33562,7 +34096,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34033,6 +34567,14 @@ This method controls whether the position between two cached points is interpola + + + + + + + + @@ -34096,7 +34638,7 @@ This method controls whether the position between two cached points is interpola - + Return the text of a specific line. @@ -34105,7 +34647,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34113,7 +34655,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34455,7 +34997,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34469,7 +35011,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34483,7 +35025,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34558,7 +35100,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34606,7 +35148,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34828,7 +35370,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34874,7 +35416,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34920,7 +35462,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34966,7 +35508,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35012,7 +35554,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35032,7 +35574,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35078,6 +35620,16 @@ This method controls whether the position between two cached points is interpola + + + + + + + + + + @@ -35317,6 +35869,18 @@ This method controls whether the position between two cached points is interpola Return the collision bounce parameter. + + + + + + + + + + + + @@ -36182,19 +36746,19 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -36232,17 +36796,17 @@ This method controls whether the position between two cached points is interpola - + - + - + - + @@ -36250,13 +36814,13 @@ This method controls whether the position between two cached points is interpola - + - + @@ -36716,6 +37280,8 @@ This method controls whether the position between two cached points is interpola + + @@ -36814,7 +37380,7 @@ This method controls whether the position between two cached points is interpola - + @@ -37338,7 +37904,7 @@ This method controls whether the position between two cached points is interpola - + @@ -37348,7 +37914,7 @@ This method controls whether the position between two cached points is interpola - + @@ -38376,6 +38942,12 @@ This method controls whether the position between two cached points is interpola + + + + + + @@ -38706,7 +39278,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40178,6 +40750,14 @@ This method controls whether the position between two cached points is interpola + + + + + + + + @@ -40623,6 +41203,8 @@ This method controls whether the position between two cached points is interpola + + @@ -40834,7 +41416,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40842,7 +41424,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40850,7 +41432,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40858,7 +41440,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40866,7 +41448,7 @@ This method controls whether the position between two cached points is interpola - + @@ -40890,7 +41472,7 @@ This method controls whether the position between two cached points is interpola - + diff --git a/drivers/chibi/cp_loader_mod.cpp b/drivers/chibi/cp_loader_mod.cpp index 98174ff9b15..6340a6f5ea2 100644 --- a/drivers/chibi/cp_loader_mod.cpp +++ b/drivers/chibi/cp_loader_mod.cpp @@ -446,18 +446,19 @@ CPLoader::Error CPLoader_MOD::load_song(const char *p_file,CPSong *p_song,bool p if (sid.is_null()) { continue; //empty sample, not stored? } - + sm->lock_data(sid); + uint8_t *dataptr = (uint8_t*)sm->get_data(sid); + int len=sm->get_size(sid); for (int s=0;sget_byte(); //d-=128; //convert to signed int8_t*ds=(int8_t*)&d; - int16_t d16=*ds; - d16<<=8; - sm->set_data( sid, s, d16 ); + dataptr[s]=*ds; } + sm->unlock_data(sid); } file->close(); diff --git a/drivers/chibi/cp_loader_s3m.cpp b/drivers/chibi/cp_loader_s3m.cpp index c21f7bdd380..073f35791ce 100644 --- a/drivers/chibi/cp_loader_s3m.cpp +++ b/drivers/chibi/cp_loader_s3m.cpp @@ -196,8 +196,12 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { if (id.is_null()) return FILE_OUT_OF_MEMORY; + + sm->lock_data(id); + void *dataptr = sm->get_data(id); - for (int c=0;c<(data_is_stereo?2:1);c++) { + int chans = (data_is_stereo?2:1); + for (int c=0;cset_data(id,i,*v,c); + ((int16_t*)dataptr)[i*chans+c]=*v; } else { @@ -214,16 +218,16 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { uint8_t s=file->get_byte(); s-=128; //toggle sign v=(int8_t*)&s; - int16_t v16=*v; - v16<<=8; - sm->set_data(id,i,v16,c); - + ((int8_t*)dataptr)[i*chans+c]=*v; + } - - + } } + + sm->unlock_data(id); + sm->set_loop_begin( id, loop_begin ); sm->set_loop_end( id, loop_end ); diff --git a/drivers/chibi/cp_loader_xm.cpp b/drivers/chibi/cp_loader_xm.cpp index 8bde6b673eb..66f36954cec 100644 --- a/drivers/chibi/cp_loader_xm.cpp +++ b/drivers/chibi/cp_loader_xm.cpp @@ -627,6 +627,10 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool CPSample *sample=song->get_sample(sample_index[j]); CPSample_ID sid=sample->get_sample_data(); + sm->lock_data(sid); + + void*dataptr=sm->get_data(sid); + if (sm->is_16bits( sid)) { int16_t old=0; @@ -638,8 +642,9 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool int16_t sampleval=file->get_word(); newsample=sampleval+old; old=newsample; - - sm->set_data( sid, k, newsample ); + + ((int16_t*)dataptr)[k]=newsample; + //sm->set_data( sid, k, newsample ); } } else { @@ -653,10 +658,15 @@ CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool newsample=sampleval+old; old=newsample; - sm->set_data( sid, k, (int16_t)newsample << 8 ); + ((int8_t*)dataptr)[k]=newsample; + + //sm->set_data( sid, k, (int16_t)newsample << 8 ); } } + + sm->unlock_data(sid); + } for (int j=0;j<96;j++) { diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index e94930fffb2..201b1262b58 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -739,12 +739,12 @@ void ShaderGLES2::set_custom_shader(uint32_t p_code_id) { void ShaderGLES2::free_custom_shader(uint32_t p_code_id) { - if (! custom_code_map.has( p_code_id )) { + /* if (! custom_code_map.has( p_code_id )) { print_line("no code id "+itos(p_code_id)); } else { print_line("freed code id "+itos(p_code_id)); - } + }*/ ERR_FAIL_COND(! custom_code_map.has( p_code_id )); if (conditional_version.code_version==p_code_id) diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 5682a5667ec..5532e28ade2 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -22,18 +22,19 @@ png_sources = [ "png/image_loader_png.cpp" ] -if ("neon_enabled" in env and env["neon_enabled"]): +if ("neon_enabled" in env and env["neon_enabled"]): + env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) env_neon = env.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] - env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) + #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) import os # Currently .ASM filter_neon.S does not compile on NT. if (os.name!="nt"): - env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) - +else: + env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) env.drivers_sources+=png_sources diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index b7bcd447832..1c18ebd8558 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -81,6 +81,11 @@ Error ThreadPosix::set_name(const String& p_name) { ERR_FAIL_COND_V(pthread == 0, ERR_UNCONFIGURED); + #ifdef PTHREAD_NO_RENAME + return ERR_UNAVAILABLE; + + #else + #ifdef PTHREAD_RENAME_SELF // check if thread is the same as caller @@ -100,6 +105,8 @@ Error ThreadPosix::set_name(const String& p_name) { #endif return err == 0 ? OK : ERR_INVALID_PARAMETER; + + #endif // PTHREAD_NO_RENAME }; void ThreadPosix::make_default() { diff --git a/drivers/webp/utils/bit_reader.c b/drivers/webp/utils/bit_reader.c index 5081d5cd4d1..4d6b4f01640 100644 --- a/drivers/webp/utils/bit_reader.c +++ b/drivers/webp/utils/bit_reader.c @@ -17,6 +17,8 @@ #include "./bit_reader_inl.h" +#define JAVASCRIPT_ENABLED // testing + //------------------------------------------------------------------------------ // VP8BitReader @@ -40,7 +42,13 @@ void VP8InitBitReader(VP8BitReader* const br, br->bits_ = -8; // to load the very first 8bits br->eof_ = 0; VP8BitReaderSetBuffer(br, start, size); + +#ifdef JAVASCRIPT_ENABLED // html5 required aligned reads + while(((uintptr_t)br->buf_ & 1) != 0 && !br->eof_) + VP8LoadFinalBytes(br); +#else VP8LoadNewBytes(br); +#endif } void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) { diff --git a/drivers/webp/utils/bit_reader.h b/drivers/webp/utils/bit_reader.h index 7e09653ebc8..f0f450231df 100644 --- a/drivers/webp/utils/bit_reader.h +++ b/drivers/webp/utils/bit_reader.h @@ -37,6 +37,12 @@ extern "C" { // BITS can be any multiple of 8 from 8 to 56 (inclusive). // Pick values that fit natural register size. +#ifdef JAVASCRIPT_ENABLED + +#define BITS 16 + +#else + #if defined(__i386__) || defined(_M_IX86) // x86 32bit #define BITS 24 #elif defined(__x86_64__) || defined(_M_X64) // x86 64bit @@ -49,6 +55,8 @@ extern "C" { #define BITS 24 // TODO(skal): test aarch64 and find the proper BITS value. #endif +#endif + //------------------------------------------------------------------------------ // Derived types and constants: // bit_t = natural register type for storing 'value_' (which is BITS+8 bits) diff --git a/main/main.cpp b/main/main.cpp index 66391ffa7e0..4dca79fd550 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -56,7 +56,7 @@ #ifdef TOOLS_ENABLED #include "tools/editor/editor_node.h" #include "tools/editor/project_manager.h" -#include "tools/editor/console.h" + #include "tools/pck/pck_packer.h" #endif @@ -1330,6 +1330,12 @@ bool Main::start() { continue; String name = s.get_slicec('/',1); String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; + path=path.substr(1,path.length()-1); + } + RES res = ResourceLoader::load(path); ERR_EXPLAIN("Can't autoload: "+path); ERR_CONTINUE(res.is_null()); @@ -1355,7 +1361,16 @@ bool Main::start() { ERR_EXPLAIN("Path in autoload not a node or script: "+path); ERR_CONTINUE(!n); n->set_name(name); + sml->get_root()->add_child(n); + + if (global_var) { + for(int i=0;iadd_global_constant(name,n); + } + } + + } } diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index a62225f6634..7b070105290 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1156,6 +1156,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo codegen.opcodes.push_back(GDFunction::OPCODE_ASSERT); codegen.opcodes.push_back(ret); } break; + case GDParser::Node::TYPE_BREAKPOINT: { + // try subblocks + codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT); + } break; case GDParser::Node::TYPE_LOCAL_VAR: { @@ -1181,7 +1185,7 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo } -Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func) { +Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func,bool p_for_ready) { Vector bytecode; CodeGen codegen; @@ -1212,9 +1216,9 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * /* Parse initializer -if applies- */ - bool is_initializer=false || !p_func; + bool is_initializer=!p_for_ready && !p_func; - if (!p_func || String(p_func->name)=="_init") { + if (is_initializer || (p_func && String(p_func->name)=="_init")) { //parse initializer for class members if (!p_func && p_class->extends_used && p_script->native.is_null()){ @@ -1232,6 +1236,17 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * } + if (p_for_ready || (p_func && String(p_func->name)=="_ready")) { + //parse initializer for class members + if (p_class->ready->statements.size()) { + Error err = _parse_block(codegen,p_class->ready,stack_level); + if (err) + return err; + } + + } + + /* Parse default argument code -if applies- */ Vector defarg_addr; @@ -1260,7 +1275,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * func_name=p_func->name; } else { - func_name="_init"; + if (p_for_ready) + func_name="_ready"; + else + func_name="_init"; } codegen.opcodes.push_back(GDFunction::OPCODE_END); @@ -1614,10 +1632,14 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars //parse methods bool has_initializer=false; + bool has_ready=false; + for(int i=0;ifunctions.size();i++) { if (!has_initializer && p_class->functions[i]->name=="_init") has_initializer=true; + if (!has_ready && p_class->functions[i]->name=="_ready") + has_ready=true; Error err = _parse_function(p_script,p_class,p_class->functions[i]); if (err) return err; @@ -1640,6 +1662,13 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars return err; } + if (!has_ready && p_class->ready->statements.size()) { + //create a constructor + Error err = _parse_function(p_script,p_class,NULL,true); + if (err) + return err; + } + #ifdef DEBUG_ENABLED //validate setters/getters if debug is enabled for(int i=0;ivariables.size();i++) { diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index bdf4e9816ac..ea3e7c8b698 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h @@ -143,7 +143,7 @@ class GDCompiler { int _parse_assign_right_expression(CodeGen& codegen,const GDParser::OperatorNode *p_expression, int p_stack_level); int _parse_expression(CodeGen& codegen,const GDParser::Node *p_expression, int p_stack_level,bool p_root=false,bool p_initializer=false); Error _parse_block(CodeGen& codegen,const GDParser::BlockNode *p_block,int p_stack_level=0,int p_break_addr=-1,int p_continue_addr=-1); - Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func); + Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func,bool p_for_ready=false); Error _parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class); int err_line; int err_column; diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 381edcba502..6255cfd86a5 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -1147,8 +1147,54 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const } } + //autoloads as singletons + List props; + Globals::get_singleton()->get_property_list(&props); + + for(List::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + if (name==String(p_identifier)) { + + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + String script =path.substr(1,path.length()); + + if (!script.ends_with(".gd")) { + //not a script, try find the script anyway, + //may have some success + script=script.basename()+".gd"; + } + + if (FileAccess::exists(script)) { + + //print_line("is a script"); + Ref