diff options
118 files changed, 2124 insertions, 1170 deletions
diff --git a/.travis.yml b/.travis.yml index 6dd21dae0b..13f91b99e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,48 @@ language: cpp -compiler: + +sudo: required +dist: trusty + +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 + - 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 438db5d518..f1edc3d7d7 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 45fd4b5080..3f668dfade 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 b48f34d2df..a3f8b11946 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 7f74b61630..788fe7713c 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 1ff458f325..4fb175e639 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 ce03f089e5..e76f044df3 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<l) { diff --git a/core/object.cpp b/core/object.cpp index 9fdd11eb2e..773581d41d 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1550,7 +1550,7 @@ void Object::_bind_methods() { ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind); ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind); ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind); - ObjectTypeDB::bind_method(_MD("notification","what"),&Object::notification,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("notification","what","reversed"),&Object::notification,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID); ObjectTypeDB::bind_method(_MD("set_script","script:Script"),&Object::set_script); @@ -1615,7 +1615,7 @@ void Object::_bind_methods() { ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); - ObjectTypeDB::bind_method(_MD("has_method"),&Object::has_method); + ObjectTypeDB::bind_method(_MD("has_method","method"),&Object::has_method); ObjectTypeDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list); diff --git a/core/os/input.cpp b/core/os/input.cpp index 15872d02fd..53358fd4f5 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -62,8 +62,8 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); - ObjectTypeDB::bind_method(_MD("action_press"),&Input::action_press); - ObjectTypeDB::bind_method(_MD("action_release"),&Input::action_release); + ObjectTypeDB::bind_method(_MD("action_press","action"),&Input::action_press); + ObjectTypeDB::bind_method(_MD("action_release","action"),&Input::action_release); ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); BIND_CONSTANT( MOUSE_MODE_VISIBLE ); diff --git a/core/resource.cpp b/core/resource.cpp index 6967599f96..13e0f73b80 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -278,7 +278,7 @@ void Resource::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata); ObjectTypeDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata); - ObjectTypeDB::bind_method(_MD("duplicate"),&Resource::duplicate,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("duplicate","subresources"),&Resource::duplicate,DEFVAL(false)); ADD_SIGNAL( MethodInfo("changed") ); ADD_PROPERTY( PropertyInfo(Variant::STRING,"resource/path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR ), _SCS("set_path"),_SCS("get_path")); ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"resource/name"), _SCS("set_name"),_SCS("get_name")); diff --git a/core/script_language.h b/core/script_language.h index 9660f141c7..52ae4e488f 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -165,6 +165,7 @@ public: virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const=0; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* 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 8247cd1201..de55224d5c 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<tcount;i++) { - print_line( "Loading translation from " + r[i] ); + //print_line( "Loading translation from " + r[i] ); Ref<Translation> 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 39b3791e84..1b95899729 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -525,13 +525,13 @@ Converts the value of a variable to a String. </description> </method> - <method name="str2var:var"> + <method name="str2var:Variant"> <return type="Nil"> </return> <argument index="0" name="string" type="String"> </argument> <description> - Converts the value of a String to a variable. + Converts the value of a String to a Variant. </description> </method> <method name="range"> @@ -573,7 +573,7 @@ <method name="hash"> <return type="int"> </return> - <argument index="0" name="var:var" type="var"> + <argument index="0" name="var:Variant" type="var"> </argument> <description> Hashes the variable passed and returns an integer. @@ -1849,6 +1849,8 @@ </description> </method> <method name="register_text_enter"> + <return type="LineEdit"> + </return> <argument index="0" name="line_edit" type="Object"> </argument> <description> @@ -2412,7 +2414,7 @@ </class> <class name="AnimationPlayer" inherits="Node" category="Core"> <brief_description> - Container and player of [Animaton] resources. + Container and player of [Animation] resources. </brief_description> <description> 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 @@ <argument index="0" name="enable" type="int"> </argument> <description> + 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. </description> </method> <method name="get_space_override_mode" qualifiers="const"> @@ -3481,133 +3489,162 @@ </class> <class name="Area2D" inherits="CollisionObject2D" category="Core"> <brief_description> - General purpose area detection and influence for 2D Phisics. + General purpose area detection and influence for 2D physics. </brief_description> <description> - 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. </description> <methods> <method name="set_space_override_mode"> <argument index="0" name="enable" type="int"> </argument> <description> + 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. </description> </method> <method name="get_space_override_mode" qualifiers="const"> <return type="int"> </return> <description> + Return the space override mode. </description> </method> <method name="set_gravity_is_point"> <argument index="0" name="enable" type="bool"> </argument> <description> - 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]. </description> </method> <method name="is_gravity_a_point" qualifiers="const"> <return type="bool"> </return> <description> - 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. </description> </method> <method name="set_gravity_distance_scale"> <argument index="0" name="distance_scale" type="float"> </argument> <description> + Set the falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance. </description> </method> <method name="get_gravity_distance_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the falloff factor for point gravity. </description> </method> <method name="set_gravity_vector"> <argument index="0" name="vector" type="Vector2"> </argument> <description> - 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. </description> </method> <method name="get_gravity_vector" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the gravity vector. If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center. </description> </method> <method name="set_gravity"> <argument index="0" name="gravity" type="float"> </argument> <description> + 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). </description> </method> <method name="get_gravity" qualifiers="const"> <return type="float"> </return> <description> + Return the gravity intensity. </description> </method> <method name="set_linear_damp"> <argument index="0" name="linear_damp" type="float"> </argument> <description> + 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. </description> </method> <method name="get_linear_damp" qualifiers="const"> <return type="float"> </return> <description> + Return the linear damp rate. </description> </method> <method name="set_angular_damp"> <argument index="0" name="angular_damp" type="float"> </argument> <description> + 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. </description> </method> <method name="get_angular_damp" qualifiers="const"> <return type="float"> </return> <description> + Return the angular damp rate. </description> </method> <method name="set_priority"> <argument index="0" name="priority" type="float"> </argument> <description> + 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. </description> </method> <method name="get_priority" qualifiers="const"> <return type="float"> </return> <description> + Return the processing order of this area. </description> </method> <method name="set_collision_mask"> <argument index="0" name="collision_mask" type="int"> </argument> <description> + Set the physics layers this area can scan for collisions. </description> </method> <method name="get_collision_mask" qualifiers="const"> <return type="int"> </return> <description> + Return the physics layers this area can scan for collisions. </description> </method> <method name="set_layer_mask"> <argument index="0" name="layer_mask" type="int"> </argument> <description> + 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. </description> </method> <method name="get_layer_mask" qualifiers="const"> <return type="int"> </return> <description> + Return the physics layer this area is in. </description> </method> <method name="set_collision_mask_bit"> @@ -3616,6 +3653,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. </description> </method> <method name="get_collision_mask_bit" qualifiers="const"> @@ -3624,6 +3662,7 @@ <argument index="0" name="bit" type="int"> </argument> <description> + Return an individual bit on the collision mask. </description> </method> <method name="set_layer_mask_bit"> @@ -3632,6 +3671,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> + Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier. </description> </method> <method name="get_layer_mask_bit" qualifiers="const"> @@ -3640,42 +3680,49 @@ <argument index="0" name="bit" type="int"> </argument> <description> + Return an individual bit on the layer mask. </description> </method> <method name="set_enable_monitoring"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether this area can detect bodies/areas entering/exiting it. </description> </method> <method name="is_monitoring_enabled" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this area detects bodies/areas entering/exiting it. </description> </method> <method name="set_monitorable"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether this area can be detected by other, monitoring, areas. Only areas need to be marked as monitorable. Bodies are always so. </description> </method> <method name="is_monitorable" qualifiers="const"> <return type="bool"> </return> <description> + Set whether this area can be detected by other, monitoring, areas. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> <return type="Array"> </return> <description> + Return a list of the bodies ([PhysicsBody2D]) that are totally or partially inside this area. </description> </method> <method name="get_overlapping_areas" qualifiers="const"> <return type="Array"> </return> <description> + Return a list of the areas that are totally or partially inside this area. </description> </method> <method name="overlaps_body" qualifiers="const"> @@ -3684,6 +3731,7 @@ <argument index="0" name="body" type="Object"> </argument> <description> + Return whether the body passed is totally or partially inside this area. </description> </method> <method name="overlaps_area" qualifiers="const"> @@ -3692,6 +3740,7 @@ <argument index="0" name="area" type="Object"> </argument> <description> + Return whether the area passed is totally or partially inside this area. </description> </method> </methods> @@ -3700,6 +3749,7 @@ <argument index="0" name="body" type="Object"> </argument> <description> + This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area. </description> </signal> <signal name="body_enter_shape"> @@ -3712,12 +3762,14 @@ <argument index="3" name="area_shape" type="int"> </argument> <description> + 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. </description> </signal> <signal name="area_enter"> <argument index="0" name="area" type="Object"> </argument> <description> + This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area. </description> </signal> <signal name="area_enter_shape"> @@ -3730,12 +3782,14 @@ <argument index="3" name="area_shape" type="int"> </argument> <description> + 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. </description> </signal> <signal name="body_exit"> <argument index="0" name="body" type="Object"> </argument> <description> + This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area. </description> </signal> <signal name="body_exit_shape"> @@ -3748,12 +3802,14 @@ <argument index="3" name="area_shape" type="int"> </argument> <description> + 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. </description> </signal> <signal name="area_exit"> <argument index="0" name="area" type="Object"> </argument> <description> + This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area. </description> </signal> <signal name="area_exit_shape"> @@ -3766,6 +3822,7 @@ <argument index="3" name="area_shape" type="int"> </argument> <description> + 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. </description> </signal> </signals> @@ -3843,6 +3900,14 @@ Get whether this is a shared array instance. </description> </method> + <method name="pop_back"> + <description> + </description> + </method> + <method name="pop_front"> + <description> + </description> + </method> <method name="push_back"> <argument index="0" name="value" type="var"> </argument> @@ -3850,6 +3915,12 @@ Append an element at the end of the array. </description> </method> + <method name="push_front"> + <argument index="0" name="value" type="var"> + </argument> + <description> + </description> + </method> <method name="remove"> <argument index="0" name="pos" type="int"> </argument> @@ -4033,8 +4104,6 @@ </return> <argument index="0" name="sample" type="RID"> </argument> - <argument index="1" name="arg1" type="String"> - </argument> <description> Return the description of an audio sample. Mainly used for organization. </description> @@ -4078,7 +4147,7 @@ <method name="sample_set_data"> <argument index="0" name="sample" type="RID"> </argument> - <argument index="1" name="arg1" type="RawArray"> + <argument index="1" name="data" type="RawArray"> </argument> <description> 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 @@ </description> </method> <method name="set_zoom"> - <argument index="0" name="arg0" type="Vector2"> + <argument index="0" name="zoom" type="Vector2"> </argument> <description> </description> @@ -5914,6 +5983,18 @@ <description> </description> </method> + <method name="set_enable_follow_smoothing"> + <argument index="0" name="follow_smoothing" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_follow_smoothing_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="force_update_scroll"> <description> Force the camera to update scroll immediately. @@ -6006,6 +6087,12 @@ Hide the CanvasItem currently visible. </description> </method> + <method name="set_hidden"> + <argument index="0" name="hidden" type="bool"> + </argument> + <description> + </description> + </method> <method name="update"> <description> Queue the CanvasItem for update. NOTIFICATION_DRAW will be called on idle time to request redraw. @@ -6131,6 +6218,8 @@ </argument> <argument index="1" name="pos" type="Vector2"> </argument> + <argument index="2" name="modulate" type="Color" default="Color(1,1,1,1)"> + </argument> <description> Draw a texture at a given position. </description> @@ -6969,7 +7058,7 @@ Base node for 2D collisionables. </brief_description> <description> - 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. </description> <methods> <method name="_input_event" qualifiers="virtual"> @@ -6980,6 +7069,7 @@ <argument index="2" name="shape_idx" type="int"> </argument> <description> + 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. </description> </method> <method name="add_shape"> @@ -6995,7 +7085,7 @@ <return type="int"> </return> <description> - 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]. </description> </method> <method name="set_shape"> @@ -7022,6 +7112,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + 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). </description> </method> <method name="get_shape" qualifiers="const"> @@ -7048,6 +7139,7 @@ <argument index="0" name="shape_idx" type="int"> </argument> <description> + 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). </description> </method> <method name="remove_shape"> @@ -7066,25 +7158,28 @@ <return type="RID"> </return> <description> - Return the RID of the object. + Return the RID of this object. </description> </method> <method name="set_pickable"> <argument index="0" name="enabled" type="bool"> </argument> <description> + 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. </description> </method> <method name="is_pickable" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this object is pickable. </description> </method> </methods> <signals> <signal name="mouse_enter"> <description> + This event fires only once when the mouse pointer enters any shape of this object. </description> </signal> <signal name="input_event"> @@ -7095,10 +7190,12 @@ <argument index="2" name="shape_idx" type="int"> </argument> <description> + 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. </description> </signal> <signal name="mouse_exit"> <description> + This event fires only once when the mouse pointer exits all shapes of this object. </description> </signal> </signals> @@ -7112,7 +7209,7 @@ </description> <methods> <method name="set_build_mode"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="build_mode" type="int"> </argument> <description> </description> @@ -7187,7 +7284,7 @@ </description> </method> <method name="set_build_mode"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="build_mode" type="int"> </argument> <description> 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 @@ </description> </method> <method name="set_trigger"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="trigger" type="bool"> </argument> <description> 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 @@ </description> <methods> <method name="resource_changed"> - <argument index="0" name="arg0" type="Object"> + <argument index="0" name="resource" type="Object"> </argument> <description> </description> @@ -7671,6 +7768,66 @@ <description> </description> <methods> + <method name="add_point"> + <argument index="0" name="offset" type="float"> + </argument> + <argument index="1" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="remove_point"> + <argument index="0" name="offset" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_offset"> + <argument index="0" name="point" type="int"> + </argument> + <argument index="1" name="offset" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_offset" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="point" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_color"> + <argument index="0" name="point" type="int"> + </argument> + <argument index="1" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_color" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="point" type="int"> + </argument> + <description> + </description> + </method> + <method name="interpolate"> + <return type="Color"> + </return> + <argument index="0" name="offset" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_point_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="set_offsets"> <argument index="0" name="offsets" type="RealArray"> </argument> @@ -7841,7 +7998,7 @@ <method name="get_section_keys" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="section" type="String"> </argument> <description> </description> @@ -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]). </description> </method> + <method name="set_rotation"> + <argument index="0" name="rotation" type="float"> + </argument> + <description> + </description> + </method> + <method name="set_scale"> + <argument index="0" name="scale" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="get_margin" qualifiers="const"> <return type="float"> </return> @@ -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]). </description> </method> + <method name="get_rotation" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_scale" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> <method name="get_custom_minimum_size" qualifiers="const"> <return type="Vector2"> </return> @@ -9539,7 +9720,7 @@ This approximation makes straight segments between each point, then subdivides t </description> </method> <method name="set_show_hidden_files"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="show" type="bool"> </argument> <description> </description> @@ -10132,6 +10313,12 @@ This approximation makes straight segments between each point, then subdivides t <description> </description> </method> + <method name="get_length" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_autoplay"> <argument index="0" name="enabled" type="bool"> </argument> @@ -10152,24 +10339,18 @@ This approximation makes straight segments between each point, then subdivides t <description> </description> </method> - <method name="get_channel_volumeidx" qualifiers="const"> + <method name="get_channel_volume" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="idx" type="int"> </argument> <description> </description> </method> - <method name="get_length" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> <method name="get_channel_last_note_time" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="idx" type="int"> </argument> <description> </description> @@ -10556,7 +10737,7 @@ This approximation makes straight segments between each point, then subdivides t </description> </method> <method name="set_show_hidden_files"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="show" type="bool"> </argument> <description> </description> @@ -10618,6 +10799,8 @@ This approximation makes straight segments between each point, then subdivides t </theme_item> <theme_item name="folder" type="Texture"> </theme_item> + <theme_item name="reload" type="Texture"> + </theme_item> </theme_items> </class> <class name="FixedMaterial" inherits="Material" category="Core"> @@ -10856,9 +11039,9 @@ This approximation makes straight segments between each point, then subdivides t <method name="get_kerning_pair" qualifiers="const"> <return type="int"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="char_a" type="int"> </argument> - <argument index="1" name="arg1" type="int"> + <argument index="1" name="char_b" type="int"> </argument> <description> 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. </description> </method> + <method name="set_fallback"> + <argument index="0" name="fallback" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_fallback" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -11026,6 +11221,8 @@ This approximation makes straight segments between each point, then subdivides t </description> <methods> <method name="resume"> + <return type="Variant"> + </return> <argument index="0" name="arg" type="var" default="NULL"> </argument> <description> @@ -11632,7 +11829,7 @@ This approximation makes straight segments between each point, then subdivides t <method name="has_singleton" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="name" type="String"> </argument> <description> </description> @@ -11640,7 +11837,7 @@ This approximation makes straight segments between each point, then subdivides t <method name="get_singleton" qualifiers="const"> <return type="Object"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="name" type="String"> </argument> <description> </description> @@ -11648,7 +11845,7 @@ This approximation makes straight segments between each point, then subdivides t <method name="load_resource_pack"> <return type="bool"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="pack" type="String"> </argument> <description> </description> @@ -11656,7 +11853,7 @@ This approximation makes straight segments between each point, then subdivides t <method name="save_custom"> <return type="int"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="file" type="String"> </argument> <description> </description> @@ -12172,7 +12369,7 @@ This approximation makes straight segments between each point, then subdivides t </description> </method> <method name="resource_changed"> - <argument index="0" name="arg0" type="Object"> + <argument index="0" name="resource" type="Object"> </argument> <description> </description> @@ -13306,6 +13503,10 @@ returns:= "username=user&password=pass" <description> </description> </method> + <method name="shrink_x2_and_keep_size"> + <description> + </description> + </method> <method name="set_size_override"> <argument index="0" name="size" type="Vector2"> </argument> @@ -13489,13 +13690,13 @@ returns:= "username=user&password=pass" </description> </method> <method name="action_press"> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="action" type="String"> </argument> <description> </description> </method> <method name="action_release"> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="action" type="String"> </argument> <description> </description> @@ -14975,6 +15176,18 @@ returns:= "username=user&password=pass" <description> </description> </method> + <method name="set_exclude_nodes_from_collision"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_exclude_nodes_from_collision" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -14991,7 +15204,7 @@ returns:= "username=user&password=pass" <argument index="0" name="node" type="NodePath"> </argument> <description> - 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]. </description> </method> <method name="get_node_a" qualifiers="const"> @@ -15005,7 +15218,7 @@ returns:= "username=user&password=pass" <argument index="0" name="node" type="NodePath"> </argument> <description> - 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]. </description> </method> <method name="get_node_b" qualifiers="const"> @@ -15027,6 +15240,18 @@ returns:= "username=user&password=pass" <description> </description> </method> + <method name="set_exclude_nodes_from_collision"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_exclude_nodes_from_collision" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -15087,6 +15312,8 @@ returns:= "username=user&password=pass" </description> </method> <method name="get_collider" qualifiers="const"> + <return type="Object"> + </return> <description> </description> </method> @@ -15162,8 +15389,12 @@ returns:= "username=user&password=pass" </class> <class name="KinematicBody2D" inherits="PhysicsBody2D" category="Core"> <brief_description> + Kinematic body 2D node. </brief_description> <description> + 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. </description> <methods> <method name="move"> @@ -15172,6 +15403,7 @@ returns:= "username=user&password=pass" <argument index="0" name="rel_vec" type="Vector2"> </argument> <description> + Move the body in the given direction, stopping if there is an obstacle. </description> </method> <method name="move_to"> @@ -15180,6 +15412,7 @@ returns:= "username=user&password=pass" <argument index="0" name="position" type="Vector2"> </argument> <description> + Move the body to the given position. This is not a teleport, and the body will stop if there is an obstacle. </description> </method> <method name="test_move"> @@ -15188,66 +15421,82 @@ returns:= "username=user&password=pass" <argument index="0" name="rel_vec" type="Vector2"> </argument> <description> + Return true if there would be a collision if the body moved in the given direction. </description> </method> <method name="get_travel" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the last movement done by the body. </description> </method> <method name="revert_motion"> <description> + Undo the last movement done by the body. </description> </method> <method name="is_colliding" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the body is colliding with another. </description> </method> <method name="get_collision_pos" qualifiers="const"> <return type="Vector2"> </return> <description> + 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]. </description> </method> <method name="get_collision_normal" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the normal of the surface the body collided with. This is useful to implement sliding along a surface. </description> </method> <method name="get_collider_velocity" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the velocity of the body that collided with this one. </description> </method> <method name="get_collider" qualifiers="const"> + <return type="Object"> + </return> <description> + Return the body that collided with this one. </description> </method> <method name="get_collider_shape" qualifiers="const"> <return type="int"> </return> <description> + 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]. </description> </method> <method name="get_collider_metadata" qualifiers="const"> + <return type="var"> + </return> <description> + 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]. </description> </method> <method name="set_collision_margin"> <argument index="0" name="pixels" type="float"> </argument> <description> + 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. </description> </method> <method name="get_collision_margin" qualifiers="const"> <return type="float"> </return> <description> + Return the collision margin for this object. </description> </method> </methods> @@ -15552,7 +15801,7 @@ returns:= "username=user&password=pass" <method name="get_parameter" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="variable" type="int"> </argument> <description> </description> @@ -15568,7 +15817,7 @@ returns:= "username=user&password=pass" <method name="get_color" qualifiers="const"> <return type="Color"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="color" type="int"> </argument> <description> </description> @@ -15905,6 +16154,8 @@ returns:= "username=user&password=pass" </constant> <constant name="MODE_MIX" value="2"> </constant> + <constant name="MODE_MASK" value="3"> + </constant> </constants> </class> <class name="LightOccluder2D" inherits="Node2D" category="Core"> @@ -16269,6 +16520,8 @@ returns:= "username=user&password=pass" </description> </method> <method name="base64_to_variant"> + <return type="Variant"> + </return> <argument index="0" name="base64_str" type="String"> </argument> <description> @@ -16857,9 +17110,9 @@ returns:= "username=user&password=pass" </argument> <argument index="1" name="arrays" type="Array"> </argument> - <argument index="2" name="morph_arrays" type="Array"> + <argument index="2" name="morph_arrays" type="Array" default="Array()"> </argument> - <argument index="3" name="arg3" type="bool" default="Array()"> + <argument index="3" name="alphasort" type="bool" default="false"> </argument> <description> Create a new surface ([method get_surface_count] that will become surf_idx for this. @@ -17532,7 +17785,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="set_instance_count"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="count" type="int"> </argument> <description> 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" </description> </method> <method name="set_instance_transform"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="instance" type="int"> </argument> - <argument index="1" name="arg1" type="Transform"> + <argument index="1" name="transform" type="Transform"> </argument> <description> Set the transform for a specific instance. @@ -17557,16 +17810,16 @@ returns:= "username=user&password=pass" <method name="get_instance_transform" qualifiers="const"> <return type="Transform"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="instance" type="int"> </argument> <description> Return the transform of a specific instance. </description> </method> <method name="set_instance_color"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="instance" type="int"> </argument> - <argument index="1" name="arg1" type="Color"> + <argument index="1" name="color" type="Color"> </argument> <description> Set the color of a specific instance. @@ -17575,14 +17828,14 @@ returns:= "username=user&password=pass" <method name="get_instance_color" qualifiers="const"> <return type="Color"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="instance" type="int"> </argument> <description> Get the color of a specific instance. </description> </method> <method name="set_aabb"> - <argument index="0" name="arg0" type="AABB"> + <argument index="0" name="visibility_aabb" type="AABB"> </argument> <description> Set the visibility AABB. If not provided, MultiMesh will not be visible. @@ -18283,8 +18536,11 @@ returns:= "username=user&password=pass" <method name="add_child"> <argument index="0" name="node" type="Node"> </argument> + <argument index="1" name="legible_unique_name" type="bool" default="false"> + </argument> <description> 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. </description> </method> <method name="remove_child"> @@ -18426,7 +18682,7 @@ returns:= "username=user&password=pass" <method name="add_to_group"> <argument index="0" name="group" type="String"> </argument> - <argument index="1" name="arg1" type="bool" default="false"> + <argument index="1" name="persistent" type="bool" default="false"> </argument> <description> 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" </description> </method> <method name="edit_set_pivot"> - <argument index="0" name="arg0" type="Vector2"> + <argument index="0" name="pivot" type="Vector2"> </argument> <description> </description> @@ -18885,7 +19141,7 @@ returns:= "username=user&password=pass" <method name="get_relative_transform" qualifiers="const"> <return type="Matrix32"> </return> - <argument index="0" name="arg0" type="Object"> + <argument index="0" name="parent" type="Object"> </argument> <description> </description> @@ -19354,7 +19610,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="set_icon"> - <argument index="0" name="arg0" type="Image"> + <argument index="0" name="icon" type="Image"> </argument> <description> </description> @@ -19519,7 +19775,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="print_resources_by_type"> - <argument index="0" name="arg0" type="StringArray"> + <argument index="0" name="types" type="StringArray"> </argument> <description> </description> @@ -19527,13 +19783,13 @@ returns:= "username=user&password=pass" <method name="native_video_play"> <return type="int"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="path" type="String"> </argument> - <argument index="1" name="arg1" type="float"> + <argument index="1" name="volume" type="float"> </argument> - <argument index="2" name="arg2" type="String"> + <argument index="2" name="audio_track" type="String"> </argument> - <argument index="3" name="arg3" type="String"> + <argument index="3" name="subtitle_track" type="String"> </argument> <description> </description> @@ -19760,7 +20016,7 @@ returns:= "username=user&password=pass" <method name="notification"> <argument index="0" name="what" type="int"> </argument> - <argument index="1" name="arg1" type="bool" default="false"> + <argument index="1" name="reversed" type="bool" default="false"> </argument> <description> Notify the object of something. @@ -19898,6 +20154,8 @@ returns:= "username=user&password=pass" </description> </method> <method name="callv"> + <return type="Variant"> + </return> <argument index="0" name="method" type="String"> </argument> <argument index="1" name="arg_array" type="Array"> @@ -19908,7 +20166,7 @@ returns:= "username=user&password=pass" <method name="has_method" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="method" type="String"> </argument> <description> </description> @@ -20236,7 +20494,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="select"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="idx" type="int"> </argument> <description> Select an item by index and make it the current item. @@ -20335,7 +20593,7 @@ returns:= "username=user&password=pass" <method name="flush"> <return type="int"> </return> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="verbose" type="bool"> </argument> <description> </description> @@ -20451,7 +20709,7 @@ returns:= "username=user&password=pass" <method name="put_var"> <return type="int"> </return> - <argument index="0" name="var" type="var"> + <argument index="0" name="var" type="Variant"> </argument> <description> </description> @@ -20672,7 +20930,7 @@ returns:= "username=user&password=pass" </description> </method> <method name="set_ignore_camera_zoom"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="ignore" type="bool"> </argument> <description> </description> @@ -20935,7 +21193,7 @@ returns:= "username=user&password=pass" <method name="get_randomness" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="variable" type="int"> </argument> <description> 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" </description> </method> <method name="set_emit_timeout"> - <argument index="0" name="arg0" type="float"> + <argument index="0" name="timeout" type="float"> </argument> <description> </description> @@ -21182,6 +21440,8 @@ returns:= "username=user&password=pass" </description> </method> <method name="set_texture"> + <return type="Texture"> + </return> <argument index="0" name="texture" type="Object"> </argument> <description> @@ -21206,6 +21466,8 @@ returns:= "username=user&password=pass" </description> </method> <method name="set_color_ramp"> + <return type="ColorRamp"> + </return> <argument index="0" name="color_ramp" type="Object"> </argument> <description> @@ -22084,6 +22346,8 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="get_contact_collider_shape_metadata" qualifiers="const"> + <return type="Variant"> + </return> <argument index="0" name="contact_idx" type="int"> </argument> <description> @@ -22498,11 +22762,11 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="area_set_monitor_callback"> - <argument index="0" name="receiver" type="RID"> + <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="method" type="Object"> + <argument index="1" name="receiver" type="Object"> </argument> - <argument index="2" name="arg2" type="String"> + <argument index="2" name="method" type="String"> </argument> <description> </description> @@ -22812,9 +23076,9 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="body_set_one_way_collision_direction"> - <argument index="0" name="normal" type="RID"> + <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="arg1" type="Vector2"> + <argument index="1" name="normal" type="Vector2"> </argument> <description> </description> @@ -22822,15 +23086,15 @@ This method controls whether the position between two cached points is interpola <method name="body_get_one_way_collision_direction" qualifiers="const"> <return type="Vector2"> </return> - <argument index="0" name="arg0" type="RID"> + <argument index="0" name="body" type="RID"> </argument> <description> </description> </method> <method name="body_set_one_way_collision_max_depth"> - <argument index="0" name="normal" type="RID"> + <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="arg1" type="float"> + <argument index="1" name="depth" type="float"> </argument> <description> </description> @@ -22838,7 +23102,7 @@ This method controls whether the position between two cached points is interpola <method name="body_get_one_way_collision_max_depth" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="RID"> + <argument index="0" name="body" type="RID"> </argument> <description> </description> @@ -22866,7 +23130,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="method" type="String"> </argument> - <argument index="3" name="arg3" type="var"> + <argument index="3" name="userdata" type="var" default="NULL"> </argument> <description> </description> @@ -22990,7 +23254,7 @@ This method controls whether the position between two cached points is interpola <method name="get_process_info"> <return type="int"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="process_info" type="int"> </argument> <description> </description> @@ -23029,11 +23293,20 @@ This method controls whether the position between two cached points is interpola </constant> <constant name="AREA_PARAM_PRIORITY" value="7"> </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. + </constant> <constant name="AREA_SPACE_OVERRIDE_COMBINE" value="1"> + 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. </constant> - <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0"> + <constant name="AREA_SPACE_OVERRIDE_COMBINE_REPLACE" value="2"> + 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. </constant> - <constant name="AREA_SPACE_OVERRIDE_REPLACE" value="2"> + <constant name="AREA_SPACE_OVERRIDE_REPLACE" value="3"> + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + </constant> + <constant name="AREA_SPACE_OVERRIDE_REPLACE_COMBINE" value="4"> + 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> @@ -23321,7 +23594,7 @@ This method controls whether the position between two cached points is interpola </class> <class name="PhysicsBody" inherits="CollisionObject" category="Core"> <brief_description> - Base class for differnt types of Physics bodies. + Base class for different types of Physics bodies. </brief_description> <description> 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 </class> <class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core"> <brief_description> + Base class for all objects affected by physics. </brief_description> <description> + PhysicsBody2D is an abstract base class for implementing a physics body. All [i]x[/i]Body2D types inherit from it. </description> <methods> <method name="set_layer_mask"> <argument index="0" name="mask" type="int"> </argument> <description> + 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. </description> </method> <method name="get_layer_mask" qualifiers="const"> <return type="int"> </return> <description> + Return the physics layer this area is in. </description> </method> <method name="set_collision_mask"> <argument index="0" name="mask" type="int"> </argument> <description> + Set the physics layers this area can scan for collisions. </description> </method> <method name="get_collision_mask" qualifiers="const"> <return type="int"> </return> <description> + Return the physics layers this area can scan for collisions. </description> </method> <method name="set_collision_mask_bit"> @@ -23391,6 +23672,7 @@ This method controls whether the position between two cached points is interpola <argument index="1" name="value" type="bool"> </argument> <description> + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. </description> </method> <method name="get_collision_mask_bit" qualifiers="const"> @@ -23399,6 +23681,7 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="bit" type="int"> </argument> <description> + Return an individual bit on the collision mask. </description> </method> <method name="set_layer_mask_bit"> @@ -23407,6 +23690,7 @@ This method controls whether the position between two cached points is interpola <argument index="1" name="value" type="bool"> </argument> <description> + Set/clear individual bits on the layer mask. This makes getting a body in/out of only one layer easier. </description> </method> <method name="get_layer_mask_bit" qualifiers="const"> @@ -23415,42 +23699,49 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="bit" type="int"> </argument> <description> + Return an individual bit on the collision mask. </description> </method> <method name="set_one_way_collision_direction"> <argument index="0" name="dir" type="Vector2"> </argument> <description> + 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. </description> </method> <method name="get_one_way_collision_direction" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the direction used for one-way collision detection. </description> </method> <method name="set_one_way_collision_max_depth"> <argument index="0" name="depth" type="float"> </argument> <description> + Set how far a body can go through this one, when it allows one-way collisions (see [method set_one_way_collision_detection]). </description> </method> <method name="get_one_way_collision_max_depth" qualifiers="const"> <return type="float"> </return> <description> + Return how far a body can go through this one, when it allows one-way collisions. </description> </method> <method name="add_collision_exception_with"> <argument index="0" name="body" type="PhysicsBody2D"> </argument> <description> + Adds a body to the collision exception list. This list contains bodies that this body will not collide with. </description> </method> <method name="remove_collision_exception_with"> <argument index="0" name="body" type="PhysicsBody2D"> </argument> <description> + Removes a body from the collision exception list. </description> </method> </methods> @@ -23988,11 +24279,11 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="area_set_monitor_callback"> - <argument index="0" name="receiver" type="RID"> + <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="method" type="Object"> + <argument index="1" name="receiver" type="Object"> </argument> - <argument index="2" name="arg2" type="String"> + <argument index="2" name="method" type="String"> </argument> <description> </description> @@ -24052,8 +24343,6 @@ This method controls whether the position between two cached points is interpola </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="arg1" type="int"> - </argument> <description> </description> </method> @@ -24598,7 +24887,7 @@ This method controls whether the position between two cached points is interpola <method name="get_process_info"> <return type="int"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="process_info" type="int"> </argument> <description> </description> @@ -24765,11 +25054,20 @@ This method controls whether the position between two cached points is interpola </constant> <constant name="AREA_PARAM_PRIORITY" value="7"> </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. + </constant> <constant name="AREA_SPACE_OVERRIDE_COMBINE" value="1"> + 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. </constant> - <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0"> + <constant name="AREA_SPACE_OVERRIDE_COMBINE_REPLACE" value="2"> + 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. + </constant> + <constant name="AREA_SPACE_OVERRIDE_REPLACE" value="3"> + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. </constant> - <constant name="AREA_SPACE_OVERRIDE_REPLACE" value="2"> + <constant name="AREA_SPACE_OVERRIDE_REPLACE_COMBINE" value="4"> + 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> @@ -25580,7 +25878,7 @@ This method controls whether the position between two cached points is interpola <method name="set_item_checked"> <argument index="0" name="idx" type="int"> </argument> - <argument index="1" name="arg1" type="bool"> + <argument index="1" name="checked" type="bool"> </argument> <description> 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. </description> </method> - <method name="get_rounded_values" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="set_val"> <argument index="0" name="value" type="float"> </argument> @@ -26321,11 +26613,17 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="set_rounded_values"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="enabled" type="bool"> </argument> <description> </description> </method> + <method name="is_rounded_values" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_exp_unit_value"> <argument index="0" name="enabled" type="bool"> </argument> @@ -26974,7 +27272,7 @@ This method controls whether the position between two cached points is interpola <argument index="1" name="capture" type="int" default="9"> </argument> <description> - 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. </description> </method> <method name="find" qualifiers="const"> @@ -27125,7 +27423,7 @@ This method controls whether the position between two cached points is interpola <method name="duplicate"> <return type="Object"> </return> - <argument index="0" name="arg0" type="bool" default="false"> + <argument index="0" name="subresources" type="bool" default="false"> </argument> <description> </description> @@ -27314,7 +27612,7 @@ This method controls whether the position between two cached points is interpola <method name="get_dependencies"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="path" type="String"> </argument> <description> </description> @@ -27322,7 +27620,7 @@ This method controls whether the position between two cached points is interpola <method name="has"> <return type="bool"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="path" type="String"> </argument> <description> </description> @@ -27408,7 +27706,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="resource" type="Resource"> </argument> - <argument index="2" name="arg2" type="int" default="0"> + <argument index="2" name="flags" type="int" default="0"> </argument> <description> 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 <description> </description> </method> + <method name="push_table"> + <argument index="0" name="columns" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_table_column_expand"> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="expand" type="bool"> + </argument> + <argument index="2" name="ratio" type="int"> + </argument> + <description> + </description> + </method> + <method name="push_cell"> + <description> + </description> + </method> <method name="pop"> <description> </description> @@ -27554,7 +27872,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="scroll_to_line"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="line" type="int"> </argument> <description> </description> @@ -27667,7 +27985,7 @@ This method controls whether the position between two cached points is interpola </constant> <constant name="LIST_DOTS" value="2"> </constant> - <constant name="ITEM_MAIN" value="0"> + <constant name="ITEM_FRAME" value="0"> </constant> <constant name="ITEM_TEXT" value="1"> </constant> @@ -27687,10 +28005,14 @@ This method controls whether the position between two cached points is interpola </constant> <constant name="ITEM_LIST" value="9"> </constant> - <constant name="ITEM_META" value="10"> + <constant name="ITEM_META" value="11"> </constant> </constants> <theme_items> + <theme_item name="table_vseparation" type="int"> + </theme_item> + <theme_item name="table_hseparation" type="int"> + </theme_item> <theme_item name="line_separation" type="int"> </theme_item> <theme_item name="default_color" type="Color"> @@ -28004,7 +28326,7 @@ This method controls whether the position between two cached points is interpola Rigid body 2D node. </brief_description> <description> - 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. </description> @@ -28027,7 +28349,7 @@ This method controls whether the position between two cached points is interpola <return type="int"> </return> <description> - Return the current body mode, see [set_mode]. + Return the current body mode, see [method set_mode]. </description> </method> <method name="set_mass"> @@ -28048,14 +28370,14 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="weight" type="float"> </argument> <description> - 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. </description> </method> <method name="get_weight" qualifiers="const"> <return type="float"> </return> <description> - Return the body mass given standard earth-weight (gravity 9.8). + Return the body weight given standard earth-weight (gravity 9.8). </description> </method> <method name="set_friction"> @@ -28076,7 +28398,7 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="bounce" type="float"> </argument> <description> - Set the body bounciness, from 0 (no bounce) to 1 (bounce). + Set the body bounciness, from 0 (no bounce) to 1 (full bounce). </description> </method> <method name="get_bounce" qualifiers="const"> @@ -28090,36 +28412,42 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="gravity_scale" type="float"> </argument> <description> + Set The gravity factor. This factor multiplies gravity intensity just for this body. </description> </method> <method name="get_gravity_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the gravity factor. </description> </method> <method name="set_linear_damp"> <argument index="0" name="linear_damp" type="float"> </argument> <description> + 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. </description> </method> <method name="get_linear_damp" qualifiers="const"> <return type="float"> </return> <description> + Return the linear damp for this body. </description> </method> <method name="set_angular_damp"> <argument index="0" name="angular_damp" type="float"> </argument> <description> + 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. </description> </method> <method name="get_angular_damp" qualifiers="const"> <return type="float"> </return> <description> + Return the angular damp for this body. </description> </method> <method name="set_linear_velocity"> @@ -28133,7 +28461,7 @@ This method controls whether the position between two cached points is interpola <return type="Vector2"> </return> <description> - 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]. </description> </method> <method name="set_angular_velocity"> @@ -28147,7 +28475,7 @@ This method controls whether the position between two cached points is interpola <return type="float"> </return> <description> - 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]. </description> </method> <method name="set_max_contacts_reported"> @@ -28161,14 +28489,14 @@ This method controls whether the position between two cached points is interpola <return type="int"> </return> <description> - 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]. </description> </method> <method name="set_use_custom_integrator"> <argument index="0" name="enable" type="bool"> </argument> <description> - 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. </description> </method> <method name="is_using_custom_integrator"> @@ -28182,7 +28510,7 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="enabled" type="bool"> </argument> <description> - 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. </description> </method> <method name="is_contact_monitor_enabled" qualifiers="const"> @@ -28196,19 +28524,22 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="mode" type="int"> </argument> <description> + 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. </description> </method> <method name="get_continuous_collision_detection_mode" qualifiers="const"> <return type="int"> </return> <description> + Return whether this body is using continuous collision detection. </description> </method> <method name="set_axis_velocity"> <argument index="0" 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). + 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. </description> </method> <method name="apply_impulse"> @@ -28217,31 +28548,35 @@ This method controls whether the position between two cached points is interpola <argument index="1" name="impulse" type="Vector2"> </argument> <description> - 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. </description> </method> <method name="set_applied_force"> <argument index="0" name="force" type="Vector2"> </argument> <description> + Set the applied force vector. This is the equivalent of pushing a box over the ground: the force applied is applied constantly. </description> </method> <method name="get_applied_force" qualifiers="const"> <return type="Vector2"> </return> <description> + Return the applied force vector. </description> </method> <method name="set_sleeping"> <argument index="0" name="sleeping" type="bool"> </argument> <description> + 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. </description> </method> <method name="is_sleeping" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the body is sleeping. </description> </method> <method name="set_can_sleep"> @@ -28249,13 +28584,14 @@ This method controls whether the position between two cached points is interpola </argument> <description> 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. </description> </method> <method name="is_able_to_sleep" qualifiers="const"> <return type="bool"> </return> <description> - 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]. </description> </method> <method name="test_motion"> @@ -28268,12 +28604,14 @@ This method controls whether the position between two cached points is interpola <argument index="2" name="result" type="Physics2DTestMotionResult" default="NULL"> </argument> <description> + 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). </description> </method> <method name="get_colliding_bodies" qualifiers="const"> <return type="Array"> </return> <description> + Return a list of the bodies colliding with this one. </description> </method> </methods> @@ -28282,7 +28620,7 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="body" type="Object"> </argument> <description> - 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. </description> </signal> <signal name="body_enter_shape"> @@ -28295,7 +28633,8 @@ This method controls whether the position between two cached points is interpola <argument index="3" name="local_shape" type="int"> </argument> <description> - 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. </description> </signal> <signal name="body_exit"> @@ -28316,26 +28655,31 @@ This method controls whether the position between two cached points is interpola </argument> <description> 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. </description> </signal> </signals> <constants> <constant name="MODE_STATIC" value="1"> - Static mode (does not move, can't be moved). + Static mode. The body behaves like a [StaticBody2D], and can only move by user code. </constant> <constant name="MODE_KINEMATIC" value="3"> + Kinematic body. The body behaves like a [KinematicBody2D], and can only move by user code. </constant> <constant name="MODE_RIGID" value="0"> - 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. </constant> <constant name="MODE_CHARACTER" value="2"> - Character body, can move but not rotate. + Character body. This behaves like a rigid body, but can not rotate. </constant> <constant name="CCD_MODE_DISABLED" value="0"> + Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. </constant> <constant name="CCD_MODE_CAST_RAY" value="1"> + Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. </constant> <constant name="CCD_MODE_CAST_SHAPE" value="2"> + Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise. </constant> </constants> </class> @@ -29276,7 +29620,7 @@ This method controls whether the position between two cached points is interpola <method name="get_nodes_in_group"> <return type="Array"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="group" type="String"> </argument> <description> </description> @@ -29881,13 +30225,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="scalar_const_node_get_value"> + <method name="scalar_const_node_get_value" qualifiers="const"> + <return type="float"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="arg2" type="float"> - </argument> <description> </description> </method> @@ -29901,13 +30245,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="vec_const_node_get_value"> + <method name="vec_const_node_get_value" qualifiers="const"> + <return type="Vector3"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="arg2" type="Vector3"> - </argument> <description> </description> </method> @@ -29921,13 +30265,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="rgb_const_node_get_value"> + <method name="rgb_const_node_get_value" qualifiers="const"> + <return type="Color"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="arg2" type="Color"> - </argument> <description> </description> </method> @@ -29941,13 +30285,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="xform_const_node_get_value"> + <method name="xform_const_node_get_value" qualifiers="const"> + <return type="Transform"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="arg2" type="Transform"> - </argument> <description> </description> </method> @@ -29961,13 +30305,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="texture_node_get_filter_size"> + <method name="texture_node_get_filter_size" qualifiers="const"> + <return type="int"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> </argument> - <argument index="2" name="arg2" type="int"> - </argument> <description> </description> </method> @@ -29981,13 +30325,13 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="texture_node_get_filter_strength"> + <method name="texture_node_get_filter_strength" qualifiers="const"> + <return type="float"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="float"> </argument> - <argument index="2" name="arg2" type="float"> - </argument> <description> </description> </method> @@ -30414,6 +30758,8 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="node_get_state" qualifiers="const"> + <return type="Variant"> + </return> <argument index="0" name="shader_type" type="int"> </argument> <argument index="1" name="id" type="int"> @@ -30676,12 +31022,14 @@ This method controls whether the position between two cached points is interpola <method name="set_shader_param"> <argument index="0" name="param" type="String"> </argument> - <argument index="1" name="value" type="var"> + <argument index="1" name="value" type="Variant"> </argument> <description> </description> </method> <method name="get_shader_param" qualifiers="const"> + <return type="Variant"> + </return> <argument index="0" name="param" type="String"> </argument> <description> @@ -30757,6 +31105,8 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="collide_and_get_contacts"> + <return type="Variant"> + </return> <argument index="0" name="local_xform" type="Matrix32"> </argument> <argument index="1" name="with_shape" type="Shape2D"> @@ -30769,6 +31119,8 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="collide_with_motion_and_get_contacts"> + <return type="Variant"> + </return> <argument index="0" name="local_xform" type="Matrix32"> </argument> <argument index="1" name="local_motion" type="Vector2"> @@ -31323,6 +31675,12 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="set_hidden"> + <argument index="0" name="hidden" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_notify_local_transform"> <argument index="0" name="enable" type="bool"> </argument> @@ -31611,7 +31969,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="play"> - <argument index="0" name="arg0" type="float" default="0"> + <argument index="0" name="offset" type="float" default="0"> </argument> <description> </description> @@ -32444,7 +32802,7 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="vel" type="Vector2"> </argument> <description> - 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. </description> </method> <method name="set_constant_angular_velocity"> @@ -32458,7 +32816,7 @@ This method controls whether the position between two cached points is interpola <return type="Vector2"> </return> <description> - 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. </description> </method> <method name="get_constant_angular_velocity" qualifiers="const"> @@ -32472,24 +32830,28 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="friction" type="float"> </argument> <description> + Set the body friction, from 0 (frictionless) to 1 (full friction). </description> </method> <method name="get_friction" qualifiers="const"> <return type="float"> </return> <description> + Return the body friction. </description> </method> <method name="set_bounce"> <argument index="0" name="bounce" type="float"> </argument> <description> + Set the body bounciness, from 0 (not bouncy) to 1 (bouncy). </description> </method> <method name="get_bounce" qualifiers="const"> <return type="float"> </return> <description> + Return the body bounciness. </description> </method> </methods> @@ -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. </description> </method> + <method name="get_available_bytes" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_big_endian"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_big_endian_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="put_8"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_u8"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_16"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_u16"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_32"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_u32"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_64"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_u64"> + <argument index="0" name="val" type="int"> + </argument> + <description> + </description> + </method> + <method name="put_float"> + <argument index="0" name="val" type="float"> + </argument> + <description> + </description> + </method> + <method name="put_double"> + <argument index="0" name="val" type="float"> + </argument> + <description> + </description> + </method> + <method name="put_utf8_string"> + <argument index="0" name="val" type="String"> + </argument> + <description> + </description> + </method> + <method name="put_var"> + <argument index="0" name="val" type="Variant"> + </argument> + <description> + </description> + </method> + <method name="get_8"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_u8"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_16"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_u16"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_32"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_u32"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_64"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_u64"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_float"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_double"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_string"> + <return type="String"> + </return> + <argument index="0" name="bytes" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_utf8_string"> + <return type="String"> + </return> + <argument index="0" name="bytes" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_var"> + <return type="Variant"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -32671,7 +33205,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="play"> - <argument index="0" name="arg0" type="float" default="0"> + <argument index="0" name="offset" type="float" default="0"> </argument> <description> </description> @@ -33350,9 +33884,9 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="draw" qualifiers="const"> - <argument index="0" name="arg0" type="RID"> + <argument index="0" name="canvas_item" type="RID"> </argument> - <argument index="1" name="arg1" type="Rect2"> + <argument index="1" name="rect" type="Rect2"> </argument> <description> </description> @@ -33505,7 +34039,7 @@ This method controls whether the position between two cached points is interpola <method name="get_expand_margin_size" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="margin" type="int"> </argument> <description> 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 <method name="get_margin_size" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="margin" type="int"> </argument> <description> </description> @@ -33562,7 +34096,7 @@ This method controls whether the position between two cached points is interpola <method name="get_expand_margin_size" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="margin" type="int"> </argument> <description> </description> @@ -34033,6 +34567,14 @@ This method controls whether the position between two cached points is interpola </theme_item> <theme_item name="font_color_fg" type="Color"> </theme_item> + <theme_item name="increment_hilite" type="Texture"> + </theme_item> + <theme_item name="decrement_hilite" type="Texture"> + </theme_item> + <theme_item name="increment" type="Texture"> + </theme_item> + <theme_item name="decrement" type="Texture"> + </theme_item> <theme_item name="font" type="Font"> </theme_item> <theme_item name="tab_fg" type="StyleBox"> @@ -34096,7 +34638,7 @@ This method controls whether the position between two cached points is interpola <method name="get_line" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="line" type="int"> </argument> <description> Return the text of a specific line. @@ -34105,7 +34647,7 @@ This method controls whether the position between two cached points is interpola <method name="cursor_set_column"> <argument index="0" name="column" type="int"> </argument> - <argument index="1" name="arg1" type="bool"> + <argument index="1" name="adjust_viewport" type="bool" default="false"> </argument> <description> </description> @@ -34113,7 +34655,7 @@ This method controls whether the position between two cached points is interpola <method name="cursor_set_line"> <argument index="0" name="line" type="int"> </argument> - <argument index="1" name="arg1" type="bool"> + <argument index="1" name="adjust_viewport" type="bool" default="false"> </argument> <description> </description> @@ -34455,7 +34997,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="2" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> - <argument index="3" name="arg3" type="bool" default="false"> + <argument index="3" name="transpose" type="bool" default="false"> </argument> <description> </description> @@ -34469,7 +35011,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="3" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> - <argument index="4" name="arg4" type="bool" default="false"> + <argument index="4" name="transpose" type="bool" default="false"> </argument> <description> </description> @@ -34483,7 +35025,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="3" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> - <argument index="4" name="arg4" type="bool" default="false"> + <argument index="4" name="transpose" type="bool" default="false"> </argument> <description> </description> @@ -34558,7 +35100,7 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="set_scale"> + <method name="set_texture_scale"> <argument index="0" name="scale" type="Vector2"> </argument> <description> @@ -34606,7 +35148,7 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> - <method name="get_scale" qualifiers="const"> + <method name="get_texture_scale" qualifiers="const"> <return type="Vector2"> </return> <description> @@ -34828,7 +35370,7 @@ This method controls whether the position between two cached points is interpola <method name="get_icon_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -34874,7 +35416,7 @@ This method controls whether the position between two cached points is interpola <method name="get_stylebox_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -34920,7 +35462,7 @@ This method controls whether the position between two cached points is interpola <method name="get_font_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -34966,7 +35508,7 @@ This method controls whether the position between two cached points is interpola <method name="get_color_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -35012,7 +35554,7 @@ This method controls whether the position between two cached points is interpola <method name="get_constant_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -35032,7 +35574,7 @@ This method controls whether the position between two cached points is interpola <method name="get_type_list" qualifiers="const"> <return type="StringArray"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="type" type="String"> </argument> <description> </description> @@ -35078,6 +35620,16 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="wait_to_finish"> + <return type="Variant"> + </return> + <description> + </description> + </method> + <method name="set_name"> + <return type="Error"> + </return> + <argument index="0" name="name" type="String"> + </argument> <description> </description> </method> @@ -35317,6 +35869,18 @@ This method controls whether the position between two cached points is interpola Return the collision bounce parameter. </description> </method> + <method name="set_occluder_light_mask"> + <argument index="0" name="mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_occluder_light_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="set_cell"> <argument index="0" name="x" type="int"> </argument> @@ -36182,19 +36746,19 @@ This method controls whether the position between two cached points is interpola <method name="translate" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="message" type="String"> </argument> <description> </description> </method> <method name="add_translation"> - <argument index="0" name="arg0" type="Object"> + <argument index="0" name="translation" type="Translation"> </argument> <description> </description> </method> <method name="remove_translation"> - <argument index="0" name="arg0" type="Object"> + <argument index="0" name="translation" type="Translation"> </argument> <description> </description> @@ -36232,17 +36796,17 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="set_column_min_width"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="column" type="int"> </argument> - <argument index="1" name="arg1" type="int"> + <argument index="1" name="min_width" type="int"> </argument> <description> </description> </method> <method name="set_column_expand"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="column" type="int"> </argument> - <argument index="1" name="arg1" type="bool"> + <argument index="1" name="expand" type="bool"> </argument> <description> </description> @@ -36250,13 +36814,13 @@ This method controls whether the position between two cached points is interpola <method name="get_column_width" qualifiers="const"> <return type="int"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="column" type="int"> </argument> <description> </description> </method> <method name="set_hide_root"> - <argument index="0" name="arg0" type="bool"> + <argument index="0" name="enable" type="bool"> </argument> <description> </description> @@ -36716,6 +37280,8 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="remove_child"> + <return type="TreeItem"> + </return> <argument index="0" name="child" type="Object"> </argument> <description> @@ -36814,7 +37380,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="button" type="Texture"> </argument> - <argument index="2" name="arg2" type="int"> + <argument index="2" name="button_idx" type="int"> </argument> <description> </description> @@ -37338,7 +37904,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="property" type="String"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -37348,7 +37914,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="property" type="String"> </argument> - <argument index="2" name="value" type="var"> + <argument index="2" name="value" type="Variant"> </argument> <description> </description> @@ -38376,6 +38942,12 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="get_video_texutre"> + <return type="Texture"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -38706,7 +39278,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="set_render_target_to_screen_rect"> - <argument index="0" name="arg0" type="Rect2"> + <argument index="0" name="rect" type="Rect2"> </argument> <description> </description> @@ -40178,6 +40750,14 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="canvas_item_set_z"> + <argument index="0" name="arg0" type="RID"> + </argument> + <argument index="1" name="arg1" type="int"> + </argument> + <description> + </description> + </method> <method name="canvas_item_add_line"> <argument index="0" name="arg0" type="RID"> </argument> @@ -40623,6 +41203,8 @@ This method controls whether the position between two cached points is interpola </description> <methods> <method name="get_ref" qualifiers="const"> + <return type="Object"> + </return> <description> </description> </method> @@ -40834,7 +41416,7 @@ This method controls whether the position between two cached points is interpola <method name="get_attribute_name" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="idx" type="int"> </argument> <description> </description> @@ -40842,7 +41424,7 @@ This method controls whether the position between two cached points is interpola <method name="get_attribute_value" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="idx" type="int"> </argument> <description> </description> @@ -40850,7 +41432,7 @@ This method controls whether the position between two cached points is interpola <method name="has_attribute" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="name" type="String"> </argument> <description> </description> @@ -40858,7 +41440,7 @@ This method controls whether the position between two cached points is interpola <method name="get_named_attribute_value" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="name" type="String"> </argument> <description> </description> @@ -40866,7 +41448,7 @@ This method controls whether the position between two cached points is interpola <method name="get_named_attribute_value_safe" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="arg0" type="String"> + <argument index="0" name="name" type="String"> </argument> <description> </description> @@ -40890,7 +41472,7 @@ This method controls whether the position between two cached points is interpola <method name="seek"> <return type="int"> </return> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="pos" type="int"> </argument> <description> </description> diff --git a/drivers/chibi/cp_loader_mod.cpp b/drivers/chibi/cp_loader_mod.cpp index 98174ff9b1..6340a6f5ea 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;s<len;s++) { uint8_t d=file->get_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 c21f7bdd38..073f35791c 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;c<chans;c++) { for (int i=0;i<sample_size;i++) { if (data_is_16bits) { @@ -206,7 +210,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) { s-=32768; //toggle sign int16_t *v=(int16_t*)&s; - sm->set_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 8bde6b673e..66f36954ce 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 e94930fffb..201b1262b5 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 5682a5667e..5532e28ade 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 b7bcd44783..1c18ebd855 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 5081d5cd4d..4d6b4f0164 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 7e09653ebc..f0f450231d 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 66391ffa7e..4dca79fd55 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;i<ScriptServer::get_language_count();i++) { + ScriptServer::get_language(i)->add_global_constant(name,n); + } + } + + } } diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index a62225f663..7b07010529 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<int> 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<int> 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;i<p_class->functions.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;i<p_class->variables.size();i++) { diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index bdf4e9816a..ea3e7c8b69 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 381edcba50..6255cfd86a 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<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + for(List<PropertyInfo>::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<Script> scr; + if (ScriptCodeCompletionCache::get_sigleton()) + scr = ScriptCodeCompletionCache::get_sigleton()->get_cached_resource(script); + else + scr = ResourceLoader::load(script); + + + r_type.obj_type="Node"; + r_type.type=Variant::OBJECT; + r_type.script=scr; + r_type.value=Variant(); + + return true; + + } + } + } + + } + + //global for(Map<StringName,int>::Element *E=GDScriptLanguage::get_singleton()->get_global_map().front();E;E=E->next()) { if (E->key()==p_identifier) { @@ -1336,6 +1382,24 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl result.insert(_type_names[i]); } + //autoload singletons + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + + for(List<PropertyInfo>::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); + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + result.insert(name); + } + + } + + for(const Map<StringName,int>::Element *E=GDScriptLanguage::get_singleton()->get_global_map().front();E;E=E->next()) { result.insert(E->key().operator String()); } diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 4339a13edf..64b7f26e92 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -75,20 +75,28 @@ bool GDParser::_enter_indent_block(BlockNode* p_block) { if (tokenizer->get_token()!=GDTokenizer::TK_NEWLINE) { - _set_error("newline expected after ':'."); - return false; + // be more python-like + int current = tab_level.back()->get(); + tab_level.push_back(current+1); + return true; + //_set_error("newline expected after ':'."); + //return false; } while(true) { if (tokenizer->get_token()!=GDTokenizer::TK_NEWLINE) { + print_line("no newline"); return false; //wtf } else if (tokenizer->get_token(1)!=GDTokenizer::TK_NEWLINE) { int indent = tokenizer->get_token_line_indent(); int current = tab_level.back()->get(); - if (indent<=current) + if (indent<=current) { + print_line("current: "+itos(current)+" indent: "+itos(indent)); + print_line("less than current"); return false; + } tab_level.push_back(indent); tokenizer->advance(); @@ -1588,6 +1596,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_if->body); if (!_enter_indent_block(cf_if->body)) { + _set_error("Expected intended block after 'if'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1647,6 +1656,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { if (!_enter_indent_block(cf_if->body)) { + _set_error("Expected indented block after 'elif'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1661,7 +1671,6 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { } else if (tokenizer->get_token()==GDTokenizer::TK_CF_ELSE) { if (tab_level.back()->get() > indent_level) { - _set_error("Invalid indent"); return; } @@ -1673,6 +1682,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_if->body_else); if (!_enter_indent_block(cf_if->body_else)) { + _set_error("Expected indented block after 'else'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1713,6 +1723,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_while->body); if (!_enter_indent_block(cf_while->body)) { + _set_error("Expected indented block after 'while'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1764,6 +1775,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_for->body); if (!_enter_indent_block(cf_for->body)) { + _set_error("Expected indented block after 'while'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1850,6 +1862,17 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { return; } } break; + case GDTokenizer::TK_PR_BREAKPOINT: { + + tokenizer->advance(); + BreakpointNode *bn = alloc_node<BreakpointNode>(); + p_block->statements.push_back(bn); + + if (!_end_statement()) { + _set_error("Expected end of statement after breakpoint."); + return; + } + } break; default: { Node *expression = _parse_and_reduce_expression(p_block,p_static,false,true); @@ -2058,6 +2081,8 @@ void GDParser::_parse_class(ClassNode *p_class) { ClassNode *newclass = alloc_node<ClassNode>(); newclass->initializer = alloc_node<BlockNode>(); newclass->initializer->parent_class=newclass; + newclass->ready = alloc_node<BlockNode>(); + newclass->ready->parent_class=newclass; newclass->name=name; newclass->owner=p_class; @@ -2767,6 +2792,17 @@ void GDParser::_parse_class(ClassNode *p_class) { } }; //fallthrough to var + case GDTokenizer::TK_PR_ONREADY: { + + if (token==GDTokenizer::TK_PR_ONREADY) { + //may be fallthrough from export, ignore if so + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) { + _set_error("Expected 'var'."); + return; + } + } + }; //fallthrough to var case GDTokenizer::TK_PR_VAR: { //variale declaration and (eventual) initialization @@ -2777,6 +2813,8 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export=PropertyInfo(); } + bool onready = tokenizer->get_token(-1)==GDTokenizer::TK_PR_ONREADY; + tokenizer->advance(); if (tokenizer->get_token()!=GDTokenizer::TK_IDENTIFIER) { @@ -2807,6 +2845,21 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } + //discourage common error + if (!onready && subexpr->type==Node::TYPE_OPERATOR) { + + OperatorNode *op=static_cast<OperatorNode*>(subexpr); + if (op->op==OperatorNode::OP_CALL && op->arguments[0]->type==Node::TYPE_SELF && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + IdentifierNode *id=static_cast<IdentifierNode*>(op->arguments[1]); + if (id->name=="get_node") { + + _set_error("Use 'onready var "+String(member.identifier)+" = get_node(..)' instead"); + return; + + } + } + } + member.expression=subexpr; if (autoexport) { @@ -2853,12 +2906,19 @@ void GDParser::_parse_class(ClassNode *p_class) { op->arguments.push_back(id); op->arguments.push_back(subexpr); + #ifdef DEBUG_ENABLED NewLineNode *nl = alloc_node<NewLineNode>(); nl->line=line; - p_class->initializer->statements.push_back(nl); + if (onready) + p_class->ready->statements.push_back(nl); + else + p_class->initializer->statements.push_back(nl); #endif - p_class->initializer->statements.push_back(op); + if (onready) + p_class->ready->statements.push_back(op); + else + p_class->initializer->statements.push_back(op); @@ -3009,6 +3069,8 @@ Error GDParser::_parse(const String& p_base_path) { ClassNode *main_class = alloc_node<ClassNode>(); main_class->initializer = alloc_node<BlockNode>(); main_class->initializer->parent_class=main_class; + main_class->ready = alloc_node<BlockNode>(); + main_class->ready->parent_class=main_class; current_class=main_class; _parse_class(main_class); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 04f3dff3de..143c5f20eb 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -54,6 +54,7 @@ public: TYPE_CONTROL_FLOW, TYPE_LOCAL_VAR, TYPE_ASSERT, + TYPE_BREAKPOINT, TYPE_NEWLINE, }; @@ -105,6 +106,7 @@ public: Vector<FunctionNode*> static_functions; Vector<Signal> _signals; BlockNode *initializer; + BlockNode *ready; ClassNode *owner; //Vector<Node*> initializers; int end_line; @@ -275,6 +277,10 @@ public: AssertNode() { type=TYPE_ASSERT; } }; + struct BreakpointNode : public Node { + BreakpointNode() { type=TYPE_BREAKPOINT; } + }; + struct NewLineNode : public Node { NewLineNode() { type=TYPE_NEWLINE; } }; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 62006cf18b..1c19328fe8 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1077,6 +1077,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a ip+=2; } continue; + case OPCODE_BREAKPOINT: { +#ifdef DEBUG_ENABLED + if (ScriptDebugger::get_singleton()) { + GDScriptLanguage::get_singleton()->debug_break("Breakpoint Statement",true); + } +#endif + ip+=1; + } continue; case OPCODE_LINE: { CHECK_SPACE(2); @@ -2570,6 +2578,12 @@ void GDScriptLanguage::_add_global(const StringName& p_name,const Variant& p_val _global_array=global_array.ptr(); } +void GDScriptLanguage::add_global_constant(const StringName& p_variable,const Variant& p_value) { + + _add_global(p_variable,p_value); +} + + void GDScriptLanguage::init() { @@ -2646,6 +2660,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { "elif", "enum", "extends" , + "onready", "for" , "func" , "if" , @@ -2665,6 +2680,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { "or", "export", "assert", + "breakpoint", "yield", "static", "float", diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 3d16b59065..6fea204704 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -71,6 +71,7 @@ public: OPCODE_ITERATE_BEGIN, OPCODE_ITERATE, OPCODE_ASSERT, + OPCODE_BREAKPOINT, OPCODE_LINE, OPCODE_END }; @@ -529,6 +530,7 @@ public: virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint); virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; + virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); /* DEBUGGER FUNCTIONS */ diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index e445701669..39c7f3cfc4 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -98,6 +98,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "assert", "yield", "signal", +"breakpoint", "'['", "']'", "'{'", @@ -851,6 +852,7 @@ void GDTokenizerText::_advance() { {TK_PR_FUNCTION,"function"}, {TK_PR_CLASS,"class"}, {TK_PR_EXTENDS,"extends"}, + {TK_PR_ONREADY,"onready"}, {TK_PR_TOOL,"tool"}, {TK_PR_STATIC,"static"}, {TK_PR_EXPORT,"export"}, @@ -860,6 +862,7 @@ void GDTokenizerText::_advance() { {TK_PR_ASSERT,"assert"}, {TK_PR_YIELD,"yield"}, {TK_PR_SIGNAL,"signal"}, + {TK_PR_BREAKPOINT,"breakpoint"}, {TK_PR_CONST,"const"}, //controlflow {TK_CF_IF,"if"}, @@ -1040,7 +1043,7 @@ void GDTokenizerText::advance(int p_amount) { ////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BYTECODE_VERSION 5 +#define BYTECODE_VERSION 7 Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) { diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index d6bd63c5b8..96dd7ed20b 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -95,6 +95,7 @@ public: TK_PR_FUNCTION, TK_PR_CLASS, TK_PR_EXTENDS, + TK_PR_ONREADY, TK_PR_TOOL, TK_PR_STATIC, TK_PR_EXPORT, @@ -105,6 +106,7 @@ public: TK_PR_ASSERT, TK_PR_YIELD, TK_PR_SIGNAL, + TK_PR_BREAKPOINT, TK_BRACKET_OPEN, TK_BRACKET_CLOSE, TK_CURLY_BRACKET_OPEN, diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index ad7c392cd0..423c272ee7 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -1096,7 +1096,7 @@ void GridMap::_bind_methods() { // ObjectTypeDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants); ObjectTypeDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback); - ObjectTypeDB::bind_method(_MD("resource_changed"),&GridMap::resource_changed); + ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed); ObjectTypeDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x); ObjectTypeDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x); diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 137fcc56f5..9472f05e16 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -59,11 +59,11 @@ def configure(env): import string if (env["bits"]=="64"): #env['CCFLAGS'] = string.split('-arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -miphoneos-version-min=5.1.1 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-invalid-offsetof -ffast-math -m64 -DDEBUG -D_DEBUG -MMD -MT dependencies -isysroot $IPHONESDK') - env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) else: - env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') if (env["bits"]=="64"): env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1', @@ -116,12 +116,12 @@ def configure(env): if (env["target"]=="release"): - env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall']) - env.Append(LINKFLAGS=['-O3', '-ffast-math']) + env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math + env.Append(LINKFLAGS=['-O3']) # elif env["target"] == "release_debug": - env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) - env.Append(LINKFLAGS=['-Os', '-ffast-math']) + env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) + env.Append(LINKFLAGS=['-Os']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) elif (env["target"]=="debug"): @@ -131,7 +131,7 @@ def configure(env): elif (env["target"]=="profile"): - env.Append(CCFLAGS=['-g','-pg', '-Os', '-ffast-math']) + env.Append(CCFLAGS=['-g','-pg', '-Os']) env.Append(LINKFLAGS=['-pg']) diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index a2c6740eaf..fbd5d2e1c0 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -33,7 +33,7 @@ void AudioServerJavascript::sample_set_description(RID p_sample, const String& p } -String AudioServerJavascript::sample_get_description(RID p_sample, const String& p_description) const{ +String AudioServerJavascript::sample_get_description(RID p_sample) const{ return String(); } diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index 450237d324..1dc90c48ee 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -95,7 +95,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length); virtual void sample_set_description(RID p_sample, const String& p_description); - virtual String sample_get_description(RID p_sample, const String& p_description) const; + virtual String sample_get_description(RID p_sample) const; virtual SampleFormat sample_get_format(RID p_sample) const; virtual bool sample_is_stereo(RID p_sample) const; diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index ec21bf6ee4..0a6c8b1457 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -80,7 +80,7 @@ def configure(env): env.opus_fixed_point="yes" env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti']) - env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) + env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) env.Append(CPPFLAGS=['-DGLES2_ENABLED']) env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS']) env.Append(CPPFLAGS=['-s','ASM_JS=1']) @@ -98,3 +98,10 @@ def configure(env): #print "CCCOM is:", env.subst('$CCCOM') #print "P: ", env['p'], " Platofrm: ", env['platform'] + + import methods + + env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp index 68364ea8d5..bda092de53 100644 --- a/platform/windows/joystick.cpp +++ b/platform/windows/joystick.cpp @@ -100,6 +100,13 @@ int joystick_windows::check_free_joy_slot() const { // adapted from SDL2, works a lot better than the MSDN version bool joystick_windows::is_xinput_device(const GUID *p_guid) { + static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + + if (p_guid == &IID_ValveStreamingGamepad || p_guid == &IID_X360WiredGamepad || p_guid == &IID_X360WirelessGamepad) + return true; + PRAWINPUTDEVICELIST dev_list = NULL; unsigned int dev_list_count = 0; @@ -144,7 +151,7 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { return false; d_joysticks[joystick_count] = dinput_gamepad(); - dinput_gamepad* joy = &d_joysticks[num]; + dinput_gamepad* joy = &d_joysticks[joystick_count]; const DWORD devtype = (instance->dwDevType & 0xFF); @@ -168,7 +175,8 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); - id_to_change = num; + id_to_change = joystick_count; + joy->di_joy->SetDataFormat(&c_dfDIJoystick2); joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND); joy->di_joy->EnumObjects(objectsCallback, this, NULL); @@ -218,7 +226,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i dinput_gamepad &joy = d_joysticks[p_joy_id]; - res = joy.di_joy->SetProperty(DIPROP_RANGE, &prop_range.diph); + res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph); if (FAILED(res)) return; @@ -365,13 +373,13 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { IDirectInputDevice8_Acquire(joy->di_joy); joy->di_joy->Poll(); } - if (FAILED(hr = d_joysticks[i].di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { + if (FAILED(hr = joy->di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { //printf("failed to read joy #%d\n", i); continue; } - p_last_id = post_hat(p_last_id, i, js.rgdwPOV[0]); + p_last_id = post_hat(p_last_id, joy->id, js.rgdwPOV[0]); for (int j = 0; j < 128; j++) { @@ -379,7 +387,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (!joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, true); + p_last_id = input->joy_button(p_last_id, joy->id, j, true); joy->last_buttons[j] = true; } } @@ -387,7 +395,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, false); + p_last_id = input->joy_button(p_last_id, joy->id, j, false); joy->last_buttons[j] = false; } } @@ -402,7 +410,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { for (int k=0; k<count; k++) { if (joy->joy_axis[j] == axes[k]) { - p_last_id = input->joy_axis(p_last_id, i, j, axis_correct(values[k])); + p_last_id = input->joy_axis(p_last_id, joy->id, j, axis_correct(values[k])); break; }; }; diff --git a/platform/x11/detect.py b/platform/x11/detect.py index c93905ed3c..0226c8b8c0 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -45,10 +45,6 @@ def can_build(): print("xinerama not found.. x11 disabled.") return False - x11_error=os.system("pkg-config libevdev --modversion > /dev/null ") - if (x11_error): - print("evdev not found.. x11 disabled.") - return False return True # X11 enabled @@ -133,7 +129,6 @@ def configure(env): env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xcursor --cflags --libs') - env.ParseConfig('pkg-config libevdev --cflags --libs') if (env["openssl"]=="yes"): env.ParseConfig('pkg-config openssl --cflags --libs') @@ -155,7 +150,18 @@ def configure(env): env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) if platform.system() == 'Linux': env.Append(CPPFLAGS=["-DALSA_ENABLED"]) - env.Append(LIBS=['asound', 'udev']) + env.Append(LIBS=['asound']) + + if not os.system("pkg-config --exists libudev"): + if not os.system("pkg-config --exists libevdev"): + print("Enabling udev/evdev") + env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) + env.ParseConfig('pkg-config libudev --cflags --libs') + env.ParseConfig('pkg-config libevdev --cflags --libs') + else: + print("libevdev development libraries not found, disabling gamepad support") + else: + print("libudev development libraries not found, disabling gamepad support") if (env["pulseaudio"]=="yes"): if not os.system("pkg-config --exists libpulse-simple"): diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp index e50916d2c2..cc806f6f78 100644 --- a/platform/x11/joystick_linux.cpp +++ b/platform/x11/joystick_linux.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ //author: Andreas Haas <hondres, liugam3@gmail.com> -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "joystick_linux.h" #include "print_string.h" diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h index 339a5f239d..1064a6f841 100644 --- a/platform/x11/joystick_linux.h +++ b/platform/x11/joystick_linux.h @@ -30,7 +30,7 @@ //author: Andreas Haas <hondres, liugam3@gmail.com> #ifndef JOYSTICK_LINUX_H #define JOYSTICK_LINUX_H -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "main/input_default.h" #include "os/thread.h" #include "os/mutex.h" diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d23994edd7..0afab6442b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -426,7 +426,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi physics_2d_server->init(); input = memnew( InputDefault ); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick = memnew( joystick_linux(input)); #endif _ensure_data_dir(); @@ -461,7 +461,7 @@ void OS_X11::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED memdelete(joystick); #endif memdelete(input); @@ -1753,7 +1753,7 @@ void OS_X11::run() { while (!force_quit) { process_xevents(); // get rid of pending events -#ifdef __linux__ +#ifdef JOYDEV_ENABLED event_id = joystick->process_joysticks(event_id); #endif if (Main::iteration()==true) diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 02518189e0..eee3e40136 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -126,7 +126,7 @@ class OS_X11 : public OS_Unix { InputDefault *input; -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick_linux *joystick; #endif diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index c44b46adbf..5038752b22 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -652,7 +652,7 @@ void Area2D::_bind_methods() { ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"))); - ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); + ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Combine-Replace,Replace,Replace-Combine"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector")); diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index f5a88390e7..2b74655109 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -40,7 +40,9 @@ public: enum SpaceOverride { SPACE_OVERRIDE_DISABLED, SPACE_OVERRIDE_COMBINE, - SPACE_OVERRIDE_REPLACE + SPACE_OVERRIDE_COMBINE_REPLACE, + SPACE_OVERRIDE_REPLACE, + SPACE_OVERRIDE_REPLACE_COMBINE }; private: diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index b7b99f935a..d1cc8bbcc4 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -503,7 +503,7 @@ void Camera2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_camera_pos"),&Camera2D::get_camera_pos); ObjectTypeDB::bind_method(_MD("get_camera_screen_center"),&Camera2D::get_camera_screen_center); - ObjectTypeDB::bind_method(_MD("set_zoom"),&Camera2D::set_zoom); + ObjectTypeDB::bind_method(_MD("set_zoom","zoom"),&Camera2D::set_zoom); ObjectTypeDB::bind_method(_MD("get_zoom"),&Camera2D::get_zoom); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 275e4d0304..b1ad50a1b1 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -773,7 +773,7 @@ void CanvasItem::draw_set_transform(const Point2& p_offset, float p_rot, const S Matrix32 xform(p_rot,p_offset); xform.scale_basis(p_scale); - VisualServer::get_singleton()->canvas_item_set_transform(canvas_item,xform); + VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item,xform); } void CanvasItem::draw_polygon(const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs, Ref<Texture> p_texture) { @@ -1080,7 +1080,7 @@ void CanvasItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("draw_line","from","to","color","width"),&CanvasItem::draw_line,DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("draw_rect","rect","color"),&CanvasItem::draw_rect); ObjectTypeDB::bind_method(_MD("draw_circle","pos","radius","color"),&CanvasItem::draw_circle); - ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos"),&CanvasItem::draw_texture); + ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos","modulate"),&CanvasItem::draw_texture,DEFVAL(Color(1,1,1,1))); ObjectTypeDB::bind_method(_MD("draw_texture_rect","texture:Texture","rect","tile","modulate","transpose"),&CanvasItem::draw_texture_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_texture_rect_region","texture:Texture","rect","src_rect","modulate","transpose"),&CanvasItem::draw_texture_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_style_box","style_box:StyleBox","rect"),&CanvasItem::draw_style_box); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 4c0386b953..b96267f967 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -197,7 +197,7 @@ public: void set_blend_mode(BlendMode p_blend_mode); BlendMode get_blend_mode() const; - void set_light_mask(int p_light_mask); + virtual void set_light_mask(int p_light_mask); int get_light_mask() const; void set_opacity(float p_opacity); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 616d3da7c9..354d54b69f 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -257,10 +257,10 @@ void CollisionPolygon2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon2D::set_polygon); ObjectTypeDB::bind_method(_MD("get_polygon"),&CollisionPolygon2D::get_polygon); - ObjectTypeDB::bind_method(_MD("set_build_mode"),&CollisionPolygon2D::set_build_mode); + ObjectTypeDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon2D::set_build_mode); ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon2D::get_build_mode); - ObjectTypeDB::bind_method(_MD("set_trigger"),&CollisionPolygon2D::set_trigger); + ObjectTypeDB::bind_method(_MD("set_trigger","trigger"),&CollisionPolygon2D::set_trigger); ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionPolygon2D::is_trigger); ObjectTypeDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon2D::_set_shape_range); diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index adb2904a0a..cb2209071a 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -164,11 +164,17 @@ void PinJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_tree() && get_tree()->is_editor_hint()) { - draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(0,-10),Point2(0,+10),Color(0.7,0.6,0.0,0.5),3); + if (!is_inside_tree()) + break; + + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + break; } + + + draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(0,-10),Point2(0,+10),Color(0.7,0.6,0.0,0.5),3); } break; } @@ -241,13 +247,17 @@ void GrooveJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_tree() && get_tree()->is_editor_hint()) { + if (!is_inside_tree()) + break; - draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(-10,initial_offset),Point2(+10,initial_offset),Color(0.8,0.8,0.9,0.5),5); + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + break; } + + draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(-10,initial_offset),Point2(+10,initial_offset),Color(0.8,0.8,0.9,0.5),5); } break; } } @@ -339,12 +349,17 @@ void DampedSpringJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_tree() && get_tree()->is_editor_hint()) { - draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); - draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3); + if (!is_inside_tree()) + break; + + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + break; } + + draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); + draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3); } break; } } diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 792f079ab0..4c00d8cec9 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -273,7 +273,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) { if (navpoly.is_valid()) { - nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this); + nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this); } } @@ -309,7 +309,7 @@ void NavigationPolygonInstance::_notification(int p_what) { if (enabled && navpoly.is_valid()) { - nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this); + nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this); } break; } @@ -321,7 +321,7 @@ void NavigationPolygonInstance::_notification(int p_what) { case NOTIFICATION_TRANSFORM_CHANGED: { if (navigation && nav_id!=-1) { - navigation->navpoly_set_transform(nav_id,get_relative_transform(navigation)); + navigation->navpoly_set_transform(nav_id,get_relative_transform_to_parent(navigation)); } } break; @@ -409,7 +409,7 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg } if (navigation && navpoly.is_valid() && enabled) { - nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this); + nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this); } //update_gizmo(); _change_notify("navpoly"); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 52b112f090..0683d31fc6 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -333,17 +333,18 @@ int Node2D::get_z() const{ return z; } -Matrix32 Node2D::get_relative_transform(const Node *p_parent) const { +Matrix32 Node2D::get_relative_transform_to_parent(const Node *p_parent) const { if (p_parent==this) return Matrix32(); Node2D *parent_2d = get_parent()->cast_to<Node2D>(); + ERR_FAIL_COND_V(!parent_2d,Matrix32()); if (p_parent==parent_2d) return get_transform(); else - return parent_2d->get_relative_transform(p_parent) * get_transform(); + return parent_2d->get_relative_transform_to_parent(p_parent) * get_transform(); } @@ -394,9 +395,9 @@ void Node2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_z_as_relative","enable"),&Node2D::set_z_as_relative); ObjectTypeDB::bind_method(_MD("is_z_relative"),&Node2D::is_z_relative); - ObjectTypeDB::bind_method(_MD("edit_set_pivot"),&Node2D::edit_set_pivot); + ObjectTypeDB::bind_method(_MD("edit_set_pivot","pivot"),&Node2D::edit_set_pivot); - ObjectTypeDB::bind_method(_MD("get_relative_transform"),&Node2D::get_relative_transform); + ObjectTypeDB::bind_method(_MD("get_relative_transform_to_parent","parent"),&Node2D::get_relative_transform_to_parent); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 8efce33cda..a964a6ae34 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -99,7 +99,7 @@ public: void set_z_as_relative(bool p_enabled); bool is_z_relative() const; - Matrix32 get_relative_transform(const Node *p_parent) const; + Matrix32 get_relative_transform_to_parent(const Node *p_parent) const; diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 8bb4eb55ba..fc38a55cdf 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -193,7 +193,7 @@ void ParallaxBackground::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_limit_begin"),&ParallaxBackground::get_limit_begin); ObjectTypeDB::bind_method(_MD("set_limit_end","ofs"),&ParallaxBackground::set_limit_end); ObjectTypeDB::bind_method(_MD("get_limit_end"),&ParallaxBackground::get_limit_end); - ObjectTypeDB::bind_method(_MD("set_ignore_camera_zoom"), &ParallaxBackground::set_ignore_camera_zoom); + ObjectTypeDB::bind_method(_MD("set_ignore_camera_zoom","ignore"), &ParallaxBackground::set_ignore_camera_zoom); ObjectTypeDB::bind_method(_MD("is_ignore_camera_zoom"), &ParallaxBackground::is_ignore_camera_zoom); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 8f805ceba2..2373af9d0c 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -994,6 +994,15 @@ DVector<Vector2> Particles2D::get_emission_points() const{ return emission_points; } +void Particles2D::reset() { + + for(int i=0;i<particles.size();i++) { + particles[i].active=false; + } + time=0; + active_count=0; +} + void Particles2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_emitting","active"),&Particles2D::set_emitting); @@ -1057,6 +1066,7 @@ void Particles2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_color_phase_pos","phase"),&Particles2D::get_color_phase_pos); ObjectTypeDB::bind_method(_MD("pre_process","time"),&Particles2D::pre_process); + ObjectTypeDB::bind_method(_MD("reset"),&Particles2D::reset); ObjectTypeDB::bind_method(_MD("set_use_local_space","enable"),&Particles2D::set_use_local_space); ObjectTypeDB::bind_method(_MD("is_using_local_space"),&Particles2D::is_using_local_space); diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 4ee0fcf8da..77543a9125 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -248,6 +248,7 @@ public: DVector<Vector2> get_emission_points() const; void pre_process(float p_delta); + void reset(); Particles2D(); }; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 8f110b3931..c14f5ec63e 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -31,9 +31,13 @@ void Path2D::_notification(int p_what) { - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_tree() && get_tree()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid()) { //draw the curve!! + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) { + return; + } + for(int i=0;i<curve->get_point_count();i++) { Vector2 prev_p=curve->get_point_pos(i); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 1d48a9c8a0..1cba29f351 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -118,7 +118,7 @@ void TileMap::_update_quadrant_transform() { Matrix32 nav_rel; if (navigation) - nav_rel = get_relative_transform(navigation); + nav_rel = get_relative_transform_to_parent(navigation); for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) { @@ -261,7 +261,7 @@ void TileMap::_update_dirty_quadrants() { Vector2 tcenter = cell_size/2; Matrix32 nav_rel; if (navigation) - nav_rel = get_relative_transform(navigation); + nav_rel = get_relative_transform_to_parent(navigation); Vector2 qofs; @@ -333,6 +333,8 @@ void TileMap::_update_dirty_quadrants() { Matrix32 xform; xform.set_origin( q.pos ); vs->canvas_item_set_transform( canvas_item, xform ); + vs->canvas_item_set_light_mask(canvas_item,get_light_mask()); + q.canvas_items.push_back(canvas_item); if (debug_shapes) { @@ -1105,7 +1107,16 @@ int TileMap::get_occluder_light_mask() const{ return occluder_light_mask; } +void TileMap::set_light_mask(int p_light_mask) { + + CanvasItem::set_light_mask(p_light_mask); + for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) { + for (List<RID>::Element *F=E->get().canvas_items.front();F;F=F->next()) { + VisualServer::get_singleton()->canvas_item_set_light_mask(F->get(),get_light_mask()); + } + } +} void TileMap::_bind_methods() { diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 4676d1ef7a..fdf760483d 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -253,6 +253,8 @@ public: void set_occluder_light_mask(int p_mask); int get_occluder_light_mask() const; + virtual void set_light_mask(int p_light_mask); + void clear(); TileMap(); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index ff35837bc0..47cebd25a2 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -579,7 +579,7 @@ void Area::_bind_methods() { ADD_SIGNAL( MethodInfo("area_enter",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); - ADD_PROPERTY( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Combine-Replace,Replace,Replace-Combine"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector")); diff --git a/scene/3d/area.h b/scene/3d/area.h index f03955d1e7..529a116937 100644 --- a/scene/3d/area.h +++ b/scene/3d/area.h @@ -40,7 +40,9 @@ public: enum SpaceOverride { SPACE_OVERRIDE_DISABLED, SPACE_OVERRIDE_COMBINE, - SPACE_OVERRIDE_REPLACE + SPACE_OVERRIDE_COMBINE_REPLACE, + SPACE_OVERRIDE_REPLACE, + SPACE_OVERRIDE_REPLACE_COMBINE }; private: diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index b54cbfe0f9..49f95550c9 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -402,7 +402,7 @@ int CollisionShape::_get_update_shape_index() const{ void CollisionShape::_bind_methods() { //not sure if this should do anything - ObjectTypeDB::bind_method(_MD("resource_changed"),&CollisionShape::resource_changed); + ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&CollisionShape::resource_changed); ObjectTypeDB::bind_method(_MD("set_shape","shape"),&CollisionShape::set_shape); ObjectTypeDB::bind_method(_MD("get_shape"),&CollisionShape::get_shape); ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionShape::_add_to_collision_object); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index bb0a1fca12..3b14e1d767 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -236,7 +236,7 @@ void CollisionPolygon::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon::_add_to_collision_object); - ObjectTypeDB::bind_method(_MD("set_build_mode"),&CollisionPolygon::set_build_mode); + ObjectTypeDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon::set_build_mode); ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon::get_build_mode); ObjectTypeDB::bind_method(_MD("set_depth","depth"),&CollisionPolygon::set_depth); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 9f9c87b675..38fff2089c 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -487,9 +487,9 @@ bool Light::is_editor_only() const{ void Light::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_parameter","variable","value"), &Light::set_parameter ); - ObjectTypeDB::bind_method(_MD("get_parameter"), &Light::get_parameter ); + ObjectTypeDB::bind_method(_MD("get_parameter","variable"), &Light::get_parameter ); ObjectTypeDB::bind_method(_MD("set_color","color","value"), &Light::set_color ); - ObjectTypeDB::bind_method(_MD("get_color"), &Light::get_color ); + ObjectTypeDB::bind_method(_MD("get_color","color"), &Light::get_color ); ObjectTypeDB::bind_method(_MD("set_project_shadows","enable"), &Light::set_project_shadows ); ObjectTypeDB::bind_method(_MD("has_project_shadows"), &Light::has_project_shadows ); ObjectTypeDB::bind_method(_MD("set_projector","projector:Texture"), &Light::set_projector ); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 6868646c48..e06f0288d3 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -422,14 +422,14 @@ void Particles::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_variable","variable","value"),&Particles::set_variable); ObjectTypeDB::bind_method(_MD("get_variable","variable"),&Particles::get_variable); ObjectTypeDB::bind_method(_MD("set_randomness","variable","randomness"),&Particles::set_randomness); - ObjectTypeDB::bind_method(_MD("get_randomness"),&Particles::get_randomness); + ObjectTypeDB::bind_method(_MD("get_randomness","variable"),&Particles::get_randomness); ObjectTypeDB::bind_method(_MD("set_color_phase_pos","phase","pos"),&Particles::set_color_phase_pos); ObjectTypeDB::bind_method(_MD("get_color_phase_pos","phase"),&Particles::get_color_phase_pos); ObjectTypeDB::bind_method(_MD("set_color_phase_color","phase","color"),&Particles::set_color_phase_color); ObjectTypeDB::bind_method(_MD("get_color_phase_color","phase"),&Particles::get_color_phase_color); ObjectTypeDB::bind_method(_MD("set_material","material:Material"),&Particles::set_material); ObjectTypeDB::bind_method(_MD("get_material:Material"),&Particles::get_material); - ObjectTypeDB::bind_method(_MD("set_emit_timeout"),&Particles::set_emit_timeout); + ObjectTypeDB::bind_method(_MD("set_emit_timeout","timeout"),&Particles::set_emit_timeout); ObjectTypeDB::bind_method(_MD("get_emit_timeout"),&Particles::get_emit_timeout); ObjectTypeDB::bind_method(_MD("set_height_from_velocity","enable"),&Particles::set_height_from_velocity); ObjectTypeDB::bind_method(_MD("has_height_from_velocity"),&Particles::has_height_from_velocity); diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index 7ed2335fcb..7f9b2a343e 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -332,7 +332,7 @@ void SpatialStreamPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&SpatialStreamPlayer::set_stream); ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&SpatialStreamPlayer::get_stream); - ObjectTypeDB::bind_method(_MD("play"),&SpatialStreamPlayer::play,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("play","offset"),&SpatialStreamPlayer::play,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop"),&SpatialStreamPlayer::stop); ObjectTypeDB::bind_method(_MD("is_playing"),&SpatialStreamPlayer::is_playing); diff --git a/scene/audio/event_player.cpp b/scene/audio/event_player.cpp index 1bd692431d..11f2c7d5cd 100644 --- a/scene/audio/event_player.cpp +++ b/scene/audio/event_player.cpp @@ -312,16 +312,14 @@ void EventPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_pos"),&EventPlayer::get_pos); ObjectTypeDB::bind_method(_MD("seek_pos","time"),&EventPlayer::seek_pos); + ObjectTypeDB::bind_method(_MD("get_length"),&EventPlayer::get_length); + ObjectTypeDB::bind_method(_MD("set_autoplay","enabled"),&EventPlayer::set_autoplay); ObjectTypeDB::bind_method(_MD("has_autoplay"),&EventPlayer::has_autoplay); ObjectTypeDB::bind_method(_MD("set_channel_volume","idx","channel_volume"),&EventPlayer::set_channel_volume); - ObjectTypeDB::bind_method(_MD("get_channel_volume""idx"),&EventPlayer::get_channel_volume); - - ObjectTypeDB::bind_method(_MD("get_length"),&EventPlayer::get_length); - - - ObjectTypeDB::bind_method(_MD("get_channel_last_note_time"),&EventPlayer::get_channel_last_note_time); + ObjectTypeDB::bind_method(_MD("get_channel_volume","idx"),&EventPlayer::get_channel_volume); + ObjectTypeDB::bind_method(_MD("get_channel_last_note_time","idx"),&EventPlayer::get_channel_last_note_time); ObjectTypeDB::bind_method(_MD("_set_play","play"),&EventPlayer::_set_play); ObjectTypeDB::bind_method(_MD("_get_play"),&EventPlayer::_get_play); diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index d08fdd0c76..c621d1cb47 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -333,7 +333,7 @@ void StreamPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&StreamPlayer::set_stream); ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&StreamPlayer::get_stream); - ObjectTypeDB::bind_method(_MD("play"),&StreamPlayer::play,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("play","offset"),&StreamPlayer::play,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop"),&StreamPlayer::stop); ObjectTypeDB::bind_method(_MD("is_playing"),&StreamPlayer::is_playing); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index ec4886a6ac..6e867c45b9 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -916,6 +916,7 @@ void Control::_window_show_tooltip() { void Control::_window_call_input(Control *p_control,const InputEvent& p_input) { + _block(); while(p_control) { @@ -932,6 +933,9 @@ void Control::_window_call_input(Control *p_control,const InputEvent& p_input) { break; p_control=p_control->data.parent; } + + _unblock(); + } void Control::_window_input_event(InputEvent p_event) { @@ -1067,6 +1071,7 @@ void Control::_window_input_event(InputEvent p_event) { Size2 pos = mpos; pos = window->focus_inv_xform.xform(pos); + window->mouse_over->drop_data(pos,window->drag_data); window->drag_data=Variant(); //change mouse accordingly diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 22e3a81e52..ad30295e60 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -49,7 +49,7 @@ void FileDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - refresh->set_icon(get_icon("Reload","EditorIcons")); + refresh->set_icon(get_icon("reload")); } if (p_what==NOTIFICATION_DRAW) { @@ -650,7 +650,7 @@ void FileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_vbox:VBoxContainer"),&FileDialog::get_vbox); ObjectTypeDB::bind_method(_MD("set_access","access"),&FileDialog::set_access); ObjectTypeDB::bind_method(_MD("get_access"),&FileDialog::get_access); - ObjectTypeDB::bind_method(_MD("set_show_hidden_files"),&FileDialog::set_show_hidden_files); + ObjectTypeDB::bind_method(_MD("set_show_hidden_files","show"),&FileDialog::set_show_hidden_files); ObjectTypeDB::bind_method(_MD("is_showing_hidden_files"),&FileDialog::is_showing_hidden_files); ObjectTypeDB::bind_method(_MD("_select_drive"),&FileDialog::_select_drive); ObjectTypeDB::bind_method(_MD("_make_dir"),&FileDialog::_make_dir); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 3cc5acc1a6..540df323b6 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -304,7 +304,7 @@ void OptionButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_item_count"),&OptionButton::get_item_count); ObjectTypeDB::bind_method(_MD("add_separator"),&OptionButton::add_separator); ObjectTypeDB::bind_method(_MD("clear"),&OptionButton::clear); - ObjectTypeDB::bind_method(_MD("select"),&OptionButton::select); + ObjectTypeDB::bind_method(_MD("select","idx"),&OptionButton::select); ObjectTypeDB::bind_method(_MD("get_selected"),&OptionButton::get_selected); ObjectTypeDB::bind_method(_MD("get_selected_ID"),&OptionButton::get_selected_ID); ObjectTypeDB::bind_method(_MD("get_selected_metadata"),&OptionButton::get_selected_metadata); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 5ce7e2e0d3..0f70b4ba9d 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -45,6 +45,16 @@ void Popup::_notification(int p_what) { emit_signal("popup_hide"); } } + + if (p_what==NOTIFICATION_ENTER_TREE) { + //small helper to make editing of these easier in editor +#ifdef TOOLS_ENABLED + if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + set_as_toplevel(false); + } +#endif + } + } void Popup::_fix_size() { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 9dc03272b2..c250ca34c1 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -898,7 +898,7 @@ void PopupMenu::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_item_icon","idx","icon"),&PopupMenu::set_item_icon); ObjectTypeDB::bind_method(_MD("set_item_accelerator","idx","accel"),&PopupMenu::set_item_accelerator); ObjectTypeDB::bind_method(_MD("set_item_metadata","idx","metadata"),&PopupMenu::set_item_metadata); - ObjectTypeDB::bind_method(_MD("set_item_checked","idx"),&PopupMenu::set_item_checked); + ObjectTypeDB::bind_method(_MD("set_item_checked","idx","checked"),&PopupMenu::set_item_checked); ObjectTypeDB::bind_method(_MD("set_item_disabled","idx","disabled"),&PopupMenu::set_item_disabled); ObjectTypeDB::bind_method(_MD("set_item_submenu","idx","submenu"),&PopupMenu::set_item_submenu); ObjectTypeDB::bind_method(_MD("set_item_as_separator","idx","enable"),&PopupMenu::set_item_as_separator); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 7103ee651f..bee6527795 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -216,11 +216,10 @@ void Range::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_val"),&Range::get_val); ObjectTypeDB::bind_method(_MD("get_value"),&Range::get_val); ObjectTypeDB::bind_method(_MD("get_min"),&Range::get_min); - ObjectTypeDB::bind_method(_MD("get_max"),&Range::get_max); - ObjectTypeDB::bind_method(_MD("get_step"),&Range::get_step); - ObjectTypeDB::bind_method(_MD("get_page"),&Range::get_page); - ObjectTypeDB::bind_method(_MD("get_unit_value"),&Range::get_unit_value); - ObjectTypeDB::bind_method(_MD("get_rounded_values"),&Range::get_rounded_values); + ObjectTypeDB::bind_method(_MD("get_max"),&Range::get_max); + ObjectTypeDB::bind_method(_MD("get_step"),&Range::get_step); + ObjectTypeDB::bind_method(_MD("get_page"),&Range::get_page); + ObjectTypeDB::bind_method(_MD("get_unit_value"),&Range::get_unit_value); ObjectTypeDB::bind_method(_MD("set_val","value"),&Range::set_val); ObjectTypeDB::bind_method(_MD("set_value","value"),&Range::set_val); ObjectTypeDB::bind_method(_MD("set_min","minimum"),&Range::set_min); @@ -228,7 +227,8 @@ void Range::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_step","step"),&Range::set_step); ObjectTypeDB::bind_method(_MD("set_page","pagesize"),&Range::set_page); ObjectTypeDB::bind_method(_MD("set_unit_value","value"),&Range::set_unit_value); - ObjectTypeDB::bind_method(_MD("set_rounded_values"),&Range::set_rounded_values); + ObjectTypeDB::bind_method(_MD("set_rounded_values","enabled"),&Range::set_rounded_values); + ObjectTypeDB::bind_method(_MD("is_rounded_values"),&Range::is_rounded_values); ObjectTypeDB::bind_method(_MD("set_exp_unit_value","enabled"),&Range::set_exp_unit_value); ObjectTypeDB::bind_method(_MD("is_unit_value_exp"),&Range::is_unit_value_exp); @@ -244,16 +244,18 @@ void Range::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::REAL, "range/page" ), _SCS("set_page"), _SCS("get_page") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "range/value" ), _SCS("set_val"), _SCS("get_val") ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "range/exp_edit" ), _SCS("set_exp_unit_value"), _SCS("is_unit_value_exp") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "rounded_values" ), _SCS("set_rounded_values"), _SCS("get_rounded_values") ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "range/rounded" ), _SCS("set_rounded_values"), _SCS("is_rounded_values") ); } -void Range::set_rounded_values(bool p){ - _rounded_values = p; +void Range::set_rounded_values(bool p_enable) { + + _rounded_values = p_enable; } -bool Range::get_rounded_values() const{ - return _rounded_values; +bool Range::is_rounded_values() const { + + return _rounded_values; } void Range::set_exp_unit_value(bool p_enable) { diff --git a/scene/gui/range.h b/scene/gui/range.h index 48361ddb0e..f31a81f0b5 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -72,22 +72,23 @@ public: void set_step(double p_step); void set_page(double p_page); void set_unit_value(double p_value); - void set_rounded_values(bool); - + double get_val() const; double get_min() const; double get_max() const; double get_step() const; double get_page() const; double get_unit_value() const; - bool get_rounded_values() const; + + void set_rounded_values(bool p_enable); + bool is_rounded_values() const; void set_exp_unit_value(bool p_enable); bool is_unit_value_exp() const; void share(Range *p_range); void unshare(); - + Range(); ~Range(); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 5abb6c1d01..eaff08e1d1 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -30,35 +30,62 @@ #include "scene/scene_string_names.h" #include "os/keyboard.h" #include "os/os.h" -RichTextLabel::Item *RichTextLabel::_get_next_item(Item* p_item) { +RichTextLabel::Item *RichTextLabel::_get_next_item(Item* p_item,bool p_free) { - if (p_item->subitems.size()) { + if (p_free) { - return p_item->subitems.front()->get(); - } else if (!p_item->parent) { - return NULL; - } else if (p_item->E->next()) { + if (p_item->subitems.size()) { + + return p_item->subitems.front()->get(); + } else if (!p_item->parent) { + return NULL; + } else if (p_item->E->next()) { + + return p_item->E->next()->get(); + } else { + //go up until something with a next is found + while (p_item->parent && !p_item->E->next()) { + p_item=p_item->parent; + } + + + if (p_item->parent) + return p_item->E->next()->get(); + else + return NULL; - return p_item->E->next()->get(); - } else { - //go up until something with a next is found - while (p_item->parent && !p_item->E->next()) { - p_item=p_item->parent; } + } else { + if (p_item->subitems.size() && p_item->type!=ITEM_TABLE) { - if (p_item && p_item->parent) - return p_item->E->next()->get(); - else + return p_item->subitems.front()->get(); + } else if (p_item->type==ITEM_FRAME) { return NULL; + } else if (p_item->E->next()) { + + return p_item->E->next()->get(); + } else { + //go up until something with a next is found + while (p_item->type!=ITEM_FRAME && !p_item->E->next()) { + p_item=p_item->parent; + } + + if (p_item->type!=ITEM_FRAME) + return p_item->E->next()->get(); + else + return NULL; + + } } return NULL; } -void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p_mode,const Ref<Font> &p_base_font,const Color &p_base_color,const Point2i& p_click_pos,Item **r_click_item,int *r_click_char,bool *r_outside,int p_char_count) { + +void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y, int p_width, int p_line, ProcessMode p_mode,const Ref<Font> &p_base_font,const Color &p_base_color,const Point2i& p_click_pos,Item **r_click_item,int *r_click_char,bool *r_outside,int p_char_count) { RID ci; if (r_outside) @@ -70,7 +97,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p *r_click_item=NULL; } - Line &l = lines[p_line]; + Line &l = p_frame->lines[p_line]; Item *it = l.from; @@ -91,10 +118,13 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p l.offset_caches.clear(); l.height_caches.clear(); l.char_count=0; + l.minimum_width=0; } int wofs=margin; int spaces_size=0; + int align_ofs=0; + if (p_mode!=PROCESS_CACHE && align!=ALIGN_FILL) wofs+=line_ofs; @@ -125,7 +155,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p case ALIGN_LEFT: l.offset_caches.push_back(0); break;\ case ALIGN_CENTER: l.offset_caches.push_back(((p_width-margin)-used)/2); break;\ case ALIGN_RIGHT: l.offset_caches.push_back(((p_width-margin)-used)); break;\ - case ALIGN_FILL: l.offset_caches.push_back((p_width-margin)-used+spaces_size); break;\ + case ALIGN_FILL: l.offset_caches.push_back((p_width-margin)-used/*+spaces_size*/); break;\ }\ l.height_caches.push_back(line_height);\ l.space_caches.push_back(spaces);\ @@ -135,10 +165,11 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p spaces=0;\ spaces_size=0;\ wofs=begin;\ + align_ofs=0;\ if (p_mode!=PROCESS_CACHE) {\ lh=line<l.height_caches.size()?l.height_caches[line]:1;\ }\ - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh && p_click_pos.x<wofs) {\ + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x<p_ofs.x+wofs) {\ if (r_outside) *r_outside=true;\ *r_click_item=it;\ *r_click_char=rchar;\ @@ -148,12 +179,15 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p #define ENSURE_WIDTH(m_width) \ + if (p_mode==PROCESS_CACHE) { \ + l.minimum_width=MAX(l.minimum_width,wofs+m_width);\ + }\ if (wofs + m_width > p_width) {\ if (p_mode==PROCESS_CACHE) {\ if (spaces>0) \ spaces-=1;\ }\ - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh && p_click_pos.x>wofs) {\ + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x>p_ofs.x+wofs) {\ if (r_outside) *r_outside=true; \ *r_click_item=it;\ *r_click_char=rchar;\ @@ -165,7 +199,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p #define ADVANCE(m_width) \ {\ - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh && p_click_pos.x>=wofs && p_click_pos.x<wofs+m_width) {\ + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x>=p_ofs.x+wofs && p_click_pos.x<p_ofs.x+wofs+m_width) {\ if (r_outside) *r_outside=false; \ *r_click_item=it;\ *r_click_char=rchar;\ @@ -218,8 +252,10 @@ if (m_height > line_height) {\ underline=true; } + } else if (p_mode==PROCESS_CACHE) { l.char_count+=text->text.length(); + } rchar=0; @@ -246,6 +282,8 @@ if (m_height > line_height) {\ if (c[end]==' ') { + fw+=cw; + /* if (p_mode==PROCESS_CACHE) { fw+=cw; } else if (align==ALIGN_FILL && line<l.space_caches.size() && l.space_caches[line]>0) { @@ -254,7 +292,7 @@ if (m_height > line_height) {\ found_space=true; } else { fw+=cw; - } + }*/ } else { fw+=cw; } @@ -262,23 +300,26 @@ if (m_height > line_height) {\ end++; } - - ENSURE_WIDTH(w); - //print_line("END: "+String::chr(c[end])+"."); if (end && c[end-1]==' ') { - spaces++; if (p_mode==PROCESS_CACHE) { spaces_size+=font->get_char_size(' ').width; + } else if (align==ALIGN_FILL) { + int ln = MIN(l.offset_caches.size()-1,line); + if (l.space_caches[ln]) { + align_ofs = spaces * l.offset_caches[ln] / l.space_caches[ln]; + } } + spaces++; + /* if (found_space) { int ln = MIN(l.offset_caches.size()-1,line); fw+=l.offset_caches[ln]/l.space_caches[ln]; - } + }*/ } @@ -294,7 +335,7 @@ if (m_height > line_height) {\ - if (p_mode==PROCESS_POINTER && r_click_char && p_click_pos.y>=y && p_click_pos.y<=y+lh) { + if (p_mode==PROCESS_POINTER && r_click_char && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh) { //int o = (wofs+w)-p_click_pos.x; @@ -303,7 +344,7 @@ if (m_height > line_height) {\ cw=tab_size*font->get_char_size(' ').width; } - if (p_click_pos.x-cw/2>pofs) { + if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) { rchar=int((&c[i])-cf); //print_line("GOT: "+itos(rchar)); @@ -337,13 +378,13 @@ if (m_height > line_height) {\ if (selected) { cw = font->get_char_size(c[i],c[i+1]).x; - draw_rect(Rect2(pofs,y,cw,lh),selection_bg); + draw_rect(Rect2(p_ofs.x+pofs,p_ofs.y+y,cw,lh),selection_bg); if (visible) - font->draw_char(ci,Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); + font->draw_char(ci,p_ofs+Point2(align_ofs+pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); } else { if (visible) - cw=font->draw_char(ci,Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); + cw=font->draw_char(ci,p_ofs+Point2(align_ofs+pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); } p_char_count++; @@ -359,7 +400,7 @@ if (m_height > line_height) {\ uc.a*=0.5; //VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,y+ascent+2),Point2(pofs+cw,y+ascent+2),uc); int uy = y+lh-fh+ascent+2; - VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,uy),Point2(pofs+cw,uy),uc); + VS::get_singleton()->canvas_item_add_line(ci,p_ofs+Point2(align_ofs+pofs,uy),p_ofs+Point2(align_ofs+pofs+cw,uy),uc); } ofs+=cw; } @@ -397,7 +438,7 @@ if (m_height > line_height) {\ bool visible = visible_characters<0 || p_char_count<visible_characters; if (p_mode==PROCESS_DRAW && visible) { - img->image->draw(ci,Point2(wofs,y+lh-font->get_descent()-img->image->get_height())); + img->image->draw(ci,p_ofs+Point2(align_ofs+wofs,y+lh-font->get_descent()-img->image->get_height())); } p_char_count++; @@ -435,6 +476,148 @@ if (m_height > line_height) {\ #endif } break; + case ITEM_TABLE: { + + lh=0; + ItemTable *table = static_cast<ItemTable*>(it); + int hseparation=get_constant("table_hseparation"); + int vseparation=get_constant("table_vseparation"); + Color ccolor = _find_color(table,p_base_color); + Vector2 draw_ofs = Point2(wofs,y); + int max_y=get_size().height; + + if (p_mode==PROCESS_CACHE) { + + int idx=0; + //set minimums to zero + for(int i=0;i<table->columns.size();i++) { + table->columns[i].min_width=0; + table->columns[i].width=0; + } + //compute minimum width for each cell + for (List<Item*>::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast<ItemFrame*>(E->get()); + + int column = idx % table->columns.size(); + + int ly=0; + + + for(int i=0;i<frame->lines.size();i++) { + + _process_line(frame,Point2(),ly,p_width,i,PROCESS_CACHE,cfont,Color()); + table->columns[column].min_width=MAX( table->columns[i].min_width, frame->lines[i].minimum_width ); + } + idx++; + } + + //compute available width and total radio (for expanders) + + + int total_ratio=0; + int available_width=p_width - hseparation * (table->columns.size() -1); + table->total_width=hseparation; + + for(int i=0;i<table->columns.size();i++) { + available_width-=table->columns[i].min_width; + if (table->columns[i].expand) + total_ratio+=table->columns[i].expand_ratio; + } + + //assign actual widths + + for(int i=0;i<table->columns.size();i++) { + table->columns[i].width = table->columns[i].min_width; + if (table->columns[i].expand) + table->columns[i].width+=table->columns[i].expand_ratio*available_width/total_ratio; + table->total_width+=table->columns[i].width+hseparation; + } + + //compute caches properly again with the right width + idx=0; + for (List<Item*>::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast<ItemFrame*>(E->get()); + + int column = idx % table->columns.size(); + + + for(int i=0;i<frame->lines.size();i++) { + + int ly=0; + _process_line(frame,Point2(),ly,table->columns[column].width,i,PROCESS_CACHE,cfont,Color()); + frame->lines[i].height_cache=ly; //actual height + frame->lines[i].height_accum_cache=ly; //actual height + } + idx++; + } + + } + + + + Point2 offset(align_ofs+hseparation,vseparation); + + int row_height=0; + //draw using computed caches + int idx=0; + for (List<Item*>::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast<ItemFrame*>(E->get()); + + int column = idx % table->columns.size(); + + int ly=0; + int yofs=0; + + + int lines_h = frame->lines[frame->lines.size()-1].height_accum_cache - (frame->lines[0].height_accum_cache - frame->lines[0].height_cache); + int lines_ofs = p_ofs.y+offset.y+draw_ofs.y; + + bool visible = lines_ofs < get_size().height && lines_ofs+lines_h >=0; + + for(int i=0;i<frame->lines.size();i++) { + + + if (visible) { + if (p_mode==PROCESS_DRAW) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_DRAW,cfont,ccolor); + } else if (p_mode==PROCESS_POINTER) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_POINTER,cfont,ccolor,p_click_pos,r_click_item,r_click_char,r_outside); + } + } + + yofs+=frame->lines[i].height_cache; + if (p_mode==PROCESS_CACHE) { + frame->lines[i].height_accum_cache=offset.y+draw_ofs.y+frame->lines[i].height_cache; + } + + } + + row_height=MAX(yofs,row_height); + offset.x+=table->columns[column].width+hseparation; + + if (column==table->columns.size()-1) { + + offset.y+=row_height+vseparation; + offset.x=hseparation; + row_height=0; + } + idx++; + } + + int total_height = offset.y; + if (row_height) { + total_height=row_height+vseparation; + } + + + + ADVANCE( table->total_width ); + CHECK_HEIGHT( total_height ); + + } break; default: {} @@ -445,7 +628,7 @@ if (m_height > line_height) {\ it = _get_next_item(it); - if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y>y+lh) { + if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y>p_ofs.y+y+lh) { //at the end of all, return this if (r_outside) *r_outside=true; *r_click_item=itp; @@ -453,9 +636,9 @@ if (m_height > line_height) {\ return; } - if (it && (p_line+1 < lines.size()) && lines[p_line+1].from==it) { + if (it && (p_line+1 < p_frame->lines.size()) && p_frame->lines[p_line+1].from==it) { - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh) { + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh) { //went to next line, but pointer was on the previous one if (r_outside) *r_outside=true; *r_click_item=itp; @@ -493,8 +676,8 @@ void RichTextLabel::_scroll_changed(double) { void RichTextLabel::_update_scroll() { int total_height=0; - if (lines.size()) - total_height=lines[lines.size()-1].height_accum_cache; + if (main->lines.size()) + total_height=main->lines[main->lines.size()-1].height_accum_cache; bool exceeds = total_height > get_size().height && scroll_active; @@ -503,18 +686,18 @@ void RichTextLabel::_update_scroll() { if (exceeds) { scroll_visible=true; - first_invalid_line=0; + main->first_invalid_line=0; scroll_w=vscroll->get_combined_minimum_size().width; vscroll->show(); vscroll->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_END,scroll_w); - _validate_line_caches(); + _validate_line_caches(main); } else { scroll_visible=false; vscroll->hide(); scroll_w=0; - _validate_line_caches(); + _validate_line_caches(main); } } @@ -527,7 +710,7 @@ void RichTextLabel::_notification(int p_what) { case NOTIFICATION_RESIZED: { - first_invalid_line=0; //invalidate ALL + main->first_invalid_line=0; //invalidate ALL update(); } break; @@ -535,7 +718,7 @@ void RichTextLabel::_notification(int p_what) { if (use_bbcode) parse_bbcode(bbcode); - first_invalid_line=0; //invalidate ALL + main->first_invalid_line=0; //invalidate ALL update(); } break; @@ -550,7 +733,7 @@ void RichTextLabel::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - _validate_line_caches(); + _validate_line_caches(main); _update_scroll(); @@ -571,25 +754,25 @@ void RichTextLabel::_notification(int p_what) { int from_line = 0; int total_chars = 0; - while (from_line<lines.size()) { + while (from_line<main->lines.size()) { - if (lines[from_line].height_accum_cache>=ofs) + if (main->lines[from_line].height_accum_cache>=ofs) break; from_line++; - total_chars+=lines[from_line].char_count; + total_chars+=main->lines[from_line].char_count; } - if (from_line>=lines.size()) + if (from_line>=main->lines.size()) break; //nothing to draw - int y = (lines[from_line].height_accum_cache - lines[from_line].height_cache) - ofs; + int y = (main->lines[from_line].height_accum_cache - main->lines[from_line].height_cache) - ofs; Ref<Font> base_font=get_font("normal_font"); Color base_color=get_color("default_color"); - while (y<size.height && from_line<lines.size()) { + while (y<size.height && from_line<main->lines.size()) { - _process_line(y,size.width-scroll_w,from_line,PROCESS_DRAW,base_font,base_color,Point2i(),NULL,NULL,NULL,total_chars); - total_chars+=lines[from_line].char_count; + _process_line(main,Point2(),y,size.width-scroll_w,from_line,PROCESS_DRAW,base_font,base_color,Point2i(),NULL,NULL,NULL,total_chars); + total_chars+=main->lines[from_line].char_count; from_line++; } } @@ -597,7 +780,7 @@ void RichTextLabel::_notification(int p_what) { } -void RichTextLabel::_find_click(const Point2i& p_click,Item **r_click_item,int *r_click_char,bool *r_outside) { +void RichTextLabel::_find_click(ItemFrame* p_frame,const Point2i& p_click,Item **r_click_item,int *r_click_char,bool *r_outside) { if (r_click_item) *r_click_item=NULL; @@ -609,26 +792,26 @@ void RichTextLabel::_find_click(const Point2i& p_click,Item **r_click_item,int * //todo, change to binary search int from_line = 0; - while (from_line<lines.size()) { + while (from_line<p_frame->lines.size()) { - if (lines[from_line].height_accum_cache>=ofs) + if (p_frame->lines[from_line].height_accum_cache>=ofs) break; from_line++; } - if (from_line>=lines.size()) + if (from_line>=p_frame->lines.size()) return; - int y = (lines[from_line].height_accum_cache - lines[from_line].height_cache) - ofs; + int y = (p_frame->lines[from_line].height_accum_cache - p_frame->lines[from_line].height_cache) - ofs; Ref<Font> base_font=get_font("normal_font"); Color base_color=get_color("default_color"); - while (y<size.height && from_line<lines.size()) { + while (y<size.height && from_line<p_frame->lines.size()) { - _process_line(y,size.width-scroll_w,from_line,PROCESS_POINTER,base_font,base_color,p_click,r_click_item,r_click_char,r_outside); + _process_line(p_frame,Point2(),y,size.width-scroll_w,from_line,PROCESS_POINTER,base_font,base_color,p_click,r_click_item,r_click_char,r_outside); if (r_click_item && *r_click_item) return; from_line++; @@ -643,13 +826,13 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2& p_pos) const if (!underline_meta || selection.click) return CURSOR_ARROW; - if (first_invalid_line<lines.size()) + if (main->first_invalid_line<main->lines.size()) return CURSOR_ARROW; //invalid int line=0; Item *item=NULL; - ((RichTextLabel*)(this))->_find_click(p_pos,&item,&line); + ((RichTextLabel*)(this))->_find_click(main,p_pos,&item,&line); if (item && ((RichTextLabel*)(this))->_find_meta(item,NULL)) @@ -665,7 +848,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { case InputEvent::MOUSE_BUTTON: { - if (first_invalid_line<lines.size()) + if (main->first_invalid_line<main->lines.size()) return; const InputEventMouseButton& b = p_event.mouse_button; @@ -680,7 +863,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { Item *item=NULL; bool outside; - _find_click(Point2i(b.x,b.y),&item,&line,&outside); + _find_click(main,Point2i(b.x,b.y),&item,&line,&outside); if (item) { @@ -773,7 +956,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { } break; case InputEvent::MOUSE_MOTION: { - if (first_invalid_line<lines.size()) + if (main->first_invalid_line<main->lines.size()) return; const InputEventMouseMotion& m = p_event.mouse_motion; @@ -782,7 +965,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { int line=0; Item *item=NULL; - _find_click(Point2i(m.x,m.y),&item,&line); + _find_click(main,Point2i(m.x,m.y),&item,&line); if (!item) return; // do not update @@ -950,9 +1133,9 @@ bool RichTextLabel::_find_meta(Item *p_item,Variant *r_meta) { } -void RichTextLabel::_validate_line_caches() { +void RichTextLabel::_validate_line_caches(ItemFrame* p_frame) { - if (first_invalid_line==lines.size()) + if (p_frame->first_invalid_line==p_frame->lines.size()) return; //validate invalid lines!s @@ -960,24 +1143,24 @@ void RichTextLabel::_validate_line_caches() { Ref<Font> base_font=get_font("normal_font"); - for(int i=first_invalid_line;i<lines.size();i++) { + for(int i=p_frame->first_invalid_line;i<p_frame->lines.size();i++) { int y=0; - _process_line(y,size.width-scroll_w,i,PROCESS_CACHE,base_font,Color()); - lines[i].height_cache=y; - lines[i].height_accum_cache=y; + _process_line(p_frame,Point2(),y,size.width-scroll_w,i,PROCESS_CACHE,base_font,Color()); + p_frame->lines[i].height_cache=y; + p_frame->lines[i].height_accum_cache=y; if (i>0) - lines[i].height_accum_cache+=lines[i-1].height_accum_cache; + p_frame->lines[i].height_accum_cache+=p_frame->lines[i-1].height_accum_cache; } int total_height=0; - if (lines.size()) - total_height=lines[lines.size()-1].height_accum_cache; + if (p_frame->lines.size()) + total_height=p_frame->lines[p_frame->lines.size()-1].height_accum_cache; - first_invalid_line=lines.size(); + main->first_invalid_line=p_frame->lines.size(); updating_scroll=true; vscroll->set_max(total_height); @@ -990,17 +1173,20 @@ void RichTextLabel::_validate_line_caches() { } -void RichTextLabel::_invalidate_current_line() { +void RichTextLabel::_invalidate_current_line(ItemFrame* p_frame) { - if (lines.size()-1 <= first_invalid_line) { + if (p_frame->lines.size()-1 <= p_frame->first_invalid_line) { - first_invalid_line=lines.size()-1; + p_frame->first_invalid_line=p_frame->lines.size()-1; update(); } } void RichTextLabel::add_text(const String& p_text) { + if (current->type==ITEM_TABLE) + return; //can't add anything here + int pos=0; while (pos<p_text.length()) { @@ -1027,7 +1213,7 @@ void RichTextLabel::add_text(const String& p_text) { //append text condition! ItemText *ti = static_cast<ItemText*>(current->subitems.back()->get()); ti->text+=line; - _invalidate_current_line(); + _invalidate_current_line(main); } else { //append item condition @@ -1043,11 +1229,11 @@ void RichTextLabel::add_text(const String& p_text) { if (eol) { ItemNewline *item = memnew( ItemNewline ); - item->line=lines.size(); + item->line=current_frame->lines.size(); _add_item(item,false); - lines.resize(lines.size()+1); - lines[lines.size()-1].from=item; - _invalidate_current_line(); + current_frame->lines.resize(current_frame->lines.size()+1); + current_frame->lines[current_frame->lines.size()-1].from=item; + _invalidate_current_line(current_frame); } @@ -1055,25 +1241,38 @@ void RichTextLabel::add_text(const String& p_text) { } } -void RichTextLabel::_add_item(Item *p_item, bool p_enter) { +void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline) { + + p_item->parent=current; p_item->E=current->subitems.push_back(p_item); p_item->index=current_idx++; + if (p_enter) current=p_item; - if (lines[lines.size()-1].from==NULL) { - lines[lines.size()-1].from=p_item; + if (p_ensure_newline && current_frame->lines[current_frame->lines.size()-1].from) { + _invalidate_current_line(current_frame); + current_frame->lines.resize( current_frame->lines.size() +1 ); + } - _invalidate_current_line(); + if (current_frame->lines[current_frame->lines.size()-1].from==NULL) { + current_frame->lines[current_frame->lines.size()-1].from=p_item; + } + p_item->line=current_frame->lines.size()-1; + + _invalidate_current_line(current_frame); } void RichTextLabel::add_image(const Ref<Texture>& p_image) { + if (current->type==ITEM_TABLE) + return; + ERR_FAIL_COND(p_image.is_null()); ItemImage *item = memnew( ItemImage ); @@ -1084,15 +1283,18 @@ void RichTextLabel::add_image(const Ref<Texture>& p_image) { void RichTextLabel::add_newline() { + if (current->type==ITEM_TABLE) + return; ItemNewline *item = memnew( ItemNewline ); - item->line=lines.size(); - lines.resize(lines.size()+1); + item->line=current_frame->lines.size(); + current_frame->lines.resize(current_frame->lines.size()+1); _add_item(item,false); } void RichTextLabel::push_font(const Ref<Font>& p_font) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_COND(p_font.is_null()); ItemFont *item = memnew( ItemFont ); @@ -1102,6 +1304,7 @@ void RichTextLabel::push_font(const Ref<Font>& p_font) { } void RichTextLabel::push_color(const Color& p_color) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemColor *item = memnew( ItemColor ); item->color=p_color; @@ -1110,6 +1313,7 @@ void RichTextLabel::push_color(const Color& p_color) { } void RichTextLabel::push_underline() { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemUnderline *item = memnew( ItemUnderline ); _add_item(item,true); @@ -1118,47 +1322,40 @@ void RichTextLabel::push_underline() { void RichTextLabel::push_align(Align p_align) { - lines.resize(lines.size()+1); + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemAlign *item = memnew( ItemAlign ); item->align=p_align; - _add_item(item,true); - - ItemNewline *itemnl = memnew( ItemNewline ); - itemnl->line=lines.size()-1; - _add_item(itemnl,false); + _add_item(item,true,true); } void RichTextLabel::push_indent(int p_level) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_COND(p_level<0); - lines.resize(lines.size()+1); - ItemIndent *item = memnew( ItemIndent ); item->level=p_level; - _add_item(item,true); - - ItemNewline *itemnl = memnew( ItemNewline ); - itemnl->line=lines.size()-1; - _add_item(itemnl,false); + _add_item(item,true,true); } void RichTextLabel::push_list(ListType p_list) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_INDEX(p_list,3); ItemList *item = memnew( ItemList ); item->list_type=p_list; - _add_item(item,true); + _add_item(item,true,true); } void RichTextLabel::push_meta(const Variant& p_meta) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemMeta *item = memnew( ItemMeta ); item->meta=p_meta; @@ -1166,9 +1363,62 @@ void RichTextLabel::push_meta(const Variant& p_meta) { } +void RichTextLabel::push_table(int p_columns) { + + ERR_FAIL_COND( p_columns < 1); + ItemTable *item = memnew( ItemTable ); + + item->columns.resize(p_columns); + item->total_width=0; + for(int i=0;i<item->columns.size();i++) { + item->columns[i].expand=false; + item->columns[i].expand_ratio=1; + } + _add_item(item,true,true); + +} + +void RichTextLabel::set_table_column_expand(int p_column,bool p_expand,int p_ratio) { + + ERR_FAIL_COND(current->type!=ITEM_TABLE); + ItemTable *table = static_cast<ItemTable*>(current); + ERR_FAIL_INDEX(p_column,table->columns.size()); + table->columns[p_column].expand=p_expand; + table->columns[p_column].expand_ratio=p_ratio; +} + +void RichTextLabel::push_cell(){ + + ERR_FAIL_COND(current->type!=ITEM_TABLE); + + ItemFrame *item = memnew( ItemFrame ); + item->parent_frame=current_frame; + _add_item(item,true); + current_frame=item; + item->cell=true; + item->parent_line=item->parent_frame->lines.size()-1; + item->lines.resize(1); + item->lines[0].from=NULL; + item->first_invalid_line=0; + +} + +int RichTextLabel::get_current_table_column() const { + + ERR_FAIL_COND_V(current->type!=ITEM_TABLE,-1); + + ItemTable *table = static_cast<ItemTable*>(current); + + return table->subitems.size() % table->columns.size(); + +} + void RichTextLabel::pop() { ERR_FAIL_COND(!current->parent); + if (current->type==ITEM_FRAME) { + current_frame = static_cast<ItemFrame*>(current)->parent_frame; + } current=current->parent; } @@ -1176,9 +1426,10 @@ void RichTextLabel::clear() { main->_clear_children(); current=main; - lines.clear(); - lines.resize(1); - first_invalid_line=0; + current_frame=main; + main->lines.clear(); + main->lines.resize(1); + main->first_invalid_line=0; update(); selection.click=NULL; selection.active=false; @@ -1189,7 +1440,7 @@ void RichTextLabel::clear() { void RichTextLabel::set_tab_size(int p_spaces) { tab_size=p_spaces; - first_invalid_line=0; + main->first_invalid_line=0; update(); } @@ -1345,6 +1596,30 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) { push_font(mono_font); pos=brk_end+1; tag_stack.push_front(tag); + } else if (tag.begins_with("table=")) { + + int columns = tag.substr(6,tag.length()).to_int(); + if (columns<1) + columns=1; + //use monospace font + push_table(columns); + pos=brk_end+1; + tag_stack.push_front("table"); + } else if (tag=="cell") { + + push_cell(); + pos=brk_end+1; + tag_stack.push_front(tag); + } else if (tag.begins_with("cell=")) { + + int ratio = tag.substr(6,tag.length()).to_int(); + if (ratio<1) + ratio=1; + //use monospace font + set_table_column_expand(get_current_table_column(),true,ratio); + push_cell(); + pos=brk_end+1; + tag_stack.push_front("cell"); } else if (tag=="u") { //use underline @@ -1504,15 +1779,15 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) { void RichTextLabel::scroll_to_line(int p_line) { - ERR_FAIL_INDEX(p_line,lines.size()); - _validate_line_caches(); - vscroll->set_val(lines[p_line].height_accum_cache-lines[p_line].height_cache); + ERR_FAIL_INDEX(p_line,main->lines.size()); + _validate_line_caches(main); + vscroll->set_val(main->lines[p_line].height_accum_cache-main->lines[p_line].height_cache); } int RichTextLabel::get_line_count() const { - return lines.size(); + return current_frame->lines.size(); } void RichTextLabel::set_selection_enabled(bool p_enabled) { @@ -1556,29 +1831,31 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) { selection.active=true; update(); - if (line==-1) { + _validate_line_caches(main); - while(it) { + int fh = _find_font(t).is_valid()?_find_font(t)->get_height():get_font("normal_font")->get_height(); - if (it->type==ITEM_NEWLINE) { + float offset =0; - line=static_cast<ItemNewline*>(it)->line; - break; + int line = t->line; + Item *item =t; + while(item) { + if (item->type==ITEM_FRAME) { + ItemFrame *frame = static_cast<ItemFrame*>(item); + if (line>=0 && line<frame->lines.size()) { + offset+=frame->lines[line].height_accum_cache-frame->lines[line].height_cache; + line=frame->line; } - - it=_get_next_item(it); } - + item=item->parent; } - - line-=2; - scroll_to_line(line<0?0:line); + vscroll->set_val(offset-fh); return true; } } - it=_get_next_item(it); + it=_get_next_item(it,true); charidx=0; } @@ -1617,7 +1894,7 @@ void RichTextLabel::selection_copy() { if (item==selection.to) break; - item=_get_next_item(item); + item=_get_next_item(item,true); } if (text!="") { @@ -1670,6 +1947,9 @@ void RichTextLabel::_bind_methods() { ObjectTypeDB::bind_method(_MD("push_list","type"),&RichTextLabel::push_list); ObjectTypeDB::bind_method(_MD("push_meta","data"),&RichTextLabel::push_meta); ObjectTypeDB::bind_method(_MD("push_underline"),&RichTextLabel::push_underline); + ObjectTypeDB::bind_method(_MD("push_table","columns"),&RichTextLabel::push_table); + ObjectTypeDB::bind_method(_MD("set_table_column_expand","column","expand","ratio"),&RichTextLabel::set_table_column_expand); + ObjectTypeDB::bind_method(_MD("push_cell"),&RichTextLabel::push_cell); ObjectTypeDB::bind_method(_MD("pop"),&RichTextLabel::pop); ObjectTypeDB::bind_method(_MD("clear"),&RichTextLabel::clear); @@ -1685,7 +1965,7 @@ void RichTextLabel::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_v_scroll"),&RichTextLabel::get_v_scroll); - ObjectTypeDB::bind_method(_MD("scroll_to_line"),&RichTextLabel::scroll_to_line); + ObjectTypeDB::bind_method(_MD("scroll_to_line","line"),&RichTextLabel::scroll_to_line); ObjectTypeDB::bind_method(_MD("set_tab_size","spaces"),&RichTextLabel::set_tab_size); ObjectTypeDB::bind_method(_MD("get_tab_size"),&RichTextLabel::get_tab_size); @@ -1722,7 +2002,7 @@ void RichTextLabel::_bind_methods() { BIND_CONSTANT( LIST_LETTERS ); BIND_CONSTANT( LIST_DOTS ); - BIND_CONSTANT( ITEM_MAIN ); + BIND_CONSTANT( ITEM_FRAME ); BIND_CONSTANT( ITEM_TEXT ); BIND_CONSTANT( ITEM_IMAGE ); BIND_CONSTANT( ITEM_NEWLINE ); @@ -1750,8 +2030,8 @@ int RichTextLabel::get_visible_characters() const { int RichTextLabel::get_total_character_count() const { int tc=0; - for(int i=0;i<lines.size();i++) - tc+=lines[i].char_count; + for(int i=0;i<current_frame->lines.size();i++) + tc+=current_frame->lines[i].char_count; return tc; } @@ -1760,12 +2040,13 @@ int RichTextLabel::get_total_character_count() const { RichTextLabel::RichTextLabel() { - main = memnew( ItemMain ); + main = memnew( ItemFrame ); main->index=0; current=main; - lines.resize(1); - lines[0].from=main; - first_invalid_line=0; + main->lines.resize(1); + main->lines[0].from=main; + main->first_invalid_line=0; + current_frame=main; tab_size=4; default_align=ALIGN_LEFT; underline_meta=true; diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index eaa8d5d60a..bc45ded4ad 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -54,7 +54,7 @@ public: enum ItemType { - ITEM_MAIN, + ITEM_FRAME, ITEM_TEXT, ITEM_IMAGE, ITEM_NEWLINE, @@ -64,6 +64,7 @@ public: ITEM_ALIGN, ITEM_INDENT, ITEM_LIST, + ITEM_TABLE, ITEM_META }; @@ -72,6 +73,24 @@ protected: static void _bind_methods(); private: + struct Item; + + struct Line { + + Item *from; + Vector<int> offset_caches; + Vector<int> height_caches; + Vector<int> space_caches; + int height_cache; + int height_accum_cache; + int char_count; + int minimum_width; + + Line() { from=NULL; char_count=0; } + }; + + + struct Item { int index; @@ -79,18 +98,26 @@ private: ItemType type; List<Item*> subitems; List<Item*>::Element *E; + int line; void _clear_children() { while (subitems.size()) { memdelete(subitems.front()->get()); subitems.pop_front(); } } - Item() { parent=NULL; E=NULL; } + Item() { parent=NULL; E=NULL; line=0;} virtual ~Item() { _clear_children(); } }; - struct ItemMain : public Item { + struct ItemFrame : public Item{ + + int parent_line; + bool cell; + Vector<Line> lines; + int first_invalid_line; + ItemFrame *parent_frame; - ItemMain() { type=ITEM_MAIN; } + ItemFrame() { type=ITEM_FRAME; parent_frame=NULL; cell=false; parent_line=0; } }; + struct ItemText : public Item { String text; @@ -150,11 +177,28 @@ private: ItemNewline() { type=ITEM_NEWLINE; } }; - ItemMain *main; + + struct ItemTable : public Item{ + + struct Column { + bool expand; + int expand_ratio; + int min_width; + int width; + }; + + Vector<Column> columns; + int total_width; + ItemTable() { type=ITEM_TABLE; } + }; + + ItemFrame *main; Item *current; + ItemFrame *current_frame; VScrollBar *vscroll; + bool scroll_visible; bool scroll_follow; bool scroll_following; @@ -163,34 +207,16 @@ private: bool updating_scroll; int current_idx; - struct Line { - - Item *from; - Vector<int> offset_caches; - Vector<int> height_caches; - Vector<int> space_caches; - int height_cache; - int height_accum_cache; - int char_count; - - Line() { from=NULL; char_count=0; } - }; - - - - - Vector<Line> lines; - int first_invalid_line; int tab_size; bool underline_meta; Align default_align; - void _invalidate_current_line(); - void _validate_line_caches(); + void _invalidate_current_line(ItemFrame *p_frame); + void _validate_line_caches(ItemFrame *p_frame); - void _add_item(Item *p_item, bool p_enter=false); + void _add_item(Item *p_item, bool p_enter=false,bool p_ensure_newline=false); @@ -227,8 +253,8 @@ private: int visible_characters; - void _process_line(int &y, int p_width, int p_line, ProcessMode p_mode,const Ref<Font> &p_base_font,const Color &p_base_color,const Point2i& p_click_pos=Point2i(),Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL,int p_char_count=0); - void _find_click(const Point2i& p_click,Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL); + void _process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y, int p_width, int p_line, ProcessMode p_mode,const Ref<Font> &p_base_font,const Color &p_base_color,const Point2i& p_click_pos=Point2i(),Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL,int p_char_count=0); + void _find_click(ItemFrame *p_frame, const Point2i& p_click,Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL); Ref<Font> _find_font(Item *p_item); @@ -242,12 +268,12 @@ private: void _scroll_changed(double); void _input_event(InputEvent p_event); - Item *_get_next_item(Item* p_item); + Item *_get_next_item(Item* p_item, bool p_free=false); bool use_bbcode; String bbcode; - + void _update_all_lines(); protected: void _notification(int p_what); @@ -264,6 +290,10 @@ public: void push_indent(int p_level); void push_list(ListType p_list); void push_meta(const Variant& p_data); + void push_table(int p_columns); + void set_table_column_expand(int p_column, bool p_expand, int p_ratio=1); + int get_current_table_column() const; + void push_cell(); void pop(); void clear(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 29969b65e6..f46336a224 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3742,10 +3742,10 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_line_count"),&TextEdit::get_line_count); ObjectTypeDB::bind_method(_MD("get_text"),&TextEdit::get_text); - ObjectTypeDB::bind_method(_MD("get_line"),&TextEdit::get_line); + ObjectTypeDB::bind_method(_MD("get_line","line"),&TextEdit::get_line); - ObjectTypeDB::bind_method(_MD("cursor_set_column","column"),&TextEdit::cursor_set_column); - ObjectTypeDB::bind_method(_MD("cursor_set_line","line"),&TextEdit::cursor_set_line); + ObjectTypeDB::bind_method(_MD("cursor_set_column","column","adjust_viewport"),&TextEdit::cursor_set_column,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("cursor_set_line","line","adjust_viewport"),&TextEdit::cursor_set_line,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("cursor_get_column"),&TextEdit::cursor_get_column); ObjectTypeDB::bind_method(_MD("cursor_get_line"),&TextEdit::cursor_get_line); diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 7e6bf2cbdf..3d1b080ef2 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -42,22 +42,22 @@ Size2 TextureButton::get_minimum_size() const { else rscale= hover->get_size(); } else - rscale= pressed->get_size()*scale; + rscale=pressed->get_size(); } else rscale= normal->get_size(); - return rscale*scale; + return rscale*scale.abs(); } bool TextureButton::has_point(const Point2& p_point) const { - if (scale[0] <= 0 || scale[1] <= 0) { + if (scale[0] == 0 || scale[1] == 0) { return false; } - Point2 ppos = p_point/scale; + Point2 ppos = p_point/scale.abs(); if (click_mask.is_valid()) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1b204cff65..585f3a8936 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -672,7 +672,7 @@ void TreeItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("clear_custom_bg_color","column"),&TreeItem::clear_custom_bg_color); ObjectTypeDB::bind_method(_MD("get_custom_bg_color","column"),&TreeItem::get_custom_bg_color); - ObjectTypeDB::bind_method(_MD("add_button","column","button:Texture"),&TreeItem::add_button); + ObjectTypeDB::bind_method(_MD("add_button","column","button:Texture","button_idx"),&TreeItem::add_button); ObjectTypeDB::bind_method(_MD("get_button_count","column"),&TreeItem::get_button_count); ObjectTypeDB::bind_method(_MD("get_button:Texture","column","button_idx"),&TreeItem::get_button); ObjectTypeDB::bind_method(_MD("erase_button","column","button_idx"),&TreeItem::erase_button); @@ -3193,11 +3193,11 @@ void Tree::_bind_methods() { ObjectTypeDB::bind_method(_MD("create_item:TreeItem","parent:TreeItem"),&Tree::_create_item,DEFVAL((Object*)NULL)); ObjectTypeDB::bind_method(_MD("get_root:TreeItem"),&Tree::get_root); - ObjectTypeDB::bind_method(_MD("set_column_min_width"),&Tree::set_column_min_width); - ObjectTypeDB::bind_method(_MD("set_column_expand"),&Tree::set_column_expand); - ObjectTypeDB::bind_method(_MD("get_column_width"),&Tree::get_column_width); + ObjectTypeDB::bind_method(_MD("set_column_min_width","column","min_width"),&Tree::set_column_min_width); + ObjectTypeDB::bind_method(_MD("set_column_expand","column","expand"),&Tree::set_column_expand); + ObjectTypeDB::bind_method(_MD("get_column_width","column"),&Tree::get_column_width); - ObjectTypeDB::bind_method(_MD("set_hide_root"),&Tree::set_hide_root); + ObjectTypeDB::bind_method(_MD("set_hide_root","enable"),&Tree::set_hide_root); ObjectTypeDB::bind_method(_MD("get_next_selected:TreeItem","from:TreeItem"),&Tree::_get_next_selected); ObjectTypeDB::bind_method(_MD("get_selected:TreeItem"),&Tree::get_selected); ObjectTypeDB::bind_method(_MD("get_selected_column"),&Tree::get_selected_column); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 58683a07ad..5db809a618 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -271,6 +271,7 @@ void VideoPlayer::set_paused(bool p_paused) { playback->set_paused(p_paused); set_process(!p_paused); }; + last_audio_time = 0; }; bool VideoPlayer::is_paused() const { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a832162994..90e3915fec 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -802,6 +802,7 @@ void Node::remove_child(Node *p_child) { } ERR_FAIL_COND( idx==-1 ); + //ERR_FAIL_COND( p_child->data.blocked > 0 ); //if (data.scene) { does not matter @@ -856,7 +857,10 @@ Node *Node::_get_child_by_name(const StringName& p_name) const { Node *Node::_get_node(const NodePath& p_path) const { - ERR_FAIL_COND_V( !data.inside_tree && p_path.is_absolute(), NULL ); + if (!data.inside_tree && p_path.is_absolute()) { + ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree."); + ERR_FAIL_V(NULL); + } Node *current=NULL; Node *root=NULL; @@ -2001,7 +2005,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_greater_than","node:Node"),&Node::is_greater_than); ObjectTypeDB::bind_method(_MD("get_path"),&Node::get_path); ObjectTypeDB::bind_method(_MD("get_path_to","node:Node"),&Node::get_path_to); - ObjectTypeDB::bind_method(_MD("add_to_group","group"),&Node::add_to_group,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("add_to_group","group","persistent"),&Node::add_to_group,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("remove_from_group","group"),&Node::remove_from_group); ObjectTypeDB::bind_method(_MD("is_in_group","group"),&Node::is_in_group); ObjectTypeDB::bind_method(_MD("move_child","child_node:Node","to_pos"),&Node::move_child); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index adf053f5c9..cdfaa4c716 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -1586,7 +1586,7 @@ void SceneTree::_bind_methods() { ObjectTypeDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneTree::notify_group); ObjectTypeDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneTree::set_group); - ObjectTypeDB::bind_method(_MD("get_nodes_in_group"),&SceneTree::_get_nodes_in_group); + ObjectTypeDB::bind_method(_MD("get_nodes_in_group","group"),&SceneTree::_get_nodes_in_group); ObjectTypeDB::bind_method(_MD("get_root:Viewport"),&SceneTree::get_root); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index d19b5767c2..26b5594599 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1456,7 +1456,7 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_as_audio_listener_2d","enable"), &Viewport::set_as_audio_listener_2d); ObjectTypeDB::bind_method(_MD("is_audio_listener_2d","enable"), &Viewport::is_audio_listener_2d); - ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect"), &Viewport::set_render_target_to_screen_rect); + ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect","rect"), &Viewport::set_render_target_to_screen_rect); ObjectTypeDB::bind_method(_MD("get_mouse_pos"), &Viewport::get_mouse_pos); ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"), &Viewport::warp_mouse); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 33e1eb338e..e642efebb6 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -543,7 +543,11 @@ void make_default_theme() { t->set_constant("close_v_ofs","WindowDialog", 20 ); t->set_constant("titlebar_height","WindowDialog", 18 ); t->set_constant("title_height","WindowDialog", 20 ); - + + + // File Dialog + + t->set_icon("reload","FileDialog",make_icon( icon_reload_png )); // Popup @@ -797,6 +801,8 @@ void make_default_theme() { t->set_color("selection_color","RichTextLabel", Color(0.1,0.1,1,0.8) ); t->set_constant("line_separation","RichTextLabel", 1 ); + t->set_constant("table_hseparation","RichTextLabel", 3 ); + t->set_constant("table_vseparation","RichTextLabel", 3 ); diff --git a/scene/resources/default_theme/icon_reload.png b/scene/resources/default_theme/icon_reload.png Binary files differnew file mode 100644 index 0000000000..f7c6530d77 --- /dev/null +++ b/scene/resources/default_theme/icon_reload.png diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index c338126d3a..c1fac47724 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -194,6 +194,11 @@ static const unsigned char icon_play_png[]={ }; +static const unsigned char icon_reload_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x12,0x0,0x0,0xb,0x12,0x1,0xd2,0xdd,0x7e,0xfc,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x94,0x49,0x44,0x41,0x54,0x38,0x8d,0x85,0xd3,0xbd,0x6a,0x55,0x41,0x14,0xc5,0xf1,0xdf,0xb9,0x1f,0x91,0x20,0x5a,0x89,0xd8,0x8,0x4b,0xd0,0x42,0x1f,0xc0,0x42,0x4,0x4b,0xb,0x1b,0x9b,0xbc,0x80,0x58,0x45,0xc5,0x56,0x51,0x50,0x6b,0x21,0x9d,0xa5,0x6f,0x20,0x88,0x20,0xa8,0xad,0xa8,0xa0,0x2f,0x60,0x21,0xe8,0x4e,0x63,0xa9,0x85,0x22,0x31,0x37,0x37,0xb1,0xb8,0x73,0xc2,0xf1,0x23,0x38,0xd5,0x9c,0x61,0xaf,0x3d,0x7b,0xfe,0x6b,0x9d,0xce,0x1e,0xab,0xaa,0xc6,0x18,0xa1,0xc3,0xe,0xb6,0x92,0xec,0xfc,0x59,0x37,0xda,0x43,0x8,0xc7,0x70,0x9,0x37,0xb0,0xd2,0xd7,0x56,0x55,0x57,0x55,0xbb,0xf5,0xdd,0x1f,0xe2,0xae,0x9,0x9f,0xe2,0x24,0xb6,0x6,0x97,0x8c,0xf0,0x32,0xc9,0xb9,0xaa,0x9a,0x62,0x96,0x64,0xd1,0xa0,0x75,0x1c,0xe3,0x2,0x9e,0x34,0xc1,0x2b,0x3c,0xc6,0x3a,0x8e,0xe3,0x76,0xab,0x59,0xc6,0x41,0xfc,0xc0,0xbc,0x6f,0x30,0xc6,0x61,0x7c,0x6e,0xe2,0x53,0x49,0xde,0x57,0xd5,0x12,0xb6,0xd1,0x25,0x99,0x55,0xd5,0x3,0xac,0x36,0x1e,0xd3,0x5d,0x6,0x49,0xe6,0x78,0xd4,0xc4,0xe7,0xf1,0xa9,0x9d,0x6f,0x26,0xd9,0xc2,0xac,0x7d,0x5f,0xc1,0x73,0xcc,0xab,0xea,0x7a,0x55,0x4d,0x7b,0x30,0x37,0x71,0x6,0xdf,0x70,0x34,0xc9,0xc6,0x90,0x4d,0x92,0x21,0xa3,0x15,0xec,0xc3,0x6a,0x92,0x59,0x57,0x55,0x13,0x4c,0xdb,0x9b,0x36,0x92,0x2c,0x57,0xd5,0xb8,0x4d,0xf5,0xcf,0x55,0x55,0x33,0x4c,0x92,0x74,0xa3,0x46,0x7a,0x8e,0x13,0x38,0xd8,0x1a,0xfe,0x53,0x3c,0xb0,0xef,0x4b,0xbf,0x19,0xb5,0xf1,0x36,0xf1,0x31,0xc9,0xcc,0x22,0x34,0xff,0x5b,0x87,0xf1,0x95,0xbf,0x73,0xb0,0x86,0x5b,0xf8,0x89,0xed,0xfe,0xed,0x83,0xdb,0x97,0x70,0x19,0x6b,0x78,0x88,0xab,0xbd,0x8d,0x13,0x9c,0xc6,0x6b,0xac,0x27,0x49,0xb3,0x70,0x96,0x64,0xa7,0xc1,0x9b,0xe0,0x90,0x66,0x75,0x92,0xae,0xaa,0xba,0xde,0xc6,0xad,0x24,0x6f,0xf0,0xc,0x47,0xaa,0xea,0x3b,0x2e,0xe,0xb2,0xbf,0xdf,0x22,0xd2,0x7d,0x4e,0xce,0xb7,0x34,0xee,0xec,0x26,0x71,0x60,0xd5,0x5d,0xdc,0xb1,0x0,0xd9,0xff,0x17,0x2c,0xb2,0x30,0xc5,0x59,0xbc,0xee,0xeb,0xfb,0x9,0x86,0x84,0xef,0xe1,0x0,0xee,0xe3,0x2d,0x3e,0xe0,0x5,0xae,0x25,0xe9,0xf0,0x6e,0xc8,0xe6,0x37,0x88,0x3,0x58,0x1d,0xc6,0x2d,0x85,0xfd,0xf9,0x92,0x85,0x5b,0x86,0xd,0x7e,0x1,0x82,0x4c,0xaa,0x69,0x77,0x3c,0x4b,0x15,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + static const unsigned char icon_stop_png[]={ 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0x9,0xf,0x14,0x33,0x24,0x62,0xd4,0x2f,0x95,0x0,0x0,0x0,0x39,0x49,0x44,0x41,0x54,0x38,0x8d,0x63,0x60,0xa0,0x6,0xf8,0xf0,0xe1,0x3,0x33,0xb9,0x7a,0x18,0x61,0x2,0xf,0x1f,0x3e,0xfc,0x4f,0x8a,0x1,0xf2,0xf2,0xf2,0x8c,0xc,0xc,0xc,0xc,0x4c,0xa4,0xda,0x8c,0xe,0x46,0xd,0x18,0x35,0x60,0x70,0x18,0xc0,0xc0,0xc0,0x40,0x59,0x66,0xa2,0x18,0x0,0x0,0x2a,0xc7,0xf,0x64,0xd5,0xe,0x11,0x85,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 }; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index aad5e7cfdd..3890f4bedb 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -517,7 +517,7 @@ void Font::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_descent"),&Font::get_descent); ObjectTypeDB::bind_method(_MD("add_kerning_pair","char_a","char_b","kerning"),&Font::add_kerning_pair); - ObjectTypeDB::bind_method(_MD("get_kerning_pair"),&Font::get_kerning_pair); + ObjectTypeDB::bind_method(_MD("get_kerning_pair","char_a","char_b"),&Font::get_kerning_pair); ObjectTypeDB::bind_method(_MD("add_texture","texture:Texture"),&Font::add_texture); ObjectTypeDB::bind_method(_MD("add_char","character","texture","rect","align","advance"),&Font::add_char,DEFVAL(Point2()),DEFVAL(-1)); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 8cb0904415..88ed2f45c5 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -971,7 +971,7 @@ void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); ObjectTypeDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); - ObjectTypeDB::bind_method(_MD("add_surface","primitive","arrays","morph_arrays"),&Mesh::add_surface,DEFVAL(Array())); + ObjectTypeDB::bind_method(_MD("add_surface","primitive","arrays","morph_arrays","alphasort"),&Mesh::add_surface,DEFVAL(Array()),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); ObjectTypeDB::bind_method(_MD("surface_remove","surf_idx"),&Mesh::surface_remove); ObjectTypeDB::bind_method(_MD("surface_get_array_len","surf_idx"),&Mesh::surface_get_array_len); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 0755d101b2..ee68c3b7fc 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -224,13 +224,13 @@ void MultiMesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mesh","mesh:Mesh"),&MultiMesh::set_mesh); ObjectTypeDB::bind_method(_MD("get_mesh:Mesh"),&MultiMesh::get_mesh); - ObjectTypeDB::bind_method(_MD("set_instance_count"),&MultiMesh::set_instance_count); + ObjectTypeDB::bind_method(_MD("set_instance_count","count"),&MultiMesh::set_instance_count); ObjectTypeDB::bind_method(_MD("get_instance_count"),&MultiMesh::get_instance_count); - ObjectTypeDB::bind_method(_MD("set_instance_transform"),&MultiMesh::set_instance_transform); - ObjectTypeDB::bind_method(_MD("get_instance_transform"),&MultiMesh::get_instance_transform); - ObjectTypeDB::bind_method(_MD("set_instance_color"),&MultiMesh::set_instance_color); - ObjectTypeDB::bind_method(_MD("get_instance_color"),&MultiMesh::get_instance_color); - ObjectTypeDB::bind_method(_MD("set_aabb"),&MultiMesh::set_aabb); + ObjectTypeDB::bind_method(_MD("set_instance_transform","instance","transform"),&MultiMesh::set_instance_transform); + ObjectTypeDB::bind_method(_MD("get_instance_transform","instance"),&MultiMesh::get_instance_transform); + ObjectTypeDB::bind_method(_MD("set_instance_color","instance","color"),&MultiMesh::set_instance_color); + ObjectTypeDB::bind_method(_MD("get_instance_color","instance"),&MultiMesh::get_instance_color); + ObjectTypeDB::bind_method(_MD("set_aabb","visibility_aabb"),&MultiMesh::set_aabb); ObjectTypeDB::bind_method(_MD("get_aabb"),&MultiMesh::get_aabb); ObjectTypeDB::bind_method(_MD("generate_aabb"),&MultiMesh::generate_aabb); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index f8a14e58a0..04334e1159 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -179,25 +179,25 @@ void ShaderGraph::_bind_methods() { ObjectTypeDB::bind_method(_MD("default_get_value","shader_type","id","param_id"), &ShaderGraph::default_get_value); ObjectTypeDB::bind_method(_MD("scalar_const_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_const_node_set_value); - ObjectTypeDB::bind_method(_MD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_set_value); + ObjectTypeDB::bind_method(_MD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_get_value); ObjectTypeDB::bind_method(_MD("vec_const_node_set_value","shader_type","id","value"),&ShaderGraph::vec_const_node_set_value); - ObjectTypeDB::bind_method(_MD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_set_value); + ObjectTypeDB::bind_method(_MD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_get_value); ObjectTypeDB::bind_method(_MD("rgb_const_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_const_node_set_value); - ObjectTypeDB::bind_method(_MD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_set_value); + ObjectTypeDB::bind_method(_MD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_get_value); ObjectTypeDB::bind_method(_MD("xform_const_node_set_value","shader_type","id","value"),&ShaderGraph::xform_const_node_set_value); - ObjectTypeDB::bind_method(_MD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_set_value); + ObjectTypeDB::bind_method(_MD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_get_value); // void get_node_list(ShaderType p_which,List<int> *p_node_list) const; ObjectTypeDB::bind_method(_MD("texture_node_set_filter_size","shader_type","id","filter_size"),&ShaderGraph::texture_node_set_filter_size); - ObjectTypeDB::bind_method(_MD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_set_filter_size); + ObjectTypeDB::bind_method(_MD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_get_filter_size); ObjectTypeDB::bind_method(_MD("texture_node_set_filter_strength","shader_type","id","filter_strength"),&ShaderGraph::texture_node_set_filter_strength); - ObjectTypeDB::bind_method(_MD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_set_filter_strength); + ObjectTypeDB::bind_method(_MD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_get_filter_strength); ObjectTypeDB::bind_method(_MD("scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::scalar_op_node_set_op); ObjectTypeDB::bind_method(_MD("scalar_op_node_get_op","shader_type","id"),&ShaderGraph::scalar_op_node_get_op); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 527fae5946..1f518c30e1 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -83,7 +83,7 @@ void StyleBox::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_center_size"),&StyleBox::get_center_size); ObjectTypeDB::bind_method(_MD("get_offset"),&StyleBox::get_offset); - ObjectTypeDB::bind_method(_MD("draw"),&StyleBox::draw); + ObjectTypeDB::bind_method(_MD("draw","canvas_item","rect"),&StyleBox::draw); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/left", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_LEFT ); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/right", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_RIGHT ); @@ -182,10 +182,10 @@ void StyleBoxTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_texture:Texture"),&StyleBoxTexture::get_texture); ObjectTypeDB::bind_method(_MD("set_margin_size","margin","size"),&StyleBoxTexture::set_margin_size); - ObjectTypeDB::bind_method(_MD("get_margin_size"),&StyleBoxTexture::get_margin_size); + ObjectTypeDB::bind_method(_MD("get_margin_size","margin"),&StyleBoxTexture::get_margin_size); ObjectTypeDB::bind_method(_MD("set_expand_margin_size","margin","size"),&StyleBoxTexture::set_expand_margin_size); - ObjectTypeDB::bind_method(_MD("get_expand_margin_size"),&StyleBoxTexture::get_expand_margin_size); + ObjectTypeDB::bind_method(_MD("get_expand_margin_size","margin"),&StyleBoxTexture::get_expand_margin_size); ObjectTypeDB::bind_method(_MD("set_draw_center","enable"),&StyleBoxTexture::set_draw_center); ObjectTypeDB::bind_method(_MD("get_draw_center"),&StyleBoxTexture::get_draw_center); @@ -392,7 +392,7 @@ void StyleBoxImageMask::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_expand","expand"),&StyleBoxImageMask::set_expand); ObjectTypeDB::bind_method(_MD("get_expand"),&StyleBoxImageMask::get_expand); ObjectTypeDB::bind_method(_MD("set_expand_margin_size","margin","size"),&StyleBoxImageMask::set_expand_margin_size); - ObjectTypeDB::bind_method(_MD("get_expand_margin_size"),&StyleBoxImageMask::get_expand_margin_size); + ObjectTypeDB::bind_method(_MD("get_expand_margin_size","margin"),&StyleBoxImageMask::get_expand_margin_size); ADD_PROPERTY( PropertyInfo(Variant::IMAGE, "image"), _SCS("set_image"), _SCS("get_image")); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "expand"), _SCS("set_expand"), _SCS("get_expand")); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 5df3d64d1a..edfa12da1f 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -70,9 +70,9 @@ void Texture::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_alpha"),&Texture::has_alpha); ObjectTypeDB::bind_method(_MD("set_flags","flags"),&Texture::set_flags); ObjectTypeDB::bind_method(_MD("get_flags"),&Texture::get_flags); - ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","modulate"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("draw_rect","canvas_item","rect","tile","modulate"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("draw_rect_region","canvas_item","rect","src_rect","modulate"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","modulate","transpose"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw_rect","canvas_item","rect","tile","modulate","transpose"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw_rect_region","canvas_item","rect","src_rect","modulate","transpose"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); BIND_CONSTANT( FLAG_MIPMAPS ); BIND_CONSTANT( FLAG_REPEAT ); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 651e234b49..006aeeeaac 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -552,36 +552,36 @@ void Theme::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_icon:Texture","name","type"),&Theme::get_icon); ObjectTypeDB::bind_method(_MD("has_icon","name","type"),&Theme::has_icon); ObjectTypeDB::bind_method(_MD("clear_icon","name","type"),&Theme::clear_icon); - ObjectTypeDB::bind_method(_MD("get_icon_list"),&Theme::_get_icon_list); + ObjectTypeDB::bind_method(_MD("get_icon_list","type"),&Theme::_get_icon_list); ObjectTypeDB::bind_method(_MD("set_stylebox","name","type","texture:StyleBox"),&Theme::set_stylebox); ObjectTypeDB::bind_method(_MD("get_stylebox:StyleBox","name","type"),&Theme::get_stylebox); ObjectTypeDB::bind_method(_MD("has_stylebox","name","type"),&Theme::has_stylebox); ObjectTypeDB::bind_method(_MD("clear_stylebox","name","type"),&Theme::clear_stylebox); - ObjectTypeDB::bind_method(_MD("get_stylebox_list"),&Theme::_get_stylebox_list); + ObjectTypeDB::bind_method(_MD("get_stylebox_list","type"),&Theme::_get_stylebox_list); ObjectTypeDB::bind_method(_MD("set_font","name","type","font:Font"),&Theme::set_font); ObjectTypeDB::bind_method(_MD("get_font:Font","name","type"),&Theme::get_font); ObjectTypeDB::bind_method(_MD("has_font","name","type"),&Theme::has_font); ObjectTypeDB::bind_method(_MD("clear_font","name","type"),&Theme::clear_font); - ObjectTypeDB::bind_method(_MD("get_font_list"),&Theme::_get_font_list); + ObjectTypeDB::bind_method(_MD("get_font_list","type"),&Theme::_get_font_list); ObjectTypeDB::bind_method(_MD("set_color","name","type","color"),&Theme::set_color); ObjectTypeDB::bind_method(_MD("get_color","name","type"),&Theme::get_color); ObjectTypeDB::bind_method(_MD("has_color","name","type"),&Theme::has_color); ObjectTypeDB::bind_method(_MD("clear_color","name","type"),&Theme::clear_color); - ObjectTypeDB::bind_method(_MD("get_color_list"),&Theme::_get_color_list); + ObjectTypeDB::bind_method(_MD("get_color_list","type"),&Theme::_get_color_list); ObjectTypeDB::bind_method(_MD("set_constant","name","type","constant"),&Theme::set_constant); ObjectTypeDB::bind_method(_MD("get_constant","name","type"),&Theme::get_constant); ObjectTypeDB::bind_method(_MD("has_constant","name","type"),&Theme::has_constant); ObjectTypeDB::bind_method(_MD("clear_constant","name","type"),&Theme::clear_constant); - ObjectTypeDB::bind_method(_MD("get_constant_list"),&Theme::_get_constant_list); + ObjectTypeDB::bind_method(_MD("get_constant_list","type"),&Theme::_get_constant_list); ObjectTypeDB::bind_method(_MD("set_default_font","font"),&Theme::set_default_theme_font); ObjectTypeDB::bind_method(_MD("get_default_font"),&Theme::get_default_theme_font); - ObjectTypeDB::bind_method(_MD("get_type_list"),&Theme::_get_type_list); + ObjectTypeDB::bind_method(_MD("get_type_list","type"),&Theme::_get_type_list); ObjectTypeDB::bind_method("copy_default_theme",&Theme::copy_default_theme); diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index b4723fdc25..9d7cdc2420 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -360,7 +360,7 @@ void AudioServerSW::sample_set_description(RID p_sample, const String& p_descrip AUDIO_LOCK sample_manager->sample_set_description(p_sample,p_description); } -String AudioServerSW::sample_get_description(RID p_sample, const String& p_description) const { +String AudioServerSW::sample_get_description(RID p_sample) const { AUDIO_LOCK return sample_manager->sample_get_description(p_sample); @@ -767,8 +767,6 @@ void AudioServerSW::_thread_func(void *self) { AudioServerSW *as=(AudioServerSW *)self; - as->thread->set_name("AudioServerSW"); - while (!as->exit_update_thread) { as->_update_streams(true); OS::get_singleton()->delay_usec(5000); @@ -809,6 +807,7 @@ void AudioServerSW::init() { #ifndef NO_THREADS exit_update_thread=false; thread = Thread::create(_thread_func,this); + thread->set_name("AudioServerSW"); #endif } diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index c566e129c1..75d635e243 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -118,7 +118,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length); virtual void sample_set_description(RID p_sample, const String& p_description); - virtual String sample_get_description(RID p_sample, const String& p_description) const; + virtual String sample_get_description(RID p_sample) const; virtual SampleFormat sample_get_format(RID p_sample) const; virtual bool sample_is_stereo(RID p_sample) const; diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 6c5a2de97b..8dbfea3fd6 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -88,7 +88,7 @@ void AudioServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("sample_get_length","sample"), &AudioServer::sample_get_length ); ObjectTypeDB::bind_method(_MD("sample_set_signed_data","sample","data"), &AudioServer::sample_set_signed_data ); - ObjectTypeDB::bind_method(_MD("sample_set_data","sample"), &AudioServer::sample_set_data ); + ObjectTypeDB::bind_method(_MD("sample_set_data","sample","data"), &AudioServer::sample_set_data ); ObjectTypeDB::bind_method(_MD("sample_get_data","sample"), &AudioServer::sample_get_data ); ObjectTypeDB::bind_method(_MD("sample_set_mix_rate","sample","mix_rate"), &AudioServer::sample_set_mix_rate ); diff --git a/servers/audio_server.h b/servers/audio_server.h index cd3e920f31..6490a281d8 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -160,7 +160,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length)=0; virtual void sample_set_description(RID p_sample, const String& p_description)=0; - virtual String sample_get_description(RID p_sample, const String& p_description) const=0; + virtual String sample_get_description(RID p_sample) const=0; virtual SampleFormat sample_get_format(RID p_sample) const=0; virtual bool sample_is_stereo(RID p_sample) const=0; diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index c66e73b430..79d08b1e75 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -406,29 +406,41 @@ void BodySW::integrate_forces(real_t p_step) { return; AreaSW *def_area = get_space()->get_default_area(); - AreaSW *damp_area = def_area; + // AreaSW *damp_area = def_area; ERR_FAIL_COND(!def_area); int ac = areas.size(); - bool replace = false; + bool stopped = false; gravity = Vector3(0,0,0); area_linear_damp = 0; area_angular_damp = 0; if (ac) { areas.sort(); const AreaCMP *aa = &areas[0]; - damp_area = aa[ac-1].area; - for(int i=ac-1;i>=0;i--) { - _compute_area_gravity_and_dampenings(aa[i].area); - if (aa[i].area->get_space_override_mode() == PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE) { - replace = true; - break; + // damp_area = aa[ac-1].area; + for(int i=ac-1;i>=0 && !stopped;i--) { + PhysicsServer::AreaSpaceOverrideMode mode=aa[i].area->get_space_override_mode(); + switch (mode) { + case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE: + case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: { + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE; + } break; + case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE: + case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: { + gravity = Vector3(0,0,0); + area_angular_damp = 0; + area_linear_damp = 0; + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE; + } break; + default: {} } } } - if( !replace ) { + if( !stopped ) { _compute_area_gravity_and_dampenings(def_area); } diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index a9a8042c19..7a35510963 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -517,7 +517,7 @@ void PhysicsServerSW::body_set_mode(RID p_body, BodyMode p_mode) { body->set_mode(p_mode); }; -PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body, BodyMode p_mode) const { +PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const { BodySW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body,BODY_MODE_STATIC); diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index abbb057616..b9dcff658b 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -146,7 +146,7 @@ public: virtual RID body_get_space(RID p_body) const; virtual void body_set_mode(RID p_body, BodyMode p_mode); - virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const; + virtual BodyMode body_get_mode(RID p_body) const; virtual void body_add_shape(RID p_body, RID p_shape, const Transform& p_transform=Transform()); virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape); diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index d0c5cbc77b..8d82d4a920 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -395,6 +395,7 @@ void Body2DSW::_compute_area_gravity_and_dampenings(const Area2DSW *p_area) { area_linear_damp += p_area->get_linear_damp(); area_angular_damp += p_area->get_angular_damp(); + printf("%f\n",gravity.y); } void Body2DSW::integrate_forces(real_t p_step) { @@ -403,27 +404,39 @@ void Body2DSW::integrate_forces(real_t p_step) { return; Area2DSW *def_area = get_space()->get_default_area(); - Area2DSW *damp_area = def_area; + // Area2DSW *damp_area = def_area; ERR_FAIL_COND(!def_area); int ac = areas.size(); - bool replace = false; + bool stopped = false; gravity = Vector2(0,0); area_angular_damp = 0; area_linear_damp = 0; if (ac) { areas.sort(); const AreaCMP *aa = &areas[0]; - damp_area = aa[ac-1].area; - for(int i=ac-1;i>=0;i--) { - _compute_area_gravity_and_dampenings(aa[i].area); - if (aa[i].area->get_space_override_mode() == Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE) { - replace = true; - break; + // damp_area = aa[ac-1].area; + for(int i=ac-1;i>=0 && !stopped;i--) { + Physics2DServer::AreaSpaceOverrideMode mode=aa[i].area->get_space_override_mode(); + switch (mode) { + case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE: + case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: { + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE; + } break; + case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE: + case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: { + gravity = Vector2(0,0); + area_angular_damp = 0; + area_linear_damp = 0; + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE; + } break; + default: {} } } } - if( !replace ) { + if( !stopped ) { _compute_area_gravity_and_dampenings(def_area); } gravity*=gravity_scale; @@ -501,7 +514,7 @@ void Body2DSW::integrate_forces(real_t p_step) { _update_shapes_with_motion(motion); } - damp_area=NULL; // clear the area, so it is set in the next frame + // damp_area=NULL; // clear the area, so it is set in the next frame def_area=NULL; // clear the area, so it is set in the next frame contact_count=0; diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index 5d8446ed38..789ec9950b 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -548,7 +548,7 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("area_attach_object_instance_ID","area","id"),&Physics2DServer::area_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_get_object_instance_ID","area"),&Physics2DServer::area_get_object_instance_ID); - ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","receiver","method"),&Physics2DServer::area_set_monitor_callback); + ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","area","receiver","method"),&Physics2DServer::area_set_monitor_callback); ObjectTypeDB::bind_method(_MD("body_create","mode","init_sleeping"),&Physics2DServer::body_create,DEFVAL(BODY_MODE_RIGID),DEFVAL(false)); @@ -606,17 +606,17 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("body_set_max_contacts_reported","body","amount"),&Physics2DServer::body_set_max_contacts_reported); ObjectTypeDB::bind_method(_MD("body_get_max_contacts_reported","body"),&Physics2DServer::body_get_max_contacts_reported); - ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_direction","normal"),&Physics2DServer::body_set_one_way_collision_direction); - ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_direction"),&Physics2DServer::body_get_one_way_collision_direction); + ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_direction","body","normal"),&Physics2DServer::body_set_one_way_collision_direction); + ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_direction","body"),&Physics2DServer::body_get_one_way_collision_direction); - ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_max_depth","normal"),&Physics2DServer::body_set_one_way_collision_max_depth); - ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_max_depth"),&Physics2DServer::body_get_one_way_collision_max_depth); + ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_max_depth","body","depth"),&Physics2DServer::body_set_one_way_collision_max_depth); + ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_max_depth","body"),&Physics2DServer::body_get_one_way_collision_max_depth); ObjectTypeDB::bind_method(_MD("body_set_omit_force_integration","body","enable"),&Physics2DServer::body_set_omit_force_integration); ObjectTypeDB::bind_method(_MD("body_is_omitting_force_integration","body"),&Physics2DServer::body_is_omitting_force_integration); - ObjectTypeDB::bind_method(_MD("body_set_force_integration_callback","body","receiver","method"),&Physics2DServer::body_set_force_integration_callback); + ObjectTypeDB::bind_method(_MD("body_set_force_integration_callback","body","receiver","method","userdata"),&Physics2DServer::body_set_force_integration_callback,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("body_test_motion","body","motion","margin","result:Physics2DTestMotionResult"),&Physics2DServer::_body_test_motion,DEFVAL(0.08),DEFVAL(Variant())); @@ -638,7 +638,7 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_active","active"),&Physics2DServer::set_active); - ObjectTypeDB::bind_method(_MD("get_process_info"),&Physics2DServer::get_process_info); + ObjectTypeDB::bind_method(_MD("get_process_info","process_info"),&Physics2DServer::get_process_info); // ObjectTypeDB::bind_method(_MD("init"),&Physics2DServer::init); // ObjectTypeDB::bind_method(_MD("step"),&Physics2DServer::step); @@ -663,9 +663,11 @@ void Physics2DServer::_bind_methods() { BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP); BIND_CONSTANT( AREA_PARAM_PRIORITY ); - BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_DISABLED ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE_REPLACE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE_COMBINE ); BIND_CONSTANT( BODY_MODE_STATIC ); BIND_CONSTANT( BODY_MODE_KINEMATIC ); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 6845c7dfe1..a53cfae752 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -325,7 +325,9 @@ public: enum AreaSpaceOverrideMode { AREA_SPACE_OVERRIDE_DISABLED, AREA_SPACE_OVERRIDE_COMBINE, + AREA_SPACE_OVERRIDE_COMBINE_REPLACE, // Combines, then discards all subsequent calculations AREA_SPACE_OVERRIDE_REPLACE, + AREA_SPACE_OVERRIDE_REPLACE_COMBINE // Discards all previous calculations, then keeps combining }; virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode)=0; diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 53409acdfb..ea5f5fbbbf 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -467,7 +467,7 @@ void PhysicsServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("area_attach_object_instance_ID","area","id"),&PhysicsServer::area_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_get_object_instance_ID","area"),&PhysicsServer::area_get_object_instance_ID); - ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","receiver","method"),&PhysicsServer::area_set_monitor_callback); + ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","area","receiver","method"),&PhysicsServer::area_set_monitor_callback); ObjectTypeDB::bind_method(_MD("area_set_ray_pickable","area","enable"),&PhysicsServer::area_set_ray_pickable); ObjectTypeDB::bind_method(_MD("area_is_ray_pickable","area"),&PhysicsServer::area_is_ray_pickable); @@ -671,7 +671,7 @@ void PhysicsServer::_bind_methods() { //ObjectTypeDB::bind_method(_MD("flush_queries"),&PhysicsServer::flush_queries); - ObjectTypeDB::bind_method(_MD("get_process_info"),&PhysicsServer::get_process_info); + ObjectTypeDB::bind_method(_MD("get_process_info","process_info"),&PhysicsServer::get_process_info); BIND_CONSTANT( SHAPE_PLANE ); BIND_CONSTANT( SHAPE_RAY ); @@ -693,9 +693,11 @@ void PhysicsServer::_bind_methods() { BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP ); BIND_CONSTANT( AREA_PARAM_PRIORITY ); - BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_DISABLED ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE_REPLACE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE_COMBINE ); BIND_CONSTANT( BODY_MODE_STATIC ); BIND_CONSTANT( BODY_MODE_KINEMATIC ); diff --git a/servers/physics_server.h b/servers/physics_server.h index 75584966bb..d0065e13aa 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -318,7 +318,9 @@ public: enum AreaSpaceOverrideMode { AREA_SPACE_OVERRIDE_DISABLED, AREA_SPACE_OVERRIDE_COMBINE, + AREA_SPACE_OVERRIDE_COMBINE_REPLACE, AREA_SPACE_OVERRIDE_REPLACE, + AREA_SPACE_OVERRIDE_REPLACE_COMBINE }; virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode)=0; @@ -370,7 +372,7 @@ public: virtual RID body_get_space(RID p_body) const=0; virtual void body_set_mode(RID p_body, BodyMode p_mode)=0; - virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const=0; + virtual BodyMode body_get_mode(RID p_body) const=0; virtual void body_add_shape(RID p_body, RID p_shape, const Transform& p_transform=Transform())=0; virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape)=0; diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 25e6a68469..52381cf096 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -526,6 +526,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("canvas_item_get_opacity"),&VisualServer::canvas_item_get_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity); + ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z); ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect); diff --git a/tools/editor/console.cpp b/tools/editor/console.cpp deleted file mode 100644 index 0c98f05706..0000000000 --- a/tools/editor/console.cpp +++ /dev/null @@ -1,386 +0,0 @@ -/*************************************************************************/ -/* console.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "console.h" -#include "os/os.h" -#include "os/keyboard.h" - -#include "editor_icons.h" -#include "scene/gui/label.h" -#include "globals.h" - - -void Console::_stats_update_timer_callback() { - - if (!status->is_visible()) - return; - - VisualServer *vs = VisualServer::get_singleton(); - - stats.render_objects_in_frame->set_text(1,String::num(vs->get_render_info( VisualServer::INFO_OBJECTS_IN_FRAME ) ) ); - stats.material_changes_in_frame->set_text(1,String::num(vs->get_render_info( VisualServer::INFO_MATERIAL_CHANGES_IN_FRAME ) ) ); - - int64_t total_vmem = vs->get_render_info( VisualServer::INFO_USAGE_VIDEO_MEM_TOTAL ); - if (total_vmem<0) - stats.usage_video_mem_total->set_text(1, "Unknown"); - else - stats.usage_video_mem_total->set_text(1,String::humanize_size( total_vmem ) ); - - stats.usage_video_mem_used->set_text(1,String::humanize_size( vs->get_render_info( VisualServer::INFO_VIDEO_MEM_USED ) ) ); - stats.usage_texture_mem_used->set_text(1,String::humanize_size( vs->get_render_info( VisualServer::INFO_TEXTURE_MEM_USED ) ) ); - stats.usage_vertex_mem_used->set_text(1,String::humanize_size( vs->get_render_info( VisualServer::INFO_VERTEX_MEM_USED ) ) ); - - - stats.usage_static_memory_total->set_text(1,String::humanize_size( Memory::get_static_mem_available() ) ); - stats.usage_static_memory->set_text(1,String::humanize_size( Memory::get_static_mem_usage() ) ); - stats.usage_dynamic_memory_total->set_text(1,String::humanize_size( Memory::get_dynamic_mem_available() ) ); - stats.usage_dynamic_memory->set_text(1,String::humanize_size( Memory::get_dynamic_mem_usage() ) ); - stats.usage_objects_instanced->set_text(1,String::num( ObjectDB::get_object_count()) ); - - -} - -void Console::_print_handle(void *p_this,const String& p_string) { - - - return; - Console *self = (Console*)p_this; - - OutputQueue oq; - oq.text=p_string; - oq.type=OutputStrings::LINE_NORMAL; - - - if (self->output_queue_mutex) - self->output_queue_mutex->lock(); - - self->output_queue.push_back(oq); - - if (self->output_queue_mutex) - self->output_queue_mutex->unlock(); - -} -void Console::_error_handle(void *p_this,const char*p_function,const char* p_file,int p_line,const char *p_error, const char *p_explanation,ErrorHandlerType p_type) { - - - Console *self = (Console*)p_this; - - OutputQueue oq; - oq.text="ERROR: "+String(p_file)+":"+itos(p_line)+", in function: "+String(p_function); - oq.text+="\n "+String(p_error)+"."; - if (p_explanation && p_explanation[0]) - oq.text+="\n Reason: "+String(p_explanation); - oq.text+="\n"; - oq.type=OutputStrings::LINE_ERROR; - - - if (self->output_queue_mutex) - self->output_queue_mutex->lock(); - - self->output_queue.push_back(oq); - - if (self->output_queue_mutex) - self->output_queue_mutex->unlock(); - - -} - -void Console::_window_input_event(InputEvent p_event) { - - Control::_window_input_event(p_event); - - if (p_event.type==InputEvent::KEY && p_event.key.pressed) { - - if (p_event.key.scancode==KEY_QUOTELEFT && p_event.key.mod.control) { - - if (is_visible()) - hide(); - else { - globals_property_editor->edit( NULL ); - globals_property_editor->edit( Globals::get_singleton() ); - show(); - }; - } - - if (p_event.key.scancode==KEY_ESCAPE && !window_has_modal_stack() && is_visible()) { - hide(); - get_tree()->call_group(0,"windows","_cancel_input_ID",p_event.ID); - } - - - } -} - -void Console::_window_resize_event() { - -// Control::_window_resize_event(); - _resized(); -} - - -void Console::_resized() { - - set_pos( Point2( 0, OS::get_singleton()->get_video_mode().height-height) ); - set_size( Size2( OS::get_singleton()->get_video_mode().width, height) ); -} - -void Console::_notification(int p_what) { - - switch(p_what) { - - case NOTIFICATION_ENTER_TREE: { - - _resized(); - show(); - globals_property_editor->edit( Globals::get_singleton() ); - - } break; - - case NOTIFICATION_PROCESS: { - //pop messies - - if (output_queue_mutex) - output_queue_mutex->lock(); - - while(output_queue.size()) { - - OutputQueue q = output_queue.front()->get(); - if (q.type==OutputStrings::LINE_ERROR || q.type==OutputStrings::LINE_WARNING) - errors->add_line(q.text,q.meta,q.type); - output->add_line(q.text,q.meta,q.type); - output_queue.pop_front(); - } - - if (output_queue_mutex) - output_queue_mutex->unlock(); - - } break; - case NOTIFICATION_DRAW: { - - RID ci = get_canvas_item(); - get_stylebox("panel","Panel")->draw(ci,Rect2(Point2(),get_size())); - - } break; - } -} - - -void Console::_close_pressed() { - - hide(); -} - -void Console::_inspector_node_selected() { - - - Node *node = inspect_tree_editor->get_selected(); - - if (!node) - inspect_property_editor->edit(NULL); - else { - - inspect_history.add_object(node->get_instance_ID()); - - inspect_property_editor->edit(node); - } - -} - -void Console::_bind_methods() { - - ObjectTypeDB::bind_method("_stats_update_timer_callback",&Console::_stats_update_timer_callback); - ObjectTypeDB::bind_method("_close_pressed",&Console::_close_pressed); - ObjectTypeDB::bind_method("_inspector_node_selected",&Console::_inspector_node_selected); -} - - -Console::Console() { - - Ref<Theme> theme( memnew( Theme ) ); - set_theme( theme ); - editor_register_icons(theme); - - height=300; - tabs = memnew( TabContainer ); - tabs->set_tab_align(TabContainer::ALIGN_LEFT); - add_child(tabs); - tabs->set_area_as_parent_rect(); - - output = memnew( OutputStrings ); - output->set_name("Output"); - tabs->add_child(output); - errors = memnew( OutputStrings ); - errors->set_name("Errors"); - tabs->add_child(errors); - status = memnew( Control ); - status->set_name("Stats"); - tabs->add_child(status); - inspect = memnew( Control ); - inspect->set_name("Inspect"); - tabs->add_child(inspect); - globals = memnew( Control ); - globals->set_name("Globals"); - tabs->add_child(globals); - - // stats - - stats_tree = memnew( Tree ); - stats_tree->set_hide_root(true); - stats_tree->set_columns(2); - status->add_child(stats_tree); - stats_tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - stats_tree->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); - stats_tree->set_margin( MARGIN_RIGHT, 0.5 ); - stats_tree->set_begin( Point2( 20,25 ) ); - stats_tree->set_end( Point2( 0.5,5 ) ); - - Label *stats_label = memnew( Label ); - stats_label->set_text("Engine Statistics:"); - stats_label->set_pos( Point2( 5,5 ) ); - status->add_child(stats_label); - - TreeItem *stats_tree_root = stats_tree->create_item(NULL); - - { - //system items - TreeItem *system_item = stats_tree->create_item(stats_tree_root); - system_item->set_text(0,"System"); - - stats.usage_static_memory_total = stats_tree->create_item(system_item); - stats.usage_static_memory_total->set_text(0,"Total Static Mem");; - stats.usage_static_memory = stats_tree->create_item(system_item); - stats.usage_static_memory->set_text(0,"Static Mem Usage");; - stats.usage_dynamic_memory_total = stats_tree->create_item(system_item); - stats.usage_dynamic_memory_total->set_text(0,"Total Dynamic Mem");; - stats.usage_dynamic_memory = stats_tree->create_item(system_item); - stats.usage_dynamic_memory->set_text(0,"Dynamic Mem Usage"); - stats.usage_objects_instanced = stats_tree->create_item(system_item); - stats.usage_objects_instanced->set_text(0,"Instanced Objects"); - - //render items - TreeItem *render_item = stats_tree->create_item(stats_tree_root); - render_item->set_text(0,"Render"); - stats.render_objects_in_frame = stats_tree->create_item(render_item); - stats.render_objects_in_frame->set_text(0,"Visible Objects"); - stats.material_changes_in_frame = stats_tree->create_item(render_item); - stats.material_changes_in_frame->set_text(0,"Material Changes"); - stats.usage_video_mem_total = stats_tree->create_item(render_item); - stats.usage_video_mem_total->set_text(0,"Total Video Mem"); - stats.usage_texture_mem_used = stats_tree->create_item(render_item); - stats.usage_texture_mem_used->set_text(0,"Texture Mem Usage"); - stats.usage_vertex_mem_used = stats_tree->create_item(render_item); - stats.usage_vertex_mem_used->set_text(0,"Vertex Mem Usage"); - stats.usage_video_mem_used = stats_tree->create_item(render_item); - stats.usage_video_mem_used->set_text(0,"Combined Mem Usage"); - } - - { - - inspect_tree_editor = memnew( SceneTreeEditor ); - inspect_tree_editor->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); - inspect_tree_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - inspect_tree_editor->set_begin( Point2( 20, 5 ) ); - inspect_tree_editor->set_end( Point2( 0.49, 5 ) ); - inspect->add_child(inspect_tree_editor); - - inspect_property_editor = memnew( PropertyEditor ); - inspect_property_editor->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - inspect_property_editor->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - inspect_property_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - inspect_property_editor->set_begin( Point2( 0.51, 5 ) ); - inspect_property_editor->set_end( Point2( 5, 5 ) ); - inspect->add_child(inspect_property_editor); - } - - - { //globals - - globals_property_editor = memnew( PropertyEditor ); - globals_property_editor->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - globals_property_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - globals_property_editor->set_begin( Point2( 15, 5 ) ); - globals_property_editor->set_end( Point2( 5, 5 ) ); - globals_property_editor->get_top_label()->set_text("Globals Editor:"); - globals->add_child(globals_property_editor); - - } - - -#ifndef NO_THREADS - output_queue_mutex = Mutex::create(); -#else - output_queue_mutex = NULL; -#endif - - - hide(); - set_process(true); - - close = memnew( Button ); - add_child(close); - close->set_anchor( MARGIN_LEFT, ANCHOR_END); - close->set_anchor( MARGIN_RIGHT, ANCHOR_END); - close->set_begin( Point2( 25, 3 ) ); - close->set_end( Point2( 5, 3 ) ); - close->set_flat(true); - close->connect("pressed", this,"_close_pressed"); - - - close->set_icon( get_icon("close","Icons") ); -// force_top_viewport(true); - - - err_handler.userdata=this; - err_handler.errfunc=_error_handle; - add_error_handler(&err_handler); - - print_handler.userdata=this; - print_handler.printfunc=_print_handle; - add_print_handler(&print_handler); - - Timer *timer = memnew( Timer ); - add_child(timer); - timer->set_wait_time(1); - timer->start(); - timer->connect("timeout", this,"_stats_update_timer_callback"); - inspect_tree_editor->connect("node_selected", this,"_inspector_node_selected"); - - - -} - - -Console::~Console() { - - if (output_queue_mutex) - memdelete(output_queue_mutex); - - remove_error_handler(&err_handler); - remove_print_handler(&print_handler); - -} diff --git a/tools/editor/console.h b/tools/editor/console.h deleted file mode 100644 index aff425fcde..0000000000 --- a/tools/editor/console.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************/ -/* console.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 CONSOLE_H -#define CONSOLE_H - -#include "scene/gui/popup.h" -#include "scene/gui/button.h" -#include "scene/gui/tab_container.h" -#include "scene/gui/tree.h" -#include "scene/main/timer.h" -#include "output_strings.h" -#include "property_editor.h" -#include "scene_tree_editor.h" -#include "editor_data.h" - -class Console : public Popup { - - OBJ_TYPE( Console, Popup ); - - TabContainer *tabs; - OutputStrings *output; - OutputStrings *errors; - Control *status; - Control *inspect; - Control *globals; - Button *close; - int height; - - EditorHistory inspect_history; - SceneTreeEditor *inspect_tree_editor; - PropertyEditor *inspect_property_editor; - PropertyEditor *globals_property_editor; - - Tree *stats_tree; - - struct StatsItems { - - TreeItem *render_objects_in_frame; - TreeItem *material_changes_in_frame; - - TreeItem *usage_video_mem_total; - TreeItem *usage_video_mem_used; - TreeItem *usage_texture_mem_used; - TreeItem *usage_vertex_mem_used; - - TreeItem *usage_static_memory_total; - TreeItem *usage_static_memory; - TreeItem *usage_dynamic_memory_total; - TreeItem *usage_dynamic_memory; - TreeItem *usage_objects_instanced; - - } stats; - - struct OutputQueue { - - OutputStrings::LineType type; - Variant meta; - String text; - }; - - Mutex *output_queue_mutex; - List<OutputQueue> output_queue; - - - ErrorHandlerList err_handler; - PrintHandlerList print_handler; - - void _inspector_node_selected(); - - static void _error_handle(void *p_this,const char*p_function,const char* p_file,int p_line,const char *p_error, const char *p_explanation,ErrorHandlerType p_type); - static void _print_handle(void *p_this,const String& p_string); - -protected: - - virtual void _window_input_event(InputEvent p_event); - virtual void _window_resize_event(); - - void _stats_update_timer_callback(); - void _resized(); - void _close_pressed(); - - void _notification(int p_what); - - static void _bind_methods(); -public: - Console(); - ~Console(); -}; - -#endif // CONSOLE_H diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index fc7ee2bde7..28a9b63412 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -1071,7 +1071,7 @@ void EditorFileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_vbox:VBoxContainer"),&EditorFileDialog::get_vbox); ObjectTypeDB::bind_method(_MD("set_access","access"),&EditorFileDialog::set_access); ObjectTypeDB::bind_method(_MD("get_access"),&EditorFileDialog::get_access); - ObjectTypeDB::bind_method(_MD("set_show_hidden_files"),&EditorFileDialog::set_show_hidden_files); + ObjectTypeDB::bind_method(_MD("set_show_hidden_files","show"),&EditorFileDialog::set_show_hidden_files); ObjectTypeDB::bind_method(_MD("is_showing_hidden_files"),&EditorFileDialog::is_showing_hidden_files); ObjectTypeDB::bind_method(_MD("_select_drive"),&EditorFileDialog::_select_drive); ObjectTypeDB::bind_method(_MD("_make_dir"),&EditorFileDialog::_make_dir); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index a5a3890129..1905ab731f 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -690,16 +690,28 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); //class_desc->add_newline(); - class_desc->add_newline(); +// class_desc->add_newline(); class_desc->push_indent(1); + class_desc->push_table(2); + class_desc->set_table_column_expand(1,1); for(int i=0;i<cd.methods.size();i++) { + class_desc->push_cell(); + + method_line[cd.methods[i].name]=class_desc->get_line_count()-2; //gets overriden if description + class_desc->push_align(RichTextLabel::ALIGN_RIGHT); class_desc->push_font(doc_code_font); _add_type(cd.methods[i].return_type); - class_desc->add_text(" "); + //class_desc->add_text(" "); + class_desc->pop(); //align + class_desc->pop(); //font + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->push_font(doc_code_font); + if (cd.methods[i].description!="") { method_descr=true; class_desc->push_meta("@"+cd.methods[i].name); @@ -742,12 +754,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } class_desc->pop();//monofont - class_desc->add_newline(); +// class_desc->add_newline(); + class_desc->pop(); //cell } - + class_desc->pop(); //table class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } diff --git a/tools/editor/icons/icon_edit_pivot.png b/tools/editor/icons/icon_edit_pivot.png Binary files differnew file mode 100644 index 0000000000..d68f7bbf25 --- /dev/null +++ b/tools/editor/icons/icon_edit_pivot.png diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0946383c8d..9213543ff5 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -152,6 +152,46 @@ public: } }; +void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { + List<Node*> &selection = editor_selection->get_selected_node_list(); + + undo_redo->create_action("Move Pivot"); + + for(List<Node*>::Element *E=selection.front();E;E=E->next()) { + + Node2D *n2d = E->get()->cast_to<Node2D>(); + + if (n2d && n2d->edit_has_pivot()) { + + Vector2 offset = n2d->edit_get_pivot(); + Vector2 gpos = n2d->get_global_pos(); + + Vector2 local_mouse_pos = n2d->get_canvas_transform().affine_inverse().xform(mouse_pos); + + Vector2 motion_ofs = gpos-local_mouse_pos; + + undo_redo->add_do_method(n2d,"set_global_pos",local_mouse_pos); + undo_redo->add_do_method(n2d,"edit_set_pivot",offset+n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); + undo_redo->add_undo_method(n2d,"set_global_pos",gpos); + undo_redo->add_undo_method(n2d,"edit_set_pivot",offset); + for(int i=0;i<n2d->get_child_count();i++) { + Node2D *n2dc = n2d->get_child(i)->cast_to<Node2D>(); + if (!n2dc) + continue; + + undo_redo->add_do_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + undo_redo->add_undo_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + + } + + } + + } + + undo_redo->commit_action(); + +} + void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { if (!is_visible()) @@ -179,38 +219,7 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { mouse_pos=transform.affine_inverse().xform(mouse_pos); mouse_pos=snap_point(mouse_pos); - undo_redo->create_action("Move Pivot"); - - for(List<Node*>::Element *E=selection.front();E;E=E->next()) { - - Node2D *n2d = E->get()->cast_to<Node2D>(); - - if (n2d && n2d->edit_has_pivot()) { - - Vector2 offset = n2d->edit_get_pivot(); - Vector2 gpos = n2d->get_global_pos(); - - Vector2 motion_ofs = gpos-mouse_pos; - - undo_redo->add_do_method(n2d,"set_global_pos",mouse_pos); - undo_redo->add_do_method(n2d,"edit_set_pivot",offset+n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); - undo_redo->add_undo_method(n2d,"set_global_pos",gpos); - undo_redo->add_undo_method(n2d,"edit_set_pivot",offset); - for(int i=0;i<n2d->get_child_count();i++) { - Node2D *n2dc = n2d->get_child(i)->cast_to<Node2D>(); - if (!n2dc) - continue; - - undo_redo->add_do_method(n2dc,"set_global_pos",n2dc->get_global_pos()); - undo_redo->add_undo_method(n2dc,"set_global_pos",n2dc->get_global_pos()); - - } - - } - - } - - undo_redo->commit_action(); + _edit_set_pivot(mouse_pos); } } @@ -221,7 +230,7 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { void CanvasItemEditor::_tool_select(int p_index) { - ToolButton *tb[TOOL_MAX]={select_button,list_select_button,move_button,rotate_button,pan_button}; + ToolButton *tb[TOOL_MAX]={select_button,list_select_button,move_button,rotate_button,pivot_button,pan_button}; for(int i=0;i<TOOL_MAX;i++) { tb[i]->set_pressed(i==p_index); @@ -1130,6 +1139,20 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { return; } + + if (b.button_index==BUTTON_LEFT && tool==TOOL_EDIT_PIVOT) { + if (b.pressed) { + + Point2 mouse_pos(b.x,b.y); + mouse_pos=transform.affine_inverse().xform(mouse_pos); + mouse_pos=snap_point(mouse_pos); + _edit_set_pivot(mouse_pos); + } + return; + } + + + if (tool==TOOL_PAN || b.button_index!=BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE)) return; @@ -1858,6 +1881,8 @@ void CanvasItemEditor::_viewport_draw() { CanvasItem *single_item=NULL; + bool pivot_found=false; + for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { @@ -1899,7 +1924,7 @@ void CanvasItemEditor::_viewport_draw() { viewport->draw_line(endpoints[i],endpoints[(i+1)%4],c,2); } - if (single && (tool==TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE)) { //kind of sucks + if (single && (tool==TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE || tool==TOOL_EDIT_PIVOT)) { //kind of sucks if (canvas_item->cast_to<Node2D>()) { @@ -1907,6 +1932,7 @@ void CanvasItemEditor::_viewport_draw() { if (canvas_item->cast_to<Node2D>()->edit_has_pivot()) { viewport->draw_texture(pivot,xform.get_origin()+(-pivot->get_size()/2).floor()); can_move_pivot=true; + pivot_found=true; } } @@ -1941,6 +1967,7 @@ void CanvasItemEditor::_viewport_draw() { //E->get().last_rect = rect; } + pivot_button->set_disabled(!pivot_found); VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Matrix32()); @@ -2149,6 +2176,7 @@ void CanvasItemEditor::_notification(int p_what) { move_button->set_icon( get_icon("ToolMove","EditorIcons")); rotate_button->set_icon( get_icon("ToolRotate","EditorIcons")); pan_button->set_icon( get_icon("ToolPan", "EditorIcons")); + pivot_button->set_icon( get_icon("EditPivot", "EditorIcons")); select_handle=get_icon("EditorHandle","EditorIcons"); lock_button->set_icon(get_icon("Lock","EditorIcons")); unlock_button->set_icon(get_icon("Unlock","EditorIcons")); @@ -3206,6 +3234,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { list_select_button->connect("pressed",this,"_tool_select",make_binds(TOOL_LIST_SELECT)); list_select_button->set_tooltip("Show a list of all objects at the position clicked\n(same as Alt+RMB in selet mode)."); + pivot_button = memnew( ToolButton ); + pivot_button->set_toggle_mode(true); + hb->add_child(pivot_button); + pivot_button->connect("pressed",this,"_tool_select",make_binds(TOOL_EDIT_PIVOT)); + pivot_button->set_tooltip("Click to change object's rotation pivot"); + pan_button = memnew( ToolButton ); pan_button->set_toggle_mode(true); hb->add_child(pan_button); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index 2376e9f842..c731e8c4c6 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -70,6 +70,7 @@ class CanvasItemEditor : public VBoxContainer { TOOL_LIST_SELECT, TOOL_MOVE, TOOL_ROTATE, + TOOL_EDIT_PIVOT, TOOL_PAN, TOOL_MAX }; @@ -245,6 +246,7 @@ class CanvasItemEditor : public VBoxContainer { ToolButton *move_button; ToolButton *rotate_button; + ToolButton *pivot_button; ToolButton *pan_button; ToolButton *lock_button; @@ -266,6 +268,7 @@ class CanvasItemEditor : public VBoxContainer { PopupMenu *selection_menu; + //PopupMenu *popup; DragType drag; Point2 drag_from; @@ -306,6 +309,7 @@ class CanvasItemEditor : public VBoxContainer { CanvasItem *ref_item; + void _edit_set_pivot(const Vector2& mouse_pos); void _add_canvas_item(CanvasItem *p_canvas_item); void _remove_canvas_item(CanvasItem *p_canvas_item); void _clear_canvas_items(); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index f22bd3d956..59f5d89073 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -316,6 +316,8 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_keyword_color("Color",basetype_color); get_text_edit()->add_keyword_color("Image",basetype_color); get_text_edit()->add_keyword_color("InputEvent",basetype_color); + get_text_edit()->add_keyword_color("Rect2",basetype_color); + get_text_edit()->add_keyword_color("NodePath",basetype_color); //colorize engine types Color type_color= EDITOR_DEF("text_editor/engine_type_color",Color(0.0,0.2,0.4)); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 66c7a39096..ebbd41bc23 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -218,7 +218,8 @@ struct _TileMapEditorCopyData { bool TileMapEditor::forward_input_event(const InputEvent& p_event) { - if (!node || !node->get_tileset().is_valid()) + + if (!node || !node->get_tileset().is_valid() || !node->is_visible()) return false; Matrix32 xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index dd3c7552de..301ae2ec14 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -33,6 +33,7 @@ #include "editor_node.h" #include "scene/gui/margin_container.h" #include "translation.h" +#include "global_constants.h" ProjectSettings *ProjectSettings::singleton=NULL; @@ -777,10 +778,11 @@ void ProjectSettings::_translation_file_open() { void ProjectSettings::_autoload_file_callback(const String& p_path) { autoload_add_path->set_text(p_path); - if (autoload_add_name->get_text().strip_edges()==String()) { + //if (autoload_add_name->get_text().strip_edges()==String()) { autoload_add_name->set_text( p_path.get_file().basename() ); - } + //} + //_translation_add(p_translation); } @@ -789,6 +791,40 @@ void ProjectSettings::_autoload_file_open() { autoload_file_open->popup_centered_ratio(); } +void ProjectSettings::_autoload_edited() { + + if (updating_autoload) + return; + + TreeItem *ti = autoload_list->get_edited(); + if (!ti || autoload_list->get_edited_column()!=2) + return; + + updating_autoload=true; + bool checked=ti->is_checked(2); + + String base="autoload/"+ti->get_text(0); + + String path = Globals::get_singleton()->get(base); + + if (path.begins_with("*")) + path=path.substr(1,path.length()); + + if (checked) + path="*"+path; + + undo_redo->create_action("Toggle Autoload GlobalVar"); + undo_redo->add_do_property(Globals::get_singleton(),base,path); + undo_redo->add_undo_property(Globals::get_singleton(),base,Globals::get_singleton()->get(base)); + undo_redo->add_do_method(this,"_update_autoload"); + undo_redo->add_undo_method(this,"_update_autoload"); + undo_redo->add_do_method(this,"_settings_changed"); + undo_redo->add_undo_method(this,"_settings_changed"); + undo_redo->commit_action(); + updating_autoload=false; + +} + void ProjectSettings::_autoload_add() { String name = autoload_add_name->get_text(); @@ -799,6 +835,35 @@ void ProjectSettings::_autoload_add() { } + if (ObjectTypeDB::type_exists(name)) { + + message->set_text("Invalid Name.Must not collide with an existing engine class name."); + message->popup_centered(Size2(300,100)); + return; + + } + + for(int i=0;i<Variant::VARIANT_MAX;i++) { + if (Variant::get_type_name(Variant::Type(i))==name) { + + message->set_text("Invalid Name.Must not collide with an existing buit-in type name."); + message->popup_centered(Size2(300,100)); + return; + + } + } + + for(int i=0;i<GlobalConstants::get_global_constant_count();i++) { + + if (GlobalConstants::get_global_constant_name(i)==name) { + + message->set_text("Invalid Name.Must not collide with an existing global constant name."); + message->popup_centered(Size2(300,100)); + return; + } + + } + String path = autoload_add_path->get_text(); if (!FileAccess::exists(path)) { message->set_text("Invalid Path.\nFile does not exist."); @@ -815,7 +880,7 @@ void ProjectSettings::_autoload_add() { undo_redo->create_action("Add Autoload"); name = "autoload/"+name; - undo_redo->add_do_property(Globals::get_singleton(),name,path); + undo_redo->add_do_property(Globals::get_singleton(),name,"*"+path); if (Globals::get_singleton()->has(name)) undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name)); else @@ -865,11 +930,14 @@ void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button String swap_name= "autoload/"+swap->get_text(0); + int order = Globals::get_singleton()->get_order(name); + int swap_order = Globals::get_singleton()->get_order(swap_name); + undo_redo->create_action("Move Autoload"); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",swap_name,Globals::get_singleton()->get_order(name)); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",name,Globals::get_singleton()->get_order(swap_name)); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",swap_name,Globals::get_singleton()->get_order(swap_name)); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,Globals::get_singleton()->get_order(name)); + undo_redo->add_do_method(Globals::get_singleton(),"set_order",swap_name,order); + undo_redo->add_do_method(Globals::get_singleton(),"set_order",name,swap_order); + undo_redo->add_undo_method(Globals::get_singleton(),"set_order",swap_name,swap_order); + undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order); undo_redo->add_do_method(this,"_update_autoload"); undo_redo->add_undo_method(this,"_update_autoload"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1208,6 +1276,11 @@ void ProjectSettings::_update_translations() { void ProjectSettings::_update_autoload() { + if (updating_autoload) + return; + + updating_autoload=true; + autoload_list->clear(); TreeItem *root = autoload_list->create_item(); autoload_list->set_hide_root(true); @@ -1222,18 +1295,31 @@ void ProjectSettings::_update_autoload() { continue; String name = pi.name.get_slice("/",1); + String path = Globals::get_singleton()->get(pi.name); + if (name=="") continue; - + bool global=false; + if (path.begins_with("*")) { + path=path.substr(1,path.length()); + global=true; + } TreeItem *t = autoload_list->create_item(root); t->set_text(0,name); - t->set_text(1,Globals::get_singleton()->get(pi.name)); - t->add_button(1,get_icon("MoveUp","EditorIcons"),1); - t->add_button(1,get_icon("MoveDown","EditorIcons"),2); - t->add_button(1,get_icon("Del","EditorIcons"),0); + t->set_text(1,path); + t->set_cell_mode(2,TreeItem::CELL_MODE_CHECK); + t->set_editable(2,true); + t->set_text(2,"Enable"); + t->set_checked(2,global); + t->add_button(3,get_icon("MoveUp","EditorIcons"),1); + t->add_button(3,get_icon("MoveDown","EditorIcons"),2); + t->add_button(3,get_icon("Del","EditorIcons"),0); + } + updating_autoload=false; + } void ProjectSettings::_toggle_search_bar(bool p_pressed) { @@ -1302,6 +1388,7 @@ void ProjectSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("_autoload_file_callback"),&ProjectSettings::_autoload_file_callback); ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload); ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete); + ObjectTypeDB::bind_method(_MD("_autoload_edited"),&ProjectSettings::_autoload_edited); ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box); ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar); @@ -1694,11 +1781,24 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { autoload_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); autoload_file_open->connect("file_selected",this,"_autoload_file_callback"); - autoload_list->set_columns(2); + autoload_list->set_columns(4); autoload_list->set_column_titles_visible(true); - autoload_list->set_column_title(0,"name"); - autoload_list->set_column_title(1,"path"); + autoload_list->set_column_title(0,"Name"); + autoload_list->set_column_expand(0,true); + autoload_list->set_column_min_width(0,100); + autoload_list->set_column_title(1,"Path"); + autoload_list->set_column_expand(1,true); + autoload_list->set_column_min_width(1,100); + autoload_list->set_column_title(2,"Singleton"); + autoload_list->set_column_expand(2,false); + autoload_list->set_column_min_width(2,80); + autoload_list->set_column_expand(3,false); + autoload_list->set_column_min_width(3,80); + autoload_list->connect("button_pressed",this,"_autoload_delete"); + autoload_list->connect("item_edited",this,"_autoload_edited"); + + updating_autoload=false; } diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index f201f5c48f..0148c4a2f1 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -95,8 +95,10 @@ class ProjectSettings : public AcceptDialog { void _update_autoload(); void _autoload_file_callback(const String& p_path); void _autoload_add(); + void _autoload_edited(); void _autoload_file_open(); void _autoload_delete(Object *p_item,int p_column, int p_button); + bool updating_autoload; void _item_selected(); diff --git a/tools/pck/pck_packer.cpp b/tools/pck/pck_packer.cpp index d398fefb5f..228d37df7c 100644 --- a/tools/pck/pck_packer.cpp +++ b/tools/pck/pck_packer.cpp @@ -26,7 +26,7 @@ void PCKPacker::_bind_methods() { ObjectTypeDB::bind_method(_MD("pck_start","pck_name","alignment"),&PCKPacker::pck_start); ObjectTypeDB::bind_method(_MD("add_file","pck_path","source_path"),&PCKPacker::add_file); - ObjectTypeDB::bind_method(_MD("flush"),&PCKPacker::flush); + ObjectTypeDB::bind_method(_MD("flush","verbose"),&PCKPacker::flush); }; |