diff options
300 files changed, 3363 insertions, 4768 deletions
diff --git a/.gitignore b/.gitignore index cbb0b5b133..f8296ef51e 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,10 @@ gmon.out .cproject .settings/ +# Geany/geany-plugins files +*.geany +.geanyprj + # Misc .DS_Store logs/ diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..b37cd2884d --- /dev/null +++ b/.mailmap @@ -0,0 +1,26 @@ +Andrea Catania <info@andreacatania.com> +Andreas Haas <liu.gam3@gmail.com> +Andreas Haas <Hinsbart@users.noreply.github.com> +Andreas Haas <entenflugstuhl@gmail.com> +Ariel Manzur <ariel@godotengine.org> +Ariel Manzur <ariel@okamstudio.com> +Bastiaan Olij <mux213@gmail.com> +Bernhard Liebl <poke1024@gmx.de> +Bernhard Liebl <poke1024@gmx.org> +Geequlim <geequlim@gmail.com> +Ignacio Etcheverry <ignalfonsore@gmail.com> +Indah Sylvia <ISylvox@yahoo.com> +Jakub Grzesik <kubecz3k@gmail.com> +Juan Linietsky <reduzio@gmail.com> +Juan Linietsky <juan@okamstudio.com> +Juan Linietsky <reduz@Juans-MBP.fibertel.com.ar> +Julian Murgia <the.straton@gmail.com> +Leon Krause <eska@eska.me> +Leon Krause <eska@eska.me> <eska014@users.noreply.github.com> +Marcelo Fernandez <marcelofg55@gmail.com> +Mariano Javier Suligoy <marianognu.easyrpg@gmail.com> +Paul Batty <p_batty@hotmail.co.uk> +Poommetee Ketson <poommetee@protonmail.com> +Saracen <SaracenOne@gmail.com> +Thomas Herzog <therzog@mail.de> +Zher Huei Lee <lee.zh.92@gmail.com> diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 2921626f3a..32b94b9b02 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1129,6 +1129,22 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left); ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "clipboard"), "set_clipboard", "get_clipboard"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "exit_code"), "set_exit_code", "get_exit_code"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vsync_enabled"), "set_use_vsync", "is_vsync_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "low_processor_usage_mode"), "set_low_processor_usage_mode", "is_in_low_processor_usage_mode"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_screen_on"), "set_keep_screen_on", "is_keep_screen_on"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"), "set_screen_orientation", "get_screen_orientation"); + ADD_GROUP("Window", "window_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_fullscreen"), "set_window_fullscreen", "is_window_fullscreen"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_maximized"), "set_window_maximized", "is_window_maximized"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_minimized"), "set_window_minimized", "is_window_minimized"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_resizable"), "set_window_resizable", "is_window_resizable"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_position"), "set_window_position", "get_window_position"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_size"), "set_window_size", "get_window_size"); + BIND_ENUM_CONSTANT(DAY_SUNDAY); BIND_ENUM_CONSTANT(DAY_MONDAY); BIND_ENUM_CONSTANT(DAY_TUESDAY); @@ -1808,6 +1824,8 @@ void _File::_bind_methods() { ClassDB::bind_method(D_METHOD("file_exists", "path"), &_File::file_exists); ClassDB::bind_method(D_METHOD("get_modified_time", "file"), &_File::get_modified_time); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "endian_swap"), "set_endian_swap", "get_endian_swap"); + BIND_ENUM_CONSTANT(READ); BIND_ENUM_CONSTANT(WRITE); BIND_ENUM_CONSTANT(READ_WRITE); @@ -2466,7 +2484,13 @@ Array _ClassDB::get_method_list(StringName p_class, bool p_no_inheritance) const Array ret; for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { +#ifdef DEBUG_METHODS_ENABLED ret.push_back(E->get().operator Dictionary()); +#else + Dictionary dict; + dict["name"] = E->get().name; + ret.push_back(dict); +#endif } return ret; @@ -2561,7 +2585,7 @@ void _Engine::set_target_fps(int p_fps) { Engine::get_singleton()->set_target_fps(p_fps); } -float _Engine::get_target_fps() const { +int _Engine::get_target_fps() const { return Engine::get_singleton()->get_target_fps(); } @@ -2643,6 +2667,11 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint); ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_hint"), "set_editor_hint", "is_editor_hint"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_scale"), "set_time_scale", "get_time_scale"); } _Engine *_Engine::singleton = NULL; diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index bc5b8ea04c..2353b6d09f 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -656,7 +656,7 @@ public: int get_iterations_per_second() const; void set_target_fps(int p_fps); - float get_target_fps() const; + int get_target_fps() const; float get_frames_per_second() const; diff --git a/core/color.cpp b/core/color.cpp index 7278b5c4ee..b708f15d69 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -396,7 +396,7 @@ String Color::to_html(bool p_alpha) const { txt += _to_hex(g); txt += _to_hex(b); if (p_alpha) - txt = _to_hex(a) + txt; + txt += _to_hex(a); return txt; } @@ -413,96 +413,95 @@ Color::operator String() const { Color Color::operator+(const Color &p_color) const { return Color( - CLAMP(r + p_color.r, 0.0, 1.0), - CLAMP(g + p_color.g, 0.0, 1.0), - CLAMP(b + p_color.b, 0.0, 1.0), - CLAMP(a + p_color.a, 0.0, 1.0)); + r + p_color.r, + g + p_color.g, + b + p_color.b, + a + p_color.a); } void Color::operator+=(const Color &p_color) { - r = CLAMP(r + p_color.r, 0.0, 1.0); - g = CLAMP(g + p_color.g, 0.0, 1.0); - b = CLAMP(b + p_color.b, 0.0, 1.0); - a = CLAMP(a + p_color.a, 0.0, 1.0); + r = r + p_color.r; + g = g + p_color.g; + b = b + p_color.b; + a = a + p_color.a; } Color Color::operator-(const Color &p_color) const { return Color( - CLAMP(r - p_color.r, 0.0, 1.0), - CLAMP(g - p_color.g, 0.0, 1.0), - CLAMP(b - p_color.b, 0.0, 1.0), - CLAMP(a - p_color.a, 0.0, 1.0)); + r - p_color.r, + g - p_color.g, + b - p_color.b, + a - p_color.a); } void Color::operator-=(const Color &p_color) { - r = CLAMP(r - p_color.r, 0.0, 1.0); - g = CLAMP(g - p_color.g, 0.0, 1.0); - b = CLAMP(b - p_color.b, 0.0, 1.0); - a = CLAMP(a - p_color.a, 0.0, 1.0); + r = r - p_color.r; + g = g - p_color.g; + b = b - p_color.b; + a = a - p_color.a; } Color Color::operator*(const Color &p_color) const { return Color( - CLAMP(r * p_color.r, 0.0, 1.0), - CLAMP(g * p_color.g, 0.0, 1.0), - CLAMP(b * p_color.b, 0.0, 1.0), - CLAMP(a * p_color.a, 0.0, 1.0)); + r * p_color.r, + g * p_color.g, + b * p_color.b, + a * p_color.a); } Color Color::operator*(const real_t &rvalue) const { return Color( - CLAMP(r * rvalue, 0.0, 1.0), - CLAMP(g * rvalue, 0.0, 1.0), - CLAMP(b * rvalue, 0.0, 1.0), - CLAMP(a * rvalue, 0.0, 1.0)); + r * rvalue, + g * rvalue, + b * rvalue, + a * rvalue); } void Color::operator*=(const Color &p_color) { - r = CLAMP(r * p_color.r, 0.0, 1.0); - g = CLAMP(g * p_color.g, 0.0, 1.0); - b = CLAMP(b * p_color.b, 0.0, 1.0); - a = CLAMP(a * p_color.a, 0.0, 1.0); + r = r * p_color.r; + g = g * p_color.g; + b = b * p_color.b; + a = a * p_color.a; } void Color::operator*=(const real_t &rvalue) { - r = CLAMP(r * rvalue, 0.0, 1.0); - g = CLAMP(g * rvalue, 0.0, 1.0); - b = CLAMP(b * rvalue, 0.0, 1.0); - a = CLAMP(a * rvalue, 0.0, 1.0); -}; + r = r * rvalue; + g = g * rvalue; + b = b * rvalue; + a = a * rvalue; +} Color Color::operator/(const Color &p_color) const { return Color( - p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0), - p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0), - p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0), - p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0)); + r / p_color.r, + g / p_color.g, + b / p_color.b, + a / p_color.a); } Color Color::operator/(const real_t &rvalue) const { - if (rvalue == 0) return Color(1.0, 1.0, 1.0, 1.0); return Color( - CLAMP(r / rvalue, 0.0, 1.0), - CLAMP(g / rvalue, 0.0, 1.0), - CLAMP(b / rvalue, 0.0, 1.0), - CLAMP(a / rvalue, 0.0, 1.0)); + r / rvalue, + g / rvalue, + b / rvalue, + a / rvalue); } void Color::operator/=(const Color &p_color) { - r = p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0); - g = p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0); - b = p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0); - a = p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0); + r = r / p_color.r; + g = g / p_color.g; + b = b / p_color.b; + a = a / p_color.a; } void Color::operator/=(const real_t &rvalue) { @@ -513,18 +512,18 @@ void Color::operator/=(const real_t &rvalue) { b = 1.0; a = 1.0; } else { - r = CLAMP(r / rvalue, 0.0, 1.0); - g = CLAMP(g / rvalue, 0.0, 1.0); - b = CLAMP(b / rvalue, 0.0, 1.0); - a = CLAMP(a / rvalue, 0.0, 1.0); + r = r / rvalue; + g = g / rvalue; + b = b / rvalue; + a = a / rvalue; } }; Color Color::operator-() const { return Color( - CLAMP(1.0 - r, 0.0, 1.0), - CLAMP(1.0 - g, 0.0, 1.0), - CLAMP(1.0 - b, 0.0, 1.0), - CLAMP(1.0 - a, 0.0, 1.0)); + 1.0 - r, + 1.0 - g, + 1.0 - b, + 1.0 - a); } diff --git a/core/color.h b/core/color.h index 0ff4fe6edd..9af8fb0a78 100644 --- a/core/color.h +++ b/core/color.h @@ -105,18 +105,18 @@ struct Color { _FORCE_INLINE_ Color darkened(float p_amount) const { Color res = *this; - res.r = CLAMP(res.r * (1.0f - p_amount), 0.0, 1.0); - res.g = CLAMP(res.g * (1.0f - p_amount), 0.0, 1.0); - res.b = CLAMP(res.b * (1.0f - p_amount), 0.0, 1.0); + res.r = res.r * (1.0f - p_amount); + res.g = res.g * (1.0f - p_amount); + res.b = res.b * (1.0f - p_amount); return res; } _FORCE_INLINE_ Color lightened(float p_amount) const { Color res = *this; - res.r = CLAMP(res.r + (1.0f - res.r) * p_amount, 0.0, 1.0); - res.g = CLAMP(res.g + (1.0f - res.g) * p_amount, 0.0, 1.0); - res.b = CLAMP(res.b + (1.0f - res.b) * p_amount, 0.0, 1.0); + res.r = res.r + (1.0f - res.r) * p_amount; + res.g = res.g + (1.0f - res.g) * p_amount; + res.b = res.b + (1.0f - res.b) * p_amount; return res; } diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 54743d37af..a9eb9466b7 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -682,6 +682,9 @@ void HTTPClient::_bind_methods() { ClassDB::bind_method(D_METHOD("query_string_from_dict", "fields"), &HTTPClient::query_string_from_dict); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_mode_enabled"), "set_blocking_mode", "is_blocking_mode_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "connection", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_connection", "get_connection"); + BIND_ENUM_CONSTANT(METHOD_GET); BIND_ENUM_CONSTANT(METHOD_HEAD); BIND_ENUM_CONSTANT(METHOD_POST); diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp index dbfb6d9a81..6354eef8b5 100644 --- a/core/io/networked_multiplayer_peer.cpp +++ b/core/io/networked_multiplayer_peer.cpp @@ -33,6 +33,7 @@ void NetworkedMultiplayerPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_transfer_mode", "mode"), &NetworkedMultiplayerPeer::set_transfer_mode); + ClassDB::bind_method(D_METHOD("get_transfer_mode"), &NetworkedMultiplayerPeer::get_transfer_mode); ClassDB::bind_method(D_METHOD("set_target_peer", "id"), &NetworkedMultiplayerPeer::set_target_peer); ClassDB::bind_method(D_METHOD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer); @@ -45,6 +46,9 @@ void NetworkedMultiplayerPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_refuse_new_connections", "enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections); ClassDB::bind_method(D_METHOD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_connections"), "set_refuse_new_connections", "is_refusing_new_connections"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_mode", PROPERTY_HINT_ENUM, "Unreliable,Unreliable Ordered,Reliable"), "set_transfer_mode", "get_transfer_mode"); + BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE); BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED); BIND_ENUM_CONSTANT(TRANSFER_MODE_RELIABLE); diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h index 057b933dc9..66089c27b9 100644 --- a/core/io/networked_multiplayer_peer.h +++ b/core/io/networked_multiplayer_peer.h @@ -58,6 +58,7 @@ public: }; virtual void set_transfer_mode(TransferMode p_mode) = 0; + virtual TransferMode get_transfer_mode() const = 0; virtual void set_target_peer(int p_peer_id) = 0; virtual int get_packet_peer() const = 0; diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 9cfa04346c..bd851ebb6d 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -141,6 +141,8 @@ void PacketPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_allow_object_decoding", "enable"), &PacketPeer::set_allow_object_decoding); ClassDB::bind_method(D_METHOD("is_object_decoding_allowed"), &PacketPeer::is_object_decoding_allowed); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_object_decoding"), "set_allow_object_decoding", "is_object_decoding_allowed"); }; /***************/ @@ -153,11 +155,16 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) { void PacketPeerStream::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer); + ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::set_stream_peer); + ClassDB::bind_method(D_METHOD("get_stream_peer"), &PacketPeerStream::get_stream_peer); ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size); ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size); ClassDB::bind_method(D_METHOD("get_input_buffer_max_size"), &PacketPeerStream::get_input_buffer_max_size); ClassDB::bind_method(D_METHOD("get_output_buffer_max_size"), &PacketPeerStream::get_output_buffer_max_size); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "input_buffer_max_size"), "set_input_buffer_max_size", "get_input_buffer_max_size"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "output_buffer_max_size"), "set_output_buffer_max_size", "get_output_buffer_max_size"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream_peer", PROPERTY_HINT_RESOURCE_TYPE, "StreamPeer", 0), "set_stream_peer", "get_stream_peer"); } Error PacketPeerStream::_poll_buffer() const { @@ -262,6 +269,11 @@ void PacketPeerStream::set_stream_peer(const Ref<StreamPeer> &p_peer) { peer = p_peer; } +Ref<StreamPeer> PacketPeerStream::get_stream_peer() const { + + return peer; +} + void PacketPeerStream::set_input_buffer_max_size(int p_max_size) { //warning may lose packets diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index 6636d56959..b10152e96b 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -98,6 +98,7 @@ public: virtual int get_max_packet_size() const; void set_stream_peer(const Ref<StreamPeer> &p_peer); + Ref<StreamPeer> get_stream_peer() const; void set_input_buffer_max_size(int p_max_size); int get_input_buffer_max_size() const; void set_output_buffer_max_size(int p_max_size); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 87add585eb..1351030d1e 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -202,7 +202,8 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: " + local_path + " (cached)"); - + if (r_error) + *r_error = OK; return RES(ResourceCache::get(local_path)); } diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index f142abd3a4..fc00c26889 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -401,6 +401,8 @@ void StreamPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_string", "bytes"), &StreamPeer::get_string); ClassDB::bind_method(D_METHOD("get_utf8_string", "bytes"), &StreamPeer::get_utf8_string); ClassDB::bind_method(D_METHOD("get_var"), &StreamPeer::get_var); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "big_endian"), "set_big_endian", "is_big_endian_enabled"); } //////////////////////////////// @@ -414,6 +416,9 @@ void StreamPeerBuffer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_data_array"), &StreamPeerBuffer::get_data_array); ClassDB::bind_method(D_METHOD("clear"), &StreamPeerBuffer::clear); ClassDB::bind_method(D_METHOD("duplicate"), &StreamPeerBuffer::duplicate); + + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_array"), "set_data_array", "get_data_array"); + } Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { diff --git a/core/object.cpp b/core/object.cpp index f9d733c11f..aaa37e6cf2 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -605,11 +605,11 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NONZERO)); #ifdef TOOLS_ENABLED if (editor_section_folding.size()) { - p_list->push_back(PropertyInfo(Variant::ARRAY, CoreStringNames::get_singleton()->_sections_unfolded, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::ARRAY, CoreStringNames::get_singleton()->_sections_unfolded, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } #endif if (!metadata.empty()) - p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_STORE_IF_NONZERO)); + p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_STORE_IF_NONZERO)); if (script_instance && !p_reversed) { p_list->push_back(PropertyInfo(Variant::NIL, "Script Variables", PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_CATEGORY)); script_instance->get_property_list(p_list); diff --git a/core/object.h b/core/object.h index 5de87b8a7d..75800acaa7 100644 --- a/core/object.h +++ b/core/object.h @@ -111,10 +111,11 @@ enum PropertyUsageFlags { PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 18, PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 19, PROPERTY_USAGE_INTERNAL = 1 << 20, + PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 21, // If the object is duplicated also this property will be duplicated PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK, PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED, - PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNAL, + PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, }; #define ADD_SIGNAL(m_signal) ClassDB::add_signal(get_class_static(), m_signal) diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp index 57463a662d..0da377453e 100644 --- a/core/script_debugger_local.cpp +++ b/core/script_debugger_local.cpp @@ -294,6 +294,11 @@ void ScriptDebuggerLocal::send_message(const String &p_message, const Array &p_a print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args))); } +void ScriptDebuggerLocal::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info) { + + print_line("ERROR: '" + (p_descr.empty() ? p_err : p_descr) + "'"); +} + ScriptDebuggerLocal::ScriptDebuggerLocal() { profiling = false; diff --git a/core/script_debugger_local.h b/core/script_debugger_local.h index c93120331d..c87bc90bb4 100644 --- a/core/script_debugger_local.h +++ b/core/script_debugger_local.h @@ -44,6 +44,7 @@ class ScriptDebuggerLocal : public ScriptDebugger { public: void debug(ScriptLanguage *p_script, bool p_can_continue); virtual void send_message(const String &p_message, const Array &p_args); + virtual void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info); virtual bool is_profiling() const { return profiling; } virtual void add_profiling_frame_data(const StringName &p_name, const Array &p_data) {} diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index bbc2125c5a..a297bb738f 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -355,6 +355,13 @@ void ScriptDebuggerRemote::_get_output() { locking = false; } + if (n_messages_dropped > 0) { + Message msg; + msg.message = "Too many messages! " + String::num_int64(n_messages_dropped) + " messages were dropped."; + messages.push_back(msg); + n_messages_dropped = 0; + } + while (messages.size()) { locking = true; packet_peer_stream->put_var("message:" + messages.front()->get().message); @@ -366,6 +373,20 @@ void ScriptDebuggerRemote::_get_output() { locking = false; } + if (n_errors_dropped > 0) { + OutputError oe; + oe.error = "TOO_MANY_ERRORS"; + oe.error_descr = "Too many errors! " + String::num_int64(n_errors_dropped) + " errors were dropped."; + oe.warning = false; + uint64_t time = OS::get_singleton()->get_ticks_msec(); + oe.hr = time / 3600000; + oe.min = (time / 60000) % 60; + oe.sec = (time / 1000) % 60; + oe.msec = time % 1000; + errors.push_back(oe); + n_errors_dropped = 0; + } + while (errors.size()) { locking = true; packet_peer_stream->put_var("error"); @@ -411,22 +432,6 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char if (p_type == ERR_HANDLER_SCRIPT) return; //ignore script errors, those go through debugger - ScriptDebuggerRemote *sdr = (ScriptDebuggerRemote *)ud; - - OutputError oe; - oe.error = p_err; - oe.error_descr = p_descr; - oe.source_file = p_file; - oe.source_line = p_line; - oe.source_func = p_func; - oe.warning = p_type == ERR_HANDLER_WARNING; - uint64_t time = OS::get_singleton()->get_ticks_msec(); - oe.hr = time / 3600000; - oe.min = (time / 60000) % 60; - oe.sec = (time / 1000) % 60; - oe.msec = time % 1000; - Array cstack; - Vector<ScriptLanguage::StackInfo> si; for (int i = 0; i < ScriptServer::get_language_count(); i++) { @@ -435,28 +440,8 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char break; } - cstack.resize(si.size() * 2); - for (int i = 0; i < si.size(); i++) { - String path; - int line = 0; - if (si[i].script.is_valid()) { - path = si[i].script->get_path(); - line = si[i].line; - } - cstack[i * 2 + 0] = path; - cstack[i * 2 + 1] = line; - } - - oe.callstack = cstack; - - sdr->mutex->lock(); - - if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { - - sdr->errors.push_back(oe); - } - - sdr->mutex->unlock(); + ScriptDebuggerRemote *sdr = (ScriptDebuggerRemote *)ud; + sdr->send_error(p_func, p_file, p_line, p_err, p_descr, p_type, si); } bool ScriptDebuggerRemote::_parse_live_edit(const Array &p_command) { @@ -891,11 +876,54 @@ void ScriptDebuggerRemote::send_message(const String &p_message, const Array &p_ mutex->lock(); if (!locking && tcp_client->is_connected_to_host()) { - Message msg; - msg.message = p_message; - msg.data = p_args; - messages.push_back(msg); + if (messages.size() >= max_messages_per_frame) { + n_messages_dropped++; + } else { + Message msg; + msg.message = p_message; + msg.data = p_args; + messages.push_back(msg); + } + } + mutex->unlock(); +} + +void ScriptDebuggerRemote::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info) { + + OutputError oe; + oe.error = p_err; + oe.error_descr = p_descr; + oe.source_file = p_file; + oe.source_line = p_line; + oe.source_func = p_func; + oe.warning = p_type == ERR_HANDLER_WARNING; + uint64_t time = OS::get_singleton()->get_ticks_msec(); + oe.hr = time / 3600000; + oe.min = (time / 60000) % 60; + oe.sec = (time / 1000) % 60; + oe.msec = time % 1000; + Array cstack; + + cstack.resize(p_stack_info.size() * 3); + for (int i = 0; i < p_stack_info.size(); i++) { + cstack[i * 3 + 0] = p_stack_info[i].file; + cstack[i * 3 + 1] = p_stack_info[i].func; + cstack[i * 3 + 2] = p_stack_info[i].line; } + + oe.callstack = cstack; + + mutex->lock(); + + if (!locking && tcp_client->is_connected_to_host()) { + + if (errors.size() >= max_errors_per_frame) { + n_errors_dropped++; + } else { + errors.push_back(oe); + } + } + mutex->unlock(); } @@ -1011,7 +1039,11 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() : requested_quit(false), mutex(Mutex::create()), max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")), + max_messages_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_messages_per_frame")), + max_errors_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_errors_per_frame")), char_count(0), + n_messages_dropped(0), + n_errors_dropped(0), last_msec(0), msec_count(0), locking(false), diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h index 00ed22dc29..2c4e29f172 100644 --- a/core/script_debugger_remote.h +++ b/core/script_debugger_remote.h @@ -87,7 +87,11 @@ class ScriptDebuggerRemote : public ScriptDebugger { List<String> output_strings; List<Message> messages; + int max_messages_per_frame; + int n_messages_dropped; List<OutputError> errors; + int max_errors_per_frame; + int n_errors_dropped; int max_cps; int char_count; @@ -153,6 +157,7 @@ public: virtual void request_quit(); virtual void send_message(const String &p_message, const Array &p_args); + virtual void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info); virtual void set_request_scene_tree_message_func(RequestSceneTreeMessageFunc p_func, void *p_udata); virtual void set_live_edit_funcs(LiveEditFuncs *p_funcs); diff --git a/core/script_language.cpp b/core/script_language.cpp index 2a8c76c4b8..1dab58e29e 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -61,6 +61,8 @@ void Script::_bind_methods() { ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal); ClassDB::bind_method(D_METHOD("is_tool"), &Script::is_tool); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "source_code", PROPERTY_HINT_NONE, "", 0), "set_source_code", "get_source_code"); } void ScriptServer::set_scripting_enabled(bool p_enabled) { diff --git a/core/script_language.h b/core/script_language.h index 6bf2129f9b..66614a293c 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -254,7 +254,8 @@ public: virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1) = 0; struct StackInfo { - Ref<Script> script; + String file; + String func; int line; }; @@ -391,6 +392,7 @@ public: ScriptLanguage *get_break_language() const; virtual void send_message(const String &p_message, const Array &p_args) = 0; + virtual void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info) = 0; virtual bool is_remote() const { return false; } virtual void request_quit() {} diff --git a/core/translation.cpp b/core/translation.cpp index cf947404cd..32096d2eab 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -873,7 +873,7 @@ void Translation::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_messages"), &Translation::_set_messages); ClassDB::bind_method(D_METHOD("_get_messages"), &Translation::_get_messages); - ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_messages", "_get_messages"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_messages", "_get_messages"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "locale"), "set_locale", "get_locale"); } diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index a8eb527b09..b3f9dd818d 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -108,6 +108,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) { void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) { VARIANT_ARGPTRS + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; @@ -127,6 +128,7 @@ void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_A void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) { VARIANT_ARGPTRS + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); @@ -149,6 +151,7 @@ void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT } void UndoRedo::add_do_property(Object *p_object, const String &p_property, const Variant &p_value) { + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; @@ -163,6 +166,7 @@ void UndoRedo::add_do_property(Object *p_object, const String &p_property, const } void UndoRedo::add_undo_property(Object *p_object, const String &p_property, const Variant &p_value) { + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); @@ -182,6 +186,7 @@ void UndoRedo::add_undo_property(Object *p_object, const String &p_property, con } void UndoRedo::add_do_reference(Object *p_object) { + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; @@ -194,6 +199,7 @@ void UndoRedo::add_do_reference(Object *p_object) { } void UndoRedo::add_undo_reference(Object *p_object) { + ERR_FAIL_COND(p_object == NULL); ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND((current_action + 1) >= actions.size()); @@ -240,13 +246,6 @@ void UndoRedo::commit_action() { redo(); // perform action - if (max_steps > 0 && actions.size() > max_steps) { - //clear early steps - - while (actions.size() > max_steps) - _pop_history_tail(); - } - if (callback && actions.size() > 0) { callback(callback_ud, actions[actions.size() - 1].name); } @@ -341,16 +340,6 @@ String UndoRedo::get_current_action_name() const { return actions[current_action].name; } -void UndoRedo::set_max_steps(int p_max_steps) { - - max_steps = p_max_steps; -} - -int UndoRedo::get_max_steps() const { - - return max_steps; -} - uint64_t UndoRedo::get_version() const { return version; @@ -379,7 +368,6 @@ UndoRedo::UndoRedo() { version = 1; action_level = 0; current_action = -1; - max_steps = -1; merge_mode = MERGE_DISABLE; callback = NULL; callback_ud = NULL; @@ -504,8 +492,6 @@ void UndoRedo::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_history"), &UndoRedo::clear_history); ClassDB::bind_method(D_METHOD("get_current_action_name"), &UndoRedo::get_current_action_name); ClassDB::bind_method(D_METHOD("get_version"), &UndoRedo::get_version); - ClassDB::bind_method(D_METHOD("set_max_steps", "max_steps"), &UndoRedo::set_max_steps); - ClassDB::bind_method(D_METHOD("get_max_steps"), &UndoRedo::get_max_steps); ClassDB::bind_method(D_METHOD("redo"), &UndoRedo::redo); ClassDB::bind_method(D_METHOD("undo"), &UndoRedo::undo); diff --git a/core/undo_redo.h b/core/undo_redo.h index 5d7ab782d6..a373296b73 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -79,7 +79,6 @@ private: Vector<Action> actions; int current_action; int action_level; - int max_steps; MergeMode merge_mode; uint64_t version; @@ -115,9 +114,6 @@ public: String get_current_action_name() const; void clear_history(); - void set_max_steps(int p_max_steps); - int get_max_steps() const; - uint64_t get_version() const; void set_commit_notify_callback(CommitNotifyCallback p_callback, void *p_ud); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 662371b107..e46fac77ee 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -339,7 +339,7 @@ bool Variant::booleanize() const { CASE_TYPE(m_prefix, m_op_name, m_name) { \ if (p_b.type == NIL) \ _RETURN(true) \ - DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, ==, true, true, false) \ + DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, false, true, true) \ } #define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \ @@ -539,12 +539,12 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, if (arr_b->size() != l) _RETURN(true); for (int i = 0; i < l; i++) { - if (((*arr_a)[i] == (*arr_b)[i])) { - _RETURN(false); + if (((*arr_a)[i] != (*arr_b)[i])) { + _RETURN(true); } } - _RETURN(true); + _RETURN(false); } DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, INT, !=, _int); diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index cd05c83347..c98a80ca8c 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -41,10 +41,12 @@ <argument index="1" name="alpha" type="float"> </argument> <description> - Returns color [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. Note: [code]name[/code] is defined in color_names.inc. + Returns a color according to the standardised [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. [codeblock] - red = ColorN('red') + red = ColorN("red", 1) [/codeblock] + Supported color names: + "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflower", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "webgray", "green", "webgreen", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrod", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "webmaroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navyblue", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "webpurple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen". </description> </method> <method name="abs"> diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 6e8b760966..75b15442c7 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1285,7 +1285,7 @@ </constant> <constant name="PROPERTY_USAGE_DEFAULT_INTL" value="71" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_NOEDITOR" value="1048581" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_NOEDITOR" value="5" enum="PropertyUsageFlags"> </constant> <constant name="METHOD_FLAG_NORMAL" value="1" enum="MethodFlags"> Flag for normal method diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index f78b39eadb..4955701792 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -50,20 +50,6 @@ Return the index of the specified track. If the track is not found, return -1. </description> </method> - <method name="get_length" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the total length of the animation (in seconds). - </description> - </method> - <method name="get_step" qualifiers="const"> - <return type="float"> - </return> - <description> - Get the animation step value. - </description> - </method> <method name="get_track_count" qualifiers="const"> <return type="int"> </return> @@ -71,13 +57,6 @@ Return the amount of tracks in the animation. </description> </method> - <method name="has_loop" qualifiers="const"> - <return type="bool"> - </return> - <description> - Return whether the animation has the loop flag set. - </description> - </method> <method name="method_track_get_key_indices" qualifiers="const"> <return type="PoolIntArray"> </return> @@ -122,33 +101,6 @@ Remove a track by specifying the track index. </description> </method> - <method name="set_length"> - <return type="void"> - </return> - <argument index="0" name="time_sec" type="float"> - </argument> - <description> - Set the total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping. - </description> - </method> - <method name="set_loop"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Set a flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation. - </description> - </method> - <method name="set_step"> - <return type="void"> - </return> - <argument index="0" name="size_sec" type="float"> - </argument> - <description> - Set the animation step value. - </description> - </method> <method name="track_find_key" qualifiers="const"> <return type="int"> </return> @@ -456,6 +408,17 @@ </description> </method> </methods> + <members> + <member name="length" type="float" setter="set_length" getter="get_length"> + The total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping. + </member> + <member name="loop" type="bool" setter="set_loop" getter="has_loop"> + A flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation. + </member> + <member name="step" type="float" setter="set_step" getter="get_step"> + The animation step value. + </member> + </members> <constants> <constant name="TYPE_VALUE" value="0" enum="TrackType"> Value tracks set values in node properties, but only those which can be Interpolated. diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index a244788020..ee7e795389 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -90,13 +90,6 @@ Returns the list of stored animation names. </description> </method> - <method name="get_autoplay" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the name of the animation that will be automatically played when the scene is loaded. - </description> - </method> <method name="get_blend_time" qualifiers="const"> <return type="float"> </return> @@ -108,34 +101,6 @@ Get the blend time (in seconds) between two animations, referenced by their names. </description> </method> - <method name="get_current_animation" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the name of the animation being played. - </description> - </method> - <method name="get_current_animation_length" qualifiers="const"> - <return type="float"> - </return> - <description> - Get the length (in seconds) of the currently being played animation. - </description> - </method> - <method name="get_current_animation_position" qualifiers="const"> - <return type="float"> - </return> - <description> - Get the position (in seconds) of the currently playing animation. - </description> - </method> - <method name="get_speed_scale" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the speed scaling ratio of the current animation channel. For instance, if this value is 1 then the animation plays at normal speed. If it's 0.5 then it plays at half speed. If it's 2 then it plays at double speed. - </description> - </method> <method name="has_animation" qualifiers="const"> <return type="bool"> </return> @@ -145,13 +110,6 @@ Returns [code]true[/code] if the [code]AnimationPlayer[/code] stores an [Animation] with key [code]name[/code]. </description> </method> - <method name="is_active" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the player is active. - </description> - </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> @@ -226,24 +184,6 @@ Seek the animation to the [code]seconds[/code] point in time (in seconds). If [code]update[/code] is [code]true[/code], the animation updates too, otherwise it updates at process time. </description> </method> - <method name="set_active"> - <return type="void"> - </return> - <argument index="0" name="active" type="bool"> - </argument> - <description> - Sets the player as active (playing). If [code]true[/code], updates animations in response to process-related notifications. Default value: [code]true[/code]. - </description> - </method> - <method name="set_autoplay"> - <return type="void"> - </return> - <argument index="0" name="name" type="String"> - </argument> - <description> - Defines the name of the animation to play when the scene loads. Default value: [code]""[/code]. - </description> - </method> <method name="set_blend_time"> <return type="void"> </return> @@ -257,24 +197,6 @@ Specify a blend time (in seconds) between two animations, referenced by their names. </description> </method> - <method name="set_current_animation"> - <return type="void"> - </return> - <argument index="0" name="anim" type="String"> - </argument> - <description> - Sets the name of the current animation. If already playing, restarts the animation. Ensure [member active] is [code]true[/code] to simulate [method play]. Default value: [code]""[/code]. - </description> - </method> - <method name="set_speed_scale"> - <return type="void"> - </return> - <argument index="0" name="speed" type="float"> - </argument> - <description> - Sets the speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default value: [code]1[/code]. - </description> - </method> <method name="stop"> <return type="void"> </return> @@ -286,12 +208,30 @@ </method> </methods> <members> + <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay"> + The name of the animation to play when the scene loads. Default value: [code]""[/code]. + </member> + <member name="current_animation" type="String" setter="set_current_animation" getter="get_current_animation"> + The name of the current animation, "" if not playing anything. When being set, does not restart the animation. See also [method play]. Default value: [code]""[/code]. + </member> + <member name="current_animation_length" type="float" setter="" getter="get_current_animation_length"> + The length (in seconds) of the currently being played animation. + </member> + <member name="current_animation_position" type="float" setter="" getter="get_current_animation_position"> + The position (in seconds) of the currently playing animation. + </member> + <member name="playback_active" type="bool" setter="set_active" getter="is_active"> + If [code]true[/code], updates animations in response to process-related notifications. Default value: [code]true[/code]. + </member> <member name="playback_default_blend_time" type="float" setter="set_default_blend_time" getter="get_default_blend_time"> The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. Default value: [code]0[/code]. </member> <member name="playback_process_mode" type="int" setter="set_animation_process_mode" getter="get_animation_process_mode" enum="AnimationPlayer.AnimationProcessMode"> The process notification in which to update animations. Default value: [enum ANIMATION_PROCESS_IDLE]. </member> + <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale"> + The speed scaling ratio. For instance, if this value is 1 then the animation plays at normal speed. If it's 0.5 then it plays at half speed. If it's 2 then it plays at double speed. Default value: [code]1[/code]. + </member> <member name="root_node" type="NodePath" setter="set_root" getter="get_root"> The node from which node path references will travel. Default value: [code]".."[/code]. </member> diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml index ecd1f81951..33224e92bd 100644 --- a/doc/classes/AnimationTreePlayer.xml +++ b/doc/classes/AnimationTreePlayer.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationTreePlayer" inherits="Node" category="Core" version="3.0-beta"> <brief_description> - Animation Player that uses a node graph for the blending. + Animation Player that uses a node graph for blending Animations. </brief_description> <description> A node graph tool for blending multiple animations bound to an [AnimationPlayer]. Especially useful for animating characters or other skeleton-based rigs. It can combine several animations to form a desired pose. + It takes [Animation]s from an [AnimationPlayer] node and mixes them depending on the graph. </description> <tutorials> </tutorials> @@ -37,7 +38,7 @@ <argument index="0" name="id" type="String"> </argument> <description> - Returns the [AnimationPlayer]'s animation bound to the [code]AnimationTreePlayer[/code]'s animation node with name [code]id[/code]. + Returns the [AnimationPlayer]'s [Animation] bound to the [code]AnimationTreePlayer[/code]'s animation node with name [code]id[/code]. </description> </method> <method name="animation_node_get_master_animation" qualifiers="const"> @@ -46,7 +47,7 @@ <argument index="0" name="id" type="String"> </argument> <description> - Returns the name of the [member master_player]'s animation bound to this animation node. + Returns the name of the [member master_player]'s [Animation] bound to this animation node. </description> </method> <method name="animation_node_set_animation"> @@ -57,7 +58,7 @@ <argument index="1" name="animation" type="Animation"> </argument> <description> - Binds a new animation from the [member master_player] to the [code]AnimationTreePlayer[/code]'s animation node with name [code]id[/code]. + Binds a new [Animation] from the [member master_player] to the [code]AnimationTreePlayer[/code]'s animation node with name [code]id[/code]. </description> </method> <method name="animation_node_set_filter_path"> @@ -81,7 +82,7 @@ <argument index="1" name="source" type="String"> </argument> <description> - Binds the animation named [code]source[/code] from [member master_player] to the animation node [code]id[/code]. Recalculates caches. + Binds the [Animation] named [code]source[/code] from [member master_player] to the animation node [code]id[/code]. Recalculates caches. </description> </method> <method name="are_nodes_connected" qualifiers="const"> @@ -115,6 +116,10 @@ </argument> <description> Sets the blend amount of a Blend2 node given its name and value. + A Blend2 Node blends two animations with the amount between 0 and 1. + At 0, Output is input a. + Towards 1, the influence of a gets lessened, the influence of b gets raised. + At 1, Output is input b. </description> </method> <method name="blend2_node_set_filter_path"> @@ -148,6 +153,12 @@ </argument> <description> Sets the blend amount of a Blend3 node given its name and value. + A Blend3 Node blends three animations with the amount between -1 and 1. + At -1, Output is input b-. + From -1 to 0, the influence of b- gets lessened, the influence of a gets raised and the influence of b+ is 0. + At 0, Output is input a. + From 0 to 1, the influence of a gets lessened, the influence of b+ gets raised and the influence of b+ is 0. + At 1, Output is input b+. </description> </method> <method name="blend4_node_get_amount" qualifiers="const"> @@ -168,6 +179,8 @@ </argument> <description> Sets the blend amount of a Blend4 node given its name and value. + A Blend4 Node blends two pairs of animations. + The two pairs are blended like blend2 and then added together. </description> </method> <method name="connect_nodes"> @@ -198,7 +211,7 @@ <return type="PoolStringArray"> </return> <description> - Returns a PoolStringArray containing the name of all nodes. + Returns a [PoolStringArray] containing the name of all nodes. </description> </method> <method name="mix_node_get_amount" qualifiers="const"> @@ -219,6 +232,7 @@ </argument> <description> Sets mix amount of a Mix node given its name and value. + A Mix node adds input b to input a by a the amount given by ratio. </description> </method> <method name="node_exists" qualifiers="const"> @@ -450,7 +464,7 @@ <return type="void"> </return> <description> - Resets this AnimationTreePlayer. + Resets this [code]AnimationTreePlayer[/code]. </description> </method> <method name="timescale_node_get_scale" qualifiers="const"> @@ -471,6 +485,8 @@ </argument> <description> Sets the time scale of the TimeScale node with name [code]id[/code] to [code]scale[/code]. + The timescale node is used to speed [Animation]s up if the scale is above 1 or slow them down if it is below 1. + If applied after a blend or mix, affects all input animations to that blend or mix. </description> </method> <method name="timeseek_node_seek"> @@ -482,6 +498,7 @@ </argument> <description> Sets the time seek value of the TimeSeek node with name [code]id[/code] to [code]seconds[/code] + This functions as a seek in the [Animation] or the blend or mix of [Animation]s input in it. </description> </method> <method name="transition_node_delete_input"> @@ -510,7 +527,7 @@ <argument index="0" name="id" type="String"> </argument> <description> - Returns the number of inputs for the transition node with name [code]id[/code]. + Returns the number of inputs for the transition node with name [code]id[/code]. You can add inputs by rightclicking on the transition node. </description> </method> <method name="transition_node_get_xfade_time" qualifiers="const"> @@ -586,9 +603,11 @@ </member> <member name="base_path" type="NodePath" setter="set_base_path" getter="get_base_path"> The node from which to relatively access other nodes. Default value: [code]".."[/code]. + It accesses the Bones, so it should point to the same Node the AnimationPlayer would point its Root Node at. </member> <member name="master_player" type="NodePath" setter="set_master_player" getter="get_master_player"> The path to the [AnimationPlayer] from which this [code]AnimationTreePlayer[/code] binds animations to animation nodes. + Once set, Animation nodes can be added to the AnimationTreePlayer. </member> <member name="playback_process_mode" type="int" setter="set_animation_process_mode" getter="get_animation_process_mode" enum="AnimationTreePlayer.AnimationProcessMode"> The thread in which to update animations. Default value: [enum ANIMATION_PROCESS_IDLE]. diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml index b74e767fd2..58fa99f7da 100644 --- a/doc/classes/Area.xml +++ b/doc/classes/Area.xml @@ -33,14 +33,14 @@ <return type="Array"> </return> <description> - Returns a list of intersecting [code]Area[/code]s. + Returns a list of intersecting [code]Area[/code]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> <return type="Array"> </return> <description> - Returns a list of intersecting [PhysicsBody]s. + Returns a list of intersecting [PhysicsBody]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="overlaps_area" qualifiers="const"> @@ -49,7 +49,7 @@ <argument index="0" name="area" type="Node"> </argument> <description> - If [code]true[/code] the given area overlaps the Area. + If [code]true[/code] the given area overlaps the Area. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="overlaps_body" qualifiers="const"> @@ -58,7 +58,7 @@ <argument index="0" name="body" type="Node"> </argument> <description> - If [code]true[/code] the given body overlaps the Area. + If [code]true[/code] the given body overlaps the Area. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="set_collision_layer_bit"> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 6a3f0e7645..ca395321e3 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -33,14 +33,14 @@ <return type="Array"> </return> <description> - Returns a list of intersecting [code]Area2D[/code]s. + Returns a list of intersecting [code]Area2D[/code]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> <return type="Array"> </return> <description> - Returns a list of intersecting [PhysicsBody2D]s. + Returns a list of intersecting [PhysicsBody2D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="overlaps_area" qualifiers="const"> @@ -49,7 +49,7 @@ <argument index="0" name="area" type="Node"> </argument> <description> - If [code]true[/code] the given area overlaps the Area2D. + If [code]true[/code] the given area overlaps the Area2D. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="overlaps_body" qualifiers="const"> @@ -58,7 +58,7 @@ <argument index="0" name="body" type="Node"> </argument> <description> - If [code]true[/code] the given body overlaps the Area2D. + If [code]true[/code] the given body overlaps the Area2D. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="set_collision_layer_bit"> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 92c4fe2fe7..2f1c0b92fd 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -51,12 +51,6 @@ <description> </description> </method> - <method name="get_blend_shape_mode" qualifiers="const"> - <return type="int" enum="Mesh.BlendShapeMode"> - </return> - <description> - </description> - </method> <method name="get_blend_shape_name" qualifiers="const"> <return type="String"> </return> @@ -65,12 +59,6 @@ <description> </description> </method> - <method name="get_custom_aabb" qualifiers="const"> - <return type="AABB"> - </return> - <description> - </description> - </method> <method name="get_surface_count" qualifiers="const"> <return type="int"> </return> @@ -84,22 +72,6 @@ <description> </description> </method> - <method name="set_blend_shape_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="Mesh.BlendShapeMode"> - </argument> - <description> - </description> - </method> - <method name="set_custom_aabb"> - <return type="void"> - </return> - <argument index="0" name="aabb" type="AABB"> - </argument> - <description> - </description> - </method> <method name="surface_get_array_index_len" qualifiers="const"> <return type="int"> </return> @@ -212,6 +184,12 @@ </description> </method> </methods> + <members> + <member name="blend_shape_mode" type="int" setter="set_blend_shape_mode" getter="get_blend_shape_mode" enum="Mesh.BlendShapeMode"> + </member> + <member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb"> + </member> + </members> <constants> <constant name="NO_INDEX_ARRAY" value="-1"> Default value used for index_array_len when no indices are present. diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml index 13bc66f6f3..037f4778a5 100644 --- a/doc/classes/AudioEffectReverb.xml +++ b/doc/classes/AudioEffectReverb.xml @@ -12,20 +12,6 @@ <demos> </demos> <methods> - <method name="get_predelay_feedback" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="set_predelay_feedback"> - <return type="void"> - </return> - <argument index="0" name="feedback" type="float"> - </argument> - <description> - </description> - </method> </methods> <members> <member name="damping" type="float" setter="set_damping" getter="get_damping"> diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml index 83e9729bc1..c3c218b1d7 100644 --- a/doc/classes/AudioStreamSample.xml +++ b/doc/classes/AudioStreamSample.xml @@ -11,20 +11,6 @@ <demos> </demos> <methods> - <method name="get_data" qualifiers="const"> - <return type="PoolByteArray"> - </return> - <description> - </description> - </method> - <method name="set_data"> - <return type="void"> - </return> - <argument index="0" name="data" type="PoolByteArray"> - </argument> - <description> - </description> - </method> </methods> <members> <member name="format" type="int" setter="set_format" getter="get_format" enum="AudioStreamSample.Format"> diff --git a/doc/classes/BakedLightmapData.xml b/doc/classes/BakedLightmapData.xml index 2b95cff136..5d23bf876a 100644 --- a/doc/classes/BakedLightmapData.xml +++ b/doc/classes/BakedLightmapData.xml @@ -27,30 +27,6 @@ <description> </description> </method> - <method name="get_bounds" qualifiers="const"> - <return type="AABB"> - </return> - <description> - </description> - </method> - <method name="get_cell_space_transform" qualifiers="const"> - <return type="Transform"> - </return> - <description> - </description> - </method> - <method name="get_cell_subdiv" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_octree" qualifiers="const"> - <return type="PoolByteArray"> - </return> - <description> - </description> - </method> <method name="get_user_count" qualifiers="const"> <return type="int"> </return> @@ -73,42 +49,18 @@ <description> </description> </method> - <method name="set_bounds"> - <return type="void"> - </return> - <argument index="0" name="bounds" type="AABB"> - </argument> - <description> - </description> - </method> - <method name="set_cell_space_transform"> - <return type="void"> - </return> - <argument index="0" name="xform" type="Transform"> - </argument> - <description> - </description> - </method> - <method name="set_cell_subdiv"> - <return type="void"> - </return> - <argument index="0" name="cell_subdiv" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_octree"> - <return type="void"> - </return> - <argument index="0" name="octree" type="PoolByteArray"> - </argument> - <description> - </description> - </method> </methods> <members> + <member name="bounds" type="AABB" setter="set_bounds" getter="get_bounds"> + </member> + <member name="cell_space_transform" type="Transform" setter="set_cell_space_transform" getter="get_cell_space_transform"> + </member> + <member name="cell_subdiv" type="int" setter="set_cell_subdiv" getter="get_cell_subdiv"> + </member> <member name="energy" type="float" setter="set_energy" getter="get_energy"> </member> + <member name="octree" type="PoolByteArray" setter="set_octree" getter="get_octree"> + </member> </members> <constants> </constants> diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 7f1aaa6822..9dd3cf0eff 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -21,7 +21,7 @@ <method name="_toggled" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="pressed" type="bool"> + <argument index="0" name="button_pressed" type="bool"> </argument> <description> Called when button is toggled (only if toggle_mode is active). @@ -82,7 +82,7 @@ </description> </signal> <signal name="toggled"> - <argument index="0" name="pressed" type="bool"> + <argument index="0" name="button_pressed" type="bool"> </argument> <description> This signal is emitted when the button was just toggled between pressed and normal states (only if toggle_mode is active). The new state is contained in the [i]pressed[/i] argument. diff --git a/doc/classes/BoneAttachment.xml b/doc/classes/BoneAttachment.xml index b7f21ebf0c..6af47b940f 100644 --- a/doc/classes/BoneAttachment.xml +++ b/doc/classes/BoneAttachment.xml @@ -11,23 +11,12 @@ <demos> </demos> <methods> - <method name="get_bone_name" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the name of the bone node attached to. - </description> - </method> - <method name="set_bone_name"> - <return type="void"> - </return> - <argument index="0" name="bone_name" type="String"> - </argument> - <description> - Changes the name of the bone node - </description> - </method> </methods> + <members> + <member name="bone_name" type="String" setter="set_bone_name" getter="get_bone_name"> + The name of the attached bone. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index c95691d07f..72f6513e66 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -47,27 +47,6 @@ Returns the location of the [code]Camera2D[/code]'s screen-center, relative to the origin. </description> </method> - <method name="get_custom_viewport" qualifiers="const"> - <return type="Node"> - </return> - <description> - Returns the [Viewport] used by the camera if it is not using the default viewport. - </description> - </method> - <method name="get_h_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the horizontal offset of the camera. - </description> - </method> - <method name="get_v_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the vertical offset of the camera. - </description> - </method> <method name="make_current"> <return type="void"> </return> @@ -83,33 +62,6 @@ This has no effect if smoothing is disabled. </description> </method> - <method name="set_custom_viewport"> - <return type="void"> - </return> - <argument index="0" name="viewport" type="Node"> - </argument> - <description> - Assigns a custom [Viewport] node to the [code]Camera2D[/code]. If [code]viewport[/code] is not a [Viewport], it re-assigns the default viewport instead. - </description> - </method> - <method name="set_h_offset"> - <return type="void"> - </return> - <argument index="0" name="ofs" type="float"> - </argument> - <description> - The camera's horizontal offset is set to [code]ofs[/code]. - </description> - </method> - <method name="set_v_offset"> - <return type="void"> - </return> - <argument index="0" name="ofs" type="float"> - </argument> - <description> - The camera's vertical offset is set to [code]ofs[/code]. - </description> - </method> </methods> <members> <member name="anchor_mode" type="int" setter="set_anchor_mode" getter="get_anchor_mode" enum="Camera2D.AnchorMode"> @@ -118,6 +70,9 @@ <member name="current" type="bool" setter="_set_current" getter="is_current"> If [code]true[/code] the camera is the active camera for the current scene. Only one camera can be current, so setting a different camera [code]current[/code] will disable this one. </member> + <member name="custom_viewport" type="Node" setter="set_custom_viewport" getter="get_custom_viewport"> + The custom [Viewport] node attached to the [code]Camera2D[/code]. If null or not a [Viewport], uses the default viewport instead. + </member> <member name="drag_margin_bottom" type="float" setter="set_drag_margin" getter="get_drag_margin"> Bottom margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen. </member> @@ -163,6 +118,12 @@ <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> The camera's offset, useful for looking around or camera shake animations. </member> + <member name="offset_h" type="float" setter="set_h_offset" getter="get_h_offset"> + The horizontal offset of the camera, relative to the drag margins. Default value: [code]0[/code] + </member> + <member name="offset_v" type="float" setter="set_v_offset" getter="get_v_offset"> + The vertical offset of the camera, relative to the drag margins. Default value: [code]0[/code] + </member> <member name="rotating" type="bool" setter="set_rotating" getter="is_rotating"> If [code]true[/code] the camera rotates with the target. Default value: [code]false[/code] </member> diff --git a/doc/classes/CanvasLayer.xml b/doc/classes/CanvasLayer.xml index 01c2dd6ba9..bccbf69cdf 100644 --- a/doc/classes/CanvasLayer.xml +++ b/doc/classes/CanvasLayer.xml @@ -11,27 +11,6 @@ <demos> </demos> <methods> - <method name="get_custom_viewport" qualifiers="const"> - <return type="Node"> - </return> - <description> - Returns the [Viewport] used by the camera if it is not using the default viewport. - </description> - </method> - <method name="get_rotation" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the base rotation for this layer in radians (helper). - </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform2D"> - </return> - <description> - Return the base transform for this layer. - </description> - </method> <method name="get_world_2d" qualifiers="const"> <return type="World2D"> </return> @@ -39,47 +18,29 @@ Return the [World2D] used by this layer. </description> </method> - <method name="set_custom_viewport"> - <return type="void"> - </return> - <argument index="0" name="viewport" type="Node"> - </argument> - <description> - Assigns a custom [Viewport] node to the [code]CanvasLayer[/code]. If [code]viewport[/code] is not a [Viewport], it re-assigns the default viewport instead. - </description> - </method> - <method name="set_rotation"> - <return type="void"> - </return> - <argument index="0" name="radians" type="float"> - </argument> - <description> - Set the base rotation for this layer in radians (helper). - </description> - </method> - <method name="set_transform"> - <return type="void"> - </return> - <argument index="0" name="transform" type="Transform2D"> - </argument> - <description> - Set the base transform for this layer. - </description> - </method> </methods> <members> + <member name="custom_viewport" type="Node" setter="set_custom_viewport" getter="get_custom_viewport"> + The custom [Viewport] node assigned to the [code]CanvasLayer[/code]. If null, uses the default viewport instead. + </member> <member name="layer" type="int" setter="set_layer" getter="get_layer"> Layer index for draw order. Lower values are drawn first. Default value: [code]1[/code]. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> The layer's base offset. </member> - <member name="rotation" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees"> + <member name="rotation" type="float" setter="set_rotation" getter="get_rotation"> + The layer's rotation in radians. + </member> + <member name="rotation_degrees" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees"> The layer's rotation in degrees. </member> <member name="scale" type="Vector2" setter="set_scale" getter="get_scale"> The layer's scale. </member> + <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> + The layer's transform. + </member> </members> <constants> </constants> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 6fa7ed0a86..ef555537a1 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -5,6 +5,7 @@ </brief_description> <description> A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate(color)) may accept values > 1. + You can also create a color from standardised color names with [method @GDScript.ColorN]. </description> <tutorials> </tutorials> @@ -63,7 +64,7 @@ <argument index="0" name="from" type="String"> </argument> <description> - Constructs a color from an HTML hexadecimal color string in ARGB or RGB format. + Constructs a color from an HTML hexadecimal color string in ARGB or RGB format. See also [method @GDScript.ColorN]. The following string formats are supported: [code]"#ff00ff00"[/code] - ARGB format with '#' [code]"ff00ff00"[/code] - ARGB format diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml index 192f139ba9..1896fd46fb 100644 --- a/doc/classes/ColorPicker.xml +++ b/doc/classes/ColorPicker.xml @@ -20,55 +20,18 @@ Adds the current selected to color to a list of colors (presets), the presets will be displayed in the color picker and the user will be able to select them, notice that the presets list is only for this color picker. </description> </method> - <method name="get_pick_color" qualifiers="const"> - <return type="Color"> - </return> - <description> - Gets the current color. - </description> - </method> - <method name="is_editing_alpha" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether the color has transparency or not. - </description> - </method> - <method name="is_raw_mode" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether this color picker is in raw mode or not, raw mode will allow the color R, G, B component values to go beyond 1, you have to consider that the max value for color components is 1, going beyond that value will not have effect in the color, but can be used for special operations that require it (like tinting without darkening or rendering sprites in HDR). - </description> - </method> - <method name="set_edit_alpha"> - <return type="void"> - </return> - <argument index="0" name="show" type="bool"> - </argument> - <description> - Set true if you want the color to have an alpha channel (transparency), or false if you want a solid color. - </description> - </method> - <method name="set_pick_color"> - <return type="void"> - </return> - <argument index="0" name="color" type="Color"> - </argument> - <description> - Select the current color. - </description> - </method> - <method name="set_raw_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="bool"> - </argument> - <description> - Set whether this color picker is using raw mode or not, see [method is_raw_mode]. - </description> - </method> </methods> + <members> + <member name="color" type="Color" setter="set_pick_color" getter="get_pick_color"> + The currently selected color. + </member> + <member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha"> + If [code]true[/code], shows an alpha channel slider (transparency). + </member> + <member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode"> + If [code]true[/code], allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR). + </member> + </members> <signals> <signal name="color_changed"> <argument index="0" name="color" type="Color"> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 680e008ff1..87ed5df500 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -178,13 +178,6 @@ Returns the mouse cursor shape the control displays on mouse hover, one of the [code]CURSOR_*[/code] constants. </description> </method> - <method name="get_default_cursor_shape" qualifiers="const"> - <return type="int" enum="Control.CursorShape"> - </return> - <description> - Returns the default cursor shape for this control. See enum [code]CURSOR_*[/code] for the list of shapes. - </description> - </method> <method name="get_drag_data" qualifiers="virtual"> <return type="Object"> </return> @@ -200,13 +193,6 @@ Returns MARGIN_LEFT and MARGIN_TOP at the same time. This is a helper (see [method set_margin]). </description> </method> - <method name="get_focus_mode" qualifiers="const"> - <return type="int" enum="Control.FocusMode"> - </return> - <description> - Returns the focus access mode for the control (FOCUS_NONE, FOCUS_CLICK, FOCUS_ALL) (see [method set_focus_mode]). - </description> - </method> <method name="get_focus_owner" qualifiers="const"> <return type="Control"> </return> @@ -224,13 +210,6 @@ <description> </description> </method> - <method name="get_global_position" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the Control position, relative to the top-left corner of the parent Control and independent of the anchor mode. - </description> - </method> <method name="get_global_rect" qualifiers="const"> <return type="Rect2"> </return> @@ -490,15 +469,6 @@ Sets MARGIN_LEFT and MARGIN_TOP at the same time. This is a helper (see [method set_margin]). </description> </method> - <method name="set_default_cursor_shape"> - <return type="void"> - </return> - <argument index="0" name="shape" type="int" enum="Control.CursorShape"> - </argument> - <description> - Sets the default cursor shape for this control. See [code]CURSOR_*[/code] for the list of available cursor shapes. Useful for Godot plugins and applications or games that use the system's mouse cursors. - </description> - </method> <method name="set_drag_forwarding"> <return type="void"> </return> @@ -524,24 +494,6 @@ Sets MARGIN_RIGHT and MARGIN_BOTTOM at the same time. This is a helper (see [method set_margin]). </description> </method> - <method name="set_focus_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="Control.FocusMode"> - </argument> - <description> - Set the focus access mode for the control (FOCUS_NONE, FOCUS_CLICK, FOCUS_ALL). Only one Control can be focused at the same time, and it will receive keyboard signals. - </description> - </method> - <method name="set_global_position"> - <return type="void"> - </return> - <argument index="0" name="position" type="Vector2"> - </argument> - <description> - 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_margins_preset"> <return type="void"> </return> @@ -594,6 +546,9 @@ <member name="anchor_top" type="float" setter="_set_anchor" getter="get_anchor"> Anchors the top edge of the node to the origin, the center or the end of its parent container. It changes how the top margin updates when the node moves or changes size. Use one of the [code]ANCHOR_*[/code] constants. Default value: [code]ANCHOR_BEGIN[/code]. </member> + <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" enum="Control.FocusMode"> + The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard signals. + </member> <member name="focus_neighbour_bottom" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour"> Tells Godot which node it should give keyboard focus to if the user presses Tab, the down arrow on the keyboard, or down on a gamepad. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one. If the user presses Tab, Godot will give focus to the closest node to the right first, then to the bottom. If the user presses Shift+Tab, Godot will look to the left of the node, then above it. @@ -631,11 +586,17 @@ <member name="margin_top" type="float" setter="set_margin" getter="get_margin"> Distance between the node's top edge and its parent container, based on [member anchor_top]. </member> + <member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" enum="Control.CursorShape"> + The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors. + </member> <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter"> - Controls whether the control will be able to receive mouse button input events through [Control._gui_input] and how these events should be handled. Use one of the [code]MOUSE_FILTER_*[/code] constants. See the constants to learn what each does. + Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Use one of the [code]MOUSE_FILTER_*[/code] constants. See the constants to learn what each does. </member> <member name="rect_clip_content" type="bool" setter="set_clip_contents" getter="is_clipping_contents"> </member> + <member name="rect_global_position" type="Vector2" setter="set_global_position" getter="get_global_position"> + The node's global position, relative to the world (usually to the top-left corner of the window). + </member> <member name="rect_min_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size"> The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes. </member> @@ -697,12 +658,12 @@ </signal> <signal name="mouse_entered"> <description> - Emitted when the mouse enters the control's [code]Rect[/code] area. + Emitted when the mouse enters the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it. </description> </signal> <signal name="mouse_exited"> <description> - Emitted when the mouse leaves the control's [code]Rect[/code] area. + Emitted when the mouse leaves the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it. </description> </signal> <signal name="resized"> @@ -870,13 +831,13 @@ Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical]. </constant> <constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter"> - The control will receive mouse button input events through [method Control._gui_input] if clicked on. These events are automatically marked as handled and they will not propogate further to other controls. + The control will receive mouse button input events through [method _gui_input] if clicked on. These events are automatically marked as handled and they will not propagate further to other controls. </constant> <constant name="MOUSE_FILTER_PASS" value="1" enum="MouseFilter"> - The control will receive mouse button input events through [method Control._gui_input] if clicked on. If this control does not handle the event, the parent control (if any) will be considered for a mouse click, and so on until there is no more parent control to potentially handle it. Even if no control handled it at all, the event will still be handled automatically. + The control will receive mouse button input events through [method _gui_input] if clicked on. If this control does not handle the event, the parent control (if any) will be considered for a mouse click, and so on until there is no more parent control to potentially handle it. Even if no control handled it at all, the event will still be handled automatically. </constant> <constant name="MOUSE_FILTER_IGNORE" value="2" enum="MouseFilter"> - The control will not receive mouse button input events through [method Control._gui_input] and will not block other controls from receiving these events. These events will also not be handled automatically. + The control will not receive mouse button input events through [method _gui_input] and will not block other controls from receiving these events. These events will also not be handled automatically. </constant> <constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection"> </constant> diff --git a/doc/classes/CubeMap.xml b/doc/classes/CubeMap.xml index 30022efd38..7639f6d409 100644 --- a/doc/classes/CubeMap.xml +++ b/doc/classes/CubeMap.xml @@ -11,13 +11,6 @@ <demos> </demos> <methods> - <method name="get_flags" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the render flags for the [code]CubeMap[/code]. See the [code]FLAG_*[/code] constants for details. - </description> - </method> <method name="get_height" qualifiers="const"> <return type="int"> </return> @@ -41,15 +34,6 @@ Returns the [code]CubeMap[/code]'s width. </description> </method> - <method name="set_flags"> - <return type="void"> - </return> - <argument index="0" name="flags" type="int"> - </argument> - <description> - Returns the render flags for the [code]CubeMap[/code]. See the [code]FLAG_*[/code] constants for details. - </description> - </method> <method name="set_side"> <return type="void"> </return> @@ -63,6 +47,9 @@ </method> </methods> <members> + <member name="flags" type="int" setter="set_flags" getter="get_flags"> + The render flags for the [code]CubeMap[/code]. See the [code]FLAG_*[/code] constants for details. + </member> <member name="lossy_storage_quality" type="float" setter="set_lossy_storage_quality" getter="get_lossy_storage_quality"> The lossy storage quality of the [code]CubeMap[/code] if the storage mode is set to STORAGE_COMPRESS_LOSSY. </member> diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 174b62fde0..da6ecebcba 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -126,6 +126,8 @@ </argument> <argument index="1" name="value" type="Variant"> </argument> + <argument index="2" name="update_current" type="bool"> + </argument> <description> </description> </method> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 0fd5892860..400ec83ecc 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -25,13 +25,6 @@ Returns the frames per second of the running game. </description> </method> - <method name="get_iterations_per_second" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of fixed iterations per second (for fixed process and physics). - </description> - </method> <method name="get_main_loop" qualifiers="const"> <return type="MainLoop"> </return> @@ -47,20 +40,6 @@ <description> </description> </method> - <method name="get_target_fps" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the desired frames per second. If the hardware cannot keep up, this setting may not be respected. It defaults to 0, which indicates no limit. - </description> - </method> - <method name="get_time_scale"> - <return type="float"> - </return> - <description> - Returns how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed. - </description> - </method> <method name="get_version_info" qualifiers="const"> <return type="Dictionary"> </return> @@ -83,13 +62,6 @@ <description> </description> </method> - <method name="is_editor_hint" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the editor is running. - </description> - </method> <method name="is_in_physics_frame" qualifiers="const"> <return type="bool"> </return> @@ -97,43 +69,21 @@ Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop. </description> </method> - <method name="set_editor_hint"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Sets the running inside the editor hint if [code]enabled[/code] is [code]true[/code]. - </description> - </method> - <method name="set_iterations_per_second"> - <return type="void"> - </return> - <argument index="0" name="iterations_per_second" type="int"> - </argument> - <description> - Sets the number of fixed iterations per second (for fixed process and physics). - </description> - </method> - <method name="set_target_fps"> - <return type="void"> - </return> - <argument index="0" name="target_fps" type="int"> - </argument> - <description> - Sets the target frames per second. - </description> - </method> - <method name="set_time_scale"> - <return type="void"> - </return> - <argument index="0" name="time_scale" type="float"> - </argument> - <description> - Sets the time scale. - </description> - </method> </methods> + <members> + <member name="editor_hint" type="bool" setter="set_editor_hint" getter="is_editor_hint"> + If [code]true[/code], it is running inside the editor. Useful for tool scripts. + </member> + <member name="iterations_per_second" type="int" setter="set_iterations_per_second" getter="get_iterations_per_second"> + The number of fixed iterations per second (for fixed process and physics). + </member> + <member name="target_fps" type="float" setter="set_target_fps" getter="get_target_fps"> + The desired frames per second. If the hardware cannot keep up, this setting may not be respected. Defaults to 0, which indicates no limit. + </member> + <member name="time_scale" type="float" setter="set_time_scale" getter="get_time_scale"> + Controls how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index 8c270ece4b..20ea064a18 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -109,13 +109,6 @@ Returns the next 64 bits from the file as a floating point number. </description> </method> - <method name="get_endian_swap"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if endian swap is enabled for this file. - </description> - </method> <method name="get_error" qualifiers="const"> <return type="int" enum="Error"> </return> @@ -274,16 +267,6 @@ Changes the file reading/writing cursor to the specified position (in bytes from the end of the file). Note that this is an offset, so you should use negative numbers or the cursor will be at the end of the file. </description> </method> - <method name="set_endian_swap"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] the file's endianness is swapped. Use this if you're dealing with files written in big endian machines. - Note that this is about the file format, not CPU type. This is always reseted to [code]false[/code] whenever you open the file. - </description> - </method> <method name="store_16"> <return type="void"> </return> @@ -393,6 +376,12 @@ </description> </method> </methods> + <members> + <member name="endian_swap" type="bool" setter="set_endian_swap" getter="get_endian_swap"> + If [code]true[/code] the file's endianness is swapped. Use this if you're dealing with files written in big endian machines. + Note that this is about the file format, not CPU type. This is always reseted to [code]false[/code] whenever you open the file. + </member> + </members> <constants> <constant name="READ" value="1" enum="ModeFlags"> Opens the file for read operations. diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index 3387b4a2ed..d064ae908f 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -33,27 +33,6 @@ <description> </description> </method> - <method name="get_current_dir" qualifiers="const"> - <return type="String"> - </return> - <description> - Get the current working directory of the file dialog. - </description> - </method> - <method name="get_current_file" qualifiers="const"> - <return type="String"> - </return> - <description> - Get the current selected file of the file dialog (empty if none). - </description> - </method> - <method name="get_current_path" qualifiers="const"> - <return type="String"> - </return> - <description> - Get the current selected path (directory and file) of the file dialog (empty if none). - </description> - </method> <method name="get_vbox"> <return type="VBoxContainer"> </return> @@ -68,37 +47,19 @@ Invalidate and update the current dialog content list. </description> </method> - <method name="set_current_dir"> - <return type="void"> - </return> - <argument index="0" name="dir" type="String"> - </argument> - <description> - Set the current working directory of the file dialog. - </description> - </method> - <method name="set_current_file"> - <return type="void"> - </return> - <argument index="0" name="file" type="String"> - </argument> - <description> - Set the current selected file name of the file dialog. - </description> - </method> - <method name="set_current_path"> - <return type="void"> - </return> - <argument index="0" name="path" type="String"> - </argument> - <description> - Set the current selected file path of the file dialog. - </description> - </method> </methods> <members> <member name="access" type="int" setter="set_access" getter="get_access" enum="FileDialog.Access"> </member> + <member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir"> + The current working directory of the file dialog. + </member> + <member name="current_file" type="String" setter="set_current_file" getter="get_current_file"> + The currently selected file of the file dialog. + </member> + <member name="current_path" type="String" setter="set_current_path" getter="get_current_path"> + The currently selected file path of the file dialog. + </member> <member name="filters" type="PoolStringArray" setter="set_filters" getter="get_filters"> </member> <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode"> diff --git a/doc/classes/GIProbeData.xml b/doc/classes/GIProbeData.xml index aba59f57ea..2ac591889c 100644 --- a/doc/classes/GIProbeData.xml +++ b/doc/classes/GIProbeData.xml @@ -9,161 +9,31 @@ <demos> </demos> <methods> - <method name="get_bias" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_bounds" qualifiers="const"> - <return type="AABB"> - </return> - <description> - </description> - </method> - <method name="get_cell_size" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_dynamic_data" qualifiers="const"> - <return type="PoolIntArray"> - </return> - <description> - </description> - </method> - <method name="get_dynamic_range" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_energy" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_normal_bias" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_propagation" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_to_cell_xform" qualifiers="const"> - <return type="Transform"> - </return> - <description> - </description> - </method> - <method name="is_compressed" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="is_interior" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_bias"> - <return type="void"> - </return> - <argument index="0" name="bias" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_bounds"> - <return type="void"> - </return> - <argument index="0" name="bounds" type="AABB"> - </argument> - <description> - </description> - </method> - <method name="set_cell_size"> - <return type="void"> - </return> - <argument index="0" name="cell_size" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_compress"> - <return type="void"> - </return> - <argument index="0" name="compress" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_dynamic_data"> - <return type="void"> - </return> - <argument index="0" name="dynamic_data" type="PoolIntArray"> - </argument> - <description> - </description> - </method> - <method name="set_dynamic_range"> - <return type="void"> - </return> - <argument index="0" name="dynamic_range" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_energy"> - <return type="void"> - </return> - <argument index="0" name="energy" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_interior"> - <return type="void"> - </return> - <argument index="0" name="interior" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_normal_bias"> - <return type="void"> - </return> - <argument index="0" name="bias" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_propagation"> - <return type="void"> - </return> - <argument index="0" name="propagation" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_to_cell_xform"> - <return type="void"> - </return> - <argument index="0" name="to_cell_xform" type="Transform"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="bias" type="float" setter="set_bias" getter="get_bias"> + </member> + <member name="bounds" type="AABB" setter="set_bounds" getter="get_bounds"> + </member> + <member name="cell_size" type="float" setter="set_cell_size" getter="get_cell_size"> + </member> + <member name="compress" type="bool" setter="set_compress" getter="is_compressed"> + </member> + <member name="dynamic_data" type="PoolIntArray" setter="set_dynamic_data" getter="get_dynamic_data"> + </member> + <member name="dynamic_range" type="int" setter="set_dynamic_range" getter="get_dynamic_range"> + </member> + <member name="energy" type="float" setter="set_energy" getter="get_energy"> + </member> + <member name="interior" type="bool" setter="set_interior" getter="is_interior"> + </member> + <member name="normal_bias" type="float" setter="set_normal_bias" getter="get_normal_bias"> + </member> + <member name="propagation" type="float" setter="set_propagation" getter="get_propagation"> + </member> + <member name="to_cell_xform" type="Transform" setter="set_to_cell_xform" getter="get_to_cell_xform"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 3bc7fed1d9..d7a263bd3f 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -49,26 +49,6 @@ Return an Array containing the list of connections. A connection consists in a structure of the form {from_slot: 0, from: "GraphNode name 0", to_slot: 1, to: "GraphNode name 1" } </description> </method> - <method name="get_scroll_ofs" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the scroll offset. - </description> - </method> - <method name="get_snap" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_zoom" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the current zoom value. - </description> - </method> <method name="is_node_connected"> <return type="bool"> </return> @@ -84,36 +64,6 @@ Return true if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode. </description> </method> - <method name="is_right_disconnects_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - Return true is the disconnection of connections is enable in the visual GraphEdit. False otherwise. - </description> - </method> - <method name="is_using_snap" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_right_disconnects"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Enable the disconnection of existing connections in the visual GraphEdit by left-clicking a connection and releasing into the void. - </description> - </method> - <method name="set_scroll_ofs"> - <return type="void"> - </return> - <argument index="0" name="ofs" type="Vector2"> - </argument> - <description> - </description> - </method> <method name="set_selected"> <return type="void"> </return> @@ -122,32 +72,24 @@ <description> </description> </method> - <method name="set_snap"> - <return type="void"> - </return> - <argument index="0" name="pixels" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_use_snap"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_zoom"> - <return type="void"> - </return> - <argument index="0" name="p_zoom" type="float"> - </argument> - <description> - Set the zoom value of the GraphEdit. Zoom value is between [0.01; 1.728]. - </description> - </method> </methods> + <members> + <member name="right_disconnects" type="bool" setter="set_right_disconnects" getter="is_right_disconnects_enabled"> + If [code]true[/code], enables disconnection of existing connections in the GraphEdit by dragging the right end. + </member> + <member name="scroll_offset" type="Vector2" setter="set_scroll_ofs" getter="get_scroll_ofs"> + The scroll offset. + </member> + <member name="snap_distance" type="int" setter="set_snap" getter="get_snap"> + The snapping distance in pixels. + </member> + <member name="use_snap" type="bool" setter="set_use_snap" getter="is_using_snap"> + If [code]true[/code], enables snapping. + </member> + <member name="zoom" type="float" setter="set_zoom" getter="get_zoom"> + The current zoom value. + </member> + </members> <signals> <signal name="_begin_node_move"> <description> diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml index c1b18e4cd8..9a8b56f8a1 100644 --- a/doc/classes/GraphNode.xml +++ b/doc/classes/GraphNode.xml @@ -95,19 +95,6 @@ Return the type of the output connection 'idx'. </description> </method> - <method name="get_offset" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the offset of the GraphNode. - </description> - </method> - <method name="get_overlay" qualifiers="const"> - <return type="int" enum="GraphNode.Overlay"> - </return> - <description> - </description> - </method> <method name="get_slot_color_left" qualifiers="const"> <return type="Color"> </return> @@ -144,18 +131,6 @@ Return the (integer) type of right (output) 'idx' slot. </description> </method> - <method name="is_comment" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="is_selected"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="is_slot_enabled_left" qualifiers="const"> <return type="bool"> </return> @@ -174,39 +149,6 @@ Return true if right (output) slot 'idx' is enabled. False otherwise. </description> </method> - <method name="set_comment"> - <return type="void"> - </return> - <argument index="0" name="comment" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_offset"> - <return type="void"> - </return> - <argument index="0" name="offset" type="Vector2"> - </argument> - <description> - Set the offset of the GraphNode. - </description> - </method> - <method name="set_overlay"> - <return type="void"> - </return> - <argument index="0" name="overlay" type="int" enum="GraphNode.Overlay"> - </argument> - <description> - </description> - </method> - <method name="set_selected"> - <return type="void"> - </return> - <argument index="0" name="selected" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_slot"> <return type="void"> </return> @@ -233,8 +175,17 @@ </method> </methods> <members> + <member name="comment" type="bool" setter="set_comment" getter="is_comment"> + </member> + <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> + The offset of the GraphNode, relative to the scroll offset of the [GraphEdit]. Note that you cannot use position directly, as [GraphEdit] is a [Container]. + </member> + <member name="overlay" type="int" setter="set_overlay" getter="get_overlay" enum="GraphNode.Overlay"> + </member> <member name="resizable" type="bool" setter="set_resizable" getter="is_resizable"> </member> + <member name="selected" type="bool" setter="set_selected" getter="is_selected"> + </member> <member name="show_close" type="bool" setter="set_show_close_button" getter="is_close_button_visible"> </member> <member name="title" type="String" setter="set_title" getter="get_title"> diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index 80f6966e12..d54e749d72 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -39,13 +39,6 @@ [code]verify_host[/code] will check the SSL identity of the host if set to [code]true[/code]. </description> </method> - <method name="get_connection" qualifiers="const"> - <return type="StreamPeer"> - </return> - <description> - Returns the current connection. - </description> - </method> <method name="get_response_body_length" qualifiers="const"> <return type="int"> </return> @@ -90,13 +83,6 @@ If [code]true[/code] this [code]HTTPClient[/code] has a response available. </description> </method> - <method name="is_blocking_mode_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - If [code]true[/code] blocking mode is enabled. - </description> - </method> <method name="is_response_chunked" qualifiers="const"> <return type="bool"> </return> @@ -172,24 +158,6 @@ Sends the body data raw, as a byte array and does not encode it in any way. </description> </method> - <method name="set_blocking_mode"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - If set to true, execution will block until all data is read from the response. - </description> - </method> - <method name="set_connection"> - <return type="void"> - </return> - <argument index="0" name="connection" type="StreamPeer"> - </argument> - <description> - Sets connection to use for this client. - </description> - </method> <method name="set_read_chunk_size"> <return type="void"> </return> @@ -200,6 +168,14 @@ </description> </method> </methods> + <members> + <member name="blocking_mode_enabled" type="bool" setter="set_blocking_mode" getter="is_blocking_mode_enabled"> + If [code]true[/code], execution will block until all data is read from the response. + </member> + <member name="connection" type="StreamPeer" setter="set_connection" getter="get_connection"> + The connection to use for this client. + </member> + </members> <constants> <constant name="METHOD_GET" value="0" enum="Method"> HTTP GET method. The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 985198c76f..f8da5297e1 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -26,13 +26,6 @@ Returns the response body length. </description> </method> - <method name="get_download_file" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the file this request will download into. - </description> - </method> <method name="get_downloaded_bytes" qualifiers="const"> <return type="int"> </return> @@ -63,20 +56,14 @@ <description> </description> </method> - <method name="set_download_file"> - <return type="void"> - </return> - <argument index="0" name="path" type="String"> - </argument> - <description> - Sets the file to download into. Outputs the response body into the file if set. - </description> - </method> </methods> <members> <member name="body_size_limit" type="int" setter="set_body_size_limit" getter="get_body_size_limit"> Maximum allowed size for response bodies. </member> + <member name="download_file" type="String" setter="set_download_file" getter="get_download_file"> + The file to download into. Will output any received file into it. + </member> <member name="max_redirects" type="int" setter="set_max_redirects" getter="get_max_redirects"> Maximum number of allowed redirects. </member> diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index a20af677cb..15b9d2298e 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -46,20 +46,6 @@ Return the format of the [code]ImageTexture[/code], one of [Image].FORMAT_*. </description> </method> - <method name="get_lossy_storage_quality" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the storage quality for [code]ImageTexture[/code].STORAGE_COMPRESS_LOSSY. - </description> - </method> - <method name="get_storage" qualifiers="const"> - <return type="int" enum="ImageTexture.Storage"> - </return> - <description> - Return the storage type. One of [code]ImageTexture[/code].STORAGE_*. - </description> - </method> <method name="load"> <return type="void"> </return> @@ -78,15 +64,6 @@ Set the [Image] of this [code]ImageTexture[/code]. </description> </method> - <method name="set_lossy_storage_quality"> - <return type="void"> - </return> - <argument index="0" name="quality" type="float"> - </argument> - <description> - Set the storage quality in case of [code]ImageTexture[/code].STORAGE_COMPRESS_LOSSY. - </description> - </method> <method name="set_size_override"> <return type="void"> </return> @@ -96,16 +73,15 @@ Resizes the [code]ImageTexture[/code] to the specified dimensions. </description> </method> - <method name="set_storage"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="ImageTexture.Storage"> - </argument> - <description> - Set the storage type. One of [code]ImageTexture[/code].STORAGE_*. - </description> - </method> </methods> + <members> + <member name="lossy_quality" type="float" setter="set_lossy_storage_quality" getter="get_lossy_storage_quality"> + The storage quality for [code]ImageTexture[/code].STORAGE_COMPRESS_LOSSY. + </member> + <member name="storage" type="int" setter="set_storage" getter="get_storage" enum="ImageTexture.Storage"> + The storage type (raw, lossy, or compressed). + </member> + </members> <constants> <constant name="STORAGE_RAW" value="0" enum="Storage"> [Image] data is stored raw and unaltered. diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index f3d0c271ac..76af678d51 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -53,12 +53,6 @@ Ensure selection is visible, adjusting the scroll position as necessary. </description> </method> - <method name="get_fixed_icon_size" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> <method name="get_item_at_position" qualifiers="const"> <return type="int"> </return> @@ -198,14 +192,6 @@ Note: This method does not trigger the item selection signal. </description> </method> - <method name="set_fixed_icon_size"> - <return type="void"> - </return> - <argument index="0" name="size" type="Vector2"> - </argument> - <description> - </description> - </method> <method name="set_item_custom_bg_color"> <return type="void"> </return> @@ -328,6 +314,8 @@ </member> <member name="fixed_column_width" type="int" setter="set_fixed_column_width" getter="get_fixed_column_width"> </member> + <member name="fixed_icon_size" type="Vector2" setter="set_fixed_icon_size" getter="get_fixed_icon_size"> + </member> <member name="icon_mode" type="int" setter="set_icon_mode" getter="get_icon_mode" enum="ItemList.IconMode"> </member> <member name="icon_scale" type="float" setter="set_icon_scale" getter="get_icon_scale"> diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml index d1dc236d40..92d648537c 100644 --- a/doc/classes/KinematicBody.xml +++ b/doc/classes/KinematicBody.xml @@ -82,7 +82,7 @@ <description> Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [code]KinematicBody[/code] or [RigidBody], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes. [code]linear_velocity[/code] is a value in pixels per second. Unlike in for example [method move_and_collide], you should [i]not[/i] multiply it with [code]delta[/code] — this is done by the method. - [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector2(0, 0)[/code], everything is considered a wall. This is useful for topdown games. + [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector3(0, 0, 0)[/code], everything is considered a wall. This is useful for topdown games. If the body is standing on a slope and the horizontal speed (relative to the floor's speed) goes below [code]slope_stop_min_velocity[/code], the body will stop completely. This prevents the body from sliding down slopes when you include gravity in [code]linear_velocity[/code]. When set to lower values, the body will not be able to stand still on steep slopes. If the body collides, it will change direction a maximum of [code]max_bounces[/code] times before it stops. [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees. diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 089b81164b..a84294f2c5 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -5,6 +5,7 @@ </brief_description> <description> Label displays plain text on the screen. It gives you control over the horizontal and vertical alignment, and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics or other formatting. For that, use [RichTextLabel] instead. + Note that contrarily to most other [Control]s, Label's [member Control.mouse_filter] defaults to MOUSE_FILTER_IGNORE (i.e. it doesn't react to mouse input events). </description> <tutorials> </tutorials> @@ -32,13 +33,6 @@ Returns the total length of the text. </description> </method> - <method name="get_visible_characters" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the restricted number of characters to display. Returns -1 if unrestricted. - </description> - </method> <method name="get_visible_line_count" qualifiers="const"> <return type="int"> </return> @@ -46,15 +40,6 @@ Returns the number of lines shown. Useful if the [code]Label[/code] 's height cannot currently display all lines. </description> </method> - <method name="set_visible_characters"> - <return type="void"> - </return> - <argument index="0" name="amount" type="int"> - </argument> - <description> - Restricts the number of characters to display. Set to -1 to disable. - </description> - </method> </methods> <members> <member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align"> @@ -84,6 +69,9 @@ <member name="valign" type="int" setter="set_valign" getter="get_valign" enum="Label.VAlign"> Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [code]VALIGN_*[/code] constants. </member> + <member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters"> + Restricts the number of characters to display. Set to -1 to disable. + </member> </members> <constants> <constant name="ALIGN_LEFT" value="0" enum="Align"> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 4434a7b7e2..5dab9199e0 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -34,13 +34,6 @@ Clears the current selection. </description> </method> - <method name="get_cursor_position" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the cursor position inside the [code]LineEdit[/code]. - </description> - </method> <method name="get_menu" qualifiers="const"> <return type="PopupMenu"> </return> @@ -81,15 +74,6 @@ Selects the whole [String]. </description> </method> - <method name="set_cursor_position"> - <return type="void"> - </return> - <argument index="0" name="position" type="int"> - </argument> - <description> - Sets the cursor position inside the [code]LineEdit[/code]. The text may scroll if needed. - </description> - </method> </methods> <members> <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align"> @@ -101,6 +85,9 @@ <member name="caret_blink_speed" type="float" setter="cursor_set_blink_speed" getter="cursor_get_blink_speed"> Duration (in seconds) of a caret's blinking cycle. </member> + <member name="caret_position" type="int" setter="set_cursor_position" getter="get_cursor_position"> + The cursor's position inside the [code]LineEdit[/code]. When set, the text may scroll to accomodate it. + </member> <member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled"> If [code]true[/code] the context menu will appear when right clicked. </member> @@ -131,14 +118,14 @@ </members> <signals> <signal name="text_changed"> - <argument index="0" name="text" type="String"> + <argument index="0" name="new_text" type="String"> </argument> <description> Emitted when the text changes. </description> </signal> <signal name="text_entered"> - <argument index="0" name="text" type="String"> + <argument index="0" name="new_text" type="String"> </argument> <description> Emitted when the user presses KEY_ENTER on the [code]LineEdit[/code]. diff --git a/doc/classes/NetworkedMultiplayerPeer.xml b/doc/classes/NetworkedMultiplayerPeer.xml index a7350b3863..db345bd0d8 100644 --- a/doc/classes/NetworkedMultiplayerPeer.xml +++ b/doc/classes/NetworkedMultiplayerPeer.xml @@ -32,13 +32,6 @@ Returns the ID of this [code]NetworkedMultiplayerPeer[/code]. </description> </method> - <method name="is_refusing_new_connections" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if this [code]NetworkedMultiplayerPeer[/code] refuses new connections. Default value: [code]false[/code]. - </description> - </method> <method name="poll"> <return type="void"> </return> @@ -46,15 +39,6 @@ Waits up to 1 second to receive a new network event. </description> </method> - <method name="set_refuse_new_connections"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] this [code]NetworkedMultiplayerPeer[/code] refuses new connections. Default value: [code]false[/code]. - </description> - </method> <method name="set_target_peer"> <return type="void"> </return> @@ -64,16 +48,15 @@ The peer to which packets will be sent. Default value: [code]0[/code]. </description> </method> - <method name="set_transfer_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="NetworkedMultiplayerPeer.TransferMode"> - </argument> - <description> - The manner in which to send packets to the [code]target_peer[/code]. See [enum TransferMode]. - </description> - </method> </methods> + <members> + <member name="refuse_new_connections" type="bool" setter="set_refuse_new_connections" getter="is_refusing_new_connections"> + If [code]true[/code] this [code]NetworkedMultiplayerPeer[/code] refuses new connections. Default value: [code]false[/code]. + </member> + <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" enum="NetworkedMultiplayerPeer.TransferMode"> + The manner in which to send packets to the [code]target_peer[/code]. See [enum TransferMode]. + </member> + </members> <signals> <signal name="connection_failed"> <description> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index e56733f102..d0c948e599 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -32,8 +32,8 @@ <return type="void"> </return> <description> - Called when the node leaves the [SceneTree] (e.g. upon freeing, scene changing, or after calling [method remove_child] in a script). If the node has children, its [method _exit_tree] callback will be called last, after all its children have left the tree. - Corresponds to the NOTIFICATION_EXIT_TREE notification in [method Object._notification]. + Called when the node is about to leave the [SceneTree] (e.g. upon freeing, scene changing, or after calling [method remove_child] in a script). If the node has children, its [method _exit_tree] callback will be called last, after all its children have left the tree. + Corresponds to the NOTIFICATION_EXIT_TREE notification in [method Object._notification] and signal [signal tree_exiting]. To get notified when the node has already left the active tree, connect to the [signal tree_exited] </description> </method> <method name="_input" qualifiers="virtual"> @@ -184,13 +184,6 @@ Returns an array of references to node's children. </description> </method> - <method name="get_filename" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns a filename that may be contained by the node. When a scene is instanced from a file, its topmost node contains the filename from which it was loaded (see [method set_filename]). - </description> - </method> <method name="get_groups" qualifiers="const"> <return type="Array"> </return> @@ -205,13 +198,6 @@ Returns the node's index, i.e. its position among the siblings of its parent. </description> </method> - <method name="get_name" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the name of the node. This name is unique among the siblings (other child nodes from the same parent). - </description> - </method> <method name="get_network_master" qualifiers="const"> <return type="int"> </return> @@ -255,13 +241,6 @@ <description> </description> </method> - <method name="get_owner" qualifiers="const"> - <return type="Node"> - </return> - <description> - Returns the node owner (see [method set_owner]). - </description> - </method> <method name="get_parent" qualifiers="const"> <return type="Node"> </return> @@ -659,24 +638,6 @@ Sets the folded state of the node in the Scene dock. </description> </method> - <method name="set_filename"> - <return type="void"> - </return> - <argument index="0" name="filename" type="String"> - </argument> - <description> - A node can contain a filename. This filename should not be changed by the user, unless writing editors and tools. When a scene is instanced from a file, its topmost node contains the filename from which it was loaded. - </description> - </method> - <method name="set_name"> - <return type="void"> - </return> - <argument index="0" name="name" type="String"> - </argument> - <description> - Sets the name of the node. The name must be unique within the parent. Using an existing name will cause the node to be automatically renamed. - </description> - </method> <method name="set_network_master"> <return type="void"> </return> @@ -688,15 +649,6 @@ Sets the node network master to the peer with the given peer ID. The network master is the peer that has authority over it on the network. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). </description> </method> - <method name="set_owner"> - <return type="void"> - </return> - <argument index="0" name="owner" type="Node"> - </argument> - <description> - Sets the node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc ascending in the tree). When saving a node (using SceneSaver) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing. - </description> - </method> <method name="set_physics_process"> <return type="void"> </return> @@ -768,6 +720,16 @@ </method> </methods> <members> + <member name="filename" type="String" setter="set_filename" getter="get_filename"> + When a scene is instanced from a file, its topmost node contains the filename from which it was loaded. + </member> + <member name="name" type="String" setter="set_name" getter="get_name"> + The name of the node. This name is unique among the siblings (other child nodes from the same parent). + When set to an existing name, the node will be automatically renamed + </member> + <member name="owner" type="Node" setter="set_owner" getter="get_owner"> + The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using SceneSaver) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing. + </member> <member name="pause_mode" type="int" setter="set_pause_mode" getter="get_pause_mode" enum="Node.PauseMode"> </member> </members> @@ -782,9 +744,14 @@ Emitted when the node enters the tree. </description> </signal> + <signal name="tree_exiting"> + <description> + Emitted when the node is still active but about to exit the tree. This is the right place for de-initialization. + </description> + </signal> <signal name="tree_exited"> <description> - Emitted when the node exits the tree. + Emitted after the node exits the tree and is no longer active. </description> </signal> </signals> @@ -793,7 +760,7 @@ Notification received when the node enters a [SceneTree]. </constant> <constant name="NOTIFICATION_EXIT_TREE" value="11"> - Notification received when the node exits a [SceneTree]. + Notification received when the node is about to exit a [SceneTree]. </constant> <constant name="NOTIFICATION_MOVED_IN_PARENT" value="12"> Notification received when the node is moved in the parent. diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 5b7def99dc..6f6fc9f835 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -38,12 +38,6 @@ Returns the [Transform2D] relative to this node's parent. </description> </method> - <method name="get_rotation" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> <method name="global_translate"> <return type="void"> </return> @@ -93,14 +87,6 @@ Applies a rotation to the node, in radians, starting from its current rotation. </description> </method> - <method name="set_rotation"> - <return type="void"> - </return> - <argument index="0" name="radians" type="float"> - </argument> - <description> - </description> - </method> <method name="to_global" qualifiers="const"> <return type="Vector2"> </return> @@ -148,6 +134,9 @@ <member name="position" type="Vector2" setter="set_position" getter="get_position"> Position, relative to the node's parent. </member> + <member name="rotation" type="float" setter="set_rotation" getter="get_rotation"> + Rotation in radians, relative to the node's parent. + </member> <member name="rotation_degrees" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees"> Rotation in degrees, relative to the node's parent. </member> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 902bf4ebfa..f2c09feef8 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -99,20 +99,6 @@ Returns the scancode of the given string (e.g. "Escape") </description> </method> - <method name="get_borderless_window" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns true if the current window is borderless. - </description> - </method> - <method name="get_clipboard" qualifiers="const"> - <return type="String"> - </return> - <description> - Get clipboard from the host OS. - </description> - </method> <method name="get_cmdline_args"> <return type="PoolStringArray"> </return> @@ -120,13 +106,6 @@ Returns the command line arguments passed to the engine. </description> </method> - <method name="get_current_screen" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the current screen index (0 padded). - </description> - </method> <method name="get_date" qualifiers="const"> <return type="Dictionary"> </return> @@ -178,12 +157,6 @@ Returns the path to the current engine executable. </description> </method> - <method name="get_exit_code" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> <method name="get_latin_keyboard_variant" qualifiers="const"> <return type="String"> </return> @@ -281,13 +254,6 @@ xxxhdpi - 640 dpi </description> </method> - <method name="get_screen_orientation" qualifiers="const"> - <return type="int" enum="OS.ScreenOrientation"> - </return> - <description> - Returns the current screen orientation, the return value will be one of the SCREEN_ORIENTATION constants in this class. - </description> - </method> <method name="get_screen_position" qualifiers="const"> <return type="Vector2"> </return> @@ -403,20 +369,6 @@ <description> </description> </method> - <method name="get_window_position" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right. - </description> - </method> - <method name="get_window_size" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the size of the window (without counting window manager decorations). - </description> - </method> <method name="has_environment" qualifiers="const"> <return type="bool"> </return> @@ -464,20 +416,6 @@ Returns [code]false[/code] if the build is a release build. </description> </method> - <method name="is_in_low_processor_usage_mode" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if low cpu usage mode is enabled. - </description> - </method> - <method name="is_keep_screen_on" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the screen is being kept on. - </description> - </method> <method name="is_ok_left_and_cancel_right" qualifiers="const"> <return type="bool"> </return> @@ -508,41 +446,6 @@ If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable. </description> </method> - <method name="is_vsync_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if synchronizing the framerate to the monitor's refresh rate is enabled. - </description> - </method> - <method name="is_window_fullscreen" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window is in fullscreen mode. - </description> - </method> - <method name="is_window_maximized" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window is maximized. - </description> - </method> - <method name="is_window_minimized" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window is minimized. - </description> - </method> - <method name="is_window_resizable" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window is resizable. - </description> - </method> <method name="kill"> <return type="int" enum="Error"> </return> @@ -636,42 +539,6 @@ Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX. </description> </method> - <method name="set_borderless_window"> - <return type="void"> - </return> - <argument index="0" name="borderless" type="bool"> - </argument> - <description> - Removes the window frame. - </description> - </method> - <method name="set_clipboard"> - <return type="void"> - </return> - <argument index="0" name="clipboard" type="String"> - </argument> - <description> - Sets clipboard to the OS. - </description> - </method> - <method name="set_current_screen"> - <return type="void"> - </return> - <argument index="0" name="screen" type="int"> - </argument> - <description> - Sets the current screen by index. - </description> - </method> - <method name="set_exit_code"> - <return type="void"> - </return> - <argument index="0" name="code" type="int"> - </argument> - <description> - Sets the exit code that will be returned by the game. - </description> - </method> <method name="set_icon"> <return type="void"> </return> @@ -689,33 +556,6 @@ <description> </description> </method> - <method name="set_keep_screen_on"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Sets keep screen on if true, or goes to sleep by device setting if false. (for Android/iOS) - </description> - </method> - <method name="set_low_processor_usage_mode"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set to [code]true[/code] to enable the low cpu usage mode. In this mode, the screen only redraws when there are changes, and a considerable sleep time is inserted between frames. Use this in tool mode to reduce CPU usage. - </description> - </method> - <method name="set_screen_orientation"> - <return type="void"> - </return> - <argument index="0" name="orientation" type="int" enum="OS.ScreenOrientation"> - </argument> - <description> - Sets the current screen orientation, the argument value must be one of the SCREEN_ORIENTATION constants in this class. - </description> - </method> <method name="set_thread_name"> <return type="int" enum="Error"> </return> @@ -734,69 +574,6 @@ Enables backup saves if [code]enabled[/code] is [code]true[/code]. </description> </method> - <method name="set_use_vsync"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] the framerate will synchronize to the monitor's refresh rate. - </description> - </method> - <method name="set_window_fullscreen"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Sets window fullscreen mode to the [i]enabled[/i] argument, [i]enabled[/i] is a toggle for the fullscreen mode, calling the function with [i]enabled[/i] true when the screen is not on fullscreen mode will cause the screen to go to fullscreen mode, calling the function with [i]enabled[/i] false when the screen is in fullscreen mode will cause the window to exit the fullscreen mode. - </description> - </method> - <method name="set_window_maximized"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Set [code]true[/code] to maximize the window. - </description> - </method> - <method name="set_window_minimized"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Set [code]true[/code] to minimize the window. - </description> - </method> - <method name="set_window_position"> - <return type="void"> - </return> - <argument index="0" name="position" type="Vector2"> - </argument> - <description> - Sets the position of the window to the specified position (this function could be restricted by the window manager, meaning that there could be some unreachable areas of the screen). - </description> - </method> - <method name="set_window_resizable"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Sets the window resizable state, if the window is not resizable it will preserve the dimensions specified in the project settings. - </description> - </method> - <method name="set_window_size"> - <return type="void"> - </return> - <argument index="0" name="size" type="Vector2"> - </argument> - <description> - Sets the window size to the specified size. - </description> - </method> <method name="set_window_title"> <return type="void"> </return> @@ -827,6 +604,46 @@ </description> </method> </methods> + <members> + <member name="clipboard" type="String" setter="set_clipboard" getter="get_clipboard"> + The clipboard from the host OS. Might be unavailable on some platforms. + </member> + <member name="current_screen" type="int" setter="set_current_screen" getter="get_current_screen"> + The current screen index (starting from 0). + </member> + <member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code"> + </member> + <member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on"> + </member> + <member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode"> + </member> + <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation"> + The current screen orientation. + </member> + <member name="vsync_enabled" type="bool" setter="set_use_vsync" getter="is_vsync_enabled"> + </member> + <member name="window_borderless" type="bool" setter="set_borderless_window" getter="get_borderless_window"> + If [code]true[/code], removes the window frame. + </member> + <member name="window_fullscreen" type="bool" setter="set_window_fullscreen" getter="is_window_fullscreen"> + If [code]true[/code], the window is fullscreen. + </member> + <member name="window_maximized" type="bool" setter="set_window_maximized" getter="is_window_maximized"> + If [code]true[/code], the window is maximized. + </member> + <member name="window_minimized" type="bool" setter="set_window_minimized" getter="is_window_minimized"> + If [code]true[/code], the window is minimized. + </member> + <member name="window_position" type="Vector2" setter="set_window_position" getter="get_window_position"> + The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right. + </member> + <member name="window_resizable" type="bool" setter="set_window_resizable" getter="is_window_resizable"> + If [code]true[/code], the window is resizable by the user. + </member> + <member name="window_size" type="Vector2" setter="set_window_size" getter="get_window_size"> + The size of the window (without counting window manager decorations). + </member> + </members> <constants> <constant name="DAY_SUNDAY" value="0" enum="Weekday"> </constant> diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml index 57d88d7ff8..b920d92f3d 100644 --- a/doc/classes/PacketPeer.xml +++ b/doc/classes/PacketPeer.xml @@ -39,12 +39,6 @@ Get a Variant. </description> </method> - <method name="is_object_decoding_allowed" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="put_packet"> <return type="int" enum="Error"> </return> @@ -63,15 +57,11 @@ Send a Variant as a packet. </description> </method> - <method name="set_allow_object_decoding"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="allow_object_decoding" type="bool" setter="set_allow_object_decoding" getter="is_object_decoding_allowed"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/PacketPeerStream.xml b/doc/classes/PacketPeerStream.xml index 5d320a09f8..879a2f2c52 100644 --- a/doc/classes/PacketPeerStream.xml +++ b/doc/classes/PacketPeerStream.xml @@ -11,44 +11,16 @@ <demos> </demos> <methods> - <method name="get_input_buffer_max_size" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_output_buffer_max_size" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="set_input_buffer_max_size"> - <return type="void"> - </return> - <argument index="0" name="max_size_bytes" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_output_buffer_max_size"> - <return type="void"> - </return> - <argument index="0" name="max_size_bytes" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_stream_peer"> - <return type="void"> - </return> - <argument index="0" name="peer" type="Reference"> - </argument> - <description> - Set the [StreamPeer] object to be wrapped. - </description> - </method> </methods> + <members> + <member name="input_buffer_max_size" type="int" setter="set_input_buffer_max_size" getter="get_input_buffer_max_size"> + </member> + <member name="output_buffer_max_size" type="int" setter="set_output_buffer_max_size" getter="get_output_buffer_max_size"> + </member> + <member name="stream_peer" type="StreamPeer" setter="set_stream_peer" getter="get_stream_peer"> + The wrapped [StreamPeer] object. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/PathFollow.xml b/doc/classes/PathFollow.xml index de7bb8715c..ac170b2ed7 100644 --- a/doc/classes/PathFollow.xml +++ b/doc/classes/PathFollow.xml @@ -12,122 +12,32 @@ <demos> </demos> <methods> - <method name="get_cubic_interpolation" qualifiers="const"> - <return type="bool"> - </return> - <description> - This method returns whether the position between two cached points (see [method set_cubic_interpolation]) is interpolated linearly, or cubicly. - </description> - </method> - <method name="get_h_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the X displacement this node has from its parent [Path]. - </description> - </method> - <method name="get_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the distance along the path in 3D units. - </description> - </method> - <method name="get_rotation_mode" qualifiers="const"> - <return type="int" enum="PathFollow.RotationMode"> - </return> - <description> - Returns the rotation mode. The constants below list which axes are allowed to rotate for each mode. - </description> - </method> - <method name="get_unit_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). - </description> - </method> - <method name="get_v_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the Y displacement this node has from its parent [Path]. - </description> - </method> - <method name="has_loop" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether this node wraps its offsets around, or truncates them to the path ends. - </description> - </method> - <method name="set_cubic_interpolation"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. - There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. - This method controls whether the position between two cached points is interpolated linearly, or cubicly. - </description> - </method> - <method name="set_h_offset"> - <return type="void"> - </return> - <argument index="0" name="h_offset" type="float"> - </argument> - <description> - Moves this node in the X axis. As this node's position will be set every time its offset is set, this allows many PathFollow to share the same curve (and thus the same movement pattern), yet not return the same position for a given path offset. - A similar effect may be achieved moving the this node's descendants. - </description> - </method> - <method name="set_loop"> - <return type="void"> - </return> - <argument index="0" name="loop" type="bool"> - </argument> - <description> - If set, any offset outside the path's length (whether set by [method set_offset] or [method set_unit_offset] will wrap around, instead of stopping at the ends. Set it for cyclic paths. - </description> - </method> - <method name="set_offset"> - <return type="void"> - </return> - <argument index="0" name="offset" type="float"> - </argument> - <description> - Sets the distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path. - </description> - </method> - <method name="set_rotation_mode"> - <return type="void"> - </return> - <argument index="0" name="rotation_mode" type="int" enum="PathFollow.RotationMode"> - </argument> - <description> - Allows or forbids rotation on one or more axes, per the constants below. - </description> - </method> - <method name="set_unit_offset"> - <return type="void"> - </return> - <argument index="0" name="unit_offset" type="float"> - </argument> - <description> - Sets the distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. - </description> - </method> - <method name="set_v_offset"> - <return type="void"> - </return> - <argument index="0" name="v_offset" type="float"> - </argument> - <description> - Moves this node in the Y axis, for the same reasons of [method set_h_offset]. - </description> - </method> </methods> + <members> + <member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation"> + If [code]true[/code] the position between two cached points is interpolated cubically, and linearly otherwise. + The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. + There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. + </member> + <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset"> + The node's offset along the curve. + </member> + <member name="loop" type="bool" setter="set_loop" getter="has_loop"> + If [code]true[/code], any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths. + </member> + <member name="offset" type="float" setter="set_offset" getter="get_offset"> + The distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path. + </member> + <member name="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow.RotationMode"> + Allows or forbids rotation on one or more axes, depending on the constants being used. + </member> + <member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset"> + The distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. + </member> + <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset"> + The node's offset perpendicular to the curve. + </member> + </members> <constants> <constant name="ROTATION_NONE" value="0" enum="RotationMode"> Forbids the PathFollow to rotate. diff --git a/doc/classes/PathFollow2D.xml b/doc/classes/PathFollow2D.xml index 56bec3d719..eed12b610d 100644 --- a/doc/classes/PathFollow2D.xml +++ b/doc/classes/PathFollow2D.xml @@ -12,122 +12,34 @@ <demos> </demos> <methods> - <method name="get_cubic_interpolation" qualifiers="const"> - <return type="bool"> - </return> - <description> - This method returns whether the position between two cached points (see [method set_cubic_interpolation]) is interpolated linearly, or cubicly. - </description> - </method> - <method name="get_h_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the horizontal displacement this node has from its parent [Path2D]. - </description> - </method> - <method name="get_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the distance along the path in pixels. - </description> - </method> - <method name="get_unit_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). - </description> - </method> - <method name="get_v_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the vertical displacement this node has from its parent [Path2D]. - </description> - </method> - <method name="has_loop" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether this node wraps its offsets around, or truncates them to the path ends. - </description> - </method> - <method name="is_rotating" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether this node rotates to follow the path. - </description> - </method> - <method name="set_cubic_interpolation"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - The points along the [Curve2D] of the [Path2D] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. - There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. - This method controls whether the position between two cached points is interpolated linearly, or cubicly. - </description> - </method> - <method name="set_h_offset"> - <return type="void"> - </return> - <argument index="0" name="h_offset" type="float"> - </argument> - <description> - Moves this node horizontally. As this node's position will be set every time its offset is set, this allows many PathFollow2D to share the same curve (and thus the same movement pattern), yet not return the same position for a given path offset. - A similar effect may be achieved moving this node's descendants. - </description> - </method> - <method name="set_loop"> - <return type="void"> - </return> - <argument index="0" name="loop" type="bool"> - </argument> - <description> - If set, any offset outside the path's length (whether set by [method set_offset] or [method set_unit_offset] will wrap around, instead of stopping at the ends. Set it for cyclic paths. - </description> - </method> - <method name="set_offset"> - <return type="void"> - </return> - <argument index="0" name="offset" type="float"> - </argument> - <description> - Sets the distance from the first vertex, measured in pixels along the path. This sets this node's position to a point within the path. - </description> - </method> - <method name="set_rotate"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If set, this node rotates to follow the path, making its descendants rotate. - </description> - </method> - <method name="set_unit_offset"> - <return type="void"> - </return> - <argument index="0" name="unit_offset" type="float"> - </argument> - <description> - Sets the distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. - </description> - </method> - <method name="set_v_offset"> - <return type="void"> - </return> - <argument index="0" name="v_offset" type="float"> - </argument> - <description> - Moves the PathFollow2D vertically, for the same reasons of [method set_h_offset]. - </description> - </method> </methods> + <members> + <member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation"> + If [code]true[/code] the position between two cached points is interpolated cubically, and linearly otherwise. + The points along the [Curve2D] of the [Path2D] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. + There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. + </member> + <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset"> + The node's offset along the curve. + </member> + <member name="lookahead" type="float" setter="set_lookahead" getter="get_lookahead"> + </member> + <member name="loop" type="bool" setter="set_loop" getter="has_loop"> + If [code]true[/code], any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths. + </member> + <member name="offset" type="float" setter="set_offset" getter="get_offset"> + The distance along the path in pixels. + </member> + <member name="rotate" type="bool" setter="set_rotate" getter="is_rotating"> + If [code]true[/code], this node rotates to follow the path, making its descendants rotate. + </member> + <member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset"> + The distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. + </member> + <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset"> + The node's offset perpendicular to the curve. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/Physics2DDirectBodyState.xml index a229ca494d..c359801020 100644 --- a/doc/classes/Physics2DDirectBodyState.xml +++ b/doc/classes/Physics2DDirectBodyState.xml @@ -11,13 +11,6 @@ <demos> </demos> <methods> - <method name="get_angular_velocity" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the angular velocity of the body. - </description> - </method> <method name="get_contact_collider" qualifiers="const"> <return type="RID"> </return> @@ -115,27 +108,6 @@ Return the local shape index of the collision. </description> </method> - <method name="get_inverse_inertia" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the inverse of the inertia of the body. - </description> - </method> - <method name="get_inverse_mass" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the inverse of the mass of the body. - </description> - </method> - <method name="get_linear_velocity" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the current linear velocity of the body. - </description> - </method> <method name="get_space_state"> <return type="Physics2DDirectSpaceState"> </return> @@ -143,41 +115,6 @@ Return the current state of space, useful for queries. </description> </method> - <method name="get_step" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the timestep (delta) used for the simulation. - </description> - </method> - <method name="get_total_angular_damp" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the rate at which the body stops rotating, if there are not any other forces moving it. - </description> - </method> - <method name="get_total_gravity" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the total gravity vector being currently applied to this body. - </description> - </method> - <method name="get_total_linear_damp" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the rate at which the body stops moving, if there are not any other forces moving it. - </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform2D"> - </return> - <description> - Return the transform matrix of the body. - </description> - </method> <method name="integrate_forces"> <return type="void"> </return> @@ -185,50 +122,39 @@ Call the built-in force integration code. </description> </method> - <method name="is_sleeping" qualifiers="const"> - <return type="bool"> - </return> - <description> - Return true if this body is currently sleeping (not active). - </description> - </method> - <method name="set_angular_velocity"> - <return type="void"> - </return> - <argument index="0" name="velocity" type="float"> - </argument> - <description> - Change the angular velocity of the body. - </description> - </method> - <method name="set_linear_velocity"> - <return type="void"> - </return> - <argument index="0" name="velocity" type="Vector2"> - </argument> - <description> - Change the linear velocity of the body. - </description> - </method> - <method name="set_sleep_state"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Set the sleeping state of the body, only affects character/rigid bodies. - </description> - </method> - <method name="set_transform"> - <return type="void"> - </return> - <argument index="0" name="transform" type="Transform2D"> - </argument> - <description> - Change the transform matrix of the body. - </description> - </method> </methods> + <members> + <member name="angular_velocity" type="float" setter="set_angular_velocity" getter="get_angular_velocity"> + The angular velocity of the body. + </member> + <member name="inverse_inertia" type="float" setter="" getter="get_inverse_inertia"> + The inverse of the inertia of the body. + </member> + <member name="inverse_mass" type="float" setter="" getter="get_inverse_mass"> + The inverse of the mass of the body. + </member> + <member name="linear_velocity" type="Vector2" setter="set_linear_velocity" getter="get_linear_velocity"> + The linear velocity of the body. + </member> + <member name="sleeping" type="bool" setter="set_sleep_state" getter="is_sleeping"> + [code]true[/code] if this body is currently sleeping (not active). + </member> + <member name="step" type="float" setter="" getter="get_step"> + The timestep (delta) used for the simulation. + </member> + <member name="total_angular_damp" type="float" setter="" getter="get_total_angular_damp"> + The rate at which the body stops rotating, if there are not any other forces moving it. + </member> + <member name="total_gravity" type="Vector2" setter="" getter="get_total_gravity"> + The total gravity vector being currently applied to this body. + </member> + <member name="total_linear_damp" type="float" setter="" getter="get_total_linear_damp"> + The rate at which the body stops moving, if there are not any other forces moving it. + </member> + <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> + The transformation matrix of the body. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml index 93165afe60..eeba622f85 100644 --- a/doc/classes/Physics2DShapeQueryParameters.xml +++ b/doc/classes/Physics2DShapeQueryParameters.xml @@ -11,84 +11,6 @@ <demos> </demos> <methods> - <method name="get_collision_layer" qualifiers="const"> - <return type="int"> - </return> - <description> - Return the physics layer the shape belongs to. - </description> - </method> - <method name="get_exclude" qualifiers="const"> - <return type="Array"> - </return> - <description> - Return the list of objects, or object [RID]s, that will be excluded from collisions. - </description> - </method> - <method name="get_margin" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the collision margin for the shape. - </description> - </method> - <method name="get_motion" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the current movement speed of the shape. - </description> - </method> - <method name="get_shape_rid" qualifiers="const"> - <return type="RID"> - </return> - <description> - Return the [RID] of the shape queried. - </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform2D"> - </return> - <description> - Return the transform matrix of the shape queried. - </description> - </method> - <method name="set_collision_layer"> - <return type="void"> - </return> - <argument index="0" name="collision_layer" type="int"> - </argument> - <description> - Set the physics layer the shape belongs to. - </description> - </method> - <method name="set_exclude"> - <return type="void"> - </return> - <argument index="0" name="exclude" type="Array"> - </argument> - <description> - Set the list of objects, or object [RID]s, that will be excluded from collisions. - </description> - </method> - <method name="set_margin"> - <return type="void"> - </return> - <argument index="0" name="margin" type="float"> - </argument> - <description> - Set the collision margin for the shape. A collision margin is an amount (in pixels) that the shape will grow when computing collisions, to account for numerical imprecision. - </description> - </method> - <method name="set_motion"> - <return type="void"> - </return> - <argument index="0" name="motion" type="Vector2"> - </argument> - <description> - Set the current movement speed of the shape. - </description> - </method> <method name="set_shape"> <return type="void"> </return> @@ -98,25 +20,27 @@ Set the [Shape2D] that will be used for collision/intersection queries. </description> </method> - <method name="set_shape_rid"> - <return type="void"> - </return> - <argument index="0" name="shape" type="RID"> - </argument> - <description> - Set the [RID] of the shape to be used in queries. - </description> - </method> - <method name="set_transform"> - <return type="void"> - </return> - <argument index="0" name="transform" type="Transform2D"> - </argument> - <description> - Set the transformation matrix of the shape. This is necessary to set its position/rotation/scale. - </description> - </method> </methods> + <members> + <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer"> + The physics layer the query should be made on. + </member> + <member name="exclude" type="Array" setter="set_exclude" getter="get_exclude"> + The list of objects or object [RID]s, that will be excluded from collisions. + </member> + <member name="margin" type="float" setter="set_margin" getter="get_margin"> + The collision margin for the shape. + </member> + <member name="motion" type="Vector2" setter="set_motion" getter="get_motion"> + The motion of the shape being queried for. + </member> + <member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid"> + The [RID] of the queried shape. See [method set_shape] also. + </member> + <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> + the transform matrix of the queried shape. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Physics2DTestMotionResult.xml b/doc/classes/Physics2DTestMotionResult.xml index bc7cb68bc9..93809ca2a4 100644 --- a/doc/classes/Physics2DTestMotionResult.xml +++ b/doc/classes/Physics2DTestMotionResult.xml @@ -9,61 +9,27 @@ <demos> </demos> <methods> - <method name="get_collider" qualifiers="const"> - <return type="Object"> - </return> - <description> - </description> - </method> - <method name="get_collider_id" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_collider_rid" qualifiers="const"> - <return type="RID"> - </return> - <description> - </description> - </method> - <method name="get_collider_shape" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_collider_velocity" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> - <method name="get_collision_normal" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> - <method name="get_collision_point" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> - <method name="get_motion" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> - <method name="get_motion_remainder" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> </methods> + <members> + <member name="collider" type="Object" setter="" getter="get_collider"> + </member> + <member name="collider_id" type="int" setter="" getter="get_collider_id"> + </member> + <member name="collider_rid" type="RID" setter="" getter="get_collider_rid"> + </member> + <member name="collider_shape" type="int" setter="" getter="get_collider_shape"> + </member> + <member name="collider_velocity" type="Vector2" setter="" getter="get_collider_velocity"> + </member> + <member name="collision_normal" type="Vector2" setter="" getter="get_collision_normal"> + </member> + <member name="collision_point" type="Vector2" setter="" getter="get_collision_point"> + </member> + <member name="motion" type="Vector2" setter="" getter="get_motion"> + </member> + <member name="motion_remainder" type="Vector2" setter="" getter="get_motion_remainder"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState.xml index 1d588ecfff..486804f196 100644 --- a/doc/classes/PhysicsDirectBodyState.xml +++ b/doc/classes/PhysicsDirectBodyState.xml @@ -37,18 +37,6 @@ <description> </description> </method> - <method name="get_angular_velocity" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - </description> - </method> - <method name="get_center_of_mass" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - </description> - </method> <method name="get_contact_collider" qualifiers="const"> <return type="RID"> </return> @@ -127,111 +115,55 @@ <description> </description> </method> - <method name="get_inverse_inertia" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - </description> - </method> - <method name="get_inverse_mass" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_linear_velocity" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - </description> - </method> - <method name="get_principal_inertia_axes" qualifiers="const"> - <return type="Basis"> - </return> - <description> - </description> - </method> <method name="get_space_state"> <return type="PhysicsDirectSpaceState"> </return> <description> </description> </method> - <method name="get_step" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_total_angular_damp" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_total_gravity" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - </description> - </method> - <method name="get_total_linear_damp" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform"> - </return> - <description> - </description> - </method> <method name="integrate_forces"> <return type="void"> </return> <description> </description> </method> - <method name="is_sleeping" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_angular_velocity"> - <return type="void"> - </return> - <argument index="0" name="velocity" type="Vector3"> - </argument> - <description> - </description> - </method> - <method name="set_linear_velocity"> - <return type="void"> - </return> - <argument index="0" name="velocity" type="Vector3"> - </argument> - <description> - </description> - </method> - <method name="set_sleep_state"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_transform"> - <return type="void"> - </return> - <argument index="0" name="transform" type="Transform"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity"> + The angular velocity of the body. + </member> + <member name="center_of_mass" type="Vector3" setter="" getter="get_center_of_mass"> + </member> + <member name="inverse_inertia" type="Vector3" setter="" getter="get_inverse_inertia"> + The inverse of the inertia of the body. + </member> + <member name="inverse_mass" type="float" setter="" getter="get_inverse_mass"> + The inverse of the mass of the body. + </member> + <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity"> + The linear velocity of the body. + </member> + <member name="principal_inertia_axes" type="Basis" setter="" getter="get_principal_inertia_axes"> + </member> + <member name="sleeping" type="bool" setter="set_sleep_state" getter="is_sleeping"> + [code]true[/code] if this body is currently sleeping (not active). + </member> + <member name="step" type="float" setter="" getter="get_step"> + The timestep (delta) used for the simulation. + </member> + <member name="total_angular_damp" type="float" setter="" getter="get_total_angular_damp"> + The rate at which the body stops rotating, if there are not any other forces moving it. + </member> + <member name="total_gravity" type="Vector3" setter="" getter="get_total_gravity"> + The total gravity vector being currently applied to this body. + </member> + <member name="total_linear_damp" type="float" setter="" getter="get_total_linear_damp"> + The rate at which the body stops moving, if there are not any other forces moving it. + </member> + <member name="transform" type="Transform" setter="set_transform" getter="get_transform"> + The transformation matrix of the body. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters.xml index 98d6846b13..19036151ed 100644 --- a/doc/classes/PhysicsShapeQueryParameters.xml +++ b/doc/classes/PhysicsShapeQueryParameters.xml @@ -9,60 +9,6 @@ <demos> </demos> <methods> - <method name="get_collision_mask" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> - <method name="get_exclude" qualifiers="const"> - <return type="Array"> - </return> - <description> - </description> - </method> - <method name="get_margin" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_shape_rid" qualifiers="const"> - <return type="RID"> - </return> - <description> - </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform"> - </return> - <description> - </description> - </method> - <method name="set_collision_mask"> - <return type="void"> - </return> - <argument index="0" name="collision_mask" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_exclude"> - <return type="void"> - </return> - <argument index="0" name="exclude" type="Array"> - </argument> - <description> - </description> - </method> - <method name="set_margin"> - <return type="void"> - </return> - <argument index="0" name="margin" type="float"> - </argument> - <description> - </description> - </method> <method name="set_shape"> <return type="void"> </return> @@ -71,23 +17,19 @@ <description> </description> </method> - <method name="set_shape_rid"> - <return type="void"> - </return> - <argument index="0" name="shape" type="RID"> - </argument> - <description> - </description> - </method> - <method name="set_transform"> - <return type="void"> - </return> - <argument index="0" name="transform" type="Transform"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask"> + </member> + <member name="exclude" type="Array" setter="set_exclude" getter="get_exclude"> + </member> + <member name="margin" type="float" setter="set_margin" getter="get_margin"> + </member> + <member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid"> + </member> + <member name="transform" type="Transform" setter="set_transform" getter="get_transform"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Polygon2D.xml b/doc/classes/Polygon2D.xml index f69010458e..26ddf617ea 100644 --- a/doc/classes/Polygon2D.xml +++ b/doc/classes/Polygon2D.xml @@ -11,22 +11,6 @@ <demos> </demos> <methods> - <method name="get_texture_rotation" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the rotation in radians of the texture polygon. - </description> - </method> - <method name="set_texture_rotation"> - <return type="void"> - </return> - <argument index="0" name="texture_rotation" type="float"> - </argument> - <description> - Set the amount of rotation of the polygon texture, [code]texture_rotation[/code] is specified in radians and clockwise rotation. - </description> - </method> </methods> <members> <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased"> @@ -54,6 +38,9 @@ Amount to offset the polygon's [code]texture[/code]. If [code](0, 0)[/code] the texture's origin (its top-left corner) will be placed at the polygon's [code]position[/code]. </member> <member name="texture_rotation" type="float" setter="set_texture_rotation_degrees" getter="get_texture_rotation_degrees"> + The texture's rotation in radians. + </member> + <member name="texture_rotation_degrees" type="float" setter="set_texture_rotation_degrees" getter="get_texture_rotation_degrees"> The texture's rotation in degrees. </member> <member name="texture_scale" type="Vector2" setter="set_texture_scale" getter="get_texture_scale"> diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 13cf16d2ee..c9a8b2a9fd 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -233,12 +233,6 @@ <description> </description> </method> - <method name="is_hide_on_state_item_selection" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="is_item_checkable" qualifiers="const"> <return type="bool"> </return> @@ -284,14 +278,6 @@ Removes the item at index "idx" from the menu. Note that the indexes of items after the removed item are going to be shifted by one. </description> </method> - <method name="set_hide_on_state_item_selection"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_item_accelerator"> <return type="void"> </return> @@ -455,6 +441,8 @@ </member> <member name="hide_on_item_selection" type="bool" setter="set_hide_on_item_selection" getter="is_hide_on_item_selection"> </member> + <member name="hide_on_state_item_selection" type="bool" setter="set_hide_on_state_item_selection" getter="is_hide_on_state_item_selection"> + </member> </members> <signals> <signal name="id_pressed"> diff --git a/doc/classes/ProximityGroup.xml b/doc/classes/ProximityGroup.xml index 42e2c5e690..4c9a20d630 100644 --- a/doc/classes/ProximityGroup.xml +++ b/doc/classes/ProximityGroup.xml @@ -21,26 +21,14 @@ <description> </description> </method> - <method name="set_dispatch_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int"> - </argument> - <description> - </description> - </method> - <method name="set_group_name"> - <return type="void"> - </return> - <argument index="0" name="name" type="String"> - </argument> - <description> - </description> - </method> </methods> <members> + <member name="dispatch_mode" type="int" setter="set_dispatch_mode" getter="get_dispatch_mode" enum="ProximityGroup.DispatchMode"> + </member> <member name="grid_radius" type="Vector3" setter="set_grid_radius" getter="get_grid_radius"> </member> + <member name="group_name" type="String" setter="set_group_name" getter="get_group_name"> + </member> </members> <signals> <signal name="broadcast"> @@ -53,5 +41,9 @@ </signal> </signals> <constants> + <constant name="MODE_PROXY" value="0" enum="DispatchMode"> + </constant> + <constant name="MODE_SIGNAL" value="1" enum="DispatchMode"> + </constant> </constants> </class> diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml index d86ff57661..169f28bd7a 100644 --- a/doc/classes/Range.xml +++ b/doc/classes/Range.xml @@ -11,22 +11,6 @@ <demos> </demos> <methods> - <method name="get_as_ratio" qualifiers="const"> - <return type="float"> - </return> - <description> - Return value mapped to 0 to 1 range. - </description> - </method> - <method name="set_as_ratio"> - <return type="void"> - </return> - <argument index="0" name="value" type="float"> - </argument> - <description> - Set value mapped to 0 to 1 (unit) range, it will then be converted to the actual value within min and max. - </description> - </method> <method name="share"> <return type="void"> </return> @@ -57,6 +41,9 @@ <member name="page" type="float" setter="set_page" getter="get_page"> Page size. Used mainly for [ScrollBar]. ScrollBar's length is its size multiplied by [code]page[/code] over the difference between [code]min_value[/code] and [code]max_value[/code]. </member> + <member name="ratio" type="float" setter="set_as_ratio" getter="get_as_ratio"> + The value mapped between 0 and 1. + </member> <member name="rounded" type="bool" setter="set_use_rounded_values" getter="is_using_rounded_values"> If [code]true[/code], [code]value[/code] will always be rounded to the nearest integer. </member> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 5c04d3406e..39b0e80775 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -53,20 +53,6 @@ Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line. </description> </method> - <method name="get_tab_size" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of spaces associated with a single tab length. Does not affect "\t" in text tags, only indent tags. - </description> - </method> - <method name="get_text"> - <return type="String"> - </return> - <description> - Returns the raw content of [member bbcode_text]. - </description> - </method> <method name="get_total_character_count" qualifiers="const"> <return type="int"> </return> @@ -88,34 +74,6 @@ Returns the number of visible lines. </description> </method> - <method name="is_meta_underlined" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the label underlines meta tags such as [url]{text}[/url]. - </description> - </method> - <method name="is_scroll_active" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the scrollbar is visible. Does not block scrolling completely. See [method scroll_to_line]. - </description> - </method> - <method name="is_scroll_following" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window scrolls down to display new content automatically. - </description> - </method> - <method name="is_selection_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the label allows text selection. - </description> - </method> <method name="newline"> <return type="void"> </return> @@ -234,51 +192,6 @@ Scrolls the window's top line to match [code]line[/code]. </description> </method> - <method name="set_meta_underline"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] will underline meta tags such as the [url] bbcode. Default value: [code]true[/code]. - </description> - </method> - <method name="set_scroll_active"> - <return type="void"> - </return> - <argument index="0" name="active" type="bool"> - </argument> - <description> - If [code]false[/code] the vertical scrollbar is hidden. Default value: [code]true[/code]. - </description> - </method> - <method name="set_scroll_follow"> - <return type="void"> - </return> - <argument index="0" name="follow" type="bool"> - </argument> - <description> - If [code]true[/code] the window scrolls to reveal new content. Default value: [code]false[/code]. - </description> - </method> - <method name="set_selection_enabled"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - If [code]true[/code] text can be selected. - </description> - </method> - <method name="set_tab_size"> - <return type="void"> - </return> - <argument index="0" name="spaces" type="int"> - </argument> - <description> - Sets the current tab length in spaces. Use with [method push_indent] to redefine indent length. - </description> - </method> <method name="set_table_column_expand"> <return type="void"> </return> @@ -294,15 +207,6 @@ Columns with a [code]false[/code] expand will not contribute to the total ratio. </description> </method> - <method name="set_text"> - <return type="void"> - </return> - <argument index="0" name="text" type="String"> - </argument> - <description> - Clears the tag stack and adds a raw text tag to the top of it. Does not parse bbcodes. Does not modify [member bbcode_text]. - </description> - </method> </methods> <members> <member name="bbcode_enabled" type="bool" setter="set_use_bbcode" getter="is_using_bbcode"> @@ -311,12 +215,31 @@ <member name="bbcode_text" type="String" setter="set_bbcode" getter="get_bbcode"> The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited. </member> + <member name="meta_underlined" type="bool" setter="set_meta_underline" getter="is_meta_underlined"> + If [code]true[/code], the label underlines meta tags such as [url]{text}[/url]. Default value: [code]true[/code]. + </member> <member name="override_selected_font_color" type="bool" setter="set_override_selected_font_color" getter="is_overriding_selected_font_color"> If [code]true[/code] the label uses the custom font color. Default value: [code]false[/code]. </member> <member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible"> The text's visibility, as a [float] between 0.0 and 1.0. </member> + <member name="scroll_active" type="bool" setter="set_scroll_active" getter="is_scroll_active"> + If [code]true[/code], the scrollbar is visible. Does not block scrolling completely. See [method scroll_to_line]. Default value: [code]true[/code]. + </member> + <member name="scroll_following" type="bool" setter="set_scroll_follow" getter="is_scroll_following"> + If [code]true[/code], the window scrolls down to display new content automatically. Default value: [code]false[/code]. + </member> + <member name="selection_enabled" type="bool" setter="set_selection_enabled" getter="is_selection_enabled"> + If [code]true[/code], the label allows text selection. + </member> + <member name="tab_size" type="int" setter="set_tab_size" getter="get_tab_size"> + The number of spaces associated with a single tab length. Does not affect "\t" in text tags, only indent tags. + </member> + <member name="text" type="String" setter="set_text" getter="get_text"> + The raw text of the label. + When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse bbcodes. Does not modify [member bbcode_text]. + </member> <member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters"> The restricted number of characters to display in the label. </member> diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml index 3c54f29c15..335112f5d7 100644 --- a/doc/classes/RigidBody.xml +++ b/doc/classes/RigidBody.xml @@ -39,7 +39,7 @@ <return type="Array"> </return> <description> - Return a list of the bodies colliding with this one. By default, number of max contacts reported is at 0 , see [method set_max_contacts_reported] to increase it. + Return a list of the bodies colliding with this one. By default, number of max contacts reported is at 0 , see [method set_max_contacts_reported] to increase it. Note that the result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="set_axis_velocity"> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index c11e118df5..3465c851f8 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -49,50 +49,11 @@ Applies a positioned impulse to the body (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 instantaneously. Both the impulse and the offset from the body origin are in global coordinates. </description> </method> - <method name="get_applied_force" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the body's total applied force. - </description> - </method> - <method name="get_applied_torque" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the body's total applied torque. - </description> - </method> <method name="get_colliding_bodies" qualifiers="const"> <return type="Array"> </return> <description> - Returns a list of the bodies colliding with this one. Use [member contacts_reported] to set the maximum number reported. You must also set [member contact_monitor] to [code]true[/code]. - </description> - </method> - <method name="get_inertia" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the body's moment of inertia, which is computed automatically from the body's mass and assigned [Shape2D]s during the physics frame. Note that it will not yet have a value in the [code]_ready()[/code] function. - </description> - </method> - <method name="set_applied_force"> - <return type="void"> - </return> - <argument index="0" name="force" type="Vector2"> - </argument> - <description> - Sets the applied force vector. This is the equivalent of firing a rocket: the force is applied constantly. - </description> - </method> - <method name="set_applied_torque"> - <return type="void"> - </return> - <argument index="0" name="torque" type="float"> - </argument> - <description> - Sets the applied torque. + Returns a list of the bodies colliding with this one. Use [member contacts_reported] to set the maximum number reported. You must also set [member contact_monitor] to [code]true[/code]. Note that the result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead. </description> </method> <method name="set_axis_velocity"> @@ -104,15 +65,6 @@ Sets the body's velocity on the given axis. 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="set_inertia"> - <return type="void"> - </return> - <argument index="0" name="inertia" type="float"> - </argument> - <description> - Set the body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this function allows you to set a custom value. Set 0 (or negative) inertia to return to automatically computing it. - </description> - </method> <method name="test_motion"> <return type="bool"> </return> @@ -134,6 +86,12 @@ <member name="angular_velocity" type="float" setter="set_angular_velocity" getter="get_angular_velocity"> The body's rotational velocity. </member> + <member name="applied_force" type="Vector2" setter="set_applied_force" getter="get_applied_force"> + The body's total applied force. + </member> + <member name="applied_torque" type="float" setter="set_applied_torque" getter="get_applied_torque"> + The body's total applied torque. + </member> <member name="bounce" type="float" setter="set_bounce" getter="get_bounce"> The body's bounciness. Default value: [code]0[/code]. </member> @@ -159,6 +117,9 @@ <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale"> Multiplies the gravity applied to the body. The body's gravity is calculated from the "Default Gravity" value in "Project > Project Settings > Physics > 2d" and/or any additional gravity vector applied by [Area2D]s. Default value: [code]1[/code]. </member> + <member name="inertia" type="float" setter="set_inertia" getter="get_inertia"> + The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this function allows you to set a custom value. Set 0 (or negative) inertia to return to automatically computing it. + </member> <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp"> Damps the body's [member linear_velocity]. If [code]-1[/code] the body will use the "Default Linear Damp" in "Project > Project Settings > Physics > 2d". Default value: [code]-1[/code]. </member> diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 3a4b843b06..e661bbb299 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -57,18 +57,6 @@ <description> </description> </method> - <method name="get_current_scene" qualifiers="const"> - <return type="Node"> - </return> - <description> - </description> - </method> - <method name="get_edited_scene_root" qualifiers="const"> - <return type="Node"> - </return> - <description> - </description> - </method> <method name="get_frame" qualifiers="const"> <return type="int"> </return> @@ -101,12 +89,6 @@ <description> </description> </method> - <method name="get_root" qualifiers="const"> - <return type="Viewport"> - </return> - <description> - </description> - </method> <method name="get_rpc_sender_id" qualifiers="const"> <return type="int"> </return> @@ -128,18 +110,6 @@ Returns true if there is a [NetworkedMultiplayerPeer] set (with [method SceneTree.set_network_peer]). </description> </method> - <method name="is_debugging_collisions_hint" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="is_debugging_navigation_hint" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="is_input_handled"> <return type="bool"> </return> @@ -153,24 +123,6 @@ Returns true if this SceneTree's [NetworkedMultiplayerPeer] is in server mode (listening for connections). </description> </method> - <method name="is_paused" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="is_refusing_new_network_connections" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="is_using_font_oversampling" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="notify_group"> <return type="void"> </return> @@ -221,38 +173,6 @@ <description> </description> </method> - <method name="set_current_scene"> - <return type="void"> - </return> - <argument index="0" name="child_node" type="Node"> - </argument> - <description> - </description> - </method> - <method name="set_debug_collisions_hint"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_debug_navigation_hint"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_edited_scene_root"> - <return type="void"> - </return> - <argument index="0" name="scene" type="Node"> - </argument> - <description> - </description> - </method> <method name="set_group"> <return type="void"> </return> @@ -285,23 +205,6 @@ <description> </description> </method> - <method name="set_network_peer"> - <return type="void"> - </return> - <argument index="0" name="peer" type="NetworkedMultiplayerPeer"> - </argument> - <description> - Set the peer object to handle the RPC system (effectively enabling networking). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals. - </description> - </method> - <method name="set_pause"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_quit_on_go_back"> <return type="void"> </return> @@ -310,14 +213,6 @@ <description> </description> </method> - <method name="set_refuse_new_network_connections"> - <return type="void"> - </return> - <argument index="0" name="refuse" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_screen_stretch"> <return type="void"> </return> @@ -332,15 +227,28 @@ <description> </description> </method> - <method name="set_use_font_oversampling"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="current_scene" type="Node" setter="set_current_scene" getter="get_current_scene"> + </member> + <member name="debug_collisions_hint" type="bool" setter="set_debug_collisions_hint" getter="is_debugging_collisions_hint"> + </member> + <member name="debug_navigation_hint" type="bool" setter="set_debug_navigation_hint" getter="is_debugging_navigation_hint"> + </member> + <member name="edited_scene_root" type="Node" setter="set_edited_scene_root" getter="get_edited_scene_root"> + </member> + <member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer"> + The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals. + </member> + <member name="paused" type="bool" setter="set_pause" getter="is_paused"> + </member> + <member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections"> + </member> + <member name="root" type="Viewport" setter="" getter="get_root"> + </member> + <member name="use_font_oversampling" type="bool" setter="set_use_font_oversampling" getter="is_using_font_oversampling"> + </member> + </members> <signals> <signal name="connected_to_server"> <description> diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml index 0fdcb26e6e..c05f4d1fd6 100644 --- a/doc/classes/SceneTreeTimer.xml +++ b/doc/classes/SceneTreeTimer.xml @@ -9,21 +9,11 @@ <demos> </demos> <methods> - <method name="get_time_left" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="set_time_left"> - <return type="void"> - </return> - <argument index="0" name="time" type="float"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="time_left" type="float" setter="set_time_left" getter="get_time_left"> + </member> + </members> <signals> <signal name="timeout"> <description> diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml index c7df24879e..4fcd4b20d9 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -31,13 +31,6 @@ <description> </description> </method> - <method name="get_source_code" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the script source code, or an empty string if source code is not available. - </description> - </method> <method name="has_script_signal" qualifiers="const"> <return type="bool"> </return> @@ -79,16 +72,12 @@ Reloads the script's class implementation. Returns an error code. </description> </method> - <method name="set_source_code"> - <return type="void"> - </return> - <argument index="0" name="source" type="String"> - </argument> - <description> - Sets the script source code. Does not reload the class implementation. - </description> - </method> </methods> + <members> + <member name="source_code" type="String" setter="set_source_code" getter="get_source_code"> + The script source code, or an empty string if source code is not available. When set, does not reload the class implementation automatically. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml index 87ad7d57f5..65ea3216f8 100644 --- a/doc/classes/ScrollContainer.xml +++ b/doc/classes/ScrollContainer.xml @@ -11,43 +11,19 @@ <demos> </demos> <methods> - <method name="get_h_scroll" qualifiers="const"> - <return type="int"> - </return> - <description> - Return current horizontal scroll value. - </description> - </method> - <method name="get_v_scroll" qualifiers="const"> - <return type="int"> - </return> - <description> - Return current vertical scroll value. - </description> - </method> - <method name="set_h_scroll"> - <return type="void"> - </return> - <argument index="0" name="val" type="int"> - </argument> - <description> - Set horizontal scroll value. - </description> - </method> - <method name="set_v_scroll"> - <return type="void"> - </return> - <argument index="0" name="val" type="int"> - </argument> - <description> - Set vertical scroll value. - </description> - </method> </methods> <members> - <member name="scroll_horizontal" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled"> + <member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll"> + The current horizontal scroll value. </member> - <member name="scroll_vertical" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled"> + <member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled"> + If [code]true[/code], enables horizontal scrolling. + </member> + <member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll"> + The current horizontal scroll value. + </member> + <member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled"> + If [code]true[/code], enables vertical scrolling. </member> </members> <constants> diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml index 082c48dfce..543164d92e 100644 --- a/doc/classes/Shader.xml +++ b/doc/classes/Shader.xml @@ -11,12 +11,6 @@ <demos> </demos> <methods> - <method name="get_code" qualifiers="const"> - <return type="String"> - </return> - <description> - </description> - </method> <method name="get_default_texture_param" qualifiers="const"> <return type="Texture"> </return> @@ -39,14 +33,6 @@ <description> </description> </method> - <method name="set_code"> - <return type="void"> - </return> - <argument index="0" name="code" type="String"> - </argument> - <description> - </description> - </method> <method name="set_default_texture_param"> <return type="void"> </return> @@ -58,6 +44,10 @@ </description> </method> </methods> + <members> + <member name="code" type="String" setter="set_code" getter="get_code"> + </member> + </members> <constants> <constant name="MODE_SPATIAL" value="0" enum="Mode"> </constant> diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml index 096d6d4332..1c2ff15a63 100644 --- a/doc/classes/ShaderMaterial.xml +++ b/doc/classes/ShaderMaterial.xml @@ -9,12 +9,6 @@ <demos> </demos> <methods> - <method name="get_shader" qualifiers="const"> - <return type="Shader"> - </return> - <description> - </description> - </method> <method name="get_shader_param" qualifiers="const"> <return type="Variant"> </return> @@ -23,14 +17,6 @@ <description> </description> </method> - <method name="set_shader"> - <return type="void"> - </return> - <argument index="0" name="shader" type="Shader"> - </argument> - <description> - </description> - </method> <method name="set_shader_param"> <return type="void"> </return> @@ -42,6 +28,10 @@ </description> </method> </methods> + <members> + <member name="shader" type="Shader" setter="set_shader" getter="get_shader"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index d0addcf9f9..4f23dbf053 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -13,13 +13,6 @@ <demos> </demos> <methods> - <method name="get_gizmo" qualifiers="const"> - <return type="SpatialGizmo"> - </return> - <description> - Returns the SpatialGizmo for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor. - </description> - </method> <method name="get_parent_spatial" qualifiers="const"> <return type="Spatial"> </return> @@ -195,15 +188,6 @@ Makes the node ignore its parents transformations. Node transformations are only in global space. </description> </method> - <method name="set_gizmo"> - <return type="void"> - </return> - <argument index="0" name="gizmo" type="SpatialGizmo"> - </argument> - <description> - Set [SpatialGizmo] for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor. - </description> - </method> <method name="set_identity"> <return type="void"> </return> @@ -289,6 +273,9 @@ </method> </methods> <members> + <member name="gizmo" type="SpatialGizmo" setter="set_gizmo" getter="get_gizmo"> + The SpatialGizmo for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor. + </member> <member name="global_transform" type="Transform" setter="set_global_transform" getter="get_global_transform"> World space (global) [Transform] of this node. </member> diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/SpatialVelocityTracker.xml index a58049a141..deb58c54ee 100644 --- a/doc/classes/SpatialVelocityTracker.xml +++ b/doc/classes/SpatialVelocityTracker.xml @@ -15,12 +15,6 @@ <description> </description> </method> - <method name="is_tracking_physics_step" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="reset"> <return type="void"> </return> @@ -29,14 +23,6 @@ <description> </description> </method> - <method name="set_track_physics_step"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> <method name="update_position"> <return type="void"> </return> @@ -46,6 +32,10 @@ </description> </method> </methods> + <members> + <member name="track_physics_step" type="bool" setter="set_track_physics_step" getter="is_tracking_physics_step"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml index 8ecd9e5816..c4cb816dc8 100644 --- a/doc/classes/StreamPeer.xml +++ b/doc/classes/StreamPeer.xml @@ -131,13 +131,6 @@ Get a Variant from the stream. </description> </method> - <method name="is_big_endian_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - Return whether this [code]StreamPeer[/code] is using big-endian format. - </description> - </method> <method name="put_16"> <return type="void"> </return> @@ -264,16 +257,12 @@ Put a Variant into the stream. </description> </method> - <method name="set_big_endian"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set this [code]StreamPeer[/code] to use big-endian format. Default is false. - </description> - </method> </methods> + <members> + <member name="big_endian" type="bool" setter="set_big_endian" getter="is_big_endian_enabled"> + If [code]true[/code], this [code]StreamPeer[/code] will using big-endian format for encoding and decoding. + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/StreamPeerBuffer.xml b/doc/classes/StreamPeerBuffer.xml index 66696ed416..d2a83f1384 100644 --- a/doc/classes/StreamPeerBuffer.xml +++ b/doc/classes/StreamPeerBuffer.xml @@ -21,12 +21,6 @@ <description> </description> </method> - <method name="get_data_array" qualifiers="const"> - <return type="PoolByteArray"> - </return> - <description> - </description> - </method> <method name="get_position" qualifiers="const"> <return type="int"> </return> @@ -55,15 +49,11 @@ <description> </description> </method> - <method name="set_data_array"> - <return type="void"> - </return> - <argument index="0" name="data" type="PoolByteArray"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="data_array" type="PoolByteArray" setter="set_data_array" getter="get_data_array"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/StyleBoxLine.xml b/doc/classes/StyleBoxLine.xml index e18af2334c..051cc90a7c 100644 --- a/doc/classes/StyleBoxLine.xml +++ b/doc/classes/StyleBoxLine.xml @@ -9,24 +9,12 @@ <demos> </demos> <methods> - <method name="get_grow" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="set_grow"> - <return type="void"> - </return> - <argument index="0" name="grow" type="float"> - </argument> - <description> - </description> - </method> </methods> <members> <member name="color" type="Color" setter="set_color" getter="get_color"> </member> + <member name="grow" type="float" setter="set_grow" getter="get_grow"> + </member> <member name="thickness" type="int" setter="set_thickness" getter="get_thickness"> </member> <member name="vertical" type="bool" setter="set_vertical" getter="is_vertical"> diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml index fbda1aedb4..4bb175701f 100644 --- a/doc/classes/Tabs.xml +++ b/doc/classes/Tabs.xml @@ -35,12 +35,6 @@ <description> </description> </method> - <method name="get_tab_align" qualifiers="const"> - <return type="int" enum="Tabs.TabAlign"> - </return> - <description> - </description> - </method> <method name="get_tab_count" qualifiers="const"> <return type="int"> </return> @@ -105,14 +99,6 @@ <description> </description> </method> - <method name="set_tab_align"> - <return type="void"> - </return> - <argument index="0" name="align" type="int" enum="Tabs.TabAlign"> - </argument> - <description> - </description> - </method> <method name="set_tab_disabled"> <return type="void"> </return> @@ -149,6 +135,8 @@ </member> <member name="scrolling_enabled" type="bool" setter="set_scrolling_enabled" getter="get_scrolling_enabled"> </member> + <member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="Tabs.TabAlign"> + </member> <member name="tab_close_display_policy" type="int" setter="set_tab_close_display_policy" getter="get_tab_close_display_policy" enum="Tabs.CloseButtonDisplayPolicy"> </member> </members> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index f4d80c46b4..c7b3794e29 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -294,24 +294,6 @@ <description> </description> </method> - <method name="set_max_chars"> - <return type="void"> - </return> - <argument index="0" name="amount" type="int"> - </argument> - <description> - Set the maximum amount of characters editable. - </description> - </method> - <method name="set_wrap"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Enable text wrapping when it goes beyond he edge of what is visible. - </description> - </method> <method name="toggle_fold_line"> <return type="void"> </return> @@ -384,6 +366,9 @@ String value of the [TextEdit]. </member> <member name="v_scroll_speed" type="float" setter="set_v_scroll_speed" getter="get_v_scroll_speed"> + If [code]true[/code], enables text wrapping when it goes beyond he edge of what is visible. + </member> + <member name="wrap_lines" type="bool" setter="set_wrap" getter="is_wrapping"> </member> </members> <signals> diff --git a/doc/classes/Texture.xml b/doc/classes/Texture.xml index bf27bc4768..fd1598996a 100644 --- a/doc/classes/Texture.xml +++ b/doc/classes/Texture.xml @@ -71,13 +71,6 @@ <description> </description> </method> - <method name="get_flags" qualifiers="const"> - <return type="int"> - </return> - <description> - Return the current texture flags. - </description> - </method> <method name="get_height" qualifiers="const"> <return type="int"> </return> @@ -105,17 +98,16 @@ <description> </description> </method> - <method name="set_flags"> - <return type="void"> - </return> - <argument index="0" name="flags" type="int"> - </argument> - <description> - Change the texture flags. - </description> - </method> </methods> + <members> + <member name="flags" type="int" setter="set_flags" getter="get_flags"> + The texture's flags. + </member> + </members> <constants> + <constant name="FLAGS_DEFAULT" value="7" enum="Flags"> + Default flags. Generate mipmaps, repeat, and filter are enabled. + </constant> <constant name="FLAG_MIPMAPS" value="1" enum="Flags"> Generate mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio. </constant> @@ -125,9 +117,6 @@ <constant name="FLAG_FILTER" value="4" enum="Flags"> Magnifying filter, to enable smooth zooming in of the texture. </constant> - <constant name="FLAGS_DEFAULT" value="7" enum="Flags"> - Default flags. Generate mipmaps, repeat, and filter are enabled. - </constant> <constant name="FLAG_ANISOTROPIC_FILTER" value="8" enum="Flags"> Anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios. More effective on planes often shown going to the horrizon as those textures (Walls or Ground for example) get squashed in the viewport to different aspect ratios and regular mipmaps keep the aspect ratio so they don't optimize storage that well in those cases. diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml index 09071b2ad1..876eed92ae 100644 --- a/doc/classes/Timer.xml +++ b/doc/classes/Timer.xml @@ -11,20 +11,6 @@ <demos> </demos> <methods> - <method name="get_time_left" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the timer's remaining time in seconds. Returns 0 if the timer is inactive. - </description> - </method> - <method name="is_paused" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the timer is paused. - </description> - </method> <method name="is_stopped" qualifiers="const"> <return type="bool"> </return> @@ -32,15 +18,6 @@ Returns [code]true[/code] if the timer is stopped. </description> </method> - <method name="set_paused"> - <return type="void"> - </return> - <argument index="0" name="paused" type="bool"> - </argument> - <description> - Pauses the timer. If [code]paused[/code] is [code]true[/code], the timer will not process until it is started or unpaused again, even if [method start] is called. - </description> - </method> <method name="start"> <return type="void"> </return> @@ -64,9 +41,15 @@ <member name="one_shot" type="bool" setter="set_one_shot" getter="is_one_shot"> If [code]true[/code], Timer will stop when reaching 0. If [code]false[/code], it will restart. Default value: [code]false[/code]. </member> + <member name="paused" type="bool" setter="set_paused" getter="is_paused"> + If [code]true[/code], the timer is paused and will not process until it is unpaused again, even if [method start] is called. + </member> <member name="process_mode" type="int" setter="set_timer_process_mode" getter="get_timer_process_mode" enum="Timer.TimerProcessMode"> Processing mode. Uses TIMER_PROCESS_* constants as value. </member> + <member name="time_left" type="float" setter="" getter="get_time_left"> + The timer's remaining time in seconds. Returns 0 if the timer is inactive. + </member> <member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time"> Wait time in seconds. </member> diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index e26082c47e..7e11421b74 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -54,20 +54,6 @@ Makes the currently selected item visible. This will scroll the tree to make sure the selected item is visible. </description> </method> - <method name="get_allow_reselect" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if a cell that is currently already selected may be selected again. - </description> - </method> - <method name="get_allow_rmb_select" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if a right click can select items. - </description> - </method> <method name="get_column_at_position" qualifiers="const"> <return type="int"> </return> @@ -95,13 +81,6 @@ Returns the column's width in pixels. </description> </method> - <method name="get_columns" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the amount of columns. - </description> - </method> <method name="get_custom_popup_rect" qualifiers="const"> <return type="Rect2"> </return> @@ -109,13 +88,6 @@ Returns the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode]. </description> </method> - <method name="get_drop_mode_flags" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the current drop mode's flags. - </description> - </method> <method name="get_drop_section_at_position" qualifiers="const"> <return type="int"> </return> @@ -202,31 +174,6 @@ Returns the current selection's column. </description> </method> - <method name="is_folding_hidden" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the folding arrow is hidden. - </description> - </method> - <method name="set_allow_reselect"> - <return type="void"> - </return> - <argument index="0" name="allow" type="bool"> - </argument> - <description> - If [code]true[/code] the currently selected cell may be selected again. - </description> - </method> - <method name="set_allow_rmb_select"> - <return type="void"> - </return> - <argument index="0" name="allow" type="bool"> - </argument> - <description> - If [code]true[/code] a right mouse button click can select items. - </description> - </method> <method name="set_column_expand"> <return type="void"> </return> @@ -269,52 +216,31 @@ If [code]true[/code] column titles are visible. </description> </method> - <method name="set_columns"> - <return type="void"> - </return> - <argument index="0" name="amount" type="int"> - </argument> - <description> - Set the amount of columns. - </description> - </method> - <method name="set_drop_mode_flags"> - <return type="void"> - </return> - <argument index="0" name="flags" type="int"> - </argument> - <description> - Set the drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants. - </description> - </method> - <method name="set_hide_folding"> - <return type="void"> - </return> - <argument index="0" name="hide" type="bool"> - </argument> - <description> - If [code]true[/code] the folding arrow is hidden. - </description> - </method> - <method name="set_hide_root"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] the tree's root is hidden. - </description> - </method> - <method name="set_select_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="Tree.SelectMode"> - </argument> - <description> - Allow single or multiple selection. See the [code]SELECT_*[/code] constants. - </description> - </method> </methods> + <members> + <member name="allow_reselect" type="bool" setter="set_allow_reselect" getter="get_allow_reselect"> + If [code]true[/code] the currently selected cell may be selected again. + </member> + <member name="allow_rmb_select" type="bool" setter="set_allow_rmb_select" getter="get_allow_rmb_select"> + If [code]true[/code] a right mouse button click can select items. + + </member> + <member name="columns" type="int" setter="set_columns" getter="get_columns"> + The amount of columns. + </member> + <member name="drop_mode_flags" type="int" setter="set_drop_mode_flags" getter="get_drop_mode_flags"> + The drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants. + </member> + <member name="hide_folding" type="bool" setter="set_hide_folding" getter="is_folding_hidden"> + If [code]true[/code] the folding arrow is hidden. + </member> + <member name="hide_root" type="bool" setter="set_hide_root" getter="is_root_hidden"> + If [code]true[/code] the tree's root is hidden. + </member> + <member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="Tree.SelectMode"> + Allow single or multiple selection. See the [code]SELECT_*[/code] constants. + </member> + </members> <signals> <signal name="button_pressed"> <argument index="0" name="item" type="Object"> diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index 421185fe51..d5bb5a2726 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -111,13 +111,6 @@ Returns the custom background color of column [code]column[/code]. </description> </method> - <method name="get_custom_minimum_height" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the custom minimum height. - </description> - </method> <method name="get_expand_right" qualifiers="const"> <return type="bool"> </return> @@ -260,13 +253,6 @@ Returns [code]true[/code] if the given column is checked. </description> </method> - <method name="is_collapsed"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if this TreeItem is collapsed. - </description> - </method> <method name="is_custom_set_as_button" qualifiers="const"> <return type="bool"> </return> @@ -284,13 +270,6 @@ Returns [code]true[/code] if column [code]column[/code] is editable. </description> </method> - <method name="is_folding_disabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if folding is disabled for this TreeItem. - </description> - </method> <method name="is_selectable" qualifiers="const"> <return type="bool"> </return> @@ -376,15 +355,6 @@ If [code]true[/code] the column [code]column[/code] is checked. </description> </method> - <method name="set_collapsed"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - If [code]true[/code] the TreeItem is collapsed. - </description> - </method> <method name="set_custom_as_button"> <return type="void"> </return> @@ -432,24 +402,6 @@ Sets the given column's custom draw callback to [code]callback[/code] method on [code]object[/code]. </description> </method> - <method name="set_custom_minimum_height"> - <return type="void"> - </return> - <argument index="0" name="height" type="int"> - </argument> - <description> - Sets the custom minimum height of this TreeItem. - </description> - </method> - <method name="set_disable_folding"> - <return type="void"> - </return> - <argument index="0" name="disable" type="bool"> - </argument> - <description> - If [code]true[/code] folding is disabled for this TreeItem. - </description> - </method> <method name="set_editable"> <return type="void"> </return> @@ -585,6 +537,17 @@ </description> </method> </methods> + <members> + <member name="collapsed" type="bool" setter="set_collapsed" getter="is_collapsed"> + If [code]true[/code] the TreeItem is collapsed. + </member> + <member name="custom_minimum_height" type="int" setter="set_custom_minimum_height" getter="get_custom_minimum_height"> + The custom minimum height. + </member> + <member name="disable_folding" type="bool" setter="set_disable_folding" getter="is_folding_disabled"> + If [code]true[/code] folding is disabled for this TreeItem. + </member> + </members> <constants> <constant name="CELL_MODE_STRING" value="0" enum="TreeCellMode"> Cell contains a string. diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index a11580860a..3d1dd8abf6 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -78,13 +78,6 @@ Returns the time needed for all tweens to end in seconds, measured from the start. Thus, if you have two tweens, one ending 10 seconds after the start and the other - 20 seconds, it would return 20 seconds, as by that time all tweens would have finished. </description> </method> - <method name="get_speed_scale" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the speed that has been set from editor GUI or [method set_repeat]. - </description> - </method> <method name="interpolate_callback"> <return type="bool"> </return> @@ -186,13 +179,6 @@ Returns true if any tweens are currently running, and false otherwise. Note that this method doesn't consider tweens that have ended. </description> </method> - <method name="is_repeat" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns true if repeat has been set from editor GUI or [method set_repeat]. - </description> - </method> <method name="remove"> <return type="bool"> </return> @@ -265,24 +251,6 @@ Activate/deactivate the tween. You can use this for pausing animations, though [method stop_all] and [method resume_all] might be more fit for this. </description> </method> - <method name="set_repeat"> - <return type="void"> - </return> - <argument index="0" name="repeat" type="bool"> - </argument> - <description> - Make the tween repeat after all tweens have finished. - </description> - </method> - <method name="set_speed_scale"> - <return type="void"> - </return> - <argument index="0" name="speed" type="float"> - </argument> - <description> - Set the speed multiplier of the tween. Set it to 1 for normal speed, 2 for two times nromal speed, and 0.5 for half of the normal speed. Setting it to 0 would pause the animation, but you might consider using [method set_active] or [method stop_all] and [method resume_all] for this. - </description> - </method> <method name="start"> <return type="bool"> </return> @@ -371,6 +339,12 @@ <members> <member name="playback_process_mode" type="int" setter="set_tween_process_mode" getter="get_tween_process_mode" enum="Tween.TweenProcessMode"> </member> + <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale"> + The speed multiplier of the tween. Set it to 1 for normal speed, 2 for two times nromal speed, and 0.5 for half of the normal speed. Setting it to 0 would pause the animation, but you might consider using [method set_active] or [method stop_all] and [method resume_all] for this. + </member> + <member name="repeat" type="bool" setter="set_repeat" getter="is_repeat"> + If [code]true[/code], the tween will repeat. + </member> </members> <signals> <signal name="tween_completed"> diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml index f0d69b9b7f..3cd88dafe3 100644 --- a/doc/classes/UndoRedo.xml +++ b/doc/classes/UndoRedo.xml @@ -108,12 +108,6 @@ Get the name of the current action. </description> </method> - <method name="get_max_steps" qualifiers="const"> - <return type="int"> - </return> - <description> - </description> - </method> <method name="get_version" qualifiers="const"> <return type="int"> </return> @@ -128,14 +122,6 @@ <description> </description> </method> - <method name="set_max_steps"> - <return type="void"> - </return> - <argument index="0" name="max_steps" type="int"> - </argument> - <description> - </description> - </method> <method name="undo"> <return type="void"> </return> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 976cdbbd90..5c1281b628 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -92,7 +92,7 @@ <argument index="3" name="t" type="float"> </argument> <description> - Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". + Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is. </description> </method> <method name="distance_squared_to"> @@ -158,7 +158,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Returns the result of the linear interpolation between this vector and "b", by amount "t". + Returns the result of the linear interpolation between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is. </description> </method> <method name="normalized"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index acb41297a7..dff3d04b0c 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -77,7 +77,7 @@ <argument index="3" name="t" type="float"> </argument> <description> - Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t). + Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is. </description> </method> <method name="distance_squared_to"> @@ -150,7 +150,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Linearly interpolates the vector to a given one (b), by the given amount (t). + Linearly interpolates the vector to a given one (b), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is. </description> </method> <method name="max_axis"> diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody.xml index 77916a7e9f..4256ddd674 100644 --- a/doc/classes/VehicleBody.xml +++ b/doc/classes/VehicleBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleBody" inherits="PhysicsBody" category="Core" version="3.0-beta"> +<class name="VehicleBody" inherits="RigidBody" category="Core" version="3.0-beta"> <brief_description> </brief_description> <description> @@ -9,27 +9,12 @@ <demos> </demos> <methods> - <method name="get_linear_velocity" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - Returns the VehicleBody's velocity vector. To get the absolute speed in scalar value, get the length of the return vector in pixels/second. Example: - [codeblock] - # vehicle is an instance of VehicleBody - var speed = vehicle.get_linear_velocity().length() - [/codeblock] - </description> - </method> </methods> <members> <member name="brake" type="float" setter="set_brake" getter="get_brake"> </member> <member name="engine_force" type="float" setter="set_engine_force" getter="get_engine_force"> </member> - <member name="friction" type="float" setter="set_friction" getter="get_friction"> - </member> - <member name="mass" type="float" setter="set_mass" getter="get_mass"> - </member> <member name="steering" type="float" setter="set_steering" getter="get_steering"> </member> </members> diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index 281dc1f071..2ea1a1a841 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -11,13 +11,6 @@ <demos> </demos> <methods> - <method name="get_buffering_msec" qualifiers="const"> - <return type="int"> - </return> - <description> - Get the amount of milliseconds to store in buffer while playing. - </description> - </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> @@ -25,13 +18,6 @@ Get the name of the video stream. </description> </method> - <method name="get_stream_position" qualifiers="const"> - <return type="float"> - </return> - <description> - Get the current position of the stream, in seconds. - </description> - </method> <method name="get_video_texture"> <return type="Texture"> </return> @@ -39,13 +25,6 @@ Get the current frame of the video as a [Texture]. </description> </method> - <method name="get_volume" qualifiers="const"> - <return type="float"> - </return> - <description> - Get the volume of the audio track as a linear value. - </description> - </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> @@ -60,33 +39,6 @@ Start the video playback. </description> </method> - <method name="set_buffering_msec"> - <return type="void"> - </return> - <argument index="0" name="msec" type="int"> - </argument> - <description> - Set the amount of milliseconds to buffer during playback. - </description> - </method> - <method name="set_stream_position"> - <return type="void"> - </return> - <argument index="0" name="position" type="float"> - </argument> - <description> - Set the current position of the stream, in seconds. - </description> - </method> - <method name="set_volume"> - <return type="void"> - </return> - <argument index="0" name="volume" type="float"> - </argument> - <description> - Set the audio volume as a linear value. - </description> - </method> <method name="stop"> <return type="void"> </return> @@ -100,6 +52,9 @@ </member> <member name="autoplay" type="bool" setter="set_autoplay" getter="has_autoplay"> </member> + <member name="buffering_msec" type="int" setter="set_buffering_msec" getter="get_buffering_msec"> + The amount of milliseconds to store in buffer while playing. + </member> <member name="bus" type="String" setter="set_bus" getter="get_bus"> </member> <member name="expand" type="bool" setter="set_expand" getter="has_expand"> @@ -108,6 +63,12 @@ </member> <member name="stream" type="VideoStream" setter="set_stream" getter="get_stream"> </member> + <member name="stream_position" type="float" setter="set_stream_position" getter="get_stream_position"> + The current position of the stream, in seconds. + </member> + <member name="volume" type="float" setter="set_volume" getter="get_volume"> + The volume of the audio track as a linear value. + </member> <member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db"> </member> </members> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index ad3903d549..acef5a6ea1 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -37,13 +37,6 @@ Return the active 3D camera. </description> </method> - <method name="get_canvas_transform" qualifiers="const"> - <return type="Transform2D"> - </return> - <description> - Get the canvas transform of the viewport. - </description> - </method> <method name="get_final_transform" qualifiers="const"> <return type="Transform2D"> </return> @@ -51,13 +44,6 @@ Get the total transform of the viewport. </description> </method> - <method name="get_global_canvas_transform" qualifiers="const"> - <return type="Transform2D"> - </return> - <description> - Get the global canvas transform of the viewport. - </description> - </method> <method name="get_mouse_position" qualifiers="const"> <return type="Vector2"> </return> @@ -101,13 +87,6 @@ Return the final, visible rect in global screen coordinates. </description> </method> - <method name="get_world_2d" qualifiers="const"> - <return type="World2D"> - </return> - <description> - Return the 2D world of the viewport. - </description> - </method> <method name="gui_get_drag_data" qualifiers="const"> <return type="Variant"> </return> @@ -152,24 +131,6 @@ <description> </description> </method> - <method name="set_canvas_transform"> - <return type="void"> - </return> - <argument index="0" name="xform" type="Transform2D"> - </argument> - <description> - Set the canvas transform of the viewport, useful for changing the on-screen positions of all child [CanvasItem]s. This is relative to the global canvas transform of the viewport. - </description> - </method> - <method name="set_global_canvas_transform"> - <return type="void"> - </return> - <argument index="0" name="xform" type="Transform2D"> - </argument> - <description> - Set the global canvas transform of the viewport. The canvas transform is relative to this. - </description> - </method> <method name="set_size_override"> <return type="void"> </return> @@ -192,14 +153,6 @@ Set whether the size override affects stretch as well. </description> </method> - <method name="set_world_2d"> - <return type="void"> - </return> - <argument index="0" name="world_2d" type="World2D"> - </argument> - <description> - </description> - </method> <method name="unhandled_input"> <return type="void"> </return> @@ -232,10 +185,16 @@ </member> <member name="audio_listener_enable_3d" type="bool" setter="set_as_audio_listener" getter="is_audio_listener"> </member> + <member name="canvas_transform" type="Transform2D" setter="set_canvas_transform" getter="get_canvas_transform"> + The canvas transform of the viewport, useful for changing the on-screen positions of all child [CanvasItem]s. This is relative to the global canvas transform of the viewport. + </member> <member name="debug_draw" type="int" setter="set_debug_draw" getter="get_debug_draw" enum="Viewport.DebugDraw"> </member> <member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled"> </member> + <member name="global_canvas_transform" type="Transform2D" setter="set_global_canvas_transform" getter="get_global_canvas_transform"> + The global canvas transform of the viewport. The canvas transform is relative to this. + </member> <member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled"> </member> <member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled"> @@ -272,6 +231,8 @@ </member> <member name="world" type="World" setter="set_world" getter="get_world"> </member> + <member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d"> + </member> </members> <signals> <signal name="size_changed"> diff --git a/doc/classes/World.xml b/doc/classes/World.xml index 9011d39669..d5bbef268a 100644 --- a/doc/classes/World.xml +++ b/doc/classes/World.xml @@ -11,35 +11,24 @@ <demos> </demos> <methods> - <method name="get_direct_space_state"> - <return type="PhysicsDirectSpaceState"> - </return> - <description> - Returns the World's physics space. - </description> - </method> - <method name="get_scenario" qualifiers="const"> - <return type="RID"> - </return> - <description> - Returns the World's visual scenario. - </description> - </method> - <method name="get_space" qualifiers="const"> - <return type="RID"> - </return> - <description> - Returns the World's sound space. - </description> - </method> </methods> <members> + <member name="direct_space_state" type="PhysicsDirectSpaceState" setter="" getter="get_direct_space_state"> + The World's physics direct space state, used for making various queries. Might be used only during [code]_physics_process[/code]. + </member> <member name="environment" type="Environment" setter="set_environment" getter="get_environment"> The World's [Environment]. </member> <member name="fallback_environment" type="Environment" setter="set_fallback_environment" getter="get_fallback_environment"> The World's fallback_environment will be used if the World's [Environment] fails or is missing. </member> + <member name="scenario" type="RID" setter="" getter="get_scenario"> + The World's visual scenario. + + </member> + <member name="space" type="RID" setter="" getter="get_space"> + The World's physics space. + </member> </members> <constants> </constants> diff --git a/doc/classes/World2D.xml b/doc/classes/World2D.xml index 93c88968ac..c9524c85a1 100644 --- a/doc/classes/World2D.xml +++ b/doc/classes/World2D.xml @@ -11,28 +11,18 @@ <demos> </demos> <methods> - <method name="get_canvas"> - <return type="RID"> - </return> - <description> - Retrieve the [RID] of this world's canvas resource. Used by the [VisualServer] for 2D drawing. - </description> - </method> - <method name="get_direct_space_state"> - <return type="Physics2DDirectSpaceState"> - </return> - <description> - Retrieve the state of this world's physics space. This allows arbitrary querying for collision. - </description> - </method> - <method name="get_space"> - <return type="RID"> - </return> - <description> - Retrieve the [RID] of this world's physics space resource. Used by the [Physics2DServer] for 2D physics, treating it as both a space and an area. - </description> - </method> </methods> + <members> + <member name="canvas" type="RID" setter="" getter="get_canvas"> + The [RID] of this world's canvas resource. Used by the [VisualServer] for 2D drawing. + </member> + <member name="direct_space_state" type="Physics2DDirectSpaceState" setter="" getter="get_direct_space_state"> + The state of this world's physics space. This allows arbitrary querying for collision. + </member> + <member name="space" type="RID" setter="" getter="get_space"> + The [RID] of this world's physics space resource. Used by the [Physics2DServer] for 2D physics, treating it as both a space and an area. + </member> + </members> <constants> </constants> </class> diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 4dcbdf4190..37a2450377 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1175,28 +1175,46 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE); } } break; case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_ADD: { glBlendEquation(GL_FUNC_ADD); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_SRC_ALPHA, GL_ONE); + } else { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); + } } break; case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_SUB: { glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_SRC_ALPHA, GL_ONE); + } else { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); + } } break; case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MUL: { glBlendEquation(GL_FUNC_ADD); - glBlendFunc(GL_DST_COLOR, GL_ZERO); + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_DST_ALPHA, GL_ZERO); + } else { + glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ZERO, GL_ONE); + } + } break; case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_PMALPHA: { glBlendEquation(GL_FUNC_ADD); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE); + } + } break; } diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 99ba0860bd..b43deab58f 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -345,7 +345,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re glBindFramebuffer(GL_READ_FRAMEBUFFER, rt->fbo); glReadBuffer(GL_COLOR_ATTACHMENT0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo); - glBlitFramebuffer(0, 0, rt->width, rt->height, p_screen_rect.position.x, win_size.height - p_screen_rect.position.y - p_screen_rect.size.height, p_screen_rect.position.x + p_screen_rect.size.width, win_size.height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + glBlitFramebuffer(0, 0, rt->width, rt->height, p_screen_rect.position.x, win_size.height - p_screen_rect.position.y - p_screen_rect.size.height, p_screen_rect.position.x + p_screen_rect.size.width, win_size.height - p_screen_rect.position.y, GL_COLOR_BUFFER_BIT, GL_NEAREST); #else canvas->canvas_begin(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b63ebcba54..7dc4f71b8e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2184,10 +2184,15 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy Transform2D v = value; GLfloat *gui = (GLfloat *)data; + //in std140 members of mat2 are treated as vec4s gui[0] = v.elements[0][0]; gui[1] = v.elements[0][1]; - gui[2] = v.elements[1][0]; - gui[3] = v.elements[1][1]; + gui[2] = 0; + gui[3] = 0; + gui[4] = v.elements[1][0]; + gui[5] = v.elements[1][1]; + gui[6] = 0; + gui[7] = 0; } break; case ShaderLanguage::TYPE_MAT3: { @@ -2362,9 +2367,15 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type, case ShaderLanguage::TYPE_MAT2: { GLfloat *gui = (GLfloat *)data; - for (int i = 0; i < 2; i++) { - gui[i] = value[i].real; - } + //in std140 members of mat2 are treated as vec4s + gui[0] = value[0].real; + gui[1] = value[1].real; + gui[2] = 0; + gui[3] = 0; + gui[4] = value[2].real; + gui[5] = value[3].real; + gui[6] = 0; + gui[7] = 0; } break; case ShaderLanguage::TYPE_MAT3: { @@ -2418,11 +2429,14 @@ _FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type, case ShaderLanguage::TYPE_BVEC4: case ShaderLanguage::TYPE_IVEC4: case ShaderLanguage::TYPE_UVEC4: - case ShaderLanguage::TYPE_VEC4: - case ShaderLanguage::TYPE_MAT2: { + case ShaderLanguage::TYPE_VEC4: { zeromem(data, 16); } break; + case ShaderLanguage::TYPE_MAT2: { + + zeromem(data, 32); + } break; case ShaderLanguage::TYPE_MAT3: { zeromem(data, 48); @@ -6950,6 +6964,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) { memdelete(cls); } else if (particles_owner.owns(p_rid)) { Particles *particles = particles_owner.get(p_rid); + particles->instance_remove_deps(); particles_owner.free(p_rid); memdelete(particles); } else { @@ -7251,8 +7266,6 @@ void RasterizerStorageGLES3::initialize() { config.force_vertex_shading = GLOBAL_GET("rendering/quality/shading/force_vertex_shading"); - GLOBAL_DEF("rendering/quality/depth_prepass/disable", false); - String renderer = (const char *)glGetString(GL_RENDERER); config.no_depth_prepass = !bool(GLOBAL_GET("rendering/quality/depth_prepass/enable")); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 875946f089..f1d7085d54 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -56,6 +56,41 @@ static int _get_datatype_size(SL::DataType p_type) { case SL::TYPE_VOID: return 0; case SL::TYPE_BOOL: return 4; case SL::TYPE_BVEC2: return 8; + case SL::TYPE_BVEC3: return 12; + case SL::TYPE_BVEC4: return 16; + case SL::TYPE_INT: return 4; + case SL::TYPE_IVEC2: return 8; + case SL::TYPE_IVEC3: return 12; + case SL::TYPE_IVEC4: return 16; + case SL::TYPE_UINT: return 4; + case SL::TYPE_UVEC2: return 8; + case SL::TYPE_UVEC3: return 12; + case SL::TYPE_UVEC4: return 16; + case SL::TYPE_FLOAT: return 4; + case SL::TYPE_VEC2: return 8; + case SL::TYPE_VEC3: return 12; + case SL::TYPE_VEC4: return 16; + case SL::TYPE_MAT2: + return 32; //4 * 4 + 4 * 4 + case SL::TYPE_MAT3: + return 48; // 4 * 4 + 4 * 4 + 4 * 4 + case SL::TYPE_MAT4: return 64; + case SL::TYPE_SAMPLER2D: return 16; + case SL::TYPE_ISAMPLER2D: return 16; + case SL::TYPE_USAMPLER2D: return 16; + case SL::TYPE_SAMPLERCUBE: return 16; + } + + ERR_FAIL_V(0); +} + +static int _get_datatype_alignment(SL::DataType p_type) { + + switch (p_type) { + + case SL::TYPE_VOID: return 0; + case SL::TYPE_BOOL: return 4; + case SL::TYPE_BVEC2: return 8; case SL::TYPE_BVEC3: return 16; case SL::TYPE_BVEC4: return 16; case SL::TYPE_INT: return 4; @@ -71,8 +106,8 @@ static int _get_datatype_size(SL::DataType p_type) { case SL::TYPE_VEC3: return 16; case SL::TYPE_VEC4: return 16; case SL::TYPE_MAT2: return 16; - case SL::TYPE_MAT3: return 48; - case SL::TYPE_MAT4: return 64; + case SL::TYPE_MAT3: return 16; + case SL::TYPE_MAT4: return 16; case SL::TYPE_SAMPLER2D: return 16; case SL::TYPE_ISAMPLER2D: return 16; case SL::TYPE_USAMPLER2D: return 16; @@ -81,7 +116,6 @@ static int _get_datatype_size(SL::DataType p_type) { ERR_FAIL_V(0); } - static String _interpstr(SL::DataInterpolation p_interp) { switch (p_interp) { @@ -341,7 +375,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener } uniform_defines[E->get().order] = ucode; uniform_sizes[E->get().order] = _get_datatype_size(E->get().type); - uniform_alignments[E->get().order] = MIN(16, _get_datatype_size(E->get().type)); + uniform_alignments[E->get().order] = _get_datatype_alignment(E->get().type); } p_actions.uniforms->insert(E->key(), E->get()); @@ -350,6 +384,27 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener for (int i = 0; i < max_uniforms; i++) { r_gen_code.uniforms += uniform_defines[i]; } +#if 1 + // add up + int offset = 0; + for (int i = 0; i < uniform_sizes.size(); i++) { + + int align = offset % uniform_alignments[i]; + + if (align != 0) { + offset += uniform_alignments[i] - align; + } + + r_gen_code.uniform_offsets.push_back(offset); + + offset += uniform_sizes[i]; + } + + r_gen_code.uniform_total_size = offset; + if (r_gen_code.uniform_total_size % 16 != 0) { //UBO sizes must be multiples of 16 + r_gen_code.uniform_total_size += r_gen_code.uniform_total_size % 16; + } +#else // add up for (int i = 0; i < uniform_sizes.size(); i++) { @@ -389,6 +444,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener } else { r_gen_code.uniform_total_size = 0; } +#endif for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) { @@ -715,7 +771,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix"; - actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] == "extra_matrix"; + actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time"; actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass"; actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom"; diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index b5f98a1244..c8567b4d53 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -214,7 +214,7 @@ void main() { vec4 color_accum = vec4(0.0); - float max_accum=0; + float max_accum=0.0; for(int i=0;i<dof_kernel_size;i++) { diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 1aa28d0fd5..d3644bffdd 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -904,7 +904,7 @@ float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, fl float sin2 = (1.0-cos2); float s_x = alpha_x * cos_phi; float s_y = alpha_y * sin_phi; - return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 )); + return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ), 0.001); } float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { @@ -913,7 +913,7 @@ float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float c float r_x = cos_phi/alpha_x; float r_y = sin_phi/alpha_y; float d = cos2 + sin2*(r_x * r_x + r_y * r_y); - return 1.0 / (M_PI * alpha_x * alpha_y * d * d ); + return 1.0 / max(M_PI * alpha_x * alpha_y * d * d, 0.001); } @@ -1307,7 +1307,7 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta //make blend more rounded blend=mix(length(inner_pos),blend,blend); blend*=blend; - blend=1.001-blend; + blend=max(0.0, 1.0-blend); if (reflections[idx].params.x>0.0){// compute reflection @@ -1476,7 +1476,7 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec } vec3 blendv = abs(probe_pos/bounds * 2.0 - 1.0); - float blend = 1.001-max(blendv.x,max(blendv.y,blendv.z)); + float blend = clamp(1.0-max(blendv.x,max(blendv.y,blendv.z)), 0.0, 1.0); //float blend=1.0; float max_distance = length(bounds); diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 0f30e3afdb..5f45f06c79 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -53,6 +53,7 @@ #if defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/param.h> +#include <sys/sysctl.h> #endif #include "project_settings.h" #include <assert.h> @@ -298,17 +299,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo args.push_back((char *)cs[i].get_data()); // shitty C cast args.push_back(0); -#ifdef __FreeBSD__ - if (p_path.find("/") != -1) { - // exec name contains path so use it - execv(p_path.utf8().get_data(), &args[0]); - } else { - // use program name and search through PATH to find it - execvp(getprogname(), &args[0]); - } -#else execvp(p_path.utf8().get_data(), &args[0]); -#endif // still alive? something failed.. fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data()); abort(); @@ -462,12 +453,23 @@ String OS_Unix::get_executable_path() const { return OS::get_executable_path(); } return b; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__OpenBSD__) char resolved_path[MAXPATHLEN]; realpath(OS::get_executable_path().utf8().get_data(), resolved_path); return String(resolved_path); +#elif defined(__FreeBSD__) + int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; + char buf[MAXPATHLEN]; + size_t len = sizeof(buf); + if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) { + WARN_PRINT("Couldn't get executable path from sysctl"); + return OS::get_executable_path(); + } + String b; + b.parse_utf8(buf); + return b; #elif defined(__APPLE__) char temp_path[1]; uint32_t buff_size = 1; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index dbffac8ebd..832d75b17d 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -31,6 +31,7 @@ #ifdef WINDOWS_ENABLED #include "file_access_windows.h" +#include "os/os.h" #include "shlwapi.h" #include <windows.h> @@ -115,25 +116,35 @@ void FileAccessWindows::close() { //_wunlink(save_path.c_str()); //unlink if exists //int rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str()); - bool rename_error; + bool rename_error = true; + int attempts = 4; + while (rename_error && attempts) { + // This workaround of trying multiple times is added to deal with paranoid Windows + // antiviruses that love reading just written files even if they are not executable, thus + // locking the file and preventing renaming from happening. #ifdef UWP_ENABLED - // UWP has no PathFileExists, so we check attributes instead - DWORD fileAttr; + // UWP has no PathFileExists, so we check attributes instead + DWORD fileAttr; - fileAttr = GetFileAttributesW(save_path.c_str()); - if (INVALID_FILE_ATTRIBUTES == fileAttr) { + fileAttr = GetFileAttributesW(save_path.c_str()); + if (INVALID_FILE_ATTRIBUTES == fileAttr) { #else - if (!PathFileExistsW(save_path.c_str())) { + if (!PathFileExistsW(save_path.c_str())) { #endif - //creating new file - rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0; - } else { - //atomic replace for existing file - rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL); - } - if (rename_error && close_fail_notify) { - close_fail_notify(save_path); + //creating new file + rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0; + } else { + //atomic replace for existing file + rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL); + } + if (rename_error && close_fail_notify) { + close_fail_notify(save_path); + } + if (rename_error) { + attempts--; + OS::get_singleton()->delay_usec(1000000); //wait 100msec and try again + } } save_path = ""; diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 7e49d1300c..91aa189c8f 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -3119,12 +3119,12 @@ void AnimationKeyEditor::set_animation(const Ref<Animation> &p_anim) { void AnimationKeyEditor::set_root(Node *p_root) { if (root) - root->disconnect("tree_exited", this, "_root_removed"); + root->disconnect("tree_exiting", this, "_root_removed"); root = p_root; if (root) - root->connect("tree_exited", this, "_root_removed", make_binds(), CONNECT_ONESHOT); + root->connect("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT); } Node *AnimationKeyEditor::get_root() const { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index feb5bf2a8f..3e079cb3ca 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1034,7 +1034,7 @@ void CodeTextEditor::_reset_zoom() { Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default if (font.is_valid()) { - EditorSettings::get_singleton()->set("interface/editor/source_font_size", 14); + EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14); font->set_size(14); } } @@ -1098,7 +1098,7 @@ bool CodeTextEditor::_add_font_size(int p_delta) { if (font.is_valid()) { int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE); if (new_size != font->get_size()) { - EditorSettings::get_singleton()->set("interface/editor/source_font_size", new_size / EDSCALE); + EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE); font->set_size(new_size); } @@ -1140,20 +1140,7 @@ void CodeTextEditor::set_error(const String &p_error) { void CodeTextEditor::_update_font() { - // FONTS - String editor_font = EDITOR_DEF("text_editor/theme/font", ""); - bool font_overridden = false; - if (editor_font != "") { - Ref<Font> fnt = ResourceLoader::load(editor_font); - if (fnt.is_valid()) { - text_editor->add_font_override("font", fnt); - font_overridden = true; - } - } - if (!font_overridden) { - - text_editor->add_font_override("font", get_font("source", "EditorFonts")); - } + text_editor->add_font_override("font", get_font("source", "EditorFonts")); } void CodeTextEditor::_on_settings_change() { diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 9e8521e0fe..95ed40d889 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -38,7 +38,7 @@ #include "project_settings.h" #include "scene/resources/packed_scene.h" -void EditorHistory::_cleanup_history() { +void EditorHistory::cleanup_history() { for (int i = 0; i < history.size(); i++) { @@ -48,8 +48,14 @@ void EditorHistory::_cleanup_history() { if (!history[i].path[j].ref.is_null()) continue; - if (ObjectDB::get_instance(history[i].path[j].object)) - continue; //has isntance, try next + Object *obj = ObjectDB::get_instance(history[i].path[j].object); + if (obj) { + Node *n = Object::cast_to<Node>(obj); + if (n && n->is_inside_tree()) + continue; + if (!n) // Possibly still alive + continue; + } if (j <= history[i].level) { //before or equal level, complete fail @@ -152,7 +158,7 @@ bool EditorHistory::is_at_end() const { bool EditorHistory::next() { - _cleanup_history(); + cleanup_history(); if ((current + 1) < history.size()) current++; @@ -164,7 +170,7 @@ bool EditorHistory::next() { bool EditorHistory::previous() { - _cleanup_history(); + cleanup_history(); if (current > 0) current--; @@ -823,7 +829,7 @@ void EditorSelection::add_node(Node *p_node) { } selection[p_node] = meta; - p_node->connect("tree_exited", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect("tree_exiting", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); //emit_signal("selection_changed"); } @@ -841,7 +847,7 @@ void EditorSelection::remove_node(Node *p_node) { if (meta) memdelete(meta); selection.erase(p_node); - p_node->disconnect("tree_exited", this, "_node_removed"); + p_node->disconnect("tree_exiting", this, "_node_removed"); //emit_signal("selection_changed"); } bool EditorSelection::is_selected(Node *p_node) const { diff --git a/editor/editor_data.h b/editor/editor_data.h index eacde04134..844145853d 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -70,11 +70,11 @@ class EditorHistory { Variant value; }; - void _cleanup_history(); - void _add_object(ObjectID p_object, const String &p_property, int p_level_change); public: + void cleanup_history(); + bool is_at_beginning() const; bool is_at_end() const; diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index c970ae355b..a58257962a 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -85,10 +85,24 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \ MAKE_FALLBACKS(m_name); +#define MAKE_SOURCE_FONT(m_name, m_size) \ + Ref<DynamicFont> m_name; \ + m_name.instance(); \ + m_name->set_size(m_size); \ + if (CustomFontSource.is_valid()) { \ + m_name->set_font_data(CustomFontSource); \ + m_name->add_fallback(dfmono); \ + } else { \ + m_name->set_font_data(dfmono); \ + } \ + m_name->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); \ + m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \ + MAKE_FALLBACKS(m_name); + void editor_register_fonts(Ref<Theme> p_theme) { /* Custom font */ - String custom_font = EditorSettings::get_singleton()->get("interface/editor/custom_font"); + String custom_font = EditorSettings::get_singleton()->get("interface/editor/main_font"); Ref<DynamicFontData> CustomFont; if (custom_font.length() > 0) { CustomFont.instance(); @@ -96,6 +110,15 @@ void editor_register_fonts(Ref<Theme> p_theme) { CustomFont->set_force_autohinter(true); //just looks better..i think? } + /* Custom source code font */ + + String custom_font_source = EditorSettings::get_singleton()->get("interface/editor/code_font"); + Ref<DynamicFontData> CustomFontSource; + if (custom_font_source.length() > 0) { + CustomFontSource.instance(); + CustomFontSource->set_font_path(custom_font_source); + } + /* Droid Sans */ Ref<DynamicFontData> DefaultFont; @@ -135,7 +158,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size); //dfd->set_force_autohinter(true); //just looks better..i think? - int default_font_size = int(EditorSettings::get_singleton()->get("interface/editor/font_size")) * EDSCALE; + int default_font_size = int(EditorSettings::get_singleton()->get("interface/editor/main_font_size")) * EDSCALE; MAKE_DEFAULT_FONT(df, default_font_size); p_theme->set_default_theme_font(df); @@ -153,41 +176,15 @@ void editor_register_fonts(Ref<Theme> p_theme) { MAKE_DEFAULT_FONT(df_rulers, 8 * EDSCALE); p_theme->set_font("rulers", "EditorFonts", df_rulers); - Ref<DynamicFont> df_code; - df_code.instance(); - df_code->set_size(int(EditorSettings::get_singleton()->get("interface/editor/source_font_size")) * EDSCALE); - df_code->set_font_data(dfmono); - MAKE_FALLBACKS(df_code); - + MAKE_SOURCE_FONT(df_code, int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) * EDSCALE); p_theme->set_font("source", "EditorFonts", df_code); - Ref<DynamicFont> df_doc_code; - df_doc_code.instance(); - df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE); - df_doc_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); - df_doc_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); - df_doc_code->set_font_data(dfmono); - MAKE_FALLBACKS(df_doc_code); - + MAKE_SOURCE_FONT(df_doc_code, int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE); p_theme->set_font("doc_source", "EditorFonts", df_doc_code); - Ref<DynamicFont> df_output_code; - df_output_code.instance(); - df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE); - df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); - df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); - df_output_code->set_font_data(dfmono); - MAKE_FALLBACKS(df_output_code); - + MAKE_SOURCE_FONT(df_output_code, int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE); p_theme->set_font("output_source", "EditorFonts", df_output_code); - Ref<DynamicFont> df_text_editor_status_code; - df_text_editor_status_code.instance(); - df_text_editor_status_code->set_size(14 * EDSCALE); - df_text_editor_status_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); - df_text_editor_status_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); - df_text_editor_status_code->set_font_data(dfmono); - MAKE_FALLBACKS(df_text_editor_status_code); - + MAKE_SOURCE_FONT(df_text_editor_status_code, 14 * EDSCALE); p_theme->set_font("status_source", "EditorFonts", df_text_editor_status_code); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 70047bc60c..621364d901 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -393,42 +393,6 @@ void EditorNode::_fs_changed() { E->get()->invalidate(); } - if (export_defer.preset != "") { - Ref<EditorExportPreset> preset; - for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { - preset = EditorExport::get_singleton()->get_export_preset(i); - if (preset->get_name() == export_defer.preset) { - break; - } - preset.unref(); - } - if (preset.is_null()) { - String err = "Unknown export preset: " + export_defer.preset; - ERR_PRINT(err.utf8().get_data()); - } else { - Ref<EditorExportPlatform> platform = preset->get_platform(); - if (platform.is_null()) { - String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; - ERR_PRINT(err.utf8().get_data()); - } else { - // ensures export_project does not loop infinitely, because notifications may - // come during the export - export_defer.preset = ""; - if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { - if (export_defer.path.ends_with(".zip")) { - platform->save_zip(preset, export_defer.path); - } else if (export_defer.path.ends_with(".pck")) { - platform->save_pack(preset, export_defer.path); - } - } else { - platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); - } - } - } - - get_tree()->quit(); - } - { //reload changed resources List<Ref<Resource> > changed; @@ -465,6 +429,42 @@ void EditorNode::_fs_changed() { } _mark_unsaved_scenes(); + + if (export_defer.preset != "" && !EditorFileSystem::get_singleton()->is_scanning()) { + Ref<EditorExportPreset> preset; + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { + preset = EditorExport::get_singleton()->get_export_preset(i); + if (preset->get_name() == export_defer.preset) { + break; + } + preset.unref(); + } + if (preset.is_null()) { + String err = "Unknown export preset: " + export_defer.preset; + ERR_PRINT(err.utf8().get_data()); + } else { + Ref<EditorExportPlatform> platform = preset->get_platform(); + if (platform.is_null()) { + String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; + ERR_PRINT(err.utf8().get_data()); + } else { + // ensures export_project does not loop infinitely, because notifications may + // come during the export + export_defer.preset = ""; + if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { + if (export_defer.path.ends_with(".zip")) { + platform->save_zip(preset, export_defer.path); + } else if (export_defer.path.ends_with(".pck")) { + platform->save_pack(preset, export_defer.path); + } + } else { + platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + } + } + } + + get_tree()->quit(); + } } void EditorNode::_resources_reimported(const Vector<String> &p_resources) { @@ -1398,7 +1398,7 @@ void EditorNode::_property_editor_forward() { } void EditorNode::_property_editor_back() { - if (editor_history.previous()) + if (editor_history.previous() || editor_history.get_path_size() == 1) _edit_current(); } @@ -4749,13 +4749,13 @@ EditorNode::EditorNode() { scene_distraction = false; script_distraction = false; - FileAccess::set_backup_save(true); - TranslationServer::get_singleton()->set_enabled(false); // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); + FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename")); + { int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode"); if (dpi_mode == 0) { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index be03e24eee..122034eaa3 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -54,7 +54,18 @@ Ref<EditorSettings> EditorSettings::singleton = NULL; // Properties -bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool p_emit_signal) { +bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) { + + _THREAD_SAFE_METHOD_ + + bool changed = _set_only(p_name, p_value); + if (changed) { + emit_signal("settings_changed"); + } + return true; +} + +bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value) { _THREAD_SAFE_METHOD_ @@ -73,7 +84,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool add_shortcut(name, sc); } - return true; + return false; } bool changed = false; @@ -102,10 +113,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool } } - if (changed && p_emit_signal) { - emit_signal("settings_changed"); - } - return true; + return changed; } bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const { @@ -205,7 +213,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(pi); } - p_list->push_back(PropertyInfo(Variant::ARRAY, "shortcuts", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); //do not edit + p_list->push_back(PropertyInfo(Variant::ARRAY, "shortcuts", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); //do not edit } void EditorSettings::_add_property_info_bind(const Dictionary &p_info) { @@ -273,12 +281,14 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("interface/editor/hidpi_mode", 0); hints["interface/editor/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/editor/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/scene_tabs/show_script_button", false); - _initial_set("interface/editor/font_size", 14); - hints["interface/editor/font_size"] = PropertyInfo(Variant::INT, "interface/editor/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/editor/source_font_size", 14); - hints["interface/editor/source_font_size"] = PropertyInfo(Variant::INT, "interface/editor/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/editor/custom_font", ""); - hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/main_font_size", 14); + hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/code_font_size", 14); + hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/main_font", ""); + hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/code_font", ""); + hints["interface/editor/code_font"] = PropertyInfo(Variant::STRING, "interface/editor/code_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/dim_editor_on_dialog_popup", true); _initial_set("interface/editor/dim_amount", 0.6f); hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); @@ -367,9 +377,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.1"); _initial_set("text_editor/cursor/right_click_moves_caret", true); - _initial_set("text_editor/theme/font", ""); - hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res"); _initial_set("text_editor/completion/auto_brace_complete", false); + _initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true); + _initial_set("text_editor/completion/callhint_tooltip_offset", Vector2()); _initial_set("text_editor/files/restore_scripts_on_load", true); _initial_set("text_editor/completion/complete_file_paths", true); _initial_set("text_editor/files/maximum_recent_files", 20); @@ -503,6 +513,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("filesystem/resources/auto_reload_modified_images", true); _initial_set("filesystem/import/automatic_reimport_on_sources_changed", true); + _initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true); if (p_extra_config.is_valid()) { @@ -982,7 +993,7 @@ void EditorSettings::raise_order(const String &p_setting) { props[p_setting].order = ++last_order; } -void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value) { +void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value, bool p_update_current) { _THREAD_SAFE_METHOD_ @@ -990,6 +1001,9 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian return; props[p_setting].initial = p_value; props[p_setting].has_default_value = true; + if (p_update_current) { + set(p_setting, p_value); + } } Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) { @@ -1174,8 +1188,10 @@ void EditorSettings::list_text_editor_themes() { void EditorSettings::load_text_editor_theme() { if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive" || get("text_editor/theme/color_theme") == "Custom") { - _load_default_text_editor_theme(); // sorry for "Settings changed" console spam - return; + if (get("text_editor/theme/color_theme") == "Default") { + _load_default_text_editor_theme(); + } + return; // sorry for "Settings changed" console spam } String theme_path = get_text_editor_themes_dir().plus_file((String)get("text_editor/theme/color_theme") + ".tet"); @@ -1421,7 +1437,7 @@ void EditorSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &EditorSettings::set_setting); ClassDB::bind_method(D_METHOD("get_setting", "name"), &EditorSettings::get_setting); ClassDB::bind_method(D_METHOD("erase", "property"), &EditorSettings::erase); - ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &EditorSettings::set_initial_value); + ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value", "update_current"), &EditorSettings::set_initial_value); ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &EditorSettings::property_can_revert); ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert); ClassDB::bind_method(D_METHOD("add_property_info", "info"), &EditorSettings::_add_property_info_bind); diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 0a20212ccd..914316ee61 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -111,7 +111,8 @@ private: bool save_changed_setting; bool optimize_save; //do not save stuff that came from config but was not set from engine - bool _set(const StringName &p_name, const Variant &p_value, bool p_emit_signal = true); + bool _set(const StringName &p_name, const Variant &p_value); + bool _set_only(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _initial_set(const StringName &p_name, const Variant &p_value); void _get_property_list(List<PropertyInfo> *p_list) const; @@ -144,9 +145,12 @@ public: bool has_setting(const String &p_setting) const; void erase(const String &p_setting); void raise_order(const String &p_setting); - void set_initial_value(const StringName &p_setting, const Variant &p_value); + void set_initial_value(const StringName &p_setting, const Variant &p_value, bool update_current = false); void set_manually(const StringName &p_setting, const Variant &p_value, bool p_emit_signal = false) { - _set(p_setting, p_value, p_emit_signal); + if (p_emit_signal) + _set(p_setting, p_value); + else + _set_only(p_setting, p_value); } bool property_can_revert(const String &p_setting); Variant property_get_revert(const String &p_setting); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ea114472a8..9f031b5a80 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1053,7 +1053,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color word_highlighted_color = alpha1; const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); const Color function_color = main_color; - const Color member_variable_color = mono_color; + const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6); const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3); const Color breakpoint_color = error_color; const Color code_folding_color = alpha4; @@ -1063,67 +1063,67 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { EditorSettings *setting = EditorSettings::get_singleton(); String text_editor_color_theme = setting->get("text_editor/theme/color_theme"); if (text_editor_color_theme == "Adaptive") { - setting->set_manually("text_editor/highlighting/symbol_color", symbol_color); - setting->set_manually("text_editor/highlighting/keyword_color", keyword_color); - setting->set_manually("text_editor/highlighting/base_type_color", basetype_color); - setting->set_manually("text_editor/highlighting/engine_type_color", type_color); - setting->set_manually("text_editor/highlighting/comment_color", comment_color); - setting->set_manually("text_editor/highlighting/string_color", string_color); - setting->set_manually("text_editor/highlighting/background_color", background_color); - setting->set_manually("text_editor/highlighting/completion_background_color", completion_background_color); - setting->set_manually("text_editor/highlighting/completion_selected_color", completion_selected_color); - setting->set_manually("text_editor/highlighting/completion_existing_color", completion_existing_color); - setting->set_manually("text_editor/highlighting/completion_scroll_color", completion_scroll_color); - setting->set_manually("text_editor/highlighting/completion_font_color", completion_font_color); - setting->set_manually("text_editor/highlighting/text_color", text_color); - setting->set_manually("text_editor/highlighting/line_number_color", line_number_color); - setting->set_manually("text_editor/highlighting/caret_color", caret_color); - setting->set_manually("text_editor/highlighting/caret_background_color", caret_background_color); - setting->set_manually("text_editor/highlighting/text_selected_color", text_selected_color); - setting->set_manually("text_editor/highlighting/selection_color", selection_color); - setting->set_manually("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color); - setting->set_manually("text_editor/highlighting/current_line_color", current_line_color); - setting->set_manually("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color); - setting->set_manually("text_editor/highlighting/word_highlighted_color", word_highlighted_color); - setting->set_manually("text_editor/highlighting/number_color", number_color); - setting->set_manually("text_editor/highlighting/function_color", function_color); - setting->set_manually("text_editor/highlighting/member_variable_color", member_variable_color); - setting->set_manually("text_editor/highlighting/mark_color", mark_color); - setting->set_manually("text_editor/highlighting/breakpoint_color", breakpoint_color); - setting->set_manually("text_editor/highlighting/code_folding_color", code_folding_color); - setting->set_manually("text_editor/highlighting/search_result_color", search_result_color); - setting->set_manually("text_editor/highlighting/search_result_border_color", search_result_border_color); + setting->set_initial_value("text_editor/highlighting/symbol_color", symbol_color, true); + setting->set_initial_value("text_editor/highlighting/keyword_color", keyword_color, true); + setting->set_initial_value("text_editor/highlighting/base_type_color", basetype_color, true); + setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color, true); + setting->set_initial_value("text_editor/highlighting/comment_color", comment_color, true); + setting->set_initial_value("text_editor/highlighting/string_color", string_color, true); + setting->set_initial_value("text_editor/highlighting/background_color", background_color, true); + setting->set_initial_value("text_editor/highlighting/completion_background_color", completion_background_color, true); + setting->set_initial_value("text_editor/highlighting/completion_selected_color", completion_selected_color, true); + setting->set_initial_value("text_editor/highlighting/completion_existing_color", completion_existing_color, true); + setting->set_initial_value("text_editor/highlighting/completion_scroll_color", completion_scroll_color, true); + setting->set_initial_value("text_editor/highlighting/completion_font_color", completion_font_color, true); + setting->set_initial_value("text_editor/highlighting/text_color", text_color, true); + setting->set_initial_value("text_editor/highlighting/line_number_color", line_number_color, true); + setting->set_initial_value("text_editor/highlighting/caret_color", caret_color, true); + setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color, true); + setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color, true); + setting->set_initial_value("text_editor/highlighting/selection_color", selection_color, true); + setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color, true); + setting->set_initial_value("text_editor/highlighting/current_line_color", current_line_color, true); + setting->set_initial_value("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color, true); + setting->set_initial_value("text_editor/highlighting/word_highlighted_color", word_highlighted_color, true); + setting->set_initial_value("text_editor/highlighting/number_color", number_color, true); + setting->set_initial_value("text_editor/highlighting/function_color", function_color, true); + setting->set_initial_value("text_editor/highlighting/member_variable_color", member_variable_color, true); + setting->set_initial_value("text_editor/highlighting/mark_color", mark_color, true); + setting->set_initial_value("text_editor/highlighting/breakpoint_color", breakpoint_color, true); + setting->set_initial_value("text_editor/highlighting/code_folding_color", code_folding_color, true); + setting->set_initial_value("text_editor/highlighting/search_result_color", search_result_color, true); + setting->set_initial_value("text_editor/highlighting/search_result_border_color", search_result_border_color, true); } else if (text_editor_color_theme == "Default") { - setting->set_manually("text_editor/highlighting/symbol_color", Color::html("badfff")); - setting->set_manually("text_editor/highlighting/keyword_color", Color::html("ffffb3")); - setting->set_manually("text_editor/highlighting/base_type_color", Color::html("a4ffd4")); - setting->set_manually("text_editor/highlighting/engine_type_color", Color::html("83d3ff")); - setting->set_manually("text_editor/highlighting/comment_color", Color::html("676767")); - setting->set_manually("text_editor/highlighting/string_color", Color::html("ef6ebe")); - setting->set_manually("text_editor/highlighting/background_color", Color::html("3b000000")); - setting->set_manually("text_editor/highlighting/completion_background_color", Color::html("2C2A32")); - setting->set_manually("text_editor/highlighting/completion_selected_color", Color::html("434244")); - setting->set_manually("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); - setting->set_manually("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); - setting->set_manually("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); - setting->set_manually("text_editor/highlighting/text_color", Color::html("aaaaaa")); - setting->set_manually("text_editor/highlighting/line_number_color", Color::html("66aaaaaa")); - setting->set_manually("text_editor/highlighting/caret_color", Color::html("aaaaaa")); - setting->set_manually("text_editor/highlighting/caret_background_color", Color::html("000000")); - setting->set_manually("text_editor/highlighting/text_selected_color", Color::html("000000")); - setting->set_manually("text_editor/highlighting/selection_color", Color::html("6ca9c2")); - setting->set_manually("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); - setting->set_manually("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); - setting->set_manually("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1)); - setting->set_manually("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); - setting->set_manually("text_editor/highlighting/number_color", Color::html("EB9532")); - setting->set_manually("text_editor/highlighting/function_color", Color::html("66a2ce")); - setting->set_manually("text_editor/highlighting/member_variable_color", Color::html("e64e59")); - setting->set_manually("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); - setting->set_manually("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)); - setting->set_manually("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); - setting->set_manually("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); - setting->set_manually("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)); + setting->set_initial_value("text_editor/highlighting/symbol_color", Color::html("badfff"), true); + setting->set_initial_value("text_editor/highlighting/keyword_color", Color::html("ffffb3"), true); + setting->set_initial_value("text_editor/highlighting/base_type_color", Color::html("a4ffd4"), true); + setting->set_initial_value("text_editor/highlighting/engine_type_color", Color::html("83d3ff"), true); + setting->set_initial_value("text_editor/highlighting/comment_color", Color::html("676767"), true); + setting->set_initial_value("text_editor/highlighting/string_color", Color::html("ef6ebe"), true); + setting->set_initial_value("text_editor/highlighting/background_color", Color::html("3b000000"), true); + setting->set_initial_value("text_editor/highlighting/completion_background_color", Color::html("2C2A32"), true); + setting->set_initial_value("text_editor/highlighting/completion_selected_color", Color::html("434244"), true); + setting->set_initial_value("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"), true); + setting->set_initial_value("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"), true); + setting->set_initial_value("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"), true); + setting->set_initial_value("text_editor/highlighting/text_color", Color::html("aaaaaa"), true); + setting->set_initial_value("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"), true); + setting->set_initial_value("text_editor/highlighting/caret_color", Color::html("aaaaaa"), true); + setting->set_initial_value("text_editor/highlighting/caret_background_color", Color::html("000000"), true); + setting->set_initial_value("text_editor/highlighting/text_selected_color", Color::html("000000"), true); + setting->set_initial_value("text_editor/highlighting/selection_color", Color::html("6ca9c2"), true); + setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2), true); + setting->set_initial_value("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15), true); + setting->set_initial_value("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1), true); + setting->set_initial_value("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15), true); + setting->set_initial_value("text_editor/highlighting/number_color", Color::html("EB9532"), true); + setting->set_initial_value("text_editor/highlighting/function_color", Color::html("66a2ce"), true); + setting->set_initial_value("text_editor/highlighting/member_variable_color", Color::html("e64e59"), true); + setting->set_initial_value("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4), true); + setting->set_initial_value("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2), true); + setting->set_initial_value("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8), true); + setting->set_initial_value("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1), true); + setting->set_initial_value("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1), true); } return theme; diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp index 3d2959c598..a5d3959952 100644 --- a/editor/import/resource_importer_bitmask.cpp +++ b/editor/import/resource_importer_bitmask.cpp @@ -77,7 +77,7 @@ Error ResourceImporterBitMap::import(const String &p_source_file, const String & bit = c.a > threshold; } - bitmap->set_bit(Vector2(i, j), bit); + bitmap->set_bit(Vector2(j, i), bit); } } diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 12aa0bb33c..03155b3a48 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -268,9 +268,15 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s for (int i = 0; i < 10; i++) file->get_32(); // i wish to know why should i do this... no doc! - loop = file->get_32() ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD; - loop_begin = file->get_32(); - loop_end = file->get_32(); + // only read 0x00 (loop forward) and 0x01 (loop ping-pong) and skip anything else because + // it's not supported (loop backward), reserved for future uses or sampler specific + // from https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl (loop type values table) + int loop_type = file->get_32(); + if (loop_type == 0x00 || loop_type == 0x01) { + loop = loop_type ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD; + loop_begin = file->get_32(); + loop_end = file->get_32(); + } } file->seek(file_pos + chunksize); } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 86b085b429..3593493d11 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -299,7 +299,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { if (current != "") { - player->set_current_animation(current); + // player->set_current_animation(current, false); Ref<Animation> anim = player->get_animation(current); { @@ -654,7 +654,9 @@ Dictionary AnimationPlayerEditor::get_state() const { d["visible"] = is_visible_in_tree(); if (EditorNode::get_singleton()->get_edited_scene() && is_visible_in_tree() && player) { d["player"] = EditorNode::get_singleton()->get_edited_scene()->get_path_to(player); - d["animation"] = player->get_current_animation(); + } + if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count()) { + d["animation"] = animation->get_item_text(animation->get_selected()); } return d; diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index af175c3493..59b79bd070 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -90,7 +90,7 @@ void BakedLightmapEditorPlugin::bake_func_begin(int p_steps) { bool BakedLightmapEditorPlugin::bake_func_step(int p_step, const String &p_description) { ERR_FAIL_COND_V(tmp_progress == NULL, false); - return tmp_progress->step(p_description, p_step); + return tmp_progress->step(p_description, p_step, false); } void BakedLightmapEditorPlugin::bake_func_end() { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a186782128..bd5e5c7355 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -340,7 +340,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const // Grid Point2 offset = grid_offset; if (snap_relative) { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0])) { offset = Object::cast_to<Node2D>(selection[0])->get_global_position(); } else { @@ -382,7 +382,7 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { drag = DRAG_PIVOT; } else if (set_pivot_shortcut.is_valid() && set_pivot_shortcut->is_shortcut(p_ev) && drag == DRAG_NONE && can_move_pivot) { if (!Input::get_singleton()->is_mouse_button_pressed(0)) { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); Vector2 mouse_pos = viewport->get_local_mouse_position(); if (selection.size() && viewport->get_rect().has_point(mouse_pos)) { //just in case, make it work if over viewport @@ -751,7 +751,7 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE undo_redo->create_action(TTR("Move Action"), UndoRedo::MERGE_ENDS); - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -811,7 +811,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() { Rect2 r2; r2.position = tl; - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -835,7 +835,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() { int CanvasItemEditor::get_item_count() { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); int ic = 0; for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -1002,7 +1002,7 @@ CanvasItemEditor::DragType CanvasItemEditor::_get_anchor_handle_drag_type(const void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -1527,7 +1527,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { bone_ik_list.clear(); } else { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get()); @@ -1608,7 +1608,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { } else { undo_redo->create_action(TTR("Edit CanvasItem")); - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -1905,7 +1905,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { return; } - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get()); @@ -2921,7 +2921,7 @@ void CanvasItemEditor::_draw_viewport() { // hide/show buttons depending on the selection bool all_locked = true; bool all_group = true; - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); if (selection.empty()) { all_locked = false; all_group = false; @@ -2976,7 +2976,7 @@ void CanvasItemEditor::_notification(int p_what) { EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels")); - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); bool all_control = true; bool has_control = false; @@ -3277,7 +3277,7 @@ void CanvasItemEditor::_update_scroll(float) { } void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_preset) { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); undo_redo->create_action(TTR("Change Anchors and Margins")); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3321,7 +3321,7 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p } void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); undo_redo->create_action(TTR("Change Anchors")); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3464,7 +3464,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { case LOCK_SELECTED: { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3482,7 +3482,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } break; case UNLOCK_SELECTED: { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3502,7 +3502,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } break; case GROUP_SELECTED: { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3520,7 +3520,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } break; case UNGROUP_SELECTED: { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -3878,7 +3878,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } break; case SKELETON_SET_IK_CHAIN: { - List<Node *> &selection = editor_selection->get_selected_node_list(); + List<Node *> selection = editor_selection->get_selected_node_list(); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { @@ -4435,6 +4435,7 @@ void CanvasItemEditorViewport::_on_change_type_closed() { void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const { label->set_position(get_global_position() + Point2(14, 14) * EDSCALE); label_desc->set_position(label->get_position() + Point2(0, label->get_size().height)); + bool add_preview = false; for (int i = 0; i < files.size(); i++) { String path = files[i]; RES res = ResourceLoader::load(path); @@ -4456,9 +4457,12 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) cons } } } - editor->get_scene_root()->add_child(preview_node); + add_preview = true; } } + + if (add_preview) + editor->get_scene_root()->add_child(preview_node); } void CanvasItemEditorViewport::_remove_preview() { @@ -4603,6 +4607,14 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons void CanvasItemEditorViewport::_perform_drop_data() { _remove_preview(); + // Without root dropping multiple files is not allowed + if (!target_node && selected_files.size() > 1) { + accept->get_ok()->set_text(TTR("Ok")); + accept->set_text(TTR("Cannot instantiate multiple nodes without root.")); + accept->popup_centered_minsize(); + return; + } + Vector<String> error_files; editor_data->get_undo_redo().create_action(TTR("Create Node")); @@ -4613,30 +4625,40 @@ void CanvasItemEditorViewport::_perform_drop_data() { if (res.is_null()) { continue; } - Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res)); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); - if (texture != NULL) { - Node *child; - if (default_type == "Light2D") - child = memnew(Light2D); - else if (default_type == "Particles2D") - child = memnew(Particles2D); - else if (default_type == "Polygon2D") - child = memnew(Polygon2D); - else if (default_type == "TouchScreenButton") - child = memnew(TouchScreenButton); - else if (default_type == "TextureRect") - child = memnew(TextureRect); - else if (default_type == "NinePatchRect") - child = memnew(NinePatchRect); - else - child = memnew(Sprite); // default - - _create_nodes(target_node, child, path, drop_pos); - } else if (scene != NULL) { - bool success = _create_instance(target_node, path, drop_pos); - if (!success) { - error_files.push_back(path); + if (scene != NULL && scene.is_valid()) { + if (!target_node) { + // Without root node act the same as "Load Inherited Scene" + Error err = EditorNode::get_singleton()->load_scene(path, false, true); + if (err != OK) { + error_files.push_back(path); + } + } else { + bool success = _create_instance(target_node, path, drop_pos); + if (!success) { + error_files.push_back(path); + } + } + } else { + Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res)); + if (texture != NULL && texture.is_valid()) { + Node *child; + if (default_type == "Light2D") + child = memnew(Light2D); + else if (default_type == "Particles2D") + child = memnew(Particles2D); + else if (default_type == "Polygon2D") + child = memnew(Polygon2D); + else if (default_type == "TouchScreenButton") + child = memnew(TouchScreenButton); + else if (default_type == "TextureRect") + child = memnew(TextureRect); + else if (default_type == "NinePatchRect") + child = memnew(NinePatchRect); + else + child = memnew(Sprite); // default + + _create_nodes(target_node, child, path, drop_pos); } } } @@ -4661,14 +4683,14 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian if (String(d["type"]) == "files") { Vector<String> files = d["files"]; bool can_instance = false; - for (int i = 0; i < files.size(); i++) { // check if dragged files contain resource or scene can be created at least one + for (int i = 0; i < files.size(); i++) { // check if dragged files contain resource or scene can be created at least once RES res = ResourceLoader::load(files[i]); if (res.is_null()) { continue; } String type = res->get_class(); if (type == "PackedScene") { - Ref<PackedScene> sdata = ResourceLoader::load(files[i]); + Ref<PackedScene> sdata = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); if (!instanced_scene) { continue; @@ -4682,7 +4704,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian type == "StreamTexture" || type == "AtlasTexture" || type == "LargeTexture") { - Ref<Texture> texture = ResourceLoader::load(files[i]); + Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res)); if (texture.is_valid() == false) { continue; } @@ -4708,6 +4730,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian } void CanvasItemEditorViewport::_show_resource_type_selector() { + _remove_preview(); List<BaseButton *> btn_list; button_group->get_buttons(&btn_list); @@ -4719,6 +4742,17 @@ void CanvasItemEditorViewport::_show_resource_type_selector() { selector->popup_centered_minsize(); } +bool CanvasItemEditorViewport::_only_packed_scenes_selected() const { + + for (int i = 0; i < selected_files.size(); ++i) { + if (ResourceLoader::load(selected_files[i])->get_class() != "PackedScene") { + return false; + } + } + + return true; +} + void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p_data) { bool is_shift = Input::get_singleton()->is_key_pressed(KEY_SHIFT); bool is_alt = Input::get_singleton()->is_key_pressed(KEY_ALT); @@ -4728,6 +4762,8 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p if (d.has("type") && String(d["type"]) == "files") { selected_files = d["files"]; } + if (selected_files.size() == 0) + return; List<Node *> list = editor->get_editor_selection()->get_selected_node_list(); if (list.size() == 0) { @@ -4737,25 +4773,19 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p } else { drop_pos = p_point; target_node = NULL; - _show_resource_type_selector(); - return; } } - if (list.size() != 1) { - accept->get_ok()->set_text(TTR("I see..")); - accept->set_text(TTR("This operation requires a single selected node.")); - accept->popup_centered_minsize(); - _remove_preview(); - return; - } - target_node = list[0]; - if (is_shift && target_node != editor->get_edited_scene()) { - target_node = target_node->get_parent(); + if (list.size() > 0) { + target_node = list[0]; + if (is_shift && target_node != editor->get_edited_scene()) { + target_node = target_node->get_parent(); + } } + drop_pos = p_point; - if (is_alt) { + if (is_alt && !_only_packed_scenes_selected()) { _show_resource_type_selector(); } else { _perform_drop_data(); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 5be71bfc28..ace87f9fe2 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -576,6 +576,7 @@ class CanvasItemEditorViewport : public Control { void _remove_preview(); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); + bool _only_packed_scenes_selected() const; void _create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point); bool _create_instance(Node *parent, String &path, const Point2 &p_point); void _perform_drop_data(); diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 42aad7a8a1..06da64b181 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -73,7 +73,7 @@ void GIProbeEditorPlugin::bake_func_begin(int p_steps) { void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) { ERR_FAIL_COND(tmp_progress == NULL); - tmp_progress->step(p_description, p_step); + tmp_progress->step(p_description, p_step, false); } void GIProbeEditorPlugin::bake_func_end() { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index bc986cee9c..f99768400f 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -313,24 +313,22 @@ void ScriptEditor::_goto_script_line2(int p_line) { void ScriptEditor::_goto_script_line(REF p_script, int p_line) { - editor->push_item(p_script.ptr()); + Ref<Script> script = Object::cast_to<Script>(*p_script); + if (!script.is_null() && script->get_path().is_resource_file()) { + if (edit(p_script, p_line, 0)) { + editor->push_item(p_script.ptr()); - if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { - - Ref<Script> script = Object::cast_to<Script>(*p_script); - if (!script.is_null() && script->get_path().is_resource_file()) - edit(p_script, p_line, 0); - } - - int selected = tab_container->get_current_tab(); - if (selected < 0 || selected >= tab_container->get_child_count()) - return; + int selected = tab_container->get_current_tab(); + if (selected < 0 || selected >= tab_container->get_child_count()) + return; - ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected)); - if (!current) - return; + ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected)); + if (!current) + return; - current->goto_line(p_line, true); + current->goto_line(p_line, true); + } + } } void ScriptEditor::_update_history_arrows() { @@ -514,7 +512,6 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) { if (p_save) { apply_scripts(); } - current->clear_edit_menu(); notify_script_close(current->get_edited_script()); } else { EditorHelp *help = Object::cast_to<EditorHelp>(tab_container->get_child(selected)); @@ -540,6 +537,9 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) { } int idx = tab_container->get_current_tab(); + if (current) { + current->clear_edit_menu(); + } memdelete(tselected); if (idx >= tab_container->get_child_count()) idx = tab_container->get_child_count() - 1; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f1ed984fee..2a6b4ee173 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -63,6 +63,7 @@ void ScriptTextEditor::apply_code() { //print_line("applying code"); script->set_source_code(code_editor->get_text_edit()->get_text()); script->update_exports(); + _update_member_keywords(); } Ref<Script> ScriptTextEditor::get_edited_script() const { @@ -70,6 +71,37 @@ Ref<Script> ScriptTextEditor::get_edited_script() const { return script; } +void ScriptTextEditor::_update_member_keywords() { + member_keywords.clear(); + code_editor->get_text_edit()->clear_member_keywords(); + Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); + + StringName instance_base = script->get_instance_base_type(); + + if (instance_base == StringName()) + return; + List<PropertyInfo> plist; + ClassDB::get_property_list(instance_base, &plist); + + for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { + String name = E->get().name; + if (E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_GROUP) + continue; + if (name.find("/") != -1) + continue; + + code_editor->get_text_edit()->add_member_keyword(name, member_variable_color); + } + + List<String> clist; + ClassDB::get_integer_constant_list(instance_base, &clist); + + for (List<String>::Element *E = clist.front(); E; E = E->next()) { + + code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color); + } +} + void ScriptTextEditor::_load_theme_settings() { TextEdit *text_edit = code_editor->get_text_edit(); @@ -563,6 +595,7 @@ void ScriptTextEditor::_validate_script() { if (!script->is_tool()) { script->set_source_code(text); script->update_exports(); + _update_member_keywords(); //script->reload(); //will update all the variables in property editors } diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index ebbe865cee..22e8fbce25 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -44,6 +44,8 @@ class ScriptTextEditor : public ScriptEditorBase { Vector<String> functions; + Vector<String> member_keywords; + HBoxContainer *edit_hb; MenuButton *edit_menu; @@ -58,6 +60,8 @@ class ScriptTextEditor : public ScriptEditorBase { int color_line; String color_args; + void _update_member_keywords(); + struct ColorsCache { Color symbol_color; Color keyword_color; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 535ce79b30..cef1da1d06 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2689,7 +2689,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { - previewing->disconnect("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect("tree_exiting", this, "_preview_exited_scene"); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) @@ -2700,7 +2700,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { } else { previewing = preview; - previewing->connect("tree_exited", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace view_menu->hide(); surface->update(); @@ -2851,7 +2851,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]); if (Object::cast_to<Camera>(pv)) { previewing = Object::cast_to<Camera>(pv); - previewing->connect("tree_exited", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace view_menu->hide(); surface->update(); @@ -3915,7 +3915,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) { if (d.has("snap_enabled")) { snap_enabled = d["snap_enabled"]; - tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_pressed(d["snap_enabled"]); + tool_option_button[TOOL_OPT_USE_SNAP]->set_pressed(d["snap_enabled"]); } if (d.has("translate_snap")) diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 15e8347bbd..612bdb1d2a 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -583,6 +583,14 @@ void AutotileEditor::_notification(int p_what) { } } +void AutotileEditor::_changed_callback(Object *p_changed, const char *p_prop) { + if (p_prop == StringName("texture") || p_prop == StringName("is_autotile")) { + edit(tile_set.ptr()); + autotile_list->update(); + workspace->update(); + } +} + void AutotileEditor::_on_autotile_selected(int p_index) { if (get_current_tile() >= 0) { @@ -618,8 +626,10 @@ void AutotileEditor::_on_edit_mode_changed(int p_edit_mode) { tool_containers[TOOLBAR_BITMASK]->hide(); tool_containers[TOOLBAR_SHAPE]->show(); tools[TOOL_SELECT]->set_tooltip(TTR("Select current edited sub-tile.")); - current_shape = PoolVector2Array(); spin_priority->hide(); + + current_shape = PoolVector2Array(); + select_coord(edited_shape_coord); } break; default: { tool_containers[TOOLBAR_DUMMY]->show(); @@ -931,50 +941,18 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { edited_shape_coord = coord; edited_occlusion_shape = tile_set->autotile_get_light_occluder(get_current_tile(), edited_shape_coord); edited_navigation_shape = tile_set->autotile_get_navigation_polygon(get_current_tile(), edited_shape_coord); - shape_anchor = edited_shape_coord; - shape_anchor.x *= (size.x + spacing); - shape_anchor.y *= (size.y + spacing); - if (edit_mode == EDITMODE_OCCLUSION) { - current_shape.resize(0); - if (edited_occlusion_shape.is_valid()) { - for (int i = 0; i < edited_occlusion_shape->get_polygon().size(); i++) { - current_shape.push_back(edited_occlusion_shape->get_polygon()[i] + shape_anchor); - } - } - } else if (edit_mode == EDITMODE_NAVIGATION) { - current_shape.resize(0); - if (edited_navigation_shape.is_valid()) { - if (edited_navigation_shape->get_polygon_count() > 0) { - PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); - for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { - current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor); - } - } - } - } - } else { - if (edit_mode == EDITMODE_COLLISION) { - Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile()); - for (int i = 0; i < sd.size(); i++) { - if (sd[i].autotile_coord == coord) { - Ref<ConvexPolygonShape2D> shape = sd[i].shape; - if (shape.is_valid()) { - - Rect2 bounding_rect; - PoolVector2Array polygon; - bounding_rect.position = shape->get_points()[0]; - for (int j = 0; j < shape->get_points().size(); j++) { - polygon.push_back(shape->get_points()[j] + shape_anchor); - bounding_rect.expand_to(shape->get_points()[j] + shape_anchor); - } - if (bounding_rect.has_point(mb->get_position())) { - current_shape = polygon; - edited_collision_shape = shape; - } - } - } + Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile()); + bool found_collision_shape = false; + for (int i = 0; i < sd.size(); i++) { + if (sd[i].autotile_coord == coord) { + edited_collision_shape = sd[i].shape; + found_collision_shape = true; + break; } } + if (!found_collision_shape) + edited_collision_shape = Ref<ConvexPolygonShape2D>(NULL); + select_coord(edited_shape_coord); } workspace->update(); } else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { @@ -1341,7 +1319,7 @@ void AutotileEditor::draw_polygon_shapes() { } Vector<Vector2> polygon; Vector<Color> colors; - if (shape == edited_collision_shape) { + if (shape == edited_collision_shape && current_shape.size() > 2) { for (int j = 0; j < current_shape.size(); j++) { polygon.push_back(current_shape[j]); colors.push_back(c_bg); @@ -1391,7 +1369,7 @@ void AutotileEditor::draw_polygon_shapes() { } Vector<Vector2> polygon; Vector<Color> colors; - if (shape == edited_occlusion_shape) { + if (shape == edited_occlusion_shape && current_shape.size() > 2) { for (int j = 0; j < current_shape.size(); j++) { polygon.push_back(current_shape[j]); colors.push_back(c_bg); @@ -1439,7 +1417,7 @@ void AutotileEditor::draw_polygon_shapes() { } Vector<Vector2> polygon; Vector<Color> colors; - if (shape == edited_navigation_shape) { + if (shape == edited_navigation_shape && current_shape.size() > 2) { for (int j = 0; j < current_shape.size(); j++) { polygon.push_back(current_shape[j]); colors.push_back(c_bg); @@ -1549,6 +1527,39 @@ void AutotileEditor::close_shape(const Vector2 &shape_anchor) { } } +void AutotileEditor::select_coord(const Vector2 &coord) { + int spacing = tile_set->autotile_get_spacing(get_current_tile()); + Vector2 size = tile_set->autotile_get_size(get_current_tile()); + Vector2 shape_anchor = coord; + shape_anchor.x *= (size.x + spacing); + shape_anchor.y *= (size.y + spacing); + if (edit_mode == EDITMODE_COLLISION) { + current_shape.resize(0); + if (edited_collision_shape.is_valid()) { + for (int j = 0; j < edited_collision_shape->get_points().size(); j++) { + current_shape.push_back(edited_collision_shape->get_points()[j] + shape_anchor); + } + } + } else if (edit_mode == EDITMODE_OCCLUSION) { + current_shape.resize(0); + if (edited_occlusion_shape.is_valid()) { + for (int i = 0; i < edited_occlusion_shape->get_polygon().size(); i++) { + current_shape.push_back(edited_occlusion_shape->get_polygon()[i] + shape_anchor); + } + } + } else if (edit_mode == EDITMODE_NAVIGATION) { + current_shape.resize(0); + if (edited_navigation_shape.is_valid()) { + if (edited_navigation_shape->get_polygon_count() > 0) { + PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); + for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { + current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor); + } + } + } + } +} + Vector2 AutotileEditor::snap_point(const Vector2 &point) { Vector2 p = point; Vector2 coord = edited_shape_coord; @@ -1578,6 +1589,7 @@ Vector2 AutotileEditor::snap_point(const Vector2 &point) { void AutotileEditor::edit(Object *p_node) { tile_set = Ref<TileSet>(Object::cast_to<TileSet>(p_node)); + tile_set->add_change_receptor(this); helper->set_tileset(tile_set); autotile_list->clear(); diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index de989a11e8..93d403deea 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -124,6 +124,7 @@ class AutotileEditor : public Control { protected: static void _bind_methods(); void _notification(int p_what); + virtual void _changed_callback(Object *p_changed, const char *p_prop); private: void _on_autotile_selected(int p_index); @@ -144,6 +145,7 @@ private: void draw_grid_snap(); void draw_polygon_shapes(); void close_shape(const Vector2 &shape_anchor); + void select_coord(const Vector2 &coord); Vector2 snap_point(const Vector2 &point); void edit(Object *p_node); diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index 5d79b8f94c..f735ef97db 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -200,7 +200,7 @@ bool ProgressDialog::task_step(const String &p_task, const String &p_state, int if (!p_force_redraw) { uint64_t tus = OS::get_singleton()->get_ticks_usec(); - if (tus - last_progress_tick < 50000) //50ms + if (tus - last_progress_tick < 200000) //200ms return cancelled; } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 1f732992d5..98871d5193 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -237,13 +237,20 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) Node *parent = base->get_parent(); int pos = base->get_index(); - memdelete(base); + parent->remove_child(base); parent->add_child(instanced_scene); parent->move_child(instanced_scene, pos); instanced_scene->set_owner(edited_scene); editor_selection->clear(); editor_selection->add_node(instanced_scene); scene_tree->set_selected(instanced_scene); + + // Delete the node as late as possible because before another one is selected + // an editor plugin could be referencing it to do something with it before + // switching to another (or to none); and since some steps of changing the + // editor state are deferred, the safest thing is to do this is as the last + // step of this function and also by enqueing instead of memdelete()-ing it here + base->queue_delete(); } bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { @@ -343,8 +350,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (existing.is_valid()) { const RefPtr empty; selected->set_script(empty); - button_create_script->show(); - button_clear_script->hide(); + _update_script_button(); } } break; @@ -1204,8 +1210,7 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) { return; selected->set_script(p_script.get_ref_ptr()); editor->push_item(p_script.operator->()); - button_create_script->hide(); - button_clear_script->show(); + _update_script_button(); } void SceneTreeDock::_delete_confirm() { @@ -1285,17 +1290,15 @@ void SceneTreeDock::_delete_confirm() { editor->get_viewport_control()->update(); editor->push_item(NULL); -} -void SceneTreeDock::_selection_changed() { - - int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size(); - if (selection_size > 1) { - //automatically turn on multi-edit - _tool_selected(TOOL_MULTI_EDIT); - } + // Fixes the EditorHistory from still offering deleted notes + EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history(); + editor_history->cleanup_history(); + EditorNode::get_singleton()->call("_prepare_history"); +} - if (selection_size == 1) { +void SceneTreeDock::_update_script_button() { + if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) { if (EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) { button_create_script->show(); button_clear_script->hide(); @@ -1309,6 +1312,16 @@ void SceneTreeDock::_selection_changed() { } } +void SceneTreeDock::_selection_changed() { + + int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size(); + if (selection_size > 1) { + //automatically turn on multi-edit + _tool_selected(TOOL_MULTI_EDIT); + } + _update_script_button(); +} + void SceneTreeDock::_create() { if (current_option == TOOL_NEW) { @@ -1643,6 +1656,7 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) { Node *n = get_node(p_to); if (n) { n->set_script(scr.get_ref_ptr()); + _update_script_button(); } } diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index f5234fc547..0a68aa7dc2 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -160,6 +160,7 @@ class SceneTreeDock : public VBoxContainer { bool _validate_no_foreign(); void _selection_changed(); + void _update_script_button(); void _fill_path_renames(Vector<StringName> base_path, Vector<StringName> new_base_path, Node *p_node, List<Pair<NodePath, NodePath> > *p_renames); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index fa0deb7606..629b5b63fb 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1053,6 +1053,8 @@ void ScriptEditorDebugger::_notification(int p_what) { break; }; + const uint64_t until = OS::get_singleton()->get_ticks_msec() + 20; + while (ppeer->get_available_packet_count() > 0) { if (pending_in_queue) { @@ -1117,6 +1119,9 @@ void ScriptEditorDebugger::_notification(int p_what) { break; } } + + if (OS::get_singleton()->get_ticks_msec() > until) + break; } } break; @@ -1166,6 +1171,7 @@ void ScriptEditorDebugger::start() { } set_process(true); + breaked = false; } void ScriptEditorDebugger::pause() { @@ -1177,6 +1183,7 @@ void ScriptEditorDebugger::unpause() { void ScriptEditorDebugger::stop() { set_process(false); + breaked = false; server->stop(); @@ -1609,30 +1616,33 @@ void ScriptEditorDebugger::_error_selected(int p_idx) { error_stack->clear(); Array st = error_list->get_item_metadata(p_idx); - for (int i = 0; i < st.size(); i += 2) { + for (int i = 0; i < st.size(); i += 3) { String script = st[i]; - int line = st[i + 1]; + String func = st[i + 1]; + int line = st[i + 2]; Array md; md.push_back(st[i]); md.push_back(st[i + 1]); + md.push_back(st[i + 2]); - String str = script.get_file() + ":" + itos(line); + String str = func + " in " + script.get_file() + ":line " + itos(line); error_stack->add_item(str); error_stack->set_item_metadata(error_stack->get_item_count() - 1, md); - error_stack->set_item_tooltip(error_stack->get_item_count() - 1, TTR("File:") + " " + String(st[i]) + "\n" + TTR("Line:") + " " + itos(line)); + error_stack->set_item_tooltip(error_stack->get_item_count() - 1, + TTR("File:") + " " + script + "\n" + TTR("Function:") + " " + func + "\n" + TTR("Line:") + " " + itos(line)); } } void ScriptEditorDebugger::_error_stack_selected(int p_idx) { Array arr = error_stack->get_item_metadata(p_idx); - if (arr.size() != 2) + if (arr.size() != 3) return; Ref<Script> s = ResourceLoader::load(arr[0]); - emit_signal("goto_script_line", s, int(arr[1]) - 1); + emit_signal("goto_script_line", s, int(arr[2]) - 1); } void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) { diff --git a/main/main.cpp b/main/main.cpp index b51ea3211c..0b231b9d30 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -665,6 +665,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048); + GLOBAL_DEF("network/limits/debugger_stdout/max_messages_per_frame", 10); + GLOBAL_DEF("network/limits/debugger_stdout/max_errors_per_frame", 10); if (debug_mode == "remote") { @@ -1843,11 +1845,6 @@ void Main::cleanup() { EditorNode::unregister_editor_types(); #endif - if (audio_server) { - audio_server->finish(); - memdelete(audio_server); - } - if (arvr_server) { // cleanup now before we pull the rug from underneath... memdelete(arvr_server); @@ -1859,6 +1856,11 @@ void Main::cleanup() { unregister_scene_types(); unregister_server_types(); + if (audio_server) { + audio_server->finish(); + memdelete(audio_server); + } + OS::get_singleton()->finalize(); finalize_physics(); diff --git a/methods.py b/methods.py index f9da6c8dd5..fbdac8a966 100644 --- a/methods.py +++ b/methods.py @@ -1274,6 +1274,8 @@ def detect_modules(): for x in files: if (not os.path.isdir(x)): continue + if (not os.path.exists(x + "/config.py")): + continue x = x.replace("modules/", "") # rest of world x = x.replace("modules\\", "") # win32 module_list.append(x) diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index b3dfc2eecf..873c9c31b7 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -49,7 +49,9 @@ CollisionObjectBullet::ShapeWrapper::~ShapeWrapper() {} void CollisionObjectBullet::ShapeWrapper::set_transform(const Transform &p_transform) { + G_TO_B(p_transform.get_basis().get_scale(), scale); G_TO_B(p_transform, transform); + UNSCALE_BT_BASIS(transform); } void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_transform) { transform = p_transform; @@ -235,7 +237,7 @@ void RigidCollisionObjectBullet::set_shape_transform(int p_index, const Transfor ERR_FAIL_INDEX(p_index, get_shape_count()); shapes[p_index].set_transform(p_transform); - on_shapes_changed(); + on_shape_changed(shapes[p_index].shape); } void RigidCollisionObjectBullet::remove_shape(ShapeBullet *p_shape) { @@ -320,7 +322,7 @@ void RigidCollisionObjectBullet::on_shapes_changed() { shpWrapper = &shapes[i]; if (shpWrapper->active) { if (!shpWrapper->bt_shape) { - shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape(); + shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape(shpWrapper->scale); } compoundShape->addChildShape(shpWrapper->transform, shpWrapper->bt_shape); } else { diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index a9b8aee019..506976eabf 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -72,6 +72,7 @@ public: ShapeBullet *shape; btCollisionShape *bt_shape; btTransform transform; + btVector3 scale; bool active; ShapeWrapper() : @@ -102,6 +103,7 @@ public: shape = otherShape.shape; bt_shape = otherShape.bt_shape; transform = otherShape.transform; + scale = otherShape.scale; active = otherShape.active; } diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 0e293a38a6..f2115a5d50 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -204,7 +204,7 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() { const CollisionObjectBullet::ShapeWrapper *shape_wrapper; - btVector3 owner_body_scale(owner->get_bt_body_scale()); + btVector3 owner_scale(owner->get_bt_body_scale()); for (int i = shapes_count - 1; 0 <= i; --i) { shape_wrapper = &shapes_wrappers[i]; @@ -213,14 +213,14 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() { } shapes[i].transform = shape_wrapper->transform; - shapes[i].transform.getOrigin() *= owner_body_scale; + shapes[i].transform.getOrigin() *= owner_scale; switch (shape_wrapper->shape->get_type()) { case PhysicsServer::SHAPE_SPHERE: case PhysicsServer::SHAPE_BOX: case PhysicsServer::SHAPE_CAPSULE: case PhysicsServer::SHAPE_CONVEX_POLYGON: case PhysicsServer::SHAPE_RAY: { - shapes[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_body_scale, safe_margin)); + shapes[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_scale * shape_wrapper->scale, safe_margin)); } break; default: WARN_PRINT("This shape is not supported to be kinematic!"); diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index ee1cc418bc..27eac4e6ee 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -48,11 +48,6 @@ ShapeBullet::ShapeBullet() {} ShapeBullet::~ShapeBullet() {} -btCollisionShape *ShapeBullet::create_bt_shape() { - btVector3 s(1, 1, 1); - return create_bt_shape(s); -} - btCollisionShape *ShapeBullet::create_bt_shape(const Vector3 &p_implicit_scale, real_t p_margin) { btVector3 s; G_TO_B(p_implicit_scale, s); @@ -82,7 +77,7 @@ void ShapeBullet::add_owner(ShapeOwnerBullet *p_owner) { void ShapeBullet::remove_owner(ShapeOwnerBullet *p_owner, bool p_permanentlyFromThisBody) { Map<ShapeOwnerBullet *, int>::Element *E = owners.find(p_owner); - ERR_FAIL_COND(!E); + if (!E) return; E->get()--; if (p_permanentlyFromThisBody || 0 >= E->get()) { owners.erase(E); diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h index 12fa9754bd..4a03c0f014 100644 --- a/modules/bullet/shape_bullet.h +++ b/modules/bullet/shape_bullet.h @@ -62,7 +62,6 @@ public: ShapeBullet(); virtual ~ShapeBullet(); - btCollisionShape *create_bt_shape(); btCollisionShape *create_bt_shape(const Vector3 &p_implicit_scale, real_t p_margin = 0); virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin = 0) = 0; diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 83dd055760..d60d8ba0e2 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -857,31 +857,31 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f btVector3 recover_initial_position(0, 0, 0); { /// Phase one - multi shapes depenetration using margin for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) { - if (recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, recover_initial_position)) { - - // Add recover position to "From" and "To" transforms - body_safe_position.getOrigin() += recover_initial_position; - } else { + if (!recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, recover_initial_position)) { break; } } + + // Add recover movement in order to make it safe + body_safe_position.getOrigin() += recover_initial_position; } #endif - btVector3 recovered_motion; - G_TO_B(p_motion, recovered_motion); - const int shape_count(p_body->get_shape_count()); + btVector3 motion; + G_TO_B(p_motion, motion); { /// phase two - sweep test, from a secure position without margin + const int shape_count(p_body->get_shape_count()); + #if debug_test_motion -//Vector3 sup_line; -//B_TO_G(body_safe_position.getOrigin(), sup_line); -//motionVec->clear(); -//motionVec->begin(Mesh::PRIMITIVE_LINES, NULL); -//motionVec->add_vertex(sup_line); -//motionVec->add_vertex(sup_line + p_motion * 10); -//motionVec->end(); + Vector3 sup_line; + B_TO_G(body_safe_position.getOrigin(), sup_line); + motionVec->clear(); + motionVec->begin(Mesh::PRIMITIVE_LINES, NULL); + motionVec->add_vertex(sup_line); + motionVec->add_vertex(sup_line + p_motion * 10); + motionVec->end(); #endif for (int shIndex = 0; shIndex < shape_count; ++shIndex) { @@ -898,7 +898,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f btTransform shape_world_from = body_safe_position * p_body->get_kinematic_utilities()->shapes[shIndex].transform; btTransform shape_world_to(shape_world_from); - shape_world_to.getOrigin() += recovered_motion; + shape_world_to.getOrigin() += motion; GodotKinClosestConvexResultCallback btResult(shape_world_from.getOrigin(), shape_world_to.getOrigin(), p_body, IGNORE_AREAS_TRUE); btResult.m_collisionFilterGroup = p_body->get_collision_layer(); @@ -909,27 +909,30 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f if (btResult.hasHit()) { /// Since for each sweep test I fix the motion of new shapes in base the recover result, /// if another shape will hit something it means that has a deepest penetration respect the previous shape - recovered_motion *= btResult.m_closestHitFraction; + motion *= btResult.m_closestHitFraction; } } + + body_safe_position.getOrigin() += motion; } bool has_penetration = false; { /// Phase three - Recover + contact test with margin + btVector3 delta_recover_movement(0, 0, 0); RecoverResult r_recover_result; bool l_has_penetration; real_t l_penetration_distance = 1e20; for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) { - l_has_penetration = recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, recovered_motion, &r_recover_result); + l_has_penetration = recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, delta_recover_movement, &r_recover_result); if (r_result) { #if PERFORM_INITIAL_UNSTACK - B_TO_G(recovered_motion + recover_initial_position, r_result->motion); + B_TO_G(motion + delta_recover_movement + recover_initial_position, r_result->motion); #else - B_TO_G(recovered_motion, r_result->motion); + B_TO_G(motion + delta_recover_movement, r_result->motion); #endif if (l_has_penetration) { has_penetration = true; @@ -942,7 +945,8 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object); CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer()); - r_result->remainder = p_motion - r_result->motion; // is the remaining movements + B_TO_G(motion, r_result->remainder); // is the remaining movements + r_result->remainder = p_motion - r_result->remainder; B_TO_G(r_recover_result.pointWorld, r_result->collision_point); B_TO_G(r_recover_result.normal, r_result->collision_normal); B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot @@ -961,17 +965,14 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f //} #if debug_test_motion -//Vector3 sup_line2; -//B_TO_G(recovered_motion, sup_line2); -////Vector3 sup_pos; -////B_TO_G( pt.getPositionWorldOnB(), sup_pos); -//normalLine->clear(); -//normalLine->begin(Mesh::PRIMITIVE_LINES, NULL); -//normalLine->add_vertex(r_result->collision_point); -//normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10); -//normalLine->end(); + Vector3 sup_line2; + B_TO_G(motion, sup_line2); + normalLine->clear(); + normalLine->begin(Mesh::PRIMITIVE_LINES, NULL); + normalLine->add_vertex(r_result->collision_point); + normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10); + normalLine->end(); #endif - } else { r_result->remainder = Vector3(); } @@ -1019,7 +1020,7 @@ public: } }; -bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result) { +bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result) { RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask()); @@ -1043,7 +1044,7 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran body_shape_position = p_body_position * kin_shape.transform; body_shape_position_recovered = body_shape_position; - body_shape_position_recovered.getOrigin() += r_recover_position; + body_shape_position_recovered.getOrigin() += r_delta_recover_movement; kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb); dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result); @@ -1060,24 +1061,24 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) { if (cs->getChildShape(x)->isConvex()) { - if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position_recovered, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_recover_position, r_recover_result)) { + if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) { penetration = true; } } else { - if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position_recovered, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_recover_position, r_recover_result)) { + if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) { penetration = true; } } } } else if (otherObject->getCollisionShape()->isConvex()) { /// Execute GJK test against object shape - if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position_recovered, otherObject->getWorldTransform(), p_recover_movement_scale, r_recover_position, r_recover_result)) { + if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) { penetration = true; } } else { - if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position_recovered, otherObject->getWorldTransform(), p_recover_movement_scale, r_recover_position, r_recover_result)) { + if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), p_recover_movement_scale, r_delta_recover_movement, r_recover_result)) { penetration = true; } @@ -1085,26 +1086,15 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran } } -#if debug_test_motion - Vector3 pos; - B_TO_G(p_body_position.getOrigin(), pos); - Vector3 sup_line; - B_TO_G(sum_recover_normals, sup_line); - motionVec->clear(); - motionVec->begin(Mesh::PRIMITIVE_LINES, NULL); - motionVec->add_vertex(pos); - motionVec->add_vertex(pos + (sup_line * 10)); - motionVec->end(); -#endif - return penetration; } -bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result) { +bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result) { // Initialize GJK input btGjkPairDetector::ClosestPointInput gjk_input; gjk_input.m_transformA = p_transformA; + gjk_input.m_transformA.getOrigin() += r_delta_recover_movement; gjk_input.m_transformB = p_transformB; // Perform GJK test @@ -1113,7 +1103,7 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt gjk_pair_detector.getClosestPoints(gjk_input, result, 0); if (0 > result.m_distance) { // Has penetration - r_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale); + r_delta_recover_movement += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale); if (r_recover_result) { if (result.m_distance < r_recover_result->penetration_distance) { @@ -1130,11 +1120,14 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt return false; } -bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result) { +bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result) { /// Contact test - btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, p_transformA, -1, p_shapeId_A); + btTransform tA(p_transformA); + tA.getOrigin() += r_delta_recover_movement; + + btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A); btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CLOSEST_POINT_ALGORITHMS); @@ -1147,7 +1140,7 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC dispatcher->freeCollisionAlgorithm(algorithm); if (contactPointResult.hasHit()) { - r_recover_position += contactPointResult.m_pointNormalWorld * (contactPointResult.m_penetration_distance * -1 * p_recover_movement_scale); + r_delta_recover_movement += contactPointResult.m_pointNormalWorld * (contactPointResult.m_penetration_distance * -1 * p_recover_movement_scale); if (r_recover_result) { if (contactPointResult.m_penetration_distance < r_recover_result->penetration_distance) { diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index 8d31ab765b..0aeb407dcc 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -191,15 +191,20 @@ private: RecoverResult() : hasPenetration(false), - penetration_distance(1e20) {} + normal(0, 0, 0), + pointWorld(0, 0, 0), + penetration_distance(1e20), + other_compound_shape_index(0), + other_collision_object(NULL), + local_shape_most_recovered(0) {} }; - bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btScalar p_recover_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL); + bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); /// This is an API that recover a kinematic object from penetration /// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions - bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL); + bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); /// This is an API that recover a kinematic object from penetration /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm - bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_movement_scale, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL); + bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); }; #endif diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml index 25d17542ea..00162d6e60 100644 --- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml +++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml @@ -47,12 +47,6 @@ Create server that listens to connections via [code]port[/code]. </description> </method> - <method name="get_compression_mode" qualifiers="const"> - <return type="int" enum="NetworkedMultiplayerENet.CompressionMode"> - </return> - <description> - </description> - </method> <method name="set_bind_ip"> <return type="void"> </return> @@ -61,15 +55,11 @@ <description> </description> </method> - <method name="set_compression_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="NetworkedMultiplayerENet.CompressionMode"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode"> + </member> + </members> <constants> <constant name="COMPRESS_NONE" value="0" enum="CompressionMode"> </constant> diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 3ad80d3978..f3f4acd768 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -36,6 +36,10 @@ void NetworkedMultiplayerENet::set_transfer_mode(TransferMode p_mode) { transfer_mode = p_mode; } +NetworkedMultiplayerPeer::TransferMode NetworkedMultiplayerENet::get_transfer_mode() const { + + return transfer_mode; +} void NetworkedMultiplayerENet::set_target_peer(int p_peer) { @@ -659,6 +663,8 @@ void NetworkedMultiplayerENet::_bind_methods() { ClassDB::bind_method(D_METHOD("get_compression_mode"), &NetworkedMultiplayerENet::get_compression_mode); ClassDB::bind_method(D_METHOD("set_bind_ip", "ip"), &NetworkedMultiplayerENet::set_bind_ip); + ADD_PROPERTY(PropertyInfo(Variant::INT, "compression_mode", PROPERTY_HINT_ENUM, "None,Range Coder,FastLZ,ZLib,ZStd"), "set_compression_mode", "get_compression_mode"); + BIND_ENUM_CONSTANT(COMPRESS_NONE); BIND_ENUM_CONSTANT(COMPRESS_RANGE_CODER); BIND_ENUM_CONSTANT(COMPRESS_FASTLZ); diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index 93758de94b..440e9b5400 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -110,6 +110,7 @@ protected: public: virtual void set_transfer_mode(TransferMode p_mode); + virtual TransferMode get_transfer_mode() const; virtual void set_target_peer(int p_peer); virtual int get_packet_peer() const; diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index e56ec774dd..8a674bc8c1 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -118,7 +118,6 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f } uint32_t imgw = p_img->get_width(), imgh = p_img->get_height(); - ERR_FAIL_COND(next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh); Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels); @@ -127,6 +126,25 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f if (img->get_format() != Image::FORMAT_RGBA8) img->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert + if (img->has_mipmaps()) { + if (next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh) { + img->resize_to_po2(); + imgw = img->get_width(); + imgh = img->get_height(); + } + } else { + if (imgw % 4 != 0 || imgh % 4 != 0) { + if (imgw % 4) { + imgw += 4 - imgw % 4; + } + if (imgh % 4) { + imgh += 4 - imgh % 4; + } + + img->resize(imgw, imgh); + } + } + PoolVector<uint8_t>::Read r = img->get_data().read(); int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps() ? -1 : 0); diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 350dc540f7..7f5dbc12be 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -40,6 +40,24 @@ extern "C" { #endif +godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) { + const CharString *cs = (const CharString *)p_cs; + + return cs->length(); +} + +const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs) { + const CharString *cs = (const CharString *)p_cs; + + return cs->get_data(); +} + +void GDAPI godot_char_string_destroy(godot_char_string *p_cs) { + CharString *cs = (CharString *)p_cs; + + cs->~CharString(); +} + void GDAPI godot_string_new(godot_string *r_dest) { String *dest = (String *)r_dest; memnew_placement(dest, String); @@ -51,35 +69,11 @@ void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src memnew_placement(dest, String(*src)); } -void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size) { - String *dest = (String *)r_dest; - memnew_placement(dest, String(String::utf8(p_contents, p_size))); -} - -void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size) { +void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size) { String *dest = (String *)r_dest; memnew_placement(dest, String(p_contents, p_size)); } -void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size) { - String *self = (String *)p_self; - - if (p_size) { - // we have a length pointer, that means we either want to know - // the length or want to write *p_size bytes into a buffer - - CharString utf8_string = self->utf8(); - - int len = utf8_string.length(); - - if (p_dest) { - memcpy(p_dest, utf8_string.get_data(), *p_size); - } else { - *p_size = len; - } - } -} - wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) { String *self = (String *)p_self; return &(self->operator[](p_idx)); @@ -90,7 +84,7 @@ wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, cons return self->operator[](p_idx); } -const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) { +const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self) { const String *self = (const String *)p_self; return self->c_str(); } @@ -130,6 +124,26 @@ godot_int GDAPI godot_string_length(const godot_string *p_self) { /* Helpers */ +signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->casecmp_to(*str); +} + +signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->nocasecmp_to(*str); +} +signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->naturalnocasecmp_to(*str); +} + godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string) { const String *self = (const String *)p_self; const String *string = (const String *)p_string; @@ -534,7 +548,7 @@ godot_string GDAPI godot_string_capitalize(const godot_string *p_self) { memnew_placement(&result, String(self->capitalize())); return result; -}; +} godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -542,7 +556,7 @@ godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_se memnew_placement(&result, String(self->camelcase_to_underscore(false))); return result; -}; +} godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -550,45 +564,45 @@ godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_s memnew_placement(&result, String(self->camelcase_to_underscore())); return result; -}; +} double GDAPI godot_string_char_to_double(const char *p_what) { return String::to_double(p_what); -}; +} godot_int GDAPI godot_string_char_to_int(const char *p_what) { return String::to_int(p_what); -}; +} int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str) { return String::to_int(p_str); -}; +} godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len) { return String::to_int(p_what, p_len); -}; +} int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len) { return String::to_int(p_str, p_len); -}; +} int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self) { const String *self = (const String *)p_self; return self->hex_to_int64(false); -}; +} int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self) { const String *self = (const String *)p_self; return self->hex_to_int64(); -}; +} int64_t GDAPI godot_string_to_int64(const godot_string *p_self) { const String *self = (const String *)p_self; return self->to_int64(); -}; +} double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end) { return String::to_double(p_str, r_end); @@ -601,7 +615,7 @@ godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_stri memnew_placement(&result, String(self->get_slice(*splitter, p_slice))); return result; -}; +} godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice) { const String *self = (const String *)p_self; @@ -609,7 +623,7 @@ godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p memnew_placement(&result, String(self->get_slicec(p_splitter, p_slice))); return result; -}; +} godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -625,7 +639,7 @@ godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_str } return result; -}; +} godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -641,7 +655,7 @@ godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, con } return result; -}; +} godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -657,7 +671,7 @@ godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const go } return result; -}; +} godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -673,7 +687,7 @@ godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_s } return result; -}; +} godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters) { const String *self = (const String *)p_self; @@ -696,7 +710,7 @@ godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const } return result; -}; +} godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { const String *self = (const String *)p_self; @@ -719,7 +733,7 @@ godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string * } return result; -}; +} godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -735,7 +749,7 @@ godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godo } return result; -}; +} godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { const String *self = (const String *)p_self; @@ -751,7 +765,7 @@ godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_sel } return result; -}; +} godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters) { const String *self = (const String *)p_self; @@ -774,7 +788,7 @@ godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const g } return result; -}; +} godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { const String *self = (const String *)p_self; @@ -797,7 +811,7 @@ godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_ } return result; -}; +} godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -812,22 +826,22 @@ godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) { } return result; -}; +} godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) { const String *self = (const String *)p_self; String *splitter = (String *)&p_splitter; return self->get_slice_count(*splitter); -}; +} wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char) { return String::char_lowercase(p_char); -}; +} wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char) { return String::char_uppercase(p_char); -}; +} godot_string GDAPI godot_string_to_lower(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -835,7 +849,7 @@ godot_string GDAPI godot_string_to_lower(const godot_string *p_self) { memnew_placement(&result, String(self->to_lower())); return result; -}; +} godot_string GDAPI godot_string_to_upper(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -843,7 +857,7 @@ godot_string GDAPI godot_string_to_upper(const godot_string *p_self) { memnew_placement(&result, String(self->to_upper())); return result; -}; +} godot_string GDAPI godot_string_get_basename(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -851,7 +865,7 @@ godot_string GDAPI godot_string_get_basename(const godot_string *p_self) { memnew_placement(&result, String(self->get_basename())); return result; -}; +} godot_string GDAPI godot_string_get_extension(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -859,7 +873,7 @@ godot_string GDAPI godot_string_get_extension(const godot_string *p_self) { memnew_placement(&result, String(self->get_extension())); return result; -}; +} godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos) { const String *self = (const String *)p_self; @@ -867,13 +881,13 @@ godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos memnew_placement(&result, String(self->left(p_pos))); return result; -}; +} wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx) { const String *self = (const String *)p_self; return self->ord_at(p_idx); -}; +} godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file) { const String *self = (const String *)p_self; @@ -882,7 +896,7 @@ godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godo memnew_placement(&result, String(self->plus_file(*file))); return result; -}; +} godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos) { const String *self = (const String *)p_self; @@ -890,7 +904,7 @@ godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_po memnew_placement(&result, String(self->right(p_pos))); return result; -}; +} godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right) { const String *self = (const String *)p_self; @@ -898,7 +912,7 @@ godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bo memnew_placement(&result, String(self->strip_edges(p_left, p_right))); return result; -}; +} godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -906,94 +920,96 @@ godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) { memnew_placement(&result, String(self->strip_escapes())); return result; -}; +} void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars) { String *self = (String *)p_self; return self->erase(p_pos, p_chars); -}; +} -void GDAPI godot_string_ascii(godot_string *p_self, char *result) { - String *self = (String *)p_self; - Vector<char> return_value = self->ascii(); +godot_char_string GDAPI godot_string_ascii(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_char_string result; - for (int i = 0; i < return_value.size(); i++) { - result[i] = return_value[i]; - } + memnew_placement(&result, CharString(self->ascii())); + + return result; } -void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result) { - String *self = (String *)p_self; - Vector<char> return_value = self->ascii(true); +godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self) { + const String *self = (const String *)p_self; - for (int i = 0; i < return_value.size(); i++) { - result[i] = return_value[i]; - } + godot_char_string result; + + memnew_placement(&result, CharString(self->ascii(true))); + + return result; } -void GDAPI godot_string_utf8(godot_string *p_self, char *result) { - String *self = (String *)p_self; - Vector<char> return_value = self->utf8(); +godot_char_string GDAPI godot_string_utf8(const godot_string *p_self) { + const String *self = (const String *)p_self; - for (int i = 0; i < return_value.size(); i++) { - result[i] = return_value[i]; - } + godot_char_string result; + + memnew_placement(&result, CharString(self->utf8())); + + return result; } godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8) { String *self = (String *)p_self; return self->parse_utf8(p_utf8); -}; +} godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len) { String *self = (String *)p_self; return self->parse_utf8(p_utf8, p_len); -}; +} godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8) { godot_string result; memnew_placement(&result, String(String::utf8(p_utf8))); return result; -}; +} godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len) { godot_string result; memnew_placement(&result, String(String::utf8(p_utf8, p_len))); return result; -}; +} uint32_t GDAPI godot_string_hash(const godot_string *p_self) { const String *self = (const String *)p_self; return self->hash(); -}; +} uint64_t GDAPI godot_string_hash64(const godot_string *p_self) { const String *self = (const String *)p_self; return self->hash64(); -}; +} uint32_t GDAPI godot_string_hash_chars(const char *p_cstr) { return String::hash(p_cstr); -}; +} uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len) { return String::hash(p_cstr, p_len); -}; +} uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str) { return String::hash(p_str); -}; +} uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len) { return String::hash(p_str, p_len); -}; +} godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1010,7 +1026,7 @@ godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) } return result; -}; +} godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1018,7 +1034,7 @@ godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { memnew_placement(&result, String(self->md5_text())); return result; -}; +} godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1035,7 +1051,7 @@ godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_sel } return result; -}; +} godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1043,13 +1059,13 @@ godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) { memnew_placement(&result, String(self->sha256_text())); return result; -}; +} godot_bool godot_string_empty(const godot_string *p_self) { const String *self = (const String *)p_self; return self->empty(); -}; +} // path functions godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) { @@ -1059,7 +1075,7 @@ godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_get_file(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1068,7 +1084,7 @@ godot_string GDAPI godot_string_get_file(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_humanize_size(size_t p_size) { godot_string result; @@ -1076,25 +1092,25 @@ godot_string GDAPI godot_string_humanize_size(size_t p_size) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_abs_path(); -}; +} godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_rel_path(); -}; +} godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_resource_file(); -}; +} godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path) { const String *self = (const String *)p_self; @@ -1104,7 +1120,7 @@ godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_ memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path) { const String *self = (const String *)p_self; @@ -1114,7 +1130,7 @@ godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const g memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1123,7 +1139,7 @@ godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_c_escape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1132,7 +1148,7 @@ godot_string GDAPI godot_string_c_escape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1141,7 +1157,7 @@ godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1150,7 +1166,7 @@ godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_http_escape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1159,7 +1175,7 @@ godot_string GDAPI godot_string_http_escape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1168,7 +1184,7 @@ godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_json_escape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1177,7 +1193,7 @@ godot_string GDAPI godot_string_json_escape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line) { const String *self = (const String *)p_self; @@ -1186,7 +1202,7 @@ godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1195,7 +1211,7 @@ godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1204,7 +1220,7 @@ godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_sel memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1213,7 +1229,7 @@ godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1222,7 +1238,7 @@ godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) { const String *self = (const String *)p_self; @@ -1231,43 +1247,43 @@ godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) { memnew_placement(&result, String(return_value)); return result; -}; +} godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_valid_float(); -}; +} godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix) { const String *self = (const String *)p_self; return self->is_valid_hex_number(p_with_prefix); -}; +} godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_valid_html_color(); -}; +} godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_valid_identifier(); -}; +} godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_valid_integer(); -}; +} godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self) { const String *self = (const String *)p_self; return self->is_valid_ip_address(); -}; +} #ifdef __cplusplus } diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index 9bd8c99612..715f2e3c08 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -63,7 +63,7 @@ godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) { return dest; } -void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v) { +void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v) { Transform *self = (Transform *)p_self; const Basis *v = (const Basis *)p_v; self->basis = *v; @@ -76,7 +76,7 @@ godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) { return dest; } -void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v) { +void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v) { Transform *self = (Transform *)p_self; const Vector3 *v = (const Vector3 *)p_v; self->origin = *v; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 06c6e9f410..6e3cf16758 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -3516,7 +3516,7 @@ "return_type": "void", "arguments": [ ["godot_transform *", "p_self"], - ["godot_basis *", "p_v"] + ["const godot_basis *", "p_v"] ] }, { @@ -3531,7 +3531,7 @@ "return_type": "void", "arguments": [ ["godot_transform *", "p_self"], - ["godot_vector3 *", "p_v"] + ["const godot_vector3 *", "p_v"] ] }, { @@ -4324,45 +4324,48 @@ ] }, { - "name": "godot_string_new", - "return_type": "void", + "name": "godot_char_string_length", + "return_type": "godot_int", "arguments": [ - ["godot_string *", "r_dest"] + ["const godot_char_string *", "p_cs"] ] }, { - "name": "godot_string_new_copy", + "name": "godot_char_string_get_data", + "return_type": "const char *", + "arguments": [ + ["const godot_char_string *", "p_cs"] + ] + }, + { + "name": "godot_char_string_destroy", "return_type": "void", "arguments": [ - ["godot_string *", "r_dest"], - ["const godot_string *", "p_src"] + ["godot_char_string *", "p_cs"] ] }, { - "name": "godot_string_new_data", + "name": "godot_string_new", "return_type": "void", "arguments": [ - ["godot_string *", "r_dest"], - ["const char *", "p_contents"], - ["const int", "p_size"] + ["godot_string *", "r_dest"] ] }, { - "name": "godot_string_new_unicode_data", + "name": "godot_string_new_copy", "return_type": "void", "arguments": [ ["godot_string *", "r_dest"], - ["const wchar_t *", "p_contents"], - ["const int", "p_size"] + ["const godot_string *", "p_src"] ] }, { - "name": "godot_string_get_data", + "name": "godot_string_new_with_wide_string", "return_type": "void", "arguments": [ - ["const godot_string *", "p_self"], - ["char *", "p_dest"], - ["int *", "p_size"] + ["godot_string *", "r_dest"], + ["const wchar_t *", "p_contents"], + ["const int", "p_size"] ] }, { @@ -4382,7 +4385,7 @@ ] }, { - "name": "godot_string_unicode_str", + "name": "godot_string_wide_str", "return_type": "const wchar_t *", "arguments": [ ["const godot_string *", "p_self"] @@ -4420,6 +4423,30 @@ ] }, { + "name": "godot_string_casecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { + "name": "godot_string_nocasecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { + "name": "godot_string_naturalnocasecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { "name": "godot_string_begins_with", "return_type": "godot_bool", "arguments": [ @@ -5125,26 +5152,23 @@ }, { "name": "godot_string_ascii", - "return_type": "void", + "return_type": "godot_char_string", "arguments": [ - ["godot_string *", "p_self"], - ["char *", "result"] + ["const godot_string *", "p_self"] ] }, { "name": "godot_string_ascii_extended", - "return_type": "void", + "return_type": "godot_char_string", "arguments": [ - ["godot_string *", "p_self"], - ["char *", "result"] + ["const godot_string *", "p_self"] ] }, { "name": "godot_string_utf8", - "return_type": "void", + "return_type": "godot_char_string", "arguments": [ - ["godot_string *", "p_self"], - ["char *", "result"] + ["const godot_string *", "p_self"] ] }, { diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index 080c0aa171..73245160c1 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -38,13 +38,24 @@ extern "C" { #include <stdint.h> #include <wchar.h> +typedef wchar_t godot_char_type; + #define GODOT_STRING_SIZE sizeof(void *) +#define GODOT_CHAR_STRING_SIZE sizeof(void *) #ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED #define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED typedef struct { uint8_t _dont_touch_that[GODOT_STRING_SIZE]; } godot_string; + +#endif + +#ifndef GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_CHAR_STRING_SIZE]; +} godot_char_string; #endif // reduce extern "C" nesting for VS2013 @@ -60,16 +71,17 @@ typedef struct { extern "C" { #endif +godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs); +const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs); +void GDAPI godot_char_string_destroy(godot_char_string *p_cs); + void GDAPI godot_string_new(godot_string *r_dest); void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); -void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size); -void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size); - -void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size); +void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size); wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx); wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx); -const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self); +const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self); godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b); godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); @@ -81,6 +93,10 @@ godot_int GDAPI godot_string_length(const godot_string *p_self); /* Helpers */ +signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str); +signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str); +signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str); + godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string); godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array); godot_array GDAPI godot_string_bigrams(const godot_string *p_self); @@ -177,9 +193,9 @@ godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self); void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars); -void GDAPI godot_string_ascii(godot_string *p_self, char *result); -void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result); -void GDAPI godot_string_utf8(godot_string *p_self, char *result); +godot_char_string GDAPI godot_string_ascii(const godot_string *p_self); +godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self); +godot_char_string GDAPI godot_string_utf8(const godot_string *p_self); godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8); godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len); godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8); diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h index 10a242b205..a646da146a 100644 --- a/modules/gdnative/include/gdnative/transform.h +++ b/modules/gdnative/include/gdnative/transform.h @@ -64,10 +64,10 @@ void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const g void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self); -void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v); +void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v); godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self); -void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v); +void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v); godot_string GDAPI godot_transform_as_string(const godot_transform *p_self); diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index 2405afc677..8101ebc6f3 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -45,7 +45,11 @@ void PluginScriptLanguage::init() { } String PluginScriptLanguage::get_type() const { - return String(_desc.type); + // We should use _desc.type here, however the returned type is used to + // query ClassDB which would complain given the type is not registered + // from his point of view... + // To solve this we just use a more generic (but present in ClassDB) type. + return String("PluginScript"); } String PluginScriptLanguage::get_extension() const { @@ -168,7 +172,7 @@ Error PluginScriptLanguage::complete_code(const String &p_code, const String &p_ for (int i = 0; i < options.size(); i++) { r_options->push_back(String(options[i])); } - Error err = *(Error *)tmp; + Error err = *(Error *)&tmp; return err; } return ERR_UNAVAILABLE; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 228c7dc56f..4e3ee4d22c 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -705,7 +705,7 @@ bool GDScript::_set(const StringName &p_name, const Variant &p_value) { void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const { - p_properties->push_back(PropertyInfo(Variant::STRING, "script/source", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_properties->push_back(PropertyInfo(Variant::STRING, "script/source", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } void GDScript::_bind_methods() { diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index b5bbaa6dc9..9566e3b32e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -349,7 +349,9 @@ public: csi.resize(_debug_call_stack_pos); for (int i = 0; i < _debug_call_stack_pos; i++) { csi[_debug_call_stack_pos - i - 1].line = _call_stack[i].line ? *_call_stack[i].line : 0; - csi[_debug_call_stack_pos - i - 1].script = Ref<GDScript>(_call_stack[i].function->get_script()); + if (_call_stack[i].function) + csi[_debug_call_stack_pos - i - 1].func = _call_stack[i].function->get_name(); + csi[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path(); } return csi; } diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index c30c6d77b9..f814304180 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -67,34 +67,6 @@ The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is retuned if the cell is empty. </description> </method> - <method name="get_cell_size" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - The dimensions of the grid's cells. - </description> - </method> - <method name="get_center_x" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether or not grid items are centered on the X axis. - </description> - </method> - <method name="get_center_y" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether or not grid items are centered on the Y axis. - </description> - </method> - <method name="get_center_z" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether or not grid items are centered on the Z axis. - </description> - </method> <method name="get_collision_layer_bit" qualifiers="const"> <return type="bool"> </return> @@ -118,20 +90,6 @@ Array of [Transform] and [Mesh] references corresponding to the non empty cells in the grid. The transforms are specified in world space. </description> </method> - <method name="get_octant_size" qualifiers="const"> - <return type="int"> - </return> - <description> - The size of each octant measured in number of cells. This applies to all three axis. - </description> - </method> - <method name="get_theme" qualifiers="const"> - <return type="MeshLibrary"> - </return> - <description> - The assigned [MeshLibrary]. - </description> - </method> <method name="get_used_cells" qualifiers="const"> <return type="Array"> </return> @@ -188,42 +146,6 @@ Optionally, the item's orientation can be passed. </description> </method> - <method name="set_cell_size"> - <return type="void"> - </return> - <argument index="0" name="size" type="Vector3"> - </argument> - <description> - Sets the height, width and depth of the grid's cells. - </description> - </method> - <method name="set_center_x"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set grid items to be centered on the X axis. By default it is enabled. - </description> - </method> - <method name="set_center_y"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set grid items to be centered on the Y axis. By default it is enabled. - </description> - </method> - <method name="set_center_z"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set grid items to be centered on the Z axis. By default it is enabled. - </description> - </method> <method name="set_clip"> <return type="void"> </return> @@ -258,24 +180,6 @@ <description> </description> </method> - <method name="set_octant_size"> - <return type="void"> - </return> - <argument index="0" name="size" type="int"> - </argument> - <description> - Sets the size for each octant measured in number of cells. This applies to all three axis. - </description> - </method> - <method name="set_theme"> - <return type="void"> - </return> - <argument index="0" name="theme" type="MeshLibrary"> - </argument> - <description> - Sets the collection of meshes for the map. - </description> - </method> <method name="world_to_map" qualifiers="const"> <return type="Vector3"> </return> @@ -286,10 +190,30 @@ </method> </methods> <members> + <member name="cell_center_x" type="bool" setter="set_center_x" getter="get_center_x"> + If [code]true[/code] grid items are centered on the X axis. + </member> + <member name="cell_center_y" type="bool" setter="set_center_y" getter="get_center_y"> + If [code]true[/code] grid items are centered on the Y axis. + </member> + <member name="cell_center_z" type="bool" setter="set_center_z" getter="get_center_z"> + If [code]true[/code] grid items are centered on the Z axis. + </member> + <member name="cell_octant_size" type="int" setter="set_octant_size" getter="get_octant_size"> + The size of each octant measured in number of cells. This applies to all three axis. + </member> + <member name="cell_scale" type="float" setter="set_cell_scale" getter="get_cell_scale"> + </member> + <member name="cell_size" type="Vector3" setter="set_cell_size" getter="get_cell_size"> + The dimensions of the grid's cells. + </member> <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer"> </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask"> </member> + <member name="theme" type="MeshLibrary" setter="set_theme" getter="get_theme"> + The assigned [MeshLibrary]. + </member> </members> <constants> <constant name="INVALID_CELL_ITEM" value="-1"> diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index e8e9419af8..234a59e516 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -43,28 +43,7 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; - if (name == "theme") { - - set_theme(p_value); - } else if (name == "cell_size") { - if (p_value.get_type() == Variant::INT || p_value.get_type() == Variant::REAL) { - //compatibility - float cs = p_value; - set_cell_size(Vector3(cs, cs, cs)); - } else { - set_cell_size(p_value); - } - } else if (name == "cell_octant_size") { - set_octant_size(p_value); - } else if (name == "cell_center_x") { - set_center_x(p_value); - } else if (name == "cell_center_y") { - set_center_y(p_value); - } else if (name == "cell_center_z") { - set_center_z(p_value); - } else if (name == "cell_scale") { - set_cell_scale(p_value); - /* } else if (name=="cells") { + /* } else if (name=="cells") { PoolVector<int> cells = p_value; int amount=cells.size(); PoolVector<int>::Read r = cells.read(); @@ -81,7 +60,7 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) { } _recreate_octant_data();*/ - } else if (name == "data") { + if (name == "data") { Dictionary d = p_value; @@ -134,21 +113,7 @@ bool GridMap::_get(const StringName &p_name, Variant &r_ret) const { String name = p_name; - if (name == "theme") { - r_ret = get_theme(); - } else if (name == "cell_size") { - r_ret = get_cell_size(); - } else if (name == "cell_octant_size") { - r_ret = get_octant_size(); - } else if (name == "cell_center_x") { - r_ret = get_center_x(); - } else if (name == "cell_center_y") { - r_ret = get_center_y(); - } else if (name == "cell_center_z") { - r_ret = get_center_z(); - } else if (name == "cell_scale") { - r_ret = cell_scale; - } else if (name == "data") { + if (name == "data") { Dictionary d; @@ -184,14 +149,6 @@ bool GridMap::_get(const StringName &p_name, Variant &r_ret) const { void GridMap::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary")); - p_list->push_back(PropertyInfo(Variant::NIL, "Cell", PROPERTY_HINT_NONE, "cell_", PROPERTY_USAGE_GROUP)); - p_list->push_back(PropertyInfo(Variant::VECTOR3, "cell_size")); - p_list->push_back(PropertyInfo(Variant::INT, "cell_octant_size", PROPERTY_HINT_RANGE, "1,1024,1")); - p_list->push_back(PropertyInfo(Variant::BOOL, "cell_center_x")); - p_list->push_back(PropertyInfo(Variant::BOOL, "cell_center_y")); - p_list->push_back(PropertyInfo(Variant::BOOL, "cell_center_z")); - p_list->push_back(PropertyInfo(Variant::REAL, "cell_scale")); if (baked_meshes.size()) { p_list->push_back(PropertyInfo(Variant::ARRAY, "baked_meshes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); } @@ -895,6 +852,9 @@ void GridMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_cell_size", "size"), &GridMap::set_cell_size); ClassDB::bind_method(D_METHOD("get_cell_size"), &GridMap::get_cell_size); + ClassDB::bind_method(D_METHOD("set_cell_scale", "scale"), &GridMap::set_cell_scale); + ClassDB::bind_method(D_METHOD("get_cell_scale"), &GridMap::get_cell_scale); + ClassDB::bind_method(D_METHOD("set_octant_size", "size"), &GridMap::set_octant_size); ClassDB::bind_method(D_METHOD("get_octant_size"), &GridMap::get_octant_size); @@ -929,6 +889,14 @@ void GridMap::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_baked_meshes"), &GridMap::clear_baked_meshes); ClassDB::bind_method(D_METHOD("make_baked_meshes", "gen_lightmap_uv", "lightmap_uv_texel_size"), &GridMap::make_baked_meshes, DEFVAL(false), DEFVAL(0.1)); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary"), "set_theme", "get_theme"); + ADD_GROUP("Cell", "cell_"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "cell_size"), "set_cell_size", "get_cell_size"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_octant_size", PROPERTY_HINT_RANGE, "1,1024,1"), "set_octant_size", "get_octant_size"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_x"), "set_center_x", "get_center_x"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_y"), "set_center_y", "get_center_y"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_z"), "set_center_z", "get_center_z"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_scale"), "set_cell_scale", "get_cell_scale"); ADD_GROUP("Collision", "collision_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 949c636050..7df2043a62 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -445,6 +445,76 @@ String CSharpLanguage::_get_indentation() const { return "\t"; } +Vector<ScriptLanguage::StackInfo> CSharpLanguage::debug_get_current_stack_info() { + + // Printing an error here will result in endless recursion, so we must be careful + + if (!gdmono->is_runtime_initialized() || !GDMono::get_singleton()->get_api_assembly() || !GDMonoUtils::mono_cache.corlib_cache_updated) + return Vector<StackInfo>(); + + MonoObject *stack_trace = mono_object_new(mono_domain_get(), CACHED_CLASS(System_Diagnostics_StackTrace)->get_mono_ptr()); + + MonoBoolean need_file_info = true; + void *ctor_args[1] = { &need_file_info }; + + CACHED_METHOD(System_Diagnostics_StackTrace, ctor_bool)->invoke_raw(stack_trace, ctor_args); + + Vector<StackInfo> si; + si = stack_trace_get_info(stack_trace); + + return si; +} + +Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObject *p_stack_trace) { + + // Printing an error here could result in endless recursion, so we must be careful + + MonoObject *exc = NULL; + + GDMonoUtils::StackTrace_GetFrames st_get_frames = CACHED_METHOD_THUNK(System_Diagnostics_StackTrace, GetFrames); + MonoArray *frames = st_get_frames(p_stack_trace, &exc); + + if (exc) { + GDMonoUtils::print_unhandled_exception(exc, true /* fail silently to avoid endless recursion */); + return Vector<StackInfo>(); + } + + int frame_count = mono_array_length(frames); + + if (frame_count <= 0) + return Vector<StackInfo>(); + + GDMonoUtils::DebugUtils_StackFrameInfo get_sf_info = CACHED_METHOD_THUNK(DebuggingUtils, GetStackFrameInfo); + + Vector<StackInfo> si; + si.resize(frame_count); + + for (int i = 0; i < frame_count; i++) { + StackInfo &sif = si[i]; + MonoObject *frame = mono_array_get(frames, MonoObject *, i); + + MonoString *file_name; + int file_line_num; + MonoString *method_decl; + get_sf_info(frame, &file_name, &file_line_num, &method_decl, &exc); + + if (exc) { + GDMonoUtils::print_unhandled_exception(exc, true /* fail silently to avoid endless recursion */); + return Vector<StackInfo>(); + } + + // TODO + // what if the StackFrame method is null (method_decl is empty). should we skip this frame? + // can reproduce with a MissingMethodException on internal calls + + sif.file = GDMonoMarshal::mono_string_to_godot(file_name); + sif.line = file_line_num; + sif.func = GDMonoMarshal::mono_string_to_godot(method_decl); + } + + return si; +} + void CSharpLanguage::frame() { const Ref<MonoGCHandle> &task_scheduler_handle = GDMonoUtils::mono_cache.task_scheduler_handle; @@ -1049,7 +1119,7 @@ bool CSharpInstance::has_method(const StringName &p_method) const { GDMonoClass *top = script->script_class; while (top && top != script->native) { - if (top->has_method(p_method)) { + if (top->has_fetched_method_unknown_params(p_method)) { return true; } @@ -1227,7 +1297,7 @@ ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) GDMonoClass *top = script->script_class; while (top && top != script->native) { - GDMonoMethod *method = top->get_method(p_method); + GDMonoMethod *method = top->get_fetched_method_unknown_params(p_method); if (method && !method->is_static()) return _member_get_rpc_mode(method); @@ -1610,7 +1680,7 @@ bool CSharpScript::_set(const StringName &p_name, const Variant &p_value) { void CSharpScript::_get_property_list(List<PropertyInfo> *p_properties) const { - p_properties->push_back(PropertyInfo(Variant::STRING, CSharpLanguage::singleton->string_names._script_source, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_properties->push_back(PropertyInfo(Variant::STRING, CSharpLanguage::singleton->string_names._script_source, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } void CSharpScript::_bind_methods() { @@ -1848,7 +1918,7 @@ void CSharpScript::set_source_code(const String &p_code) { bool CSharpScript::has_method(const StringName &p_method) const { - return script_class->has_method(p_method); + return script_class->has_fetched_method_unknown_params(p_method); } Error CSharpScript::reload(bool p_keep_state) { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 171601f3d8..3ce8a9b64e 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -303,7 +303,7 @@ public: /* TODO */ virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} /* TODO */ virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} /* TODO */ virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { return ""; } - /* TODO */ virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); } + virtual Vector<StackInfo> debug_get_current_stack_info(); /* PROFILING FUNCTIONS */ /* TODO */ virtual void profiling_start() {} @@ -335,6 +335,8 @@ public: virtual void *alloc_instance_binding_data(Object *p_object); virtual void free_instance_binding_data(void *p_data); + Vector<StackInfo> stack_trace_get_info(MonoObject *p_stack_trace); + CSharpLanguage(); ~CSharpLanguage(); }; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 2205ac4e98..800e3b723b 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -448,14 +448,14 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo compile_items.push_back(output_file); } - for (Map<StringName, TypeInterface>::Element *E = obj_types.front(); E; E = E->next()) { - const TypeInterface &itype = E->get(); + for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next()) { + const TypeInterface &itype = E.get(); if (itype.api_type == ClassDB::API_EDITOR) continue; - String output_file = path_join(obj_type_dir, E->get().proxy_name + ".cs"); - Error err = _generate_cs_type(E->get(), output_file); + String output_file = path_join(obj_type_dir, itype.proxy_name + ".cs"); + Error err = _generate_cs_type(itype, output_file); if (err == ERR_SKIP) continue; @@ -580,14 +580,14 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir, if (!solution.set_path(p_output_dir)) return ERR_FILE_NOT_FOUND; - for (Map<StringName, TypeInterface>::Element *E = obj_types.front(); E; E = E->next()) { - const TypeInterface &itype = E->get(); + for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next()) { + const TypeInterface &itype = E.get(); if (itype.api_type != ClassDB::API_EDITOR) continue; - String output_file = path_join(obj_type_dir, E->get().proxy_name + ".cs"); - Error err = _generate_cs_type(E->get(), output_file); + String output_file = path_join(obj_type_dir, itype.proxy_name + ".cs"); + Error err = _generate_cs_type(itype, output_file); if (err == ERR_SKIP) continue; @@ -945,7 +945,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str return ERR_BUG; } - Map<StringName, TypeInterface>::Element *object_itype = obj_types.find("Object"); + OrderedHashMap<StringName, TypeInterface>::Element object_itype = obj_types.find("Object"); if (!object_itype) { ERR_PRINT("BUG: Object type interface not found!"); @@ -953,7 +953,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str } output.push_back(MEMBER_BEGIN "public " CS_CLASS_SIGNALAWAITER " ToSignal("); - output.push_back(object_itype->get().cs_type); + output.push_back(object_itype.get().cs_type); output.push_back(" source, string signal)\n" OPEN_BLOCK_L2 "return new " CS_CLASS_SIGNALAWAITER "(source, signal, this);\n" CLOSE_BLOCK_L2); } @@ -999,9 +999,9 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte // Search it in base types too const TypeInterface *current_type = &p_itype; while (!setter && current_type->base_name != StringName()) { - Map<StringName, TypeInterface>::Element *base_match = obj_types.find(current_type->base_name); - ERR_FAIL_NULL_V(base_match, ERR_BUG); - current_type = &base_match->get(); + OrderedHashMap<StringName, TypeInterface>::Element base_match = obj_types.find(current_type->base_name); + ERR_FAIL_COND_V(!base_match, ERR_BUG); + current_type = &base_match.get(); setter = current_type->find_method_by_name(p_iprop.setter); } @@ -1010,9 +1010,9 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte // Search it in base types too current_type = &p_itype; while (!getter && current_type->base_name != StringName()) { - Map<StringName, TypeInterface>::Element *base_match = obj_types.find(current_type->base_name); - ERR_FAIL_NULL_V(base_match, ERR_BUG); - current_type = &base_match->get(); + OrderedHashMap<StringName, TypeInterface>::Element base_match = obj_types.find(current_type->base_name); + ERR_FAIL_COND_V(!base_match, ERR_BUG); + current_type = &base_match.get(); getter = current_type->find_method_by_name(p_iprop.getter); } @@ -1324,8 +1324,8 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) { generated_icall_funcs.clear(); - for (Map<StringName, TypeInterface>::Element *type_elem = obj_types.front(); type_elem; type_elem = type_elem->next()) { - const TypeInterface &itype = type_elem->get(); + for (OrderedHashMap<StringName, TypeInterface>::Element type_elem = obj_types.front(); type_elem; type_elem = type_elem.next()) { + const TypeInterface &itype = type_elem.get(); List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls; @@ -1631,20 +1631,20 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_by_name_or_null(const StringName &p_cname) { - const Map<StringName, TypeInterface>::Element *match = builtin_types.find(p_cname); + const Map<StringName, TypeInterface>::Element *builtin_type_match = builtin_types.find(p_cname); - if (match) - return &match->get(); + if (builtin_type_match) + return &builtin_type_match->get(); - match = obj_types.find(p_cname); + const OrderedHashMap<StringName, TypeInterface>::Element obj_type_match = obj_types.find(p_cname); - if (match) - return &match->get(); + if (obj_type_match) + return &obj_type_match.get(); - match = enum_types.find(p_cname); + const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(p_cname); - if (match) - return &match->get(); + if (enum_match) + return &enum_match->get(); return NULL; } @@ -2484,8 +2484,8 @@ void BindingsGenerator::initialize() { _generate_header_icalls(); - for (Map<StringName, TypeInterface>::Element *E = obj_types.front(); E; E = E->next()) - _generate_method_icalls(E->get()); + for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next()) + _generate_method_icalls(E.get()); _generate_method_icalls(builtin_types["NodePath"]); _generate_method_icalls(builtin_types["RID"]); diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 717a6b7a6b..8929b45cce 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -429,10 +429,11 @@ class BindingsGenerator { static bool verbose_output; + OrderedHashMap<StringName, TypeInterface> obj_types; + Map<StringName, TypeInterface> placeholder_types; Map<StringName, TypeInterface> builtin_types; Map<StringName, TypeInterface> enum_types; - Map<StringName, TypeInterface> obj_types; List<EnumInterface> global_enums; List<ConstantInterface> global_constants; diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp index da0a7b4fbd..9e48da68c1 100644 --- a/modules/mono/editor/godotsharp_editor.cpp +++ b/modules/mono/editor/godotsharp_editor.cpp @@ -151,7 +151,7 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int if (p_line >= 0) { args.push_back("-g"); - args.push_back(script_path + ":" + itos(p_line) + ":" + itos(p_col)); + args.push_back(script_path + ":" + itos(p_line + 1) + ":" + itos(p_col)); } else { args.push_back(script_path); } @@ -170,6 +170,11 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int monodevel_instance = memnew(MonoDevelopInstance(GodotSharpDirs::get_project_sln_path())); String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path()); + + if (p_line >= 0) { + script_path += ";" + itos(p_line + 1) + ";" + itos(p_col); + } + monodevel_instance->execute(script_path); } break; default: diff --git a/modules/mono/editor/monodevelop_instance.cpp b/modules/mono/editor/monodevelop_instance.cpp index 0b0b36e1e3..48a285561d 100644 --- a/modules/mono/editor/monodevelop_instance.cpp +++ b/modules/mono/editor/monodevelop_instance.cpp @@ -35,6 +35,8 @@ void MonoDevelopInstance::execute(const Vector<String> &p_files) { + _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN) + ERR_FAIL_NULL(execute_method); ERR_FAIL_COND(gc_handle.is_null()); diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs index db0e1fb744..f9e31e9703 100644 --- a/modules/mono/glue/cs_files/Color.cs +++ b/modules/mono/glue/cs_files/Color.cs @@ -336,7 +336,7 @@ namespace Godot this.r = (rgba & 0xFF) / 255.0f; } - private static float _parse_col(string str, int ofs) + private static int _parse_col(string str, int ofs) { int ig = 0; @@ -415,17 +415,17 @@ namespace Godot if (alpha) { - if ((int)_parse_col(color, 0) < 0) + if (_parse_col(color, 0) < 0) return false; } int from = alpha ? 2 : 0; - if ((int)_parse_col(color, from + 0) < 0) + if (_parse_col(color, from + 0) < 0) return false; - if ((int)_parse_col(color, from + 2) < 0) + if (_parse_col(color, from + 2) < 0) return false; - if ((int)_parse_col(color, from + 4) < 0) + if (_parse_col(color, from + 4) < 0) return false; return true; @@ -467,10 +467,10 @@ namespace Godot if (alpha) { - a = _parse_col(rgba, 0); + a = _parse_col(rgba, 0) / 255f; if (a < 0) - throw new ArgumentOutOfRangeException("Invalid color code. Alpha is " + a + " but zero or greater is expected: " + rgba); + throw new ArgumentOutOfRangeException("Invalid color code. Alpha part is not valid hexadecimal: " + rgba); } else { @@ -479,20 +479,20 @@ namespace Godot int from = alpha ? 2 : 0; - r = _parse_col(rgba, from + 0); + r = _parse_col(rgba, from + 0) / 255f; if (r < 0) - throw new ArgumentOutOfRangeException("Invalid color code. Red is " + r + " but zero or greater is expected: " + rgba); + throw new ArgumentOutOfRangeException("Invalid color code. Red part is not valid hexadecimal: " + rgba); - g = _parse_col(rgba, from + 2); + g = _parse_col(rgba, from + 2) / 255f; if (g < 0) - throw new ArgumentOutOfRangeException("Invalid color code. Green is " + g + " but zero or greater is expected: " + rgba); + throw new ArgumentOutOfRangeException("Invalid color code. Green part is not valid hexadecimal: " + rgba); - b = _parse_col(rgba, from + 4); + b = _parse_col(rgba, from + 4) / 255f; if (b < 0) - throw new ArgumentOutOfRangeException("Invalid color code. Blue is " + b + " but zero or greater is expected: " + rgba); + throw new ArgumentOutOfRangeException("Invalid color code. Blue part is not valid hexadecimal: " + rgba); } public static bool operator ==(Color left, Color right) diff --git a/modules/mono/glue/cs_files/DebuggingUtils.cs b/modules/mono/glue/cs_files/DebuggingUtils.cs new file mode 100644 index 0000000000..42ca57fbf9 --- /dev/null +++ b/modules/mono/glue/cs_files/DebuggingUtils.cs @@ -0,0 +1,83 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using System.Text; + +namespace Godot +{ + internal static class DebuggingUtils + { + internal static void AppendTypeName(this StringBuilder sb, Type type) + { + if (type.IsPrimitive) + sb.Append(type.Name); + else if (type == typeof(void)) + sb.Append("void"); + else + sb.Append(type.ToString()); + + sb.Append(" "); + } + + public static void GetStackFrameInfo(StackFrame frame, out string fileName, out int fileLineNumber, out string methodDecl) + { + fileName = frame.GetFileName(); + fileLineNumber = frame.GetFileLineNumber(); + + MethodBase methodBase = frame.GetMethod(); + + if (methodBase == null) + { + methodDecl = string.Empty; + return; + } + + StringBuilder sb = new StringBuilder(); + + if (methodBase is MethodInfo methodInfo) + sb.AppendTypeName(methodInfo.ReturnType); + + sb.Append(methodBase.DeclaringType.FullName); + sb.Append("."); + sb.Append(methodBase.Name); + + if (methodBase.IsGenericMethod) + { + Type[] genericParams = methodBase.GetGenericArguments(); + + sb.Append("<"); + + for (int j = 0; j < genericParams.Length; j++) + { + if (j > 0) + sb.Append(", "); + + sb.AppendTypeName(genericParams[j]); + } + + sb.Append(">"); + } + + sb.Append("("); + + bool varArgs = (methodBase.CallingConvention & CallingConventions.VarArgs) != 0; + + ParameterInfo[] parameter = methodBase.GetParameters(); + + for (int i = 0; i < parameter.Length; i++) + { + if (i > 0) + sb.Append(", "); + + if (i == parameter.Length - 1 && varArgs) + sb.Append("params "); + + sb.AppendTypeName(parameter[i].ParameterType); + } + + sb.Append(")"); + + methodDecl = sb.ToString(); + } + } +} diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index d4df7e0cb2..6c07c90f79 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -226,7 +226,7 @@ void GDMono::initialize() { mono_install_unhandled_exception_hook(gdmono_unhandled_exception_hook, NULL); - OS::get_singleton()->print("Mono: ALL IS GOOD\n"); + OS::get_singleton()->print("Mono: INITIALIZED\n"); } #ifndef MONO_GLUE_DISABLED diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp index d3315568cb..b826352f02 100644 --- a/modules/mono/mono_gd/gd_mono_class.cpp +++ b/modules/mono/mono_gd/gd_mono_class.cpp @@ -89,11 +89,6 @@ Vector<MonoClassField *> GDMonoClass::get_enum_fields() { } #endif -bool GDMonoClass::has_method(const StringName &p_name) { - - return get_method(p_name) != NULL; -} - bool GDMonoClass::has_attribute(GDMonoClass *p_attr_class) { #ifdef DEBUG_ENABLED @@ -225,7 +220,7 @@ void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base methods_fetched = true; } -GDMonoMethod *GDMonoClass::get_method(const StringName &p_name) { +GDMonoMethod *GDMonoClass::get_fetched_method_unknown_params(const StringName &p_name) { ERR_FAIL_COND_V(!methods_fetched, NULL); @@ -239,6 +234,11 @@ GDMonoMethod *GDMonoClass::get_method(const StringName &p_name) { return NULL; } +bool GDMonoClass::has_fetched_method_unknown_params(const StringName &p_name) { + + return get_fetched_method_unknown_params(p_name) != NULL; +} + GDMonoMethod *GDMonoClass::get_method(const StringName &p_name, int p_params_count) { MethodKey key = MethodKey(p_name, p_params_count); @@ -303,6 +303,8 @@ GDMonoMethod *GDMonoClass::get_method_with_desc(const String &p_description, boo MonoMethod *method = mono_method_desc_search_in_class(desc, mono_class); mono_method_desc_free(desc); + ERR_FAIL_COND_V(mono_method_get_class(method) != mono_class, NULL); + return get_method(method); } diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h index b6052ac0ed..f5895be144 100644 --- a/modules/mono/mono_gd/gd_mono_class.h +++ b/modules/mono/mono_gd/gd_mono_class.h @@ -112,7 +112,8 @@ public: Vector<MonoClassField *> get_enum_fields(); #endif - bool has_method(const StringName &p_name); + GDMonoMethod *get_fetched_method_unknown_params(const StringName &p_name); + bool has_fetched_method_unknown_params(const StringName &p_name); bool has_attribute(GDMonoClass *p_attr_class); MonoObject *get_attribute(GDMonoClass *p_attr_class); @@ -120,8 +121,7 @@ public: void fetch_attributes(); void fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base); - GDMonoMethod *get_method(const StringName &p_name); - GDMonoMethod *get_method(const StringName &p_name, int p_params_count); + GDMonoMethod *get_method(const StringName &p_name, int p_params_count = 0); GDMonoMethod *get_method(MonoMethod *p_raw_method); GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name); GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name, int p_params_count); diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index ff999b36f2..835a4614c1 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -31,6 +31,7 @@ #include "gd_mono_utils.h" #include "os/dir_access.h" +#include "os/os.h" #include "project_settings.h" #include "reference.h" @@ -43,16 +44,20 @@ namespace GDMonoUtils { MonoCache mono_cache; -#define CACHE_AND_CHECK(m_var, m_val) \ - { \ - m_var = m_val; \ - if (!m_var) ERR_PRINT("Mono Cache: Member " #m_var " is null. This is really bad!"); \ +#define CACHE_AND_CHECK(m_var, m_val) \ + { \ + m_var = m_val; \ + if (!m_var) { \ + ERR_EXPLAIN("Mono Cache: Member " #m_var " is null"); \ + ERR_FAIL(); \ + } \ } #define CACHE_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.class_##m_class, m_val) #define CACHE_NS_CLASS_AND_CHECK(m_ns, m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.class_##m_ns##_##m_class, m_val) #define CACHE_RAW_MONO_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.rawclass_##m_class, m_val) #define CACHE_FIELD_AND_CHECK(m_class, m_field, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.field_##m_class##_##m_field, m_val) +#define CACHE_METHOD_AND_CHECK(m_class, m_method, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.method_##m_class##_##m_method, m_val) #define CACHE_METHOD_THUNK_AND_CHECK(m_class, m_method, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.methodthunk_##m_class##_##m_method, m_val) void MonoCache::clear_members() { @@ -72,6 +77,13 @@ void MonoCache::clear_members() { class_String = NULL; class_IntPtr = NULL; +#ifdef DEBUG_ENABLED + class_System_Diagnostics_StackTrace = NULL; + methodthunk_System_Diagnostics_StackTrace_GetFrames = NULL; + method_System_Diagnostics_StackTrace_ctor_bool = NULL; + method_System_Diagnostics_StackTrace_ctor_Exception_bool = NULL; +#endif + rawclass_Dictionary = NULL; class_Vector2 = NULL; @@ -94,6 +106,11 @@ void MonoCache::clear_members() { class_WeakRef = NULL; class_MarshalUtils = NULL; +#ifdef DEBUG_ENABLED + class_DebuggingUtils = NULL; + methodthunk_DebuggingUtils_GetStackFrameInfo = NULL; +#endif + class_ExportAttribute = NULL; field_ExportAttribute_hint = NULL; field_ExportAttribute_hintString = NULL; @@ -119,6 +136,12 @@ void MonoCache::clear_members() { task_scheduler_handle = Ref<MonoGCHandle>(); } +void MonoCache::cleanup() { + + corlib_cache_updated = false; + godot_api_cache_updated = false; +} + #define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class)) void update_corlib_cache() { @@ -137,6 +160,15 @@ void update_corlib_cache() { CACHE_CLASS_AND_CHECK(double, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_double_class())); CACHE_CLASS_AND_CHECK(String, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_string_class())); CACHE_CLASS_AND_CHECK(IntPtr, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_intptr_class())); + +#ifdef DEBUG_ENABLED + CACHE_CLASS_AND_CHECK(System_Diagnostics_StackTrace, GDMono::get_singleton()->get_corlib_assembly()->get_class("System.Diagnostics", "StackTrace")); + CACHE_METHOD_THUNK_AND_CHECK(System_Diagnostics_StackTrace, GetFrames, (StackTrace_GetFrames)CACHED_CLASS(System_Diagnostics_StackTrace)->get_method("GetFrames")->get_thunk()); + CACHE_METHOD_AND_CHECK(System_Diagnostics_StackTrace, ctor_bool, CACHED_CLASS(System_Diagnostics_StackTrace)->get_method_with_desc("System.Diagnostics.StackTrace:.ctor(bool)", true)); + CACHE_METHOD_AND_CHECK(System_Diagnostics_StackTrace, ctor_Exception_bool, CACHED_CLASS(System_Diagnostics_StackTrace)->get_method_with_desc("System.Diagnostics.StackTrace:.ctor(System.Exception,bool)", true)); +#endif + + mono_cache.corlib_cache_updated = true; } void update_godot_api_cache() { @@ -161,6 +193,10 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(WeakRef, GODOT_API_CLASS(WeakRef)); CACHE_CLASS_AND_CHECK(MarshalUtils, GODOT_API_CLASS(MarshalUtils)); +#ifdef DEBUG_ENABLED + CACHE_CLASS_AND_CHECK(DebuggingUtils, GODOT_API_CLASS(DebuggingUtils)); +#endif + // Attributes CACHE_CLASS_AND_CHECK(ExportAttribute, GODOT_API_CLASS(ExportAttribute)); CACHE_FIELD_AND_CHECK(ExportAttribute, hint, CACHED_CLASS(ExportAttribute)->get_field("hint")); @@ -183,6 +219,10 @@ void update_godot_api_cache() { CACHE_METHOD_THUNK_AND_CHECK(SignalAwaiter, FailureCallback, (SignalAwaiter_FailureCallback)GODOT_API_CLASS(SignalAwaiter)->get_method("FailureCallback", 0)->get_thunk()); CACHE_METHOD_THUNK_AND_CHECK(GodotTaskScheduler, Activate, (GodotTaskScheduler_Activate)GODOT_API_CLASS(GodotTaskScheduler)->get_method("Activate", 0)->get_thunk()); +#ifdef DEBUG_ENABLED + CACHE_METHOD_THUNK_AND_CHECK(DebuggingUtils, GetStackFrameInfo, (DebugUtils_StackFrameInfo)GODOT_API_CLASS(DebuggingUtils)->get_method("GetStackFrameInfo", 4)->get_thunk()); +#endif + { /* * TODO Right now we only support Dictionary<object, object>. @@ -202,6 +242,8 @@ void update_godot_api_cache() { MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr()); mono_runtime_object_init(task_scheduler); mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler); + + mono_cache.corlib_cache_updated = true; } void clear_cache() { @@ -366,9 +408,50 @@ String get_exception_name_and_message(MonoObject *p_ex) { return res; } -void print_unhandled_exception(MonoObject *p_ex) { - ERR_PRINT(GDMonoUtils::get_exception_name_and_message(p_ex).utf8()); - mono_print_unhandled_exception(p_ex); +void print_unhandled_exception(MonoObject *p_exc) { + print_unhandled_exception(p_exc, false); +} + +void print_unhandled_exception(MonoObject *p_exc, bool p_recursion_caution) { + mono_print_unhandled_exception(p_exc); +#ifdef DEBUG_ENABLED + if (!ScriptDebugger::get_singleton()) + return; + + GDMonoClass *st_klass = CACHED_CLASS(System_Diagnostics_StackTrace); + MonoObject *stack_trace = mono_object_new(mono_domain_get(), st_klass->get_mono_ptr()); + + MonoBoolean need_file_info = true; + void *ctor_args[2] = { p_exc, &need_file_info }; + + MonoObject *unexpected_exc = NULL; + CACHED_METHOD(System_Diagnostics_StackTrace, ctor_Exception_bool)->invoke_raw(stack_trace, ctor_args, &unexpected_exc); + + if (unexpected_exc != NULL) { + mono_print_unhandled_exception(unexpected_exc); + + if (p_recursion_caution) { + // Called from CSharpLanguage::get_current_stack_info, + // so printing an error here could result in endless recursion + OS::get_singleton()->printerr("Mono: Method GDMonoUtils::print_unhandled_exception failed"); + return; + } else { + ERR_FAIL(); + } + } + + Vector<ScriptLanguage::StackInfo> si; + if (stack_trace != NULL && !p_recursion_caution) + si = CSharpLanguage::get_singleton()->stack_trace_get_info(stack_trace); + + String file = si.size() ? si[0].file : __FILE__; + String func = si.size() ? si[0].func : FUNCTION_STR; + int line = si.size() ? si[0].line : __LINE__; + String error_msg = "Unhandled exception"; + String exc_msg = GDMonoUtils::get_exception_name_and_message(p_exc); + + ScriptDebugger::get_singleton()->send_error(func, file, line, error_msg, exc_msg, ERR_HANDLER_ERROR, si); +#endif } } // namespace GDMonoUtils diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index 284585856e..2666433170 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -46,13 +46,10 @@ typedef MonoObject *(*MarshalUtils_ArraysToDict)(MonoArray *, MonoArray *, MonoO typedef MonoObject *(*SignalAwaiter_SignalCallback)(MonoObject *, MonoArray **, MonoObject **); typedef MonoObject *(*SignalAwaiter_FailureCallback)(MonoObject *, MonoObject **); typedef MonoObject *(*GodotTaskScheduler_Activate)(MonoObject *, MonoObject **); +typedef MonoArray *(*StackTrace_GetFrames)(MonoObject *, MonoObject **); +typedef void (*DebugUtils_StackFrameInfo)(MonoObject *, MonoString **, int *, MonoString **, MonoObject **); struct MonoCache { - // Format for cached classes in the Godot namespace: class_<Class> - // Macro: CACHED_CLASS(<Class>) - - // Format for cached classes in a different namespace: class_<Namespace>_<Class> - // Macro: CACHED_NS_CLASS(<Namespace>, <Class>) // ----------------------------------------------- // corlib classes @@ -73,6 +70,13 @@ struct MonoCache { GDMonoClass *class_String; GDMonoClass *class_IntPtr; +#ifdef DEBUG_ENABLED + GDMonoClass *class_System_Diagnostics_StackTrace; + StackTrace_GetFrames methodthunk_System_Diagnostics_StackTrace_GetFrames; + GDMonoMethod *method_System_Diagnostics_StackTrace_ctor_bool; + GDMonoMethod *method_System_Diagnostics_StackTrace_ctor_Exception_bool; +#endif + MonoClass *rawclass_Dictionary; // ----------------------------------------------- @@ -96,6 +100,11 @@ struct MonoCache { GDMonoClass *class_WeakRef; GDMonoClass *class_MarshalUtils; +#ifdef DEBUG_ENABLED + GDMonoClass *class_DebuggingUtils; + DebugUtils_StackFrameInfo methodthunk_DebuggingUtils_GetStackFrameInfo; +#endif + GDMonoClass *class_ExportAttribute; GDMonoField *field_ExportAttribute_hint; GDMonoField *field_ExportAttribute_hintString; @@ -120,10 +129,16 @@ struct MonoCache { Ref<MonoGCHandle> task_scheduler_handle; + bool corlib_cache_updated; + bool godot_api_cache_updated; + void clear_members(); - void cleanup() {} + void cleanup(); MonoCache() { + corlib_cache_updated = false; + godot_api_cache_updated = false; + clear_members(); } }; @@ -167,7 +182,8 @@ MonoDomain *create_domain(const String &p_friendly_name); String get_exception_name_and_message(MonoObject *p_ex); -void print_unhandled_exception(MonoObject *p_ex); +void print_unhandled_exception(MonoObject *p_exc); +void print_unhandled_exception(MonoObject *p_exc, bool p_recursion_caution); } // namespace GDMonoUtils @@ -175,9 +191,9 @@ void print_unhandled_exception(MonoObject *p_ex); #define CACHED_CLASS(m_class) (GDMonoUtils::mono_cache.class_##m_class) #define CACHED_CLASS_RAW(m_class) (GDMonoUtils::mono_cache.class_##m_class->get_mono_ptr()) -#define CACHED_NS_CLASS(m_ns, m_class) (GDMonoUtils::mono_cache.class_##m_ns##_##m_class) #define CACHED_RAW_MONO_CLASS(m_class) (GDMonoUtils::mono_cache.rawclass_##m_class) #define CACHED_FIELD(m_class, m_field) (GDMonoUtils::mono_cache.field_##m_class##_##m_field) +#define CACHED_METHOD(m_class, m_method) (GDMonoUtils::mono_cache.method_##m_class##_##m_method) #define CACHED_METHOD_THUNK(m_class, m_method) (GDMonoUtils::mono_cache.methodthunk_##m_class##_##m_method) #ifdef REAL_T_IS_DOUBLE diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml index 0217099ce6..b84a98ff6d 100644 --- a/modules/regex/doc_classes/RegExMatch.xml +++ b/modules/regex/doc_classes/RegExMatch.xml @@ -28,13 +28,6 @@ Returns the number of capturing groups. </description> </method> - <method name="get_names" qualifiers="const"> - <return type="Dictionary"> - </return> - <description> - Returns a dictionary of named groups and its corresponding group number. Only groups with that were matched are included. If multiple groups have the same name, that name would refer to the first matching one. - </description> - </method> <method name="get_start" qualifiers="const"> <return type="int"> </return> @@ -55,21 +48,18 @@ Returns an empty string if the group did not match or doesn't exist. </description> </method> - <method name="get_strings" qualifiers="const"> - <return type="Array"> - </return> - <description> - Returns an [Array] of the match and its capturing groups. - </description> - </method> - <method name="get_subject" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the source string used with the search pattern to find this matching result. - </description> - </method> </methods> + <members> + <member name="names" type="Dictionary" setter="" getter="get_names"> + A dictionary of named groups and its corresponding group number. Only groups with that were matched are included. If multiple groups have the same name, that name would refer to the first matching one. + </member> + <member name="strings" type="Array" setter="" getter="get_strings"> + An [Array] of the match and its capturing groups. + </member> + <member name="subject" type="String" setter="" getter="get_subject"> + The source string used with the search pattern to find this matching result. + </member> + </members> <constants> </constants> </class> diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 9bcbc4c4ea..6f2bb46fc8 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -156,6 +156,10 @@ void RegExMatch::_bind_methods() { ClassDB::bind_method(D_METHOD("get_string", "name"), &RegExMatch::get_string, DEFVAL(0)); ClassDB::bind_method(D_METHOD("get_start", "name"), &RegExMatch::get_start, DEFVAL(0)); ClassDB::bind_method(D_METHOD("get_end", "name"), &RegExMatch::get_end, DEFVAL(0)); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "subject"), "", "get_subject"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "names"), "", "get_names"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "strings"), "", "get_strings"); } void RegEx::_pattern_info(uint32_t what, void *where) const { @@ -343,15 +347,20 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a ERR_FAIL_COND_V(!is_valid(), String()); - String output; - output.resize(p_subject.length()); + // safety_zone is the number of chars we allocate in addition to the number of chars expected in order to + // guard against the PCRE API writing one additional \0 at the end. PCRE's API docs are unclear on whether + // PCRE understands outlength in pcre2_substitute() as counting an implicit additional terminating char or + // not. always allocating one char more than telling PCRE has us on the safe side. + const int safety_zone = 1; + + PCRE2_SIZE olength = p_subject.length() + 1; // space for output string and one terminating \0 character + Vector<CharType> output; + output.resize(olength + safety_zone); uint32_t flags = PCRE2_SUBSTITUTE_OVERFLOW_LENGTH; if (p_all) flags |= PCRE2_SUBSTITUTE_GLOBAL; - PCRE2_SIZE olength = output.length(); - PCRE2_SIZE length = p_subject.length(); if (p_end >= 0 && (uint32_t)p_end < length) length = p_end; @@ -363,15 +372,15 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a pcre2_match_context_16 *mctx = pcre2_match_context_create_16(gctx); PCRE2_SPTR16 s = (PCRE2_SPTR16)p_subject.c_str(); PCRE2_SPTR16 r = (PCRE2_SPTR16)p_replacement.c_str(); - PCRE2_UCHAR16 *o = (PCRE2_UCHAR16 *)output.c_str(); + PCRE2_UCHAR16 *o = (PCRE2_UCHAR16 *)output.ptrw(); pcre2_match_data_16 *match = pcre2_match_data_create_from_pattern_16(c, gctx); int res = pcre2_substitute_16(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); if (res == PCRE2_ERROR_NOMEMORY) { - output.resize(olength); - o = (PCRE2_UCHAR16 *)output.c_str(); + output.resize(olength + safety_zone); + o = (PCRE2_UCHAR16 *)output.ptrw(); res = pcre2_substitute_16(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); } @@ -388,15 +397,15 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a pcre2_match_context_32 *mctx = pcre2_match_context_create_32(gctx); PCRE2_SPTR32 s = (PCRE2_SPTR32)p_subject.c_str(); PCRE2_SPTR32 r = (PCRE2_SPTR32)p_replacement.c_str(); - PCRE2_UCHAR32 *o = (PCRE2_UCHAR32 *)output.c_str(); + PCRE2_UCHAR32 *o = (PCRE2_UCHAR32 *)output.ptrw(); pcre2_match_data_32 *match = pcre2_match_data_create_from_pattern_32(c, gctx); int res = pcre2_substitute_32(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); if (res == PCRE2_ERROR_NOMEMORY) { - output.resize(olength); - o = (PCRE2_UCHAR32 *)output.c_str(); + output.resize(olength + safety_zone); + o = (PCRE2_UCHAR32 *)output.ptrw(); res = pcre2_substitute_32(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); } @@ -407,7 +416,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a return String(); } - return output; + return String(output.ptr(), olength); } bool RegEx::is_valid() const { diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index d06bd79460..6a6ee390cc 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -263,8 +263,8 @@ float AudioStreamOGGVorbis::get_loop_offset() const { void AudioStreamOGGVorbis::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamOGGVorbis::set_data); - ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamOGGVorbis::get_data); + ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamOGGVorbis::set_data); + ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamOGGVorbis::get_data); ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop); @@ -272,7 +272,7 @@ void AudioStreamOGGVorbis::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset); ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop", "has_loop"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop_offset", "get_loop_offset"); } diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml index 4533d59cae..57fcc75887 100644 --- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml +++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml @@ -11,49 +11,13 @@ <demos> </demos> <methods> - <method name="get_data" qualifiers="const"> - <return type="PoolByteArray"> - </return> - <description> - </description> - </method> - <method name="get_loop_offset" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="has_loop" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_data"> - <return type="void"> - </return> - <argument index="0" name="data" type="PoolByteArray"> - </argument> - <description> - </description> - </method> - <method name="set_loop"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="set_loop_offset"> - <return type="void"> - </return> - <argument index="0" name="seconds" type="float"> - </argument> - <description> - </description> - </method> </methods> + <members> + <member name="loop" type="bool" setter="set_loop" getter="has_loop"> + </member> + <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset"> + </member> + </members> <constants> </constants> </class> diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index ac1e81859a..58c6d73ab2 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -724,5 +724,5 @@ void VideoStreamTheora::_bind_methods() { ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file); ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamTheora::get_file); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_file", "get_file"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_file", "get_file"); } diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml index 72ef586c1f..b42fc027cf 100644 --- a/modules/visual_script/doc_classes/VisualScriptYield.xml +++ b/modules/visual_script/doc_classes/VisualScriptYield.xml @@ -9,22 +9,10 @@ <demos> </demos> <methods> - <method name="get_yield_mode"> - <return type="int" enum="VisualScriptYield.YieldMode"> - </return> - <description> - </description> - </method> - <method name="set_yield_mode"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="VisualScriptYield.YieldMode"> - </argument> - <description> - </description> - </method> </methods> <members> + <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode"> + </member> <member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time"> </member> </members> diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index fd493978e6..5987fdf5da 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -130,7 +130,7 @@ void VisualScriptNode::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values); ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_default_input_values", "_get_default_input_values"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_default_input_values", "_get_default_input_values"); ADD_SIGNAL(MethodInfo("ports_changed")); } @@ -1319,7 +1319,7 @@ void VisualScript::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data", "data"), &VisualScript::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &VisualScript::_get_data); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); ADD_SIGNAL(MethodInfo("node_ports_changed", PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::INT, "id"))); } diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 130b243715..187c9b0b9e 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -425,7 +425,7 @@ void VisualScriptFunctionCall::_update_method_cache() { #ifdef DEBUG_METHODS_ENABLED - method_cache.return_val = mb->get_argument_info(-1); + method_cache.return_val = mb->get_return_info(); #endif if (mb->is_vararg()) { @@ -546,7 +546,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } @@ -739,7 +739,7 @@ void VisualScriptFunctionCall::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "singleton"), "set_singleton", "get_singleton"); ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path"); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "argument_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_argument_cache", "_get_argument_cache"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "argument_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_argument_cache", "_get_argument_cache"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "function"), "set_function", "get_function"); //when set, if loaded properly, will override argument count. ADD_PROPERTY(PropertyInfo(Variant::INT, "use_default_args"), "set_use_default_args", "get_use_default_args"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "validate"), "set_validate", "get_validate"); @@ -1350,7 +1350,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { if (property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } @@ -1493,7 +1493,7 @@ void VisualScriptPropertySet::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_type_cache", "_get_type_cache"); ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "property"), "set_property", "get_property"); @@ -2078,7 +2078,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { if (property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } @@ -2217,7 +2217,7 @@ void VisualScriptPropertyGet::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_type_cache", "_get_type_cache"); ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "property"), "set_property", "get_property"); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 1988eb0f5b..e0b4fde237 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -3107,8 +3107,8 @@ void VisualScriptConstructor::_bind_methods() { ClassDB::bind_method(D_METHOD("set_constructor", "constructor"), &VisualScriptConstructor::set_constructor); ClassDB::bind_method(D_METHOD("get_constructor"), &VisualScriptConstructor::get_constructor); - ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_constructor_type", "get_constructor_type"); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "constructor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_constructor", "get_constructor"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_constructor_type", "get_constructor_type"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "constructor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_constructor", "get_constructor"); } VisualScriptConstructor::VisualScriptConstructor() { @@ -3722,7 +3722,7 @@ void VisualScriptDeconstruct::_bind_methods() { } ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_deconstruct_type", "get_deconstruct_type"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "elem_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_elem_cache", "_get_elem_cache"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "elem_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_elem_cache", "_get_elem_cache"); } VisualScriptDeconstruct::VisualScriptDeconstruct() { diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index e6952d14d7..fac47225bc 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -436,7 +436,7 @@ void VideoStreamWebm::_bind_methods() { ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamWebm::set_file); ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamWebm::get_file); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_file", "get_file"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_file", "get_file"); } void VideoStreamWebm::set_audio_track(int p_track) { diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 89189ef1a0..7269e658b4 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -15,6 +15,7 @@ allprojects { repositories { jcenter() mavenCentral() + google() $$GRADLE_REPOSITORY_URLS$$ } } diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 37f25cc839..b5b0afb9e0 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -828,7 +828,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC //@Override public boolean dispatchTouchEvent (MotionEvent event) { public boolean gotTouchEvent(final MotionEvent event) { - super.onTouchEvent(event); final int evcount = event.getPointerCount(); if (evcount == 0) return true; @@ -842,6 +841,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC arr[i * 3 + 1] = (int)event.getX(i); arr[i * 3 + 2] = (int)event.getY(i); } + final int pointer_idx = event.getPointerId(event.getActionIndex()); //System.out.printf("gaction: %d\n",event.getAction()); final int action = event.getAction() & MotionEvent.ACTION_MASK; @@ -862,13 +862,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC */ } break; case MotionEvent.ACTION_POINTER_UP: { - final int indexPointUp = event.getActionIndex(); - final int pointer_idx = event.getPointerId(indexPointUp); GodotLib.touch(4, pointer_idx, evcount, arr); //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; case MotionEvent.ACTION_POINTER_DOWN: { - int pointer_idx = event.getActionIndex(); GodotLib.touch(3, pointer_idx, evcount, arr); //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index ca4895a2be..0222758c2b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -110,7 +110,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { @Override public boolean onTouchEvent(MotionEvent event) { - + super.onTouchEvent(event); return activity.gotTouchEvent(event); }; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 93272a1000..23811f963a 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -444,25 +444,27 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> } touch.clear(); } - } break; - case 3: { // add tuchi - - ERR_FAIL_INDEX(p_pointer, p_points.size()); + case 3: { // add touch - TouchPos tp = p_points[p_pointer]; - touch.push_back(tp); + for (int i = 0; i < p_points.size(); i++) { + if (p_points[i].id == p_pointer) { + TouchPos tp = p_points[i]; + touch.push_back(tp); - Ref<InputEventScreenTouch> ev; - ev.instance(); + Ref<InputEventScreenTouch> ev; + ev.instance(); - ev->set_index(tp.id); - ev->set_pressed(true); - ev->set_position(tp.pos); - input->parse_input_event(ev); + ev->set_index(tp.id); + ev->set_pressed(true); + ev->set_position(tp.pos); + input->parse_input_event(ev); + break; + } + } } break; - case 4: { + case 4: { // remove touch for (int i = 0; i < touch.size(); i++) { if (touch[i].id == p_pointer) { @@ -474,10 +476,10 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev->set_position(touch[i].pos); input->parse_input_event(ev); touch.remove(i); - i--; + + break; } } - } break; } } diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 99d44f3b5e..e3119814f4 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -407,7 +407,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name); if (err) { memdelete(da); - String err_str = String("Failed to export loading screen: ") + loading_screen_file; + String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file; ERR_PRINT(err_str.utf8().get_data()); return err; } diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 8472c3ccab..8c7a904bca 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -49,8 +49,14 @@ def configure(env): ## Build type if (env["target"] == "release"): - env.Append(CCFLAGS=['-O3']) - env.Append(LINKFLAGS=['-O3']) + # Use -Os to prioritize optimizing for reduced file size. This is + # particularly valuable for the web platform because it directly + # decreases download time. + # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about + # 100 KiB over -Os, which does not justify the negative impact on + # run-time performance. + env.Append(CCFLAGS=['-Os']) + env.Append(LINKFLAGS=['-Os']) elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index dc4bdc7efb..bca1851f40 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -138,13 +138,17 @@ } var actualCanvas = this.rtenv.canvas; - var context = false; + var testContext = false; + var testCanvas; try { - context = actualCanvas.getContext('webgl2') || actualCanvas.getContext('experimental-webgl2'); + testCanvas = document.createElement('canvas'); + testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2'); } catch (e) {} - if (!context) { + if (!testContext) { throw new Error("WebGL 2 not available"); } + testCanvas = null; + testContext = null; // canvas can grab focus on click if (actualCanvas.tabIndex < 0) { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 61f55beb4e..905bb9ae24 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -71,7 +71,7 @@ public: virtual void get_platform_features(List<String> *r_features) { r_features->push_back("web"); - r_features->push_back("JavaScript"); + r_features->push_back(get_os_name()); } EditorExportPlatformJavaScript(); @@ -130,7 +130,7 @@ String EditorExportPlatformJavaScript::get_name() const { String EditorExportPlatformJavaScript::get_os_name() const { - return "JavaScript"; + return "HTML5"; } Ref<Texture> EditorExportPlatformJavaScript::get_logo() const { diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index b10ef821dd..3590c30579 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -81,12 +81,6 @@ void OS_JavaScript::initialize_core() { FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES); } -void OS_JavaScript::set_opengl_extensions(const char *p_gl_extensions) { - - ERR_FAIL_COND(!p_gl_extensions); - gl_extensions = p_gl_extensions; -} - static EM_BOOL _browser_resize_callback(int event_type, const EmscriptenUiEvent *ui_event, void *user_data) { ERR_FAIL_COND_V(event_type != EMSCRIPTEN_EVENT_RESIZE, false); @@ -975,7 +969,25 @@ int OS_JavaScript::get_power_percent_left() { bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) { - return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available + if (p_feature == "HTML5" || p_feature == "web") + return true; + +#ifdef JAVASCRIPT_EVAL_ENABLED + if (p_feature == "JavaScript") + return true; +#endif + + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_get_current_context(); + // all extensions are already automatically enabled, this function allows + // checking WebGL extension support without inline JavaScript + if (p_feature == "s3tc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_s3tc_srgb")) + return true; + if (p_feature == "etc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc1")) + return true; + if (p_feature == "etc2" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc")) + return true; + + return false; } void OS_JavaScript::set_idbfs_available(bool p_idbfs_available) { @@ -992,7 +1004,6 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us set_cmdline(p_execpath, get_cmdline_args()); main_loop = NULL; - gl_extensions = NULL; window_maximized = false; soft_fs_enabled = false; canvas_size_adjustment_requested = false; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index ce4763ab64..f0ba9422e8 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -52,7 +52,6 @@ class OS_JavaScript : public OS_Unix { VisualServer *visual_server; AudioDriverJavaScript audio_driver_javascript; - const char *gl_extensions; InputDefault *input; Vector2 windowed_size; @@ -139,8 +138,6 @@ public: virtual bool has_touchscreen_ui_hint() const; - void set_opengl_extensions(const char *p_gl_extensions); - virtual Error shell_open(String p_uri); virtual String get_user_data_dir() const; String get_executable_path() const; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 23ca1e3fb9..c4efa1f0ff 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -359,6 +359,11 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } if (err == OK) { + print_line("Creating " + tmp_app_path_name + "/Contents/Frameworks"); + err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Frameworks"); + } + + if (err == OK) { print_line("Creating " + tmp_app_path_name + "/Contents/Resources"); err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources"); } @@ -502,10 +507,23 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p if (use_dmg()) { String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck"; - err = save_pack(p_preset, pack_path); + Vector<SharedObject> shared_objects; + Error err = save_pack(p_preset, pack_path, &shared_objects); // see if we can code sign our new package String identity = p_preset->get("codesign/identity"); + + if (err == OK) { + DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + for (int i = 0; i < shared_objects.size(); i++) { + da->copy(shared_objects[i].path, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file()); + if (err == OK && identity != "") { + err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file()); + } + } + memdelete(da); + } + if (err == OK && identity != "") { ep.step("Code signing bundle", 2); @@ -582,7 +600,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p ERR_CONTINUE(file.empty()); zipOpenNewFileInZip(dst_pkg_zip, - (pkg_name + ".app/Contents/MacOS/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(), + (pkg_name + ".app/Contents/Frameworks/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(), NULL, NULL, 0, diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm index 9d1a5566c9..6ccbaf896b 100644 --- a/platform/osx/godot_main_osx.mm +++ b/platform/osx/godot_main_osx.mm @@ -82,8 +82,17 @@ int main(int argc, char **argv) { #endif OS_OSX os; + Error err; + + if (os.open_with_filename != "") { + char *argv_c = (char *)malloc(os.open_with_filename.utf8().size()); + memcpy(argv_c, os.open_with_filename.utf8().get_data(), os.open_with_filename.utf8().size()); + err = Main::setup(argv[0], 1, &argv_c); + free(argv_c); + } else { + err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]); + } - Error err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]); if (err != OK) return 255; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 9423b6e1d6..c422eb9223 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -52,6 +52,21 @@ class OS_OSX : public OS_Unix { public: + enum { + KEY_EVENT_BUFFER_SIZE = 512 + }; + + struct KeyEvent { + unsigned int osx_state; + bool pressed; + bool echo; + uint32_t scancode; + uint32_t unicode; + }; + + KeyEvent key_event_buffer[KEY_EVENT_BUFFER_SIZE]; + int key_event_pos; + bool force_quit; // rasterizer seems to no longer be given to visual server, its using GLES3 directly? //Rasterizer *rasterizer; @@ -72,6 +87,7 @@ public: CGEventSourceRef eventSource; void process_events(); + void process_key_events(); void *framework; // pthread_key_t current; @@ -99,6 +115,8 @@ public: Size2 window_size; Rect2 restore_rect; + String open_with_filename; + Point2 im_position; ImeCallback im_callback; void *im_target; @@ -139,6 +157,8 @@ public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false); + virtual void set_cursor_shape(CursorShape p_shape); virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 19f33c814f..8369adbb5f 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -39,6 +39,8 @@ #include "servers/visual/visual_server_raster.h" #include "version_generated.gen.h" +#include <mach-o/dyld.h> + #include <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> #include <IOKit/IOCFPlugIn.h> @@ -49,6 +51,7 @@ #include <os/log.h> #endif +#include <dlfcn.h> #include <fcntl.h> #include <libproc.h> #include <stdio.h> @@ -141,6 +144,13 @@ static Vector2 get_mouse_pos(NSEvent *event) { @implementation GodotApplicationDelegate +- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename { + // Note: called before main loop init! + char *utfs = strdup([filename UTF8String]); + OS_OSX::singleton->open_with_filename.parse_utf8(utfs); + return YES; +} + - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); @@ -404,13 +414,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange { NSEvent *event = [NSApp currentEvent]; - Ref<InputEventKey> k; - k.instance(); - - get_key_modifier_state([event modifierFlags], k); - k->set_pressed(true); - k->set_echo(false); - k->set_scancode(0); NSString *characters; if ([aString isKindOfClass:[NSAttributedString class]]) { @@ -435,8 +438,15 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; if ((codepoint & 0xFF00) == 0xF700) continue; - k->set_unicode(codepoint); - OS_OSX::singleton->push_input(k); + OS_OSX::KeyEvent ke; + + ke.osx_state = [event modifierFlags]; + ke.pressed = true; + ke.echo = false; + ke.scancode = 0; + ke.unicode = codepoint; + + OS_OSX::singleton->key_event_buffer[OS_OSX::singleton->key_event_pos++] = ke; } [self cancelComposition]; } @@ -785,80 +795,87 @@ static int translateKey(unsigned int key) { - (void)keyDown:(NSEvent *)event { - Ref<InputEventKey> k; - k.instance(); - - get_key_modifier_state([event modifierFlags], k); - k->set_pressed(true); - k->set_scancode(latin_keyboard_keycode_convert(translateKey([event keyCode]))); - k->set_echo([event isARepeat]); + //disable raw input in IME mode + if (!imeMode) { + OS_OSX::KeyEvent ke; - NSString *characters = [event characters]; - NSUInteger i, length = [characters length]; + ke.osx_state = [event modifierFlags]; + ke.pressed = true; + ke.echo = [event isARepeat]; + ke.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode])); + ke.unicode = 0; - //disable raw input in IME mode - if (!imeMode) - OS_OSX::singleton->push_input(k); + OS_OSX::singleton->key_event_buffer[OS_OSX::singleton->key_event_pos++] = ke; + } if ((OS_OSX::singleton->im_position.x != 0) && (OS_OSX::singleton->im_position.y != 0)) [self interpretKeyEvents:[NSArray arrayWithObject:event]]; } - (void)flagsChanged:(NSEvent *)event { - Ref<InputEventKey> k; - k.instance(); - int key = [event keyCode]; - int mod = [event modifierFlags]; + if (!imeMode) { + OS_OSX::KeyEvent ke; - if (key == 0x36 || key == 0x37) { - if (mod & NSEventModifierFlagCommand) { - mod &= ~NSEventModifierFlagCommand; - k->set_pressed(true); - } else { - k->set_pressed(false); - } - } else if (key == 0x38 || key == 0x3c) { - if (mod & NSEventModifierFlagShift) { - mod &= ~NSEventModifierFlagShift; - k->set_pressed(true); - } else { - k->set_pressed(false); - } - } else if (key == 0x3a || key == 0x3d) { - if (mod & NSEventModifierFlagOption) { - mod &= ~NSEventModifierFlagOption; - k->set_pressed(true); - } else { - k->set_pressed(false); - } - } else if (key == 0x3b || key == 0x3e) { - if (mod & NSEventModifierFlagControl) { - mod &= ~NSEventModifierFlagControl; - k->set_pressed(true); + ke.echo = false; + + int key = [event keyCode]; + int mod = [event modifierFlags]; + + if (key == 0x36 || key == 0x37) { + if (mod & NSEventModifierFlagCommand) { + mod &= ~NSEventModifierFlagCommand; + ke.pressed = true; + } else { + ke.pressed = false; + } + } else if (key == 0x38 || key == 0x3c) { + if (mod & NSEventModifierFlagShift) { + mod &= ~NSEventModifierFlagShift; + ke.pressed = true; + } else { + ke.pressed = false; + } + } else if (key == 0x3a || key == 0x3d) { + if (mod & NSEventModifierFlagOption) { + mod &= ~NSEventModifierFlagOption; + ke.pressed = true; + } else { + ke.pressed = false; + } + } else if (key == 0x3b || key == 0x3e) { + if (mod & NSEventModifierFlagControl) { + mod &= ~NSEventModifierFlagControl; + ke.pressed = true; + } else { + ke.pressed = false; + } } else { - k->set_pressed(false); + return; } - } else { - return; - } - get_key_modifier_state(mod, k); - k->set_scancode(latin_keyboard_keycode_convert(translateKey(key))); + ke.osx_state = mod; + ke.scancode = latin_keyboard_keycode_convert(translateKey(key)); + ke.unicode = 0; - OS_OSX::singleton->push_input(k); + OS_OSX::singleton->key_event_buffer[OS_OSX::singleton->key_event_pos++] = ke; + } } - (void)keyUp:(NSEvent *)event { - Ref<InputEventKey> k; - k.instance(); + if (!imeMode) { + + OS_OSX::KeyEvent ke; - get_key_modifier_state([event modifierFlags], k); - k->set_pressed(false); - k->set_scancode(latin_keyboard_keycode_convert(translateKey([event keyCode]))); + ke.osx_state = [event modifierFlags]; + ke.pressed = false; + ke.echo = false; + ke.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode])); + ke.unicode = 0; - OS_OSX::singleton->push_input(k); + OS_OSX::singleton->key_event_buffer[OS_OSX::singleton->key_event_pos++] = ke; + } } inline void sendScrollEvent(int button, double factor, int modifierFlags) { @@ -1262,6 +1279,28 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) { [window release]; } +Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { + + String path = p_path; + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dylib files from within the executable path + path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); + } + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dylib files from a standard macOS location + path = get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(p_path.get_file()); + } + + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); + if (!p_library_handle) { + ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror()); + ERR_FAIL_V(ERR_CANT_OPEN); + } + return OK; +} + void OS_OSX::set_cursor_shape(CursorShape p_shape) { if (cursor_shape == p_shape) @@ -2035,11 +2074,49 @@ void OS_OSX::process_events() { [NSApp sendEvent:event]; } + process_key_events(); [autoreleasePool drain]; autoreleasePool = [[NSAutoreleasePool alloc] init]; } +void OS_OSX::process_key_events() { + + Ref<InputEventKey> k; + for (int i = 0; i < key_event_pos; i++) { + + KeyEvent &ke = key_event_buffer[i]; + + if ((i == 0 && ke.scancode == 0) || (i > 0 && key_event_buffer[i - 1].scancode == 0)) { + k.instance(); + + get_key_modifier_state(ke.osx_state, k); + k->set_pressed(ke.pressed); + k->set_echo(ke.echo); + k->set_scancode(0); + k->set_unicode(ke.unicode); + + push_input(k); + } + if (ke.scancode != 0) { + k.instance(); + + get_key_modifier_state(ke.osx_state, k); + k->set_pressed(ke.pressed); + k->set_echo(ke.echo); + k->set_scancode(ke.scancode); + + if (i + 1 < key_event_pos && key_event_buffer[i + 1].scancode == 0) { + k->set_unicode(key_event_buffer[i + 1].unicode); + } + + push_input(k); + } + } + + key_event_pos = 0; +} + void OS_OSX::push_input(const Ref<InputEvent> &p_event) { Ref<InputEvent> ev = p_event; @@ -2159,6 +2236,7 @@ OS_OSX *OS_OSX::singleton = NULL; OS_OSX::OS_OSX() { + key_event_pos = 0; mouse_mode = OS::MOUSE_MODE_VISIBLE; main_loop = NULL; singleton = this; @@ -2251,6 +2329,20 @@ OS_OSX::OS_OSX() { Vector<Logger *> loggers; loggers.push_back(memnew(OSXTerminalLogger)); _set_logger(memnew(CompositeLogger(loggers))); + + //process application:openFile: event + while (true) { + NSEvent *event = [NSApp + nextEventMatchingMask:NSEventMaskAny + untilDate:[NSDate distantPast] + inMode:NSDefaultRunLoopMode + dequeue:YES]; + + if (event == nil) + break; + + [NSApp sendEvent:event]; + } } bool OS_OSX::_check_internal_feature_support(const String &p_feature) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 4f4b225b14..5736ae1585 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -462,6 +462,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: case WM_LBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: case WM_RBUTTONDBLCLK: /*case WM_XBUTTONDOWN: case WM_XBUTTONUP: */ { @@ -520,6 +521,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) mb->set_button_index(2); mb->set_doubleclick(true); } break; + case WM_MBUTTONDBLCLK: { + + mb->set_pressed(true); + mb->set_button_index(3); + mb->set_doubleclick(true); + } break; case WM_MOUSEWHEEL: { mb->set_pressed(true); diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index a9d3a4cc64..f290a181ec 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -240,7 +240,7 @@ void SpriteFrames::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_animations"), &SpriteFrames::_set_animations); ClassDB::bind_method(D_METHOD("_get_animations"), &SpriteFrames::_get_animations); - ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_animations", "_get_animations"); //compatibility + ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_animations", "_get_animations"); //compatibility } SpriteFrames::SpriteFrames() { diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 6ecf661efd..6fff7ac0a4 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -170,7 +170,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, int p_instance, int p_ E->get().in_tree = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -197,7 +197,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, int p_instance, int p_ if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } @@ -271,7 +271,7 @@ void Area2D::_area_inout(int p_status, const RID &p_area, int p_instance, int p_ E->get().in_tree = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_entered, node); } @@ -298,7 +298,7 @@ void Area2D::_area_inout(int p_status, const RID &p_area, int p_instance, int p_ if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->area_exited, obj); } @@ -338,7 +338,7 @@ void Area2D::_clear_monitoring() { //ERR_CONTINUE(!node); node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (!E->get().in_tree) continue; @@ -368,7 +368,7 @@ void Area2D::_clear_monitoring() { //ERR_CONTINUE(!node); node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (!E->get().in_tree) continue; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 0a6d80d49c..e7e62a197c 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -143,7 +143,7 @@ Transform2D Camera2D::get_camera_transform() { if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) { - float c = smoothing * get_physics_process_delta_time(); + float c = smoothing * get_process_delta_time(); smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos; ret_camera_pos = smoothed_camera_pos; //camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing; @@ -217,14 +217,14 @@ void Camera2D::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_PHYSICS_PROCESS: { + case NOTIFICATION_INTERNAL_PROCESS: { _update_scroll(); } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (!is_physics_processing()) + if (!is_processing_internal()) _update_scroll(); } break; @@ -246,7 +246,7 @@ void Camera2D::_notification(int p_what) { add_to_group(canvas_group_name); if (Engine::get_singleton()->is_editor_hint()) { - set_physics_process(false); + set_process_internal(false); } _update_scroll(); @@ -503,9 +503,9 @@ void Camera2D::set_follow_smoothing(float p_speed) { smoothing = p_speed; if (smoothing > 0 && !(is_inside_tree() && Engine::get_singleton()->is_editor_hint())) - set_physics_process(true); + set_process_internal(true); else - set_physics_process(false); + set_process_internal(false); } float Camera2D::get_follow_smoothing() const { @@ -541,6 +541,7 @@ bool Camera2D::is_v_drag_enabled() const { void Camera2D::set_v_offset(float p_offset) { v_ofs = p_offset; + _update_scroll(); } float Camera2D::get_v_offset() const { @@ -551,6 +552,7 @@ float Camera2D::get_v_offset() const { void Camera2D::set_h_offset(float p_offset) { h_ofs = p_offset; + _update_scroll(); } float Camera2D::get_h_offset() const { @@ -713,6 +715,7 @@ void Camera2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotating"), "set_rotating", "is_rotating"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "current"), "_set_current", "is_current"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "zoom"), "set_zoom", "get_zoom"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "custom_viewport", PROPERTY_HINT_RESOURCE_TYPE, "Viewport", 0), "set_custom_viewport", "get_custom_viewport"); ADD_GROUP("Limit", "limit_"); ADD_PROPERTYI(PropertyInfo(Variant::INT, "limit_left"), "set_limit", "get_limit", MARGIN_LEFT); @@ -729,6 +732,10 @@ void Camera2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smoothing_enabled"), "set_enable_follow_smoothing", "is_follow_smoothing_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "smoothing_speed"), "set_follow_smoothing", "get_follow_smoothing"); + ADD_GROUP("Offset", "offset_"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset_v", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_v_offset", "get_v_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset_h", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_h_offset", "get_h_offset"); + ADD_GROUP("Drag Margin", "drag_margin_"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "drag_margin_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drag_margin", "get_drag_margin", MARGIN_LEFT); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "drag_margin_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drag_margin", "get_drag_margin", MARGIN_TOP); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 0854efc69c..12d6f32567 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1059,9 +1059,9 @@ void CanvasItem::_bind_methods() { ADD_GROUP("Material", ""); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial"), "set_material", "get_material"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "use_parent_material"), "set_use_parent_material", "get_use_parent_material"); - //exporting these two things doesn't really make much sense i think - //ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transform/toplevel"), "set_as_toplevel","is_set_as_toplevel") ; - //ADD_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),"set_transform_notify","is_transform_notify_enabled"); + //exporting these things doesn't really make much sense i think + // ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_as_toplevel", "is_set_as_toplevel"); + // ADD_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),"set_transform_notify","is_transform_notify_enabled"); ADD_SIGNAL(MethodInfo("draw")); ADD_SIGNAL(MethodInfo("visibility_changed")); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 965507e385..978fb379ac 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -115,6 +115,15 @@ Vector<Vector<Vector2> > CollisionPolygon2D::_decompose_in_convex() { return decomp; } +void CollisionPolygon2D::_update_in_shape_owner(bool p_xform_only) { + + parent->shape_owner_set_transform(owner_id, get_transform()); + if (p_xform_only) + return; + parent->shape_owner_set_disabled(owner_id, disabled); + parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); +} + void CollisionPolygon2D::_notification(int p_what) { switch (p_what) { @@ -124,9 +133,7 @@ void CollisionPolygon2D::_notification(int p_what) { if (parent) { owner_id = parent->create_shape_owner(this); _build_polygon(); - parent->shape_owner_set_transform(owner_id, get_transform()); - parent->shape_owner_set_disabled(owner_id, disabled); - parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); + _update_in_shape_owner(); } /*if (Engine::get_singleton()->is_editor_hint()) { @@ -136,10 +143,17 @@ void CollisionPolygon2D::_notification(int p_what) { }*/ } break; + case NOTIFICATION_ENTER_TREE: { + + if (parent) { + _update_in_shape_owner(); + } + + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (parent) { - parent->shape_owner_set_transform(owner_id, get_transform()); + _update_in_shape_owner(true); } } break; diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h index 83451f3f1a..4dafe7d1da 100644 --- a/scene/2d/collision_polygon_2d.h +++ b/scene/2d/collision_polygon_2d.h @@ -59,6 +59,8 @@ protected: void _build_polygon(); + void _update_in_shape_owner(bool p_xform_only = false); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index bf213614ed..0eeb6dafe5 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -45,6 +45,15 @@ void CollisionShape2D::_shape_changed() { update(); } +void CollisionShape2D::_update_in_shape_owner(bool p_xform_only) { + + parent->shape_owner_set_transform(owner_id, get_transform()); + if (p_xform_only) + return; + parent->shape_owner_set_disabled(owner_id, disabled); + parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); +} + void CollisionShape2D::_notification(int p_what) { switch (p_what) { @@ -57,9 +66,7 @@ void CollisionShape2D::_notification(int p_what) { if (shape.is_valid()) { parent->shape_owner_add_shape(owner_id, shape); } - parent->shape_owner_set_transform(owner_id, get_transform()); - parent->shape_owner_set_disabled(owner_id, disabled); - parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); + _update_in_shape_owner(); } /*if (Engine::get_singleton()->is_editor_hint()) { @@ -69,10 +76,17 @@ void CollisionShape2D::_notification(int p_what) { }*/ } break; + case NOTIFICATION_ENTER_TREE: { + + if (parent) { + _update_in_shape_owner(); + } + + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (parent) { - parent->shape_owner_set_transform(owner_id, get_transform()); + _update_in_shape_owner(true); } } break; diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h index b3f7d3f02a..cdff595828 100644 --- a/scene/2d/collision_shape_2d.h +++ b/scene/2d/collision_shape_2d.h @@ -47,6 +47,8 @@ class CollisionShape2D : public Node2D { bool disabled; bool one_way_collision; + void _update_in_shape_owner(bool p_xform_only = false); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 2625748f34..6e27bf1c1d 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -312,9 +312,9 @@ void NavigationPolygon::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_outlines", "outlines"), &NavigationPolygon::_set_outlines); ClassDB::bind_method(D_METHOD("_get_outlines"), &NavigationPolygon::_get_outlines); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_vertices", "get_vertices"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_polygons", "_get_polygons"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_outlines", "_get_outlines"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_outlines", "_get_outlines"); } NavigationPolygon::NavigationPolygon() : diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 71ba335f13..2c8f509bd3 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -244,66 +244,16 @@ bool PathFollow2D::get_cubic_interpolation() const { return cubic; } -bool PathFollow2D::_set(const StringName &p_name, const Variant &p_value) { - - if (p_name == SceneStringNames::get_singleton()->offset) { - set_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->unit_offset) { - set_unit_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->rotate) { - set_rotate(p_value); - } else if (p_name == SceneStringNames::get_singleton()->v_offset) { - set_v_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->h_offset) { - set_h_offset(p_value); - } else if (String(p_name) == "cubic_interp") { - set_cubic_interpolation(p_value); - } else if (String(p_name) == "loop") { - set_loop(p_value); - } else if (String(p_name) == "lookahead") { - set_lookahead(p_value); - } else - return false; - - return true; -} +void PathFollow2D::_validate_property(PropertyInfo &property) const { -bool PathFollow2D::_get(const StringName &p_name, Variant &r_ret) const { - - if (p_name == SceneStringNames::get_singleton()->offset) { - r_ret = get_offset(); - } else if (p_name == SceneStringNames::get_singleton()->unit_offset) { - r_ret = get_unit_offset(); - } else if (p_name == SceneStringNames::get_singleton()->rotate) { - r_ret = is_rotating(); - } else if (p_name == SceneStringNames::get_singleton()->v_offset) { - r_ret = get_v_offset(); - } else if (p_name == SceneStringNames::get_singleton()->h_offset) { - r_ret = get_h_offset(); - } else if (String(p_name) == "cubic_interp") { - r_ret = cubic; - } else if (String(p_name) == "loop") { - r_ret = loop; - } else if (String(p_name) == "lookahead") { - r_ret = lookahead; - } else - return false; - - return true; -} -void PathFollow2D::_get_property_list(List<PropertyInfo> *p_list) const { - - float max = 10000; - if (path && path->get_curve().is_valid()) - max = path->get_curve()->get_baked_length(); - p_list->push_back(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0," + rtos(max) + ",0.01")); - p_list->push_back(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR)); - p_list->push_back(PropertyInfo(Variant::REAL, "h_offset")); - p_list->push_back(PropertyInfo(Variant::REAL, "v_offset")); - p_list->push_back(PropertyInfo(Variant::BOOL, "rotate")); - p_list->push_back(PropertyInfo(Variant::BOOL, "cubic_interp")); - p_list->push_back(PropertyInfo(Variant::BOOL, "loop")); - p_list->push_back(PropertyInfo(Variant::REAL, "lookahead", PROPERTY_HINT_RANGE, "0.001,1024.0,0.001")); + if (property.name == "offset") { + + float max = 10000; + if (path && path->get_curve().is_valid()) + max = path->get_curve()->get_baked_length(); + + property.hint_string = "0," + rtos(max) + ",0.01"; + } } String PathFollow2D::get_configuration_warning() const { @@ -340,6 +290,18 @@ void PathFollow2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow2D::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow2D::has_loop); + + ClassDB::bind_method(D_METHOD("set_lookahead", "lookahead"), &PathFollow2D::set_lookahead); + ClassDB::bind_method(D_METHOD("get_lookahead"), &PathFollow2D::get_lookahead); + + ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01"), "set_offset", "get_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotate"), "set_rotate", "is_rotating"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cubic_interp"), "set_cubic_interpolation", "get_cubic_interpolation"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "lookahead", PROPERTY_HINT_RANGE, "0.001,1024.0,0.001"), "set_lookahead", "get_lookahead"); } void PathFollow2D::set_offset(float p_offset) { diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h index fd16f67219..735d289d74 100644 --- a/scene/2d/path_2d.h +++ b/scene/2d/path_2d.h @@ -74,9 +74,7 @@ private: void _update_transform(); protected: - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; + virtual void _validate_property(PropertyInfo &property) const; void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 60aebf5d09..1b25b3588a 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -310,7 +310,7 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap E->get().in_scene = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_scene) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -339,7 +339,7 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (in_scene) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } @@ -889,6 +889,7 @@ void RigidBody2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "inertia", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01", 0), "set_inertia", "get_inertia"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01", PROPERTY_USAGE_EDITOR), "set_weight", "get_weight"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce"); @@ -905,6 +906,9 @@ void RigidBody2D::_bind_methods() { ADD_GROUP("Angular", "angular_"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_velocity"), "set_angular_velocity", "get_angular_velocity"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_damp", PROPERTY_HINT_RANGE, "-1,128,0.01"), "set_angular_damp", "get_angular_damp"); + ADD_GROUP("Applied Forces", "applied_"); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "applied_force"), "set_applied_force", "get_applied_force"); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "applied_torque"), "set_applied_torque", "get_applied_torque"); ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 1b74256248..f6cb796b10 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -383,7 +383,8 @@ void Polygon2D::_bind_methods() { ADD_GROUP("Texture", "texture_"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_offset"), "set_texture_offset", "get_texture_offset"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_scale"), "set_texture_scale", "get_texture_scale"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation", PROPERTY_HINT_RANGE, "-1440,1440,0.1"), "set_texture_rotation_degrees", "get_texture_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1"), "set_texture_rotation_degrees", "get_texture_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation", PROPERTY_HINT_NONE, "", 0), "set_texture_rotation", "get_texture_rotation"); ADD_GROUP("Invert", "invert_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "invert_enable"), "set_invert", "get_invert"); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 5367e42aa9..361d765c97 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -999,8 +999,8 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) { bool flip_v = v & (1 << 30); bool transpose = v & (1 << 31); v &= (1 << 29) - 1; - int16_t coord_x; - int16_t coord_y; + int16_t coord_x = 0; + int16_t coord_y = 0; if (format == FORMAT_2) { coord_x = decode_uint16(&local[8]); coord_y = decode_uint16(&local[10]); @@ -1312,10 +1312,10 @@ bool TileMap::_get(const StringName &p_name, Variant &r_ret) const { void TileMap::_get_property_list(List<PropertyInfo> *p_list) const { - PropertyInfo p(Variant::INT, "format", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR); + PropertyInfo p(Variant::INT, "format", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL); p_list->push_back(p); - p = PropertyInfo(Variant::OBJECT, "tile_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR); + p = PropertyInfo(Variant::OBJECT, "tile_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL); p_list->push_back(p); } diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index c2227d9964..4b38534d97 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -219,7 +219,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->tree_exited, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); nodes[p_node] = meta; _change_node_state(p_node, false); } @@ -262,7 +262,7 @@ void VisibilityEnabler2D::_notification(int p_what) { if (!visible) _change_node_state(E->key(), true); - E->key()->disconnect(SceneStringNames::get_singleton()->tree_exited, this, "_node_removed"); + E->key()->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); } nodes.clear(); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 4089d80d4e..21f471039f 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -169,7 +169,7 @@ void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_bo E->get().in_tree = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -196,7 +196,7 @@ void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_bo if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } @@ -246,7 +246,7 @@ void Area::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->body_exited, obj); node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); } } @@ -276,7 +276,7 @@ void Area::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->area_exited, obj); node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); } } } @@ -366,7 +366,7 @@ void Area::_area_inout(int p_status, const RID &p_area, int p_instance, int p_ar E->get().in_tree = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_entered, node); } @@ -393,7 +393,7 @@ void Area::_area_inout(int p_status, const RID &p_area, int p_instance, int p_ar if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_exited, obj); } diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 96eb7eb6f4..fa4e6492a1 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -170,11 +170,11 @@ void BakedLightmapData::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_users"), &BakedLightmapData::clear_users); ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "octree", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_octree", "get_octree"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "cell_space_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_space_transform", "get_cell_space_transform"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_subdiv", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_subdiv", "get_cell_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_energy", "get_energy"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "user_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_user_data", "_get_user_data"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "octree", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_octree", "get_octree"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "user_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_user_data", "_get_user_data"); } BakedLightmapData::BakedLightmapData() { @@ -784,7 +784,7 @@ void BakedLightmap::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "capture_cell_size", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_capture_cell_size", "get_capture_cell_size"); ADD_GROUP("Data", ""); ADD_PROPERTY(PropertyInfo(Variant::STRING, "image_path", PROPERTY_HINT_DIR), "set_image_path", "get_image_path"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "light_data", PROPERTY_HINT_RESOURCE_TYPE, "BakedIndirectLightData"), "set_light_data", "get_light_data"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "light_data", PROPERTY_HINT_RESOURCE_TYPE, "BakedLightmapData"), "set_light_data", "get_light_data"); BIND_ENUM_CONSTANT(BAKE_QUALITY_LOW); BIND_ENUM_CONSTANT(BAKE_QUALITY_MEDIUM); diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index 3882b8548b..a875b65c22 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -30,43 +30,27 @@ #include "bone_attachment.h" -bool BoneAttachment::_get(const StringName &p_name, Variant &r_ret) const { +void BoneAttachment::_validate_property(PropertyInfo &property) const { - if (String(p_name) == "bone_name") { + if (property.name == "bone_name") { + Skeleton *parent = Object::cast_to<Skeleton>(get_parent()); - r_ret = get_bone_name(); - return true; - } - - return false; -} -bool BoneAttachment::_set(const StringName &p_name, const Variant &p_value) { - - if (String(p_name) == "bone_name") { - - set_bone_name(p_value); - return true; - } + if (parent) { - return false; -} -void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const { - - Skeleton *parent = Object::cast_to<Skeleton>(get_parent()); + String names; + for (int i = 0; i < parent->get_bone_count(); i++) { + if (i > 0) + names += ","; + names += parent->get_bone_name(i); + } - if (parent) { + property.hint = PROPERTY_HINT_ENUM; + property.hint_string = names; + } else { - String names; - for (int i = 0; i < parent->get_bone_count(); i++) { - if (i > 0) - names += ","; - names += parent->get_bone_name(i); + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; } - - p_list->push_back(PropertyInfo(Variant::STRING, "bone_name", PROPERTY_HINT_ENUM, names)); - } else { - - p_list->push_back(PropertyInfo(Variant::STRING, "bone_name")); } } @@ -138,4 +122,6 @@ BoneAttachment::BoneAttachment() { void BoneAttachment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bone_name", "bone_name"), &BoneAttachment::set_bone_name); ClassDB::bind_method(D_METHOD("get_bone_name"), &BoneAttachment::get_bone_name); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "bone_name"), "set_bone_name", "get_bone_name"); } diff --git a/scene/3d/bone_attachment.h b/scene/3d/bone_attachment.h index fa31642354..81a225015e 100644 --- a/scene/3d/bone_attachment.h +++ b/scene/3d/bone_attachment.h @@ -44,9 +44,7 @@ class BoneAttachment : public Spatial { void _check_unbind(); protected: - bool _get(const StringName &p_name, Variant &r_ret) const; - bool _set(const StringName &p_name, const Variant &p_value); - void _get_property_list(List<PropertyInfo> *p_list) const; + virtual void _validate_property(PropertyInfo &property) const; void _notification(int p_what); static void _bind_methods(); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index ef1b33a4e2..3a77360bc2 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -73,6 +73,14 @@ void CollisionPolygon::_build_polygon() { } } +void CollisionPolygon::_update_in_shape_owner(bool p_xform_only) { + + parent->shape_owner_set_transform(owner_id, get_transform()); + if (p_xform_only) + return; + parent->shape_owner_set_disabled(owner_id, disabled); +} + void CollisionPolygon::_notification(int p_what) { switch (p_what) { @@ -82,14 +90,20 @@ void CollisionPolygon::_notification(int p_what) { if (parent) { owner_id = parent->create_shape_owner(this); _build_polygon(); - parent->shape_owner_set_transform(owner_id, get_transform()); - parent->shape_owner_set_disabled(owner_id, disabled); + _update_in_shape_owner(); } } break; + case NOTIFICATION_ENTER_TREE: { + + if (parent) { + _update_in_shape_owner(); + } + + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (parent) { - parent->shape_owner_set_transform(owner_id, get_transform()); + _update_in_shape_owner(true); } } break; diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h index 6643cfa044..971c67f1ad 100644 --- a/scene/3d/collision_polygon.h +++ b/scene/3d/collision_polygon.h @@ -51,6 +51,8 @@ protected: void _build_polygon(); + void _update_in_shape_owner(bool p_xform_only = false); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index d6d49a197c..943f4158f7 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -64,6 +64,14 @@ void CollisionShape::make_convex_from_brothers() { } } +void CollisionShape::_update_in_shape_owner(bool p_xform_only) { + + parent->shape_owner_set_transform(owner_id, get_transform()); + if (p_xform_only) + return; + parent->shape_owner_set_disabled(owner_id, disabled); +} + void CollisionShape::_notification(int p_what) { switch (p_what) { @@ -75,19 +83,20 @@ void CollisionShape::_notification(int p_what) { if (shape.is_valid()) { parent->shape_owner_add_shape(owner_id, shape); } - parent->shape_owner_set_transform(owner_id, get_transform()); - parent->shape_owner_set_disabled(owner_id, disabled); + _update_in_shape_owner(); } } break; case NOTIFICATION_ENTER_TREE: { + if (parent) { + _update_in_shape_owner(); + } if (get_tree()->is_debugging_collisions_hint()) { _create_debug_shape(); } - } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (parent) { - parent->shape_owner_set_transform(owner_id, get_transform()); + _update_in_shape_owner(true); } } break; case NOTIFICATION_UNPARENTED: { diff --git a/scene/3d/collision_shape.h b/scene/3d/collision_shape.h index 724a025165..c9c91a5824 100644 --- a/scene/3d/collision_shape.h +++ b/scene/3d/collision_shape.h @@ -51,6 +51,8 @@ class CollisionShape : public Spatial { void _create_debug_shape(); + void _update_in_shape_owner(bool p_xform_only = false); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index ce9e801385..4ad2eb60ee 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -535,7 +535,7 @@ void GIProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData"), "set_probe_data", "get_probe_data"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data"); BIND_ENUM_CONSTANT(SUBDIV_64); BIND_ENUM_CONSTANT(SUBDIV_128); diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 5ec5b8b6c7..073e56fdb4 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -405,8 +405,8 @@ void NavigationMesh::_bind_methods() { BIND_CONSTANT(SAMPLE_PARTITION_MONOTONE); BIND_CONSTANT(SAMPLE_PARTITION_LAYERS); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_vertices", "get_vertices"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_polygons", "_get_polygons"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons"); ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type"); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 219464ae1f..8617bbc2f6 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -1597,4 +1597,21 @@ ParticlesMaterial::ParticlesMaterial() : } ParticlesMaterial::~ParticlesMaterial() { + + if (material_mutex) + material_mutex->lock(); + + if (shader_map.has(current_key)) { + shader_map[current_key].users--; + if (shader_map[current_key].users == 0) { + //deallocate shader, as it's no longer in use + VS::get_singleton()->free(shader_map[current_key].shader); + shader_map.erase(current_key); + } + + VS::get_singleton()->material_set_shader(_get_material(), RID()); + } + + if (material_mutex) + material_mutex->unlock(); } diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index afe4dd3f46..7ac7f74bb0 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -190,61 +190,16 @@ bool PathFollow::get_cubic_interpolation() const { return cubic; } -bool PathFollow::_set(const StringName &p_name, const Variant &p_value) { - - if (p_name == SceneStringNames::get_singleton()->offset) { - set_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->unit_offset) { - set_unit_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->rotation_mode) { - set_rotation_mode(RotationMode(p_value.operator int())); - } else if (p_name == SceneStringNames::get_singleton()->v_offset) { - set_v_offset(p_value); - } else if (p_name == SceneStringNames::get_singleton()->h_offset) { - set_h_offset(p_value); - } else if (String(p_name) == "cubic_interp") { - set_cubic_interpolation(p_value); - } else if (String(p_name) == "loop") { - set_loop(p_value); - } else - return false; - - return true; -} +void PathFollow::_validate_property(PropertyInfo &property) const { -bool PathFollow::_get(const StringName &p_name, Variant &r_ret) const { - - if (p_name == SceneStringNames::get_singleton()->offset) { - r_ret = get_offset(); - } else if (p_name == SceneStringNames::get_singleton()->unit_offset) { - r_ret = get_unit_offset(); - } else if (p_name == SceneStringNames::get_singleton()->rotation_mode) { - r_ret = get_rotation_mode(); - } else if (p_name == SceneStringNames::get_singleton()->v_offset) { - r_ret = get_v_offset(); - } else if (p_name == SceneStringNames::get_singleton()->h_offset) { - r_ret = get_h_offset(); - } else if (String(p_name) == "cubic_interp") { - r_ret = cubic; - } else if (String(p_name) == "loop") { - r_ret = loop; - } else - return false; - - return true; -} -void PathFollow::_get_property_list(List<PropertyInfo> *p_list) const { - - float max = 10000; - if (path && path->get_curve().is_valid()) - max = path->get_curve()->get_baked_length(); - p_list->push_back(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0," + rtos(max) + ",0.01")); - p_list->push_back(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR)); - p_list->push_back(PropertyInfo(Variant::REAL, "h_offset")); - p_list->push_back(PropertyInfo(Variant::REAL, "v_offset")); - p_list->push_back(PropertyInfo(Variant::INT, "rotation_mode", PROPERTY_HINT_ENUM, "None,Y,XY,XYZ")); - p_list->push_back(PropertyInfo(Variant::BOOL, "cubic_interp")); - p_list->push_back(PropertyInfo(Variant::BOOL, "loop")); + if (property.name == "offset") { + + float max = 10000; + if (path && path->get_curve().is_valid()) + max = path->get_curve()->get_baked_length(); + + property.hint_string = "0," + rtos(max) + ",0.01"; + } } void PathFollow::_bind_methods() { @@ -270,6 +225,14 @@ void PathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01"), "set_offset", "get_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "rotation_mode", PROPERTY_HINT_ENUM, "None,Y,XY,XYZ"), "set_rotation_mode", "get_rotation_mode"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cubic_interp"), "set_cubic_interpolation", "get_cubic_interpolation"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop"); + BIND_ENUM_CONSTANT(ROTATION_NONE); BIND_ENUM_CONSTANT(ROTATION_Y); BIND_ENUM_CONSTANT(ROTATION_XY); diff --git a/scene/3d/path.h b/scene/3d/path.h index fe57103d25..2ed686ac3c 100644 --- a/scene/3d/path.h +++ b/scene/3d/path.h @@ -79,9 +79,7 @@ private: void _update_transform(); protected: - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; + virtual void _validate_property(PropertyInfo &property) const; void _notification(int p_what); static void _bind_methods(); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 7d638d8737..a15a7dcead 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -318,7 +318,7 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, E->get().in_tree = node && node->is_inside_tree(); if (node) { node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -345,7 +345,7 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, if (node) { node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index 332eb3c740..c7556c0c5f 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -115,7 +115,7 @@ public: MODE_KINEMATIC, }; -private: +protected: bool can_sleep; PhysicsDirectBodyState *state; Mode mode; @@ -178,9 +178,8 @@ private: void _body_exit_tree(ObjectID p_id); void _body_inout(int p_status, ObjectID p_instance, int p_body_shape, int p_local_shape); - void _direct_state_changed(Object *p_state); + virtual void _direct_state_changed(Object *p_state); -protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index f719a0356b..101d9ed70c 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -112,11 +112,6 @@ void ProximityGroup::_new_group(StringName p_name) { groups[p_name] = group_version; }; -void ProximityGroup::set_group_name(String p_group_name) { - - group_name = p_group_name; -}; - void ProximityGroup::_notification(int p_what) { switch (p_what) { @@ -153,9 +148,24 @@ void ProximityGroup::_proximity_group_broadcast(String p_name, Variant p_params) }; }; -void ProximityGroup::set_dispatch_mode(int p_mode) { +void ProximityGroup::set_group_name(const String &p_group_name) { + + group_name = p_group_name; +}; + +String ProximityGroup::get_group_name() const { - dispatch_mode = (DispatchMode)p_mode; + return group_name; +}; + +void ProximityGroup::set_dispatch_mode(DispatchMode p_mode) { + + dispatch_mode = p_mode; +}; + +ProximityGroup::DispatchMode ProximityGroup::get_dispatch_mode() const { + + return dispatch_mode; }; void ProximityGroup::set_grid_radius(const Vector3 &p_radius) { @@ -171,15 +181,22 @@ Vector3 ProximityGroup::get_grid_radius() const { void ProximityGroup::_bind_methods() { ClassDB::bind_method(D_METHOD("set_group_name", "name"), &ProximityGroup::set_group_name); - ClassDB::bind_method(D_METHOD("broadcast", "name", "parameters"), &ProximityGroup::broadcast); + ClassDB::bind_method(D_METHOD("get_group_name"), &ProximityGroup::get_group_name); ClassDB::bind_method(D_METHOD("set_dispatch_mode", "mode"), &ProximityGroup::set_dispatch_mode); - ClassDB::bind_method(D_METHOD("_proximity_group_broadcast", "name", "params"), &ProximityGroup::_proximity_group_broadcast); + ClassDB::bind_method(D_METHOD("get_dispatch_mode"), &ProximityGroup::get_dispatch_mode); ClassDB::bind_method(D_METHOD("set_grid_radius", "radius"), &ProximityGroup::set_grid_radius); ClassDB::bind_method(D_METHOD("get_grid_radius"), &ProximityGroup::get_grid_radius); + ClassDB::bind_method(D_METHOD("broadcast", "name", "parameters"), &ProximityGroup::broadcast); + ClassDB::bind_method(D_METHOD("_proximity_group_broadcast", "name", "params"), &ProximityGroup::_proximity_group_broadcast); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "group_name"), "set_group_name", "get_group_name"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "dispatch_mode", PROPERTY_HINT_ENUM, "Proxy,Signal"), "set_dispatch_mode", "get_dispatch_mode"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "grid_radius"), "set_grid_radius", "get_grid_radius"); - ADD_SIGNAL(MethodInfo("broadcast", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::ARRAY, "parameters"))); + ADD_SIGNAL(MethodInfo("broadcast", PropertyInfo(Variant::STRING, "group_name"), PropertyInfo(Variant::ARRAY, "parameters"))); + + BIND_ENUM_CONSTANT(MODE_PROXY); + BIND_ENUM_CONSTANT(MODE_SIGNAL); }; ProximityGroup::ProximityGroup() { diff --git a/scene/3d/proximity_group.h b/scene/3d/proximity_group.h index aae44e0be5..448f30bf80 100644 --- a/scene/3d/proximity_group.h +++ b/scene/3d/proximity_group.h @@ -67,15 +67,21 @@ public: static void _bind_methods(); public: - void set_group_name(String p_group_name); - void broadcast(String p_name, Variant p_params); - void set_dispatch_mode(int p_mode); + void set_group_name(const String &p_group_name); + String get_group_name() const; + + void set_dispatch_mode(DispatchMode p_mode); + DispatchMode get_dispatch_mode() const; void set_grid_radius(const Vector3 &p_radius); Vector3 get_grid_radius() const; + void broadcast(String p_name, Variant p_params); + ProximityGroup(); ~ProximityGroup(); }; +VARIANT_ENUM_CAST(ProximityGroup::DispatchMode); + #endif diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 556774a0d1..dd5ae8a999 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -217,6 +217,8 @@ void RayCast::_update_raycast_state() { against_shape = rr.shape; } else { collided = false; + against = 0; + against_shape = 0; } } diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 9e3a9ac27f..2178da02b5 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -195,7 +195,7 @@ void ReflectionProbe::_validate_property(PropertyInfo &property) const { if (property.name == "interior/ambient_color" || property.name == "interior/ambient_energy" || property.name == "interior/ambient_contrib") { if (!interior) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } } diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index b3740dba68..721641e09b 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -788,7 +788,9 @@ void Spatial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); ADD_GROUP("Visibility", ""); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible"); - //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM,"transform/local"), "set_transform", "get_transform") ; +#ifdef TOOLS_ENABLED + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "SpatialGizmo", 0), "set_gizmo", "get_gizmo"); +#endif ADD_SIGNAL(MethodInfo("visibility_changed")); } diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp index 75da3a7911..c547e76e30 100644 --- a/scene/3d/spatial_velocity_tracker.cpp +++ b/scene/3d/spatial_velocity_tracker.cpp @@ -125,6 +125,8 @@ void SpatialVelocityTracker::_bind_methods() { ClassDB::bind_method(D_METHOD("update_position", "position"), &SpatialVelocityTracker::update_position); ClassDB::bind_method(D_METHOD("get_tracked_linear_velocity"), &SpatialVelocityTracker::get_tracked_linear_velocity); ClassDB::bind_method(D_METHOD("reset", "position"), &SpatialVelocityTracker::reset); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "track_physics_step"), "set_track_physics_step", "is_tracking_physics_step"); } SpatialVelocityTracker::SpatialVelocityTracker() { diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index bc968b0a5f..aeee51c4b2 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -375,7 +375,7 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) { Basis steeringMat(up, steering); - Basis rotatingMat(right, -wheel.m_rotation); + Basis rotatingMat(right, wheel.m_rotation); /* if (p_idx==1) @@ -816,26 +816,24 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { void VehicleBody::_direct_state_changed(Object *p_state) { - PhysicsDirectBodyState *s = Object::cast_to<PhysicsDirectBodyState>(p_state); + RigidBody::_direct_state_changed(p_state); - set_ignore_transform_notification(true); - set_global_transform(s->get_transform()); - set_ignore_transform_notification(false); + state = Object::cast_to<PhysicsDirectBodyState>(p_state); - float step = s->get_step(); + float step = state->get_step(); for (int i = 0; i < wheels.size(); i++) { - _update_wheel(i, s); + _update_wheel(i, state); } for (int i = 0; i < wheels.size(); i++) { - _ray_cast(i, s); - wheels[i]->set_transform(s->get_transform().inverse() * wheels[i]->m_worldTransform); + _ray_cast(i, state); + wheels[i]->set_transform(state->get_transform().inverse() * wheels[i]->m_worldTransform); } - _update_suspension(s); + _update_suspension(state); for (int i = 0; i < wheels.size(); i++) { @@ -848,21 +846,21 @@ void VehicleBody::_direct_state_changed(Object *p_state) { suspensionForce = wheel.m_maxSuspensionForce; } Vector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step; - Vector3 relpos = wheel.m_raycastInfo.m_contactPointWS - s->get_transform().origin; + Vector3 relpos = wheel.m_raycastInfo.m_contactPointWS - state->get_transform().origin; - s->apply_impulse(relpos, impulse); + state->apply_impulse(relpos, impulse); //getRigidBody()->applyImpulse(impulse, relpos); } - _update_friction(s); + _update_friction(state); for (int i = 0; i < wheels.size(); i++) { VehicleWheel &wheel = *wheels[i]; - Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - s->get_transform().origin; - Vector3 vel = s->get_linear_velocity() + (s->get_angular_velocity()).cross(relpos); // * mPos); + Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - state->get_transform().origin; + Vector3 vel = state->get_linear_velocity() + (state->get_angular_velocity()).cross(relpos); // * mPos); if (wheel.m_raycastInfo.m_isInContact) { - const Transform &chassisWorldTransform = s->get_transform(); + const Transform &chassisWorldTransform = state->get_transform(); Vector3 fwd( chassisWorldTransform.basis[0][Vector3::AXIS_Z], @@ -883,29 +881,8 @@ void VehicleBody::_direct_state_changed(Object *p_state) { wheel.m_deltaRotation *= real_t(0.99); //damping of rotation when not in contact } - linear_velocity = s->get_linear_velocity(); -} - -void VehicleBody::set_mass(real_t p_mass) { - - mass = p_mass; - PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_MASS, mass); -} - -real_t VehicleBody::get_mass() const { - return mass; -} - -void VehicleBody::set_friction(real_t p_friction) { - - friction = p_friction; - PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, friction); -} - -real_t VehicleBody::get_friction() const { - - return friction; + state = NULL; } void VehicleBody::set_engine_force(float p_engine_force) { @@ -936,18 +913,8 @@ float VehicleBody::get_steering() const { return m_steeringValue; } -Vector3 VehicleBody::get_linear_velocity() const { - return linear_velocity; -} - void VehicleBody::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mass", "mass"), &VehicleBody::set_mass); - ClassDB::bind_method(D_METHOD("get_mass"), &VehicleBody::get_mass); - - ClassDB::bind_method(D_METHOD("set_friction", "friction"), &VehicleBody::set_friction); - ClassDB::bind_method(D_METHOD("get_friction"), &VehicleBody::get_friction); - ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody::set_engine_force); ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody::get_engine_force); @@ -957,21 +924,14 @@ void VehicleBody::_bind_methods() { ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody::set_steering); ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody::get_steering); - ClassDB::bind_method(D_METHOD("get_linear_velocity"), &VehicleBody::get_linear_velocity); - - ClassDB::bind_method(D_METHOD("_direct_state_changed"), &VehicleBody::_direct_state_changed); - ADD_GROUP("Motion", ""); ADD_PROPERTY(PropertyInfo(Variant::REAL, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01"), "set_engine_force", "get_engine_force"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering"); - ADD_GROUP("Mass", ""); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_RANGE, "0.01,65536,0.01"), "set_mass", "get_mass"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0.01,1,0.01"), "set_friction", "get_friction"); } VehicleBody::VehicleBody() : - PhysicsBody(PhysicsServer::BODY_MODE_RIGID) { + RigidBody() { m_pitchControl = 0; m_currentVehicleSpeedKmHour = real_t(0.); @@ -982,10 +942,11 @@ VehicleBody::VehicleBody() : friction = 1; + state = NULL; ccd = false; exclude.insert(get_rid()); - PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); + //PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); set_mass(40); } diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index 1c7dacf5ac..7810a42e8a 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -139,20 +139,13 @@ public: VehicleWheel(); }; -class VehicleBody : public PhysicsBody { +class VehicleBody : public RigidBody { - GDCLASS(VehicleBody, PhysicsBody); - - real_t mass; - real_t friction; + GDCLASS(VehicleBody, RigidBody); float engine_force; float brake; - Vector3 linear_velocity; - Vector3 angular_velocity; - bool ccd; - real_t m_pitchControl; real_t m_steeringValue; real_t m_currentVehicleSpeedKmHour; @@ -192,12 +185,6 @@ class VehicleBody : public PhysicsBody { void _direct_state_changed(Object *p_state); public: - void set_mass(real_t p_mass); - real_t get_mass() const; - - void set_friction(real_t p_friction); - real_t get_friction() const; - void set_engine_force(float p_engine_force); float get_engine_force() const; @@ -207,8 +194,6 @@ public: void set_steering(float p_steering); float get_steering() const; - Vector3 get_linear_velocity() const; - VehicleBody(); }; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index a8818a06c3..9d6e4941f3 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -170,7 +170,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->tree_exited, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); nodes[p_node] = meta; _change_node_state(p_node, false); } @@ -208,7 +208,7 @@ void VisibilityEnabler::_notification(int p_what) { if (!visible) _change_node_state(E->key(), true); - E->key()->disconnect(SceneStringNames::get_singleton()->tree_exited, this, "_node_removed"); + E->key()->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); } nodes.clear(); @@ -240,7 +240,7 @@ void VisibilityEnabler::_node_removed(Node *p_node) { if (!visible) _change_node_state(p_node, true); - p_node->disconnect(SceneStringNames::get_singleton()->tree_exited, this, "_node_removed"); + p_node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); nodes.erase(p_node); } diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index df83be6d50..949a0be3bc 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -56,7 +56,7 @@ void AnimationCache::_clear_cache() { while (connected_nodes.size()) { - connected_nodes.front()->get()->disconnect("tree_exited", this, "_node_exit_tree"); + connected_nodes.front()->get()->disconnect("tree_exiting", this, "_node_exit_tree"); connected_nodes.erase(connected_nodes.front()); } path_cache.clear(); @@ -181,7 +181,7 @@ void AnimationCache::_update_cache() { if (!connected_nodes.has(path.node)) { connected_nodes.insert(path.node); - path.node->connect("tree_exited", this, "_node_exit_tree", Node::make_binds(path.node), CONNECT_ONESHOT); + path.node->connect("tree_exiting", this, "_node_exit_tree", Node::make_binds(path.node), CONNECT_ONESHOT); } } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index f56e8fa9e3..d1829ce4d4 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -49,24 +49,15 @@ bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; - if (p_name == SceneStringNames::get_singleton()->playback_speed || p_name == SceneStringNames::get_singleton()->speed) { //bw compatibility - set_speed_scale(p_value); + if (name.begins_with("playback/play")) { // bw compatibility - } else if (p_name == SceneStringNames::get_singleton()->playback_active) { - set_active(p_value); - } else if (name.begins_with("playback/play")) { + set_current_animation(p_value); - String which = p_value; - - if (which == "[stop]") - stop(); - else - play(which); } else if (name.begins_with("anims/")) { String which = name.get_slicec('/', 1); - add_animation(which, p_value); + } else if (name.begins_with("next/")) { String which = name.get_slicec('/', 1); @@ -100,24 +91,15 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const { String name = p_name; - if (name == "playback/speed") { //bw compatibility + if (name == "playback/play") { // bw compatibility - r_ret = speed_scale; - } else if (name == "playback/active") { - - r_ret = is_active(); - } else if (name == "playback/play") { - - if (is_active() && is_playing()) - r_ret = playback.assigned; - else - r_ret = "[stop]"; + r_ret = get_current_animation(); } else if (name.begins_with("anims/")) { String which = name.get_slicec('/', 1); - r_ret = get_animation(which).get_ref_ptr(); + } else if (name.begins_with("next/")) { String which = name.get_slicec('/', 1); @@ -150,18 +132,37 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const { return true; } -void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const { +void AnimationPlayer::_validate_property(PropertyInfo &property) const { + + if (property.name == "current_animation") { + List<String> names; + + for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) { + names.push_back(E->key()); + } + names.sort(); + names.push_front("[stop]"); + String hint; + for (List<String>::Element *E = names.front(); E; E = E->next()) { - List<String> names; + if (E != names.front()) + hint += ","; + hint += E->get(); + } + + property.hint_string = hint; + } +} + +void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const { List<PropertyInfo> anim_names; for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) { - anim_names.push_back(PropertyInfo(Variant::OBJECT, "anims/" + String(E->key()), PROPERTY_HINT_RESOURCE_TYPE, "Animation", PROPERTY_USAGE_NOEDITOR)); + anim_names.push_back(PropertyInfo(Variant::OBJECT, "anims/" + String(E->key()), PROPERTY_HINT_RESOURCE_TYPE, "Animation", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE)); if (E->get().next != StringName()) - anim_names.push_back(PropertyInfo(Variant::STRING, "next/" + String(E->key()), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - names.push_back(E->key()); + anim_names.push_back(PropertyInfo(Variant::STRING, "next/" + String(E->key()), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } anim_names.sort(); @@ -170,23 +171,7 @@ void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(E->get()); } - { - names.sort(); - names.push_front("[stop]"); - String hint; - for (List<String>::Element *E = names.front(); E; E = E->next()) { - - if (E != names.front()) - hint += ","; - hint += E->get(); - } - - p_list->push_back(PropertyInfo(Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint, PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ANIMATE_AS_TRIGGER)); - p_list->push_back(PropertyInfo(Variant::BOOL, "playback/active", PROPERTY_HINT_NONE, "")); - p_list->push_back(PropertyInfo(Variant::REAL, "playback/speed", PROPERTY_HINT_RANGE, "-64,64,0.01")); - } - - p_list->push_back(PropertyInfo(Variant::ARRAY, "blend_times", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::ARRAY, "blend_times", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::STRING, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } @@ -276,8 +261,8 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { } { - if (!child->is_connected("tree_exited", this, "_node_removed")) - child->connect("tree_exited", this, "_node_removed", make_binds(child), CONNECT_ONESHOT); + if (!child->is_connected("tree_exiting", this, "_node_removed")) + child->connect("tree_exiting", this, "_node_removed", make_binds(child), CONNECT_ONESHOT); } TrackNodeCacheKey key; @@ -990,23 +975,29 @@ bool AnimationPlayer::is_playing() const { }; return true; - */ + */ } void AnimationPlayer::set_current_animation(const String &p_anim) { - if (is_playing()) { + if (p_anim == "[stop]" || p_anim == "") { + stop(); + } else if (!is_playing() || playback.assigned != p_anim) { play(p_anim); } else { - ERR_FAIL_COND(!animation_set.has(p_anim)); - playback.current.pos = 0; - playback.current.from = &animation_set[p_anim]; - playback.assigned = p_anim; + // Same animation, do not replay from start } + + /* + ERR_FAIL_COND(!animation_set.has(p_anim)); + playback.current.pos = 0; + playback.current.from = &animation_set[p_anim]; + playback.assigned = p_anim; + */ } String AnimationPlayer::get_current_animation() const { - return (playback.assigned); + return (is_playing() ? playback.assigned : ""); } void AnimationPlayer::stop(bool p_reset) { @@ -1033,8 +1024,10 @@ float AnimationPlayer::get_speed_scale() const { void AnimationPlayer::seek(float p_time, bool p_update) { if (!playback.current.from) { - if (playback.assigned) - set_current_animation(playback.assigned); + if (playback.assigned) { + ERR_FAIL_COND(!animation_set.has(playback.assigned)); + playback.current.from = &animation_set[playback.assigned]; + } ERR_FAIL_COND(!playback.current.from); } @@ -1047,8 +1040,10 @@ void AnimationPlayer::seek(float p_time, bool p_update) { void AnimationPlayer::seek_delta(float p_time, float p_delta) { if (!playback.current.from) { - if (playback.assigned) - set_current_animation(playback.assigned); + if (playback.assigned) { + ERR_FAIL_COND(!animation_set.has(playback.assigned)); + playback.current.from = &animation_set[playback.assigned]; + } ERR_FAIL_COND(!playback.current.from); } @@ -1334,14 +1329,21 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false)); ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance); + ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ANIMATE_AS_TRIGGER), "set_current_animation", "get_current_animation"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_autoplay", "get_autoplay"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "current_animation_length", PROPERTY_HINT_NONE, "", 0), "", "get_current_animation_length"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "current_animation_position", PROPERTY_HINT_NONE, "", 0), "", "get_current_animation_position"); + ADD_GROUP("Playback Options", "playback_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_animation_process_mode", "get_animation_process_mode"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time"); - ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playback_active", PROPERTY_HINT_NONE, "", 0), "set_active", "is_active"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_speed", PROPERTY_HINT_RANGE, "-64,64,0.01"), "set_speed_scale", "get_speed_scale"); - ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "name"))); + ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "anim_name"))); ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name"))); - ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name"))); + ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "anim_name"))); BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index ef17e5adac..ef1720443f 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -251,6 +251,7 @@ private: protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; + virtual void _validate_property(PropertyInfo &property) const; void _get_property_list(List<PropertyInfo> *p_list) const; void _notification(int p_what); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 3fc68fc5e8..000dbb9cbd 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -223,7 +223,9 @@ void Tween::_bind_methods() { ADD_SIGNAL(MethodInfo("tween_step", PropertyInfo(Variant::OBJECT, "object"), PropertyInfo(Variant::STRING, "key"), PropertyInfo(Variant::REAL, "elapsed"), PropertyInfo(Variant::OBJECT, "value"))); ADD_SIGNAL(MethodInfo("tween_completed", PropertyInfo(Variant::OBJECT, "object"), PropertyInfo(Variant::STRING, "key"))); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "repeat"), "set_repeat", "is_repeat"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_tween_process_mode", "get_tween_process_mode"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_speed", PROPERTY_HINT_RANGE, "-64,64,0.01"), "set_speed_scale", "get_speed_scale"); BIND_ENUM_CONSTANT(TWEEN_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index d765248cca..8b9469021c 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -504,12 +504,12 @@ void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group); BIND_VMETHOD(MethodInfo("_pressed")); - BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "pressed"))); + BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "button_pressed"))); ADD_SIGNAL(MethodInfo("pressed")); ADD_SIGNAL(MethodInfo("button_up")); ADD_SIGNAL(MethodInfo("button_down")); - ADD_SIGNAL(MethodInfo("toggled", PropertyInfo(Variant::BOOL, "pressed"))); + ADD_SIGNAL(MethodInfo("toggled", PropertyInfo(Variant::BOOL, "button_pressed"))); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed"); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 08a39e9e79..30bcc48149 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -484,6 +484,10 @@ void ColorPicker::_bind_methods() { ClassDB::bind_method(D_METHOD("_preset_input"), &ColorPicker::_preset_input); ClassDB::bind_method(D_METHOD("_screen_input"), &ColorPicker::_screen_input); + ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "raw_mode"), "set_raw_mode", "is_raw_mode"); + ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color"))); } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 979a65f455..d4ed0db6ea 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1357,24 +1357,32 @@ float Control::_a2s(float p_val, float p_anchor, float p_range) const { } void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) { - bool pushed = false; + float parent_range = _get_parent_range((p_margin == MARGIN_LEFT || p_margin == MARGIN_RIGHT) ? 0 : 1); + float previous_margin_pos = data.margin[p_margin] + data.anchor[p_margin] * parent_range; + float previous_opposite_margin_pos = data.margin[(p_margin + 2) % 4] + data.anchor[(p_margin + 2) % 4] * parent_range; + data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0); if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) || ((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) { if (p_push_opposite_anchor) { data.anchor[(p_margin + 2) % 4] = data.anchor[p_margin]; - pushed = true; } else { data.anchor[p_margin] = data.anchor[(p_margin + 2) % 4]; } } - if (is_inside_tree()) { - if (p_keep_margin) { - _size_changed(); + if (!p_keep_margin) { + data.margin[p_margin] = _s2a(previous_margin_pos, data.anchor[p_margin], parent_range); + if (p_push_opposite_anchor) { + data.margin[(p_margin + 2) % 4] = _s2a(previous_opposite_margin_pos, data.anchor[(p_margin + 2) % 4], parent_range); } } + + if (is_inside_tree()) { + _size_changed(); + } + update(); _change_notify(); } @@ -2832,6 +2840,7 @@ void Control::_bind_methods() { ADD_GROUP("Rect", "rect_"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position"); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_global_position", PROPERTY_HINT_NONE, "", 0), "set_global_position", "get_global_position"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_degrees", "get_rotation_degrees"); @@ -2849,9 +2858,11 @@ void Control::_bind_methods() { ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_bottom"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_BOTTOM); ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_next"), "set_focus_next", "get_focus_next"); ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_previous"), "set_focus_previous", "get_focus_previous"); + ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode"); ADD_GROUP("Mouse", "mouse_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertial split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape"); ADD_GROUP("Size Flags", "size_flags_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags"); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index c4b2685012..58717edbae 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -793,6 +793,15 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mode_overrides_title"), "set_mode_overrides_title", "is_mode_overriding_title"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"), "set_filters", "get_filters"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir"), "set_current_dir", "get_current_dir"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file"), "set_current_file", "get_current_file"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path"); + ADD_SIGNAL(MethodInfo("file_selected", PropertyInfo(Variant::STRING, "path"))); ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::POOL_STRING_ARRAY, "paths"))); ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir"))); @@ -806,12 +815,6 @@ void FileDialog::_bind_methods() { BIND_ENUM_CONSTANT(ACCESS_RESOURCES); BIND_ENUM_CONSTANT(ACCESS_USERDATA); BIND_ENUM_CONSTANT(ACCESS_FILESYSTEM); - - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mode_overrides_title"), "set_mode_overrides_title", "is_mode_overriding_title"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"), "set_filters", "get_filters"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); } void FileDialog::set_show_hidden_files(bool p_show) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b8451d2f10..1b5014367b 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1180,6 +1180,12 @@ void GraphEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "right_disconnects"), "set_right_disconnects", "is_right_disconnects_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scroll_offset"), "set_scroll_ofs", "get_scroll_ofs"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "snap_distance"), "set_snap", "get_snap"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_snap"), "set_use_snap", "is_using_snap"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "zoom"), "set_zoom", "get_zoom"); + ADD_SIGNAL(MethodInfo("connection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "p_position"))); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index c5d5da1219..24857d49fa 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -705,8 +705,12 @@ void GraphNode::_bind_methods() { ClassDB::bind_method(D_METHOD("get_overlay"), &GraphNode::get_overlay); ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_close"), "set_show_close_button", "is_close_button_visible"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable"), "set_resizable", "is_resizable"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selected"), "set_selected", "is_selected"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "comment"), "set_comment", "is_comment"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "overlay", PROPERTY_HINT_ENUM, "Disabled,Breakpoint,Position"), "set_overlay", "get_overlay"); ADD_SIGNAL(MethodInfo("offset_changed")); ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to"))); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 3b3d7164b6..77d3a34c66 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1419,7 +1419,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_items"), &ItemList::_set_items); ClassDB::bind_method(D_METHOD("_get_items"), &ItemList::_get_items); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_items", "_get_items"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select"); @@ -1432,6 +1432,7 @@ void ItemList::_bind_methods() { ADD_GROUP("Icon", ""); ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_mode", PROPERTY_HINT_ENUM, "Top,Left"), "set_icon_mode", "get_icon_mode"); ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "icon_scale"), "set_icon_scale", "get_icon_scale"); + ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size"); BIND_ENUM_CONSTANT(ICON_MODE_TOP); BIND_ENUM_CONSTANT(ICON_MODE_LEFT); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 0a1d42c5e1..830f724b3c 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -564,6 +564,7 @@ void Label::set_visible_characters(int p_amount) { if (get_total_character_count() > 0) { percent_visible = (float)p_amount / (float)total_char_cache; } + _change_notify("percent_visible"); update(); } @@ -584,6 +585,7 @@ void Label::set_percent_visible(float p_percent) { visible_chars = get_total_character_count() * p_percent; percent_visible = p_percent; } + _change_notify("visible_chars"); update(); } @@ -665,6 +667,7 @@ void Label::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "autowrap"), "set_autowrap", "has_autowrap"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "is_clipping_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "uppercase"), "set_uppercase", "is_uppercase"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1", PROPERTY_USAGE_EDITOR), "set_visible_characters", "get_visible_characters"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible"); ADD_PROPERTY(PropertyInfo(Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE, "0,999,1"), "set_lines_skipped", "get_lines_skipped"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE, "-1,999,1"), "set_max_lines_visible", "get_max_lines_visible"); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 53f609723f..524a68a116 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1413,8 +1413,8 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled); ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled); - ADD_SIGNAL(MethodInfo("text_changed", PropertyInfo(Variant::STRING, "text"))); - ADD_SIGNAL(MethodInfo("text_entered", PropertyInfo(Variant::STRING, "text"))); + ADD_SIGNAL(MethodInfo("text_changed", PropertyInfo(Variant::STRING, "new_text"))); + ADD_SIGNAL(MethodInfo("text_entered", PropertyInfo(Variant::STRING, "new_text"))); BIND_ENUM_CONSTANT(ALIGN_LEFT); BIND_ENUM_CONSTANT(ALIGN_CENTER); @@ -1437,13 +1437,14 @@ void LineEdit::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "secret"), "set_secret", "is_secret"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "expand_to_text_length"), "set_expand_to_text_length", "get_expand_to_text_length"); ADD_PROPERTY(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled"); ADD_GROUP("Placeholder", "placeholder_"); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "placeholder_text"), "set_placeholder", "get_placeholder"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "placeholder_alpha", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_placeholder_alpha", "get_placeholder_alpha"); ADD_GROUP("Caret", "caret_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_blink"), "cursor_set_blink_enabled", "cursor_get_blink_enabled"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret_blink_speed", PROPERTY_HINT_RANGE, "0.1,10,0.1"), "cursor_set_blink_speed", "cursor_get_blink_speed"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "caret_position"), "set_cursor_position", "get_cursor_position"); } LineEdit::LineEdit() { diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index d25bd00f37..2e74faa61d 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -89,7 +89,7 @@ void MenuButton::_bind_methods() { ClassDB::bind_method(D_METHOD("_get_items"), &MenuButton::_get_items); ClassDB::bind_method(D_METHOD("set_disable_shortcuts", "disabled"), &MenuButton::set_disable_shortcuts); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_items", "_get_items"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); ADD_SIGNAL(MethodInfo("about_to_show")); } diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index ba35e6cd19..1a46921561 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -319,7 +319,7 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("_get_items"), &OptionButton::_get_items); ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_items", "_get_items"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "ID"))); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index d7987d4a19..89000fcde1 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -305,11 +305,15 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { case BUTTON_WHEEL_DOWN: { - _scroll(-b->get_factor(), b->get_position()); + if (get_global_position().y + get_size().y > get_viewport_rect().size.y) { + _scroll(-b->get_factor(), b->get_position()); + } } break; case BUTTON_WHEEL_UP: { - _scroll(b->get_factor(), b->get_position()); + if (get_global_position().y < 0) { + _scroll(b->get_factor(), b->get_position()); + } } break; case BUTTON_LEFT: { @@ -380,7 +384,9 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventPanGesture> pan_gesture = p_event; if (pan_gesture.is_valid()) { - _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position()); + if (get_global_position().y + get_size().y > get_viewport_rect().size.y || get_global_position().y < 0) { + _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position()); + } } } @@ -1217,9 +1223,10 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("_submenu_timeout"), &PopupMenu::_submenu_timeout); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_items", "_get_items"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "hide_on_item_selection"), "set_hide_on_item_selection", "is_hide_on_item_selection"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "hide_on_checkable_item_selection"), "set_hide_on_checkable_item_selection", "is_hide_on_checkable_item_selection"); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "hide_on_state_item_selection"), "set_hide_on_state_item_selection", "is_hide_on_state_item_selection"); ADD_SIGNAL(MethodInfo("id_pressed", PropertyInfo(Variant::INT, "ID"))); ADD_SIGNAL(MethodInfo("index_pressed", PropertyInfo(Variant::INT, "index"))); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index a74a577898..cd6c6bb65c 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -248,6 +248,7 @@ void Range::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "set_step", "get_step"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "page"), "set_page", "get_page"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "value"), "set_value", "get_value"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ratio", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_as_ratio", "get_as_ratio"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exp_edit"), "set_exp_ratio", "is_ratio_exp"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rounded"), "set_use_rounded_values", "is_using_rounded_values"); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 49618d0138..a7419519ae 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2045,6 +2045,15 @@ void RichTextLabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_underlined"), "set_meta_underline", "is_meta_underlined"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_size", PROPERTY_HINT_RANGE, "0,24,1"), "set_tab_size", "get_tab_size"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "text"), "set_text", "get_text"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_active"), "set_scroll_active", "is_scroll_active"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_following"), "set_scroll_follow", "is_scroll_following"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selection_enabled"), "set_selection_enabled", "is_selection_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_selected_font_color"), "set_override_selected_font_color", "is_overriding_selected_font_color"); ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index d54500bc51..95fcda2db3 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -323,14 +323,14 @@ void ScrollBar::_notification(int p_what) { if (drag_slave) { drag_slave->connect("gui_input", this, "_drag_slave_input"); - drag_slave->connect("tree_exited", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT); + drag_slave->connect("tree_exiting", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT); } } if (p_what == NOTIFICATION_EXIT_TREE) { if (drag_slave) { drag_slave->disconnect("gui_input", this, "_drag_slave_input"); - drag_slave->disconnect("tree_exited", this, "_drag_slave_exit"); + drag_slave->disconnect("tree_exiting", this, "_drag_slave_exit"); } drag_slave = NULL; @@ -655,7 +655,7 @@ void ScrollBar::set_drag_slave(const NodePath &p_path) { if (drag_slave) { drag_slave->disconnect("gui_input", this, "_drag_slave_input"); - drag_slave->disconnect("tree_exited", this, "_drag_slave_exit"); + drag_slave->disconnect("tree_exiting", this, "_drag_slave_exit"); } } @@ -671,7 +671,7 @@ void ScrollBar::set_drag_slave(const NodePath &p_path) { if (drag_slave) { drag_slave->connect("gui_input", this, "_drag_slave_input"); - drag_slave->connect("tree_exited", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT); + drag_slave->connect("tree_exiting", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT); } } } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 1e324a303e..413edca218 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -468,8 +468,10 @@ void ScrollContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_v_scroll"), &ScrollContainer::get_v_scroll); ADD_GROUP("Scroll", "scroll_"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_horizontal"), "set_enable_h_scroll", "is_h_scroll_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_vertical"), "set_enable_v_scroll", "is_v_scroll_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_horizontal_enabled"), "set_enable_h_scroll", "is_h_scroll_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_horizontal"), "set_h_scroll", "get_h_scroll"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_vertical_enabled"), "set_enable_v_scroll", "is_v_scroll_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_vertical"), "set_v_scroll", "get_v_scroll"); }; ScrollContainer::ScrollContainer() { diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index ba808566e1..f0e89877cd 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -851,6 +851,7 @@ void Tabs::_bind_methods() { ADD_SIGNAL(MethodInfo("tab_clicked", PropertyInfo(Variant::INT, "tab"))); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scrolling_enabled"), "set_scrolling_enabled", "get_scrolling_enabled"); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a3f59b54fc..d673f21077 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -883,7 +883,7 @@ void TextEdit::_notification(int p_what) { } // give visual indication of empty selected line - if (selection.active && line >= selection.from_line && line <= selection.to_line) { + if (selection.active && line >= selection.from_line && line <= selection.to_line && char_margin >= xmargin_beg) { int char_w = cache.font->get_char_size(' ').width; VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, char_w, get_row_height()), cache.selection_color); } @@ -1025,6 +1025,21 @@ void TextEdit::_notification(int p_what) { const Color *col = keywords.custom_getptr(range, hash); + if (!col) { + col = member_keywords.custom_getptr(range, hash); + + if (col) { + for (int k = j - 1; k >= 0; k--) { + if (str[k] == '.') { + col = NULL; //member indexing not allowed + break; + } else if (str[k] > 32) { + break; + } + } + } + } + if (col) { in_keyword = true; @@ -4047,11 +4062,21 @@ void TextEdit::set_wrap(bool p_wrap) { wrap = p_wrap; } +bool TextEdit::is_wrapping() const { + + return wrap; +} + void TextEdit::set_max_chars(int p_max_chars) { max_chars = p_max_chars; } +int TextEdit::get_max_chars() const { + + return max_chars; +} + void TextEdit::_reset_caret_blink_timer() { if (caret_blink_enabled) { caret_blink_timer->stop(); @@ -4128,6 +4153,16 @@ void TextEdit::add_color_region(const String &p_begin_key, const String &p_end_k update(); } +void TextEdit::add_member_keyword(const String &p_keyword, const Color &p_color) { + member_keywords[p_keyword] = p_color; + update(); +} + +void TextEdit::clear_member_keywords() { + member_keywords.clear(); + update(); +} + void TextEdit::set_syntax_coloring(bool p_enabled) { syntax_coloring = p_enabled; @@ -4467,31 +4502,44 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l int pos_from = 0; int last_pos = -1; - while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) { - if (p_search_flags & SEARCH_BACKWARDS) { + while (true) { - if (last_pos > from_column) - break; - pos = last_pos; + while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) { - } else { + if (p_search_flags & SEARCH_BACKWARDS) { - if (last_pos >= from_column) { + if (last_pos > from_column) + break; pos = last_pos; - break; + + } else { + + if (last_pos >= from_column) { + pos = last_pos; + break; + } } + + pos_from = last_pos + p_key.length(); } - pos_from = last_pos + p_key.length(); - } + bool is_match = true; + + if (pos != -1 && (p_search_flags & SEARCH_WHOLE_WORDS)) { + //validate for whole words + if (pos > 0 && _is_text_char(text_line[pos - 1])) + is_match = false; + else if (pos + p_key.length() < text_line.length() && _is_text_char(text_line[pos + p_key.length()])) + is_match = false; + } + + if (is_match || last_pos == -1 || pos == -1) { + break; + } - if (pos != -1 && (p_search_flags & SEARCH_WHOLE_WORDS)) { - //validate for whole words - if (pos > 0 && _is_text_char(text_line[pos - 1])) - pos = -1; - else if (_is_text_char(text_line[pos + p_key.length()])) - pos = -1; + pos_from = pos + 1; + pos = -1; } if (pos != -1) @@ -5530,7 +5578,9 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_readonly"), &TextEdit::is_readonly); ClassDB::bind_method(D_METHOD("set_wrap", "enable"), &TextEdit::set_wrap); - ClassDB::bind_method(D_METHOD("set_max_chars", "amount"), &TextEdit::set_max_chars); + ClassDB::bind_method(D_METHOD("is_wrapping"), &TextEdit::is_wrapping); + // ClassDB::bind_method(D_METHOD("set_max_chars", "amount"), &TextEdit::set_max_chars); + // ClassDB::bind_method(D_METHOD("get_max_char"), &TextEdit::get_max_chars); ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &TextEdit::set_context_menu_enabled); ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &TextEdit::is_context_menu_enabled); @@ -5604,6 +5654,8 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hiding_enabled"), "set_hiding_enabled", "is_hiding_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "wrap_lines"), "set_wrap", "is_wrapping"); + // ADD_PROPERTY(PropertyInfo(Variant::BOOL, "max_chars"), "set_max_chars", "get_max_chars"); ADD_GROUP("Caret", "caret_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode"); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 88121a06f0..acbf41aa81 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -210,6 +210,7 @@ class TextEdit : public Control { //syntax coloring HashMap<String, Color> keywords; + HashMap<String, Color> member_keywords; Vector<ColorRegion> color_regions; @@ -491,7 +492,10 @@ public: bool is_readonly() const; void set_max_chars(int p_max_chars); + int get_max_chars() const; + void set_wrap(bool p_wrap); + bool is_wrapping() const; void clear(); @@ -543,6 +547,9 @@ public: void add_color_region(const String &p_begin_key = String(), const String &p_end_key = String(), const Color &p_color = Color(), bool p_line_only = false); void clear_colors(); + void add_member_keyword(const String &p_keyword, const Color &p_color); + void clear_member_keywords(); + int get_v_scroll() const; void set_v_scroll(int p_scroll); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index fd5a47d875..8fec9fe97a 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -784,6 +784,10 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_disable_folding", "disable"), &TreeItem::set_disable_folding); ClassDB::bind_method(D_METHOD("is_folding_disabled"), &TreeItem::is_folding_disabled); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collapsed"), "set_collapsed", "is_collapsed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_folding"), "set_disable_folding", "is_folding_disabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "custom_minimum_height", PROPERTY_HINT_RANGE, "0,1000,1"), "set_custom_minimum_height", "get_custom_minimum_height"); + BIND_ENUM_CONSTANT(CELL_MODE_STRING); BIND_ENUM_CONSTANT(CELL_MODE_CHECK); BIND_ENUM_CONSTANT(CELL_MODE_RANGE); @@ -3086,6 +3090,11 @@ void Tree::set_select_mode(SelectMode p_mode) { select_mode = p_mode; } +Tree::SelectMode Tree::get_select_mode() const { + + return select_mode; +} + void Tree::deselect_all() { TreeItem *item = get_next_selected(get_root()); @@ -3139,6 +3148,11 @@ void Tree::set_hide_root(bool p_enabled) { update(); } +bool Tree::is_root_hidden() const { + + return hide_root; +} + void Tree::set_column_min_width(int p_column, int p_min_width) { ERR_FAIL_INDEX(p_column, columns.size()); @@ -3759,11 +3773,13 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("get_column_width", "column"), &Tree::get_column_width); ClassDB::bind_method(D_METHOD("set_hide_root", "enable"), &Tree::set_hide_root); + ClassDB::bind_method(D_METHOD("is_root_hidden"), &Tree::is_root_hidden); ClassDB::bind_method(D_METHOD("get_next_selected", "from"), &Tree::_get_next_selected); ClassDB::bind_method(D_METHOD("get_selected"), &Tree::get_selected); ClassDB::bind_method(D_METHOD("get_selected_column"), &Tree::get_selected_column); ClassDB::bind_method(D_METHOD("get_pressed_button"), &Tree::get_pressed_button); ClassDB::bind_method(D_METHOD("set_select_mode", "mode"), &Tree::set_select_mode); + ClassDB::bind_method(D_METHOD("get_select_mode"), &Tree::get_select_mode); ClassDB::bind_method(D_METHOD("set_columns", "amount"), &Tree::set_columns); ClassDB::bind_method(D_METHOD("get_columns"), &Tree::get_columns); @@ -3797,6 +3813,14 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &Tree::set_allow_reselect); ClassDB::bind_method(D_METHOD("get_allow_reselect"), &Tree::get_allow_reselect); + ADD_PROPERTY(PropertyInfo(Variant::INT, "columns"), "set_columns", "get_columns"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hide_folding"), "set_hide_folding", "is_folding_hidden"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hide_root"), "set_hide_root", "is_root_hidden"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "drop_mode_flags", PROPERTY_HINT_FLAGS, "On Item,Inbetween"), "set_drop_mode_flags", "get_drop_mode_flags"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Row,Multi"), "set_select_mode", "get_select_mode"); + ADD_SIGNAL(MethodInfo("item_selected")); ADD_SIGNAL(MethodInfo("cell_selected")); ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected"))); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index ccacb44e6b..709ff73971 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -542,11 +542,13 @@ public: int get_column_width(int p_column) const; void set_hide_root(bool p_enabled); + bool is_root_hidden() const; TreeItem *get_next_selected(TreeItem *p_item); TreeItem *get_selected() const; int get_selected_column() const; int get_pressed_button() const; void set_select_mode(SelectMode p_mode); + SelectMode get_select_mode() const; void deselect_all(); bool is_anything_selected(); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 953ebe84f6..4eee0126d8 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -38,11 +38,6 @@ int VideoPlayer::sp_get_channel_count() const { return playback->get_channels(); } -void VideoPlayer::sp_set_mix_rate(int p_rate) { - - server_mix_rate = p_rate; -} - bool VideoPlayer::mix(AudioFrame *p_buffer, int p_frames) { // Check the amount resampler can really handle. @@ -241,7 +236,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) { AudioServer::get_singleton()->lock(); if (channels > 0) - resampler.setup(channels, playback->get_mix_rate(), server_mix_rate, buffering_ms, 0); + resampler.setup(channels, playback->get_mix_rate(), AudioServer::get_singleton()->get_mix_rate(), buffering_ms, 0); else resampler.clear(); AudioServer::get_singleton()->unlock(); @@ -476,9 +471,13 @@ void VideoPlayer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "VideoStream"), "set_stream", "get_stream"); //ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), "set_loop", "has_loop") ; ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01"), "set_volume_db", "get_volume_db"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume", PROPERTY_HINT_EXP_RANGE, "0,15,0.01", 0), "set_volume", "get_volume"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "has_autoplay"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_paused", "is_paused"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "buffering_msec", PROPERTY_HINT_RANGE, "10,1000"), "set_buffering_msec", "get_buffering_msec"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "stream_position", PROPERTY_HINT_RANGE, "0,1280000,0.1", 0), "set_stream_position", "get_stream_position"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus"); } @@ -494,7 +493,6 @@ VideoPlayer::VideoPlayer() { bus_index = 0; buffering_ms = 500; - server_mix_rate = 44100; // internal_stream.player=this; // stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream); diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h index 7010c71ad9..5c379b5620 100644 --- a/scene/gui/video_player.h +++ b/scene/gui/video_player.h @@ -50,7 +50,6 @@ class VideoPlayer : public Control { Ref<VideoStream> stream; int sp_get_channel_count() const; - void sp_set_mix_rate(int p_rate); //notify the stream of the mix rate bool mix(AudioFrame *p_buffer, int p_frames); RID stream_rid; @@ -69,7 +68,6 @@ class VideoPlayer : public Control { bool expand; bool loops; int buffering_ms; - int server_mix_rate; int audio_track; int bus_index; diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index f720864daa..31d45d8e4c 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -254,8 +254,11 @@ void CanvasLayer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_RANGE, "-128,128,1"), "set_layer", "get_layer"); //ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_RANGE),"set_transform","get_transform") ; ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation"), "set_rotation_degrees", "get_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "custom_viewport", PROPERTY_HINT_RESOURCE_TYPE, "Viewport", 0), "set_custom_viewport", "get_custom_viewport"); } CanvasLayer::CanvasLayer() { diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 49d69299ea..3d58aa65f8 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -524,6 +524,7 @@ void HTTPRequest::_bind_methods() { ClassDB::bind_method(D_METHOD("_redirect_request"), &HTTPRequest::_redirect_request); ClassDB::bind_method(D_METHOD("_request_done"), &HTTPRequest::_request_done); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads"); ADD_PROPERTY(PropertyInfo(Variant::INT, "body_size_limit", PROPERTY_HINT_RANGE, "-1,2000000000"), "set_body_size_limit", "get_body_size_limit"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_redirects", PROPERTY_HINT_RANGE, "-1,64"), "set_max_redirects", "get_max_redirects"); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a36f398024..148cdaf526 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -275,7 +275,7 @@ void Node::_propagate_exit_tree() { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0); } - emit_signal(SceneStringNames::get_singleton()->tree_exited); + emit_signal(SceneStringNames::get_singleton()->tree_exiting); notification(NOTIFICATION_EXIT_TREE, true); if (data.tree) @@ -297,6 +297,8 @@ void Node::_propagate_exit_tree() { data.ready_notified = false; data.tree = NULL; data.depth = -1; + + emit_signal(SceneStringNames::get_singleton()->tree_exited); } void Node::move_child(Node *p_child, int p_pos) { @@ -2169,7 +2171,16 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const value = Array(value).duplicate(); } - current_node->set(name, value); + if (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) { + + Resource *res = Object::cast_to<Resource>(value); + if (res) // Duplicate only if it's a resource + current_node->set(name, res->duplicate()); + + } else { + + current_node->set(name, value); + } } } @@ -2881,7 +2892,7 @@ void Node::_bind_methods() { #ifdef TOOLS_ENABLED ClassDB::bind_method(D_METHOD("_set_import_path", "import_path"), &Node::set_import_path); ClassDB::bind_method(D_METHOD("_get_import_path"), &Node::get_import_path); - ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "_import_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_import_path", "_get_import_path"); + ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "_import_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_import_path", "_get_import_path"); #endif @@ -2943,6 +2954,7 @@ void Node::_bind_methods() { ADD_SIGNAL(MethodInfo("renamed")); ADD_SIGNAL(MethodInfo("tree_entered")); + ADD_SIGNAL(MethodInfo("tree_exiting")); ADD_SIGNAL(MethodInfo("tree_exited")); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),"set_process","is_processing") ; @@ -2951,7 +2963,10 @@ void Node::_bind_methods() { //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), "set_process_unhandled_input","is_processing_unhandled_input" ) ; ADD_GROUP("Pause", "pause_"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "pause_mode", PROPERTY_HINT_ENUM, "Inherit,Stop,Process"), "set_pause_mode", "get_pause_mode"); - ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "editor/display_folded", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_display_folded", "is_displayed_folded"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "editor/display_folded", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_display_folded", "is_displayed_folded"); + ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "name", PROPERTY_HINT_NONE, "", 0), "set_name", "get_name"); + ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "filename", PROPERTY_HINT_NONE, "", 0), "set_filename", "get_filename"); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_owner", "get_owner"); BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta"))); BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta"))); diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp index a779b49141..dbe7daa604 100644 --- a/scene/main/resource_preloader.cpp +++ b/scene/main/resource_preloader.cpp @@ -161,7 +161,7 @@ void ResourcePreloader::_bind_methods() { ClassDB::bind_method(D_METHOD("get_resource", "name"), &ResourcePreloader::get_resource); ClassDB::bind_method(D_METHOD("get_resource_list"), &ResourcePreloader::_get_resource_list); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "resources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_resources", "_get_resources"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "resources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_resources", "_get_resources"); } ResourcePreloader::ResourcePreloader() { diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index bc250ff4d5..55ae9fe1ec 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -55,6 +55,8 @@ void SceneTreeTimer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_time_left", "time"), &SceneTreeTimer::set_time_left); ClassDB::bind_method(D_METHOD("get_time_left"), &SceneTreeTimer::get_time_left); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_left"), "set_time_left", "get_time_left"); + ADD_SIGNAL(MethodInfo("timeout")); } @@ -1684,6 +1686,11 @@ void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_ } } +Ref<NetworkedMultiplayerPeer> SceneTree::get_network_peer() const { + + return network_peer; +} + bool SceneTree::is_network_server() const { ERR_FAIL_COND_V(!network_peer.is_valid(), false); @@ -2188,6 +2195,7 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene); ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer); + ClassDB::bind_method(D_METHOD("get_network_peer"), &SceneTree::get_network_peer); ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server); ClassDB::bind_method(D_METHOD("has_network_peer"), &SceneTree::has_network_peer); ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &SceneTree::get_network_connected_peers); @@ -2204,6 +2212,18 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_font_oversampling", "enable"), &SceneTree::set_use_font_oversampling); ClassDB::bind_method(D_METHOD("is_using_font_oversampling"), &SceneTree::is_using_font_oversampling); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_collisions_hint"), "set_debug_collisions_hint", "is_debugging_collisions_hint"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_navigation_hint"), "set_debug_navigation_hint", "is_debugging_navigation_hint"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling"); +#ifdef TOOLS_ENABLED + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root"); +#endif + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root"); + ADD_SIGNAL(MethodInfo("tree_changed")); ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node"))); ADD_SIGNAL(MethodInfo("node_removed", PropertyInfo(Variant::OBJECT, "node"))); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 6c4cc4e6d1..c5357762ec 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -451,6 +451,7 @@ public: //network API void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer); + Ref<NetworkedMultiplayerPeer> get_network_peer() const; bool is_network_server() const; bool has_network_peer() const; int get_network_unique_id() const; diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index b7fb449259..ad2cdbfd0f 100755 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -204,6 +204,8 @@ void Timer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.01,4096,0.01"), "set_wait_time", "get_wait_time"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused", PROPERTY_HINT_NONE, "", 0), "set_paused", "is_paused"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_left", PROPERTY_HINT_NONE, "", 0), "", "get_time_left"); BIND_ENUM_CONSTANT(TIMER_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5f1257a855..1a2ea796bd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2772,7 +2772,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world"), "set_use_own_world", "is_using_own_world"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World"), "set_world", "get_world"); - //ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), "set_world_2d", "get_world_2d") ; + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_2d", PROPERTY_HINT_RESOURCE_TYPE, "World2D", 0), "set_world_2d", "get_world_2d"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent_bg"), "set_transparent_background", "has_transparent_background"); ADD_GROUP("Rendering", ""); ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x"), "set_msaa", "get_msaa"); @@ -2798,6 +2798,8 @@ void Viewport::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::INT, "shadow_atlas_quad_1", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), "set_shadow_atlas_quadrant_subdiv", "get_shadow_atlas_quadrant_subdiv", 1); ADD_PROPERTYI(PropertyInfo(Variant::INT, "shadow_atlas_quad_2", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), "set_shadow_atlas_quadrant_subdiv", "get_shadow_atlas_quadrant_subdiv", 2); ADD_PROPERTYI(PropertyInfo(Variant::INT, "shadow_atlas_quad_3", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), "set_shadow_atlas_quadrant_subdiv", "get_shadow_atlas_quadrant_subdiv", 3); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "canvas_transform", PROPERTY_HINT_NONE, "", 0), "set_canvas_transform", "get_canvas_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_canvas_transform", PROPERTY_HINT_NONE, "", 0), "set_global_canvas_transform", "get_global_canvas_transform"); ADD_SIGNAL(MethodInfo("size_changed")); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a32e77bbfd..6e58bc88d7 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -36,13 +36,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; - if (name == "length") - set_length(p_value); - else if (name == "loop") - set_loop(p_value); - else if (name == "step") - set_step(p_value); - else if (name.begins_with("tracks/")) { + if (name.begins_with("tracks/")) { int track = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); @@ -384,20 +378,15 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { } void Animation::_get_property_list(List<PropertyInfo> *p_list) const { - - p_list->push_back(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001")); - p_list->push_back(PropertyInfo(Variant::BOOL, "loop")); - p_list->push_back(PropertyInfo(Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001")); - for (int i = 0; i < tracks.size(); i++) { - p_list->push_back(PropertyInfo(Variant::STRING, "tracks/" + itos(i) + "/type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::NODE_PATH, "tracks/" + itos(i) + "/path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::INT, "tracks/" + itos(i) + "/interp", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/loop_wrap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/imported", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::ARRAY, "tracks/" + itos(i) + "/keys", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::STRING, "tracks/" + itos(i) + "/type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::NODE_PATH, "tracks/" + itos(i) + "/path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::INT, "tracks/" + itos(i) + "/interp", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/loop_wrap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/imported", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, "tracks/" + itos(i) + "/keys", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } } @@ -1690,6 +1679,10 @@ void Animation::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &Animation::clear); ClassDB::bind_method(D_METHOD("copy_track", "track", "to_animation"), &Animation::copy_track); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"), "set_length", "get_length"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_step", "get_step"); + BIND_ENUM_CONSTANT(TYPE_VALUE); BIND_ENUM_CONSTANT(TYPE_TRANSFORM); BIND_ENUM_CONSTANT(TYPE_METHOD); diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 22992f6a40..93ed700482 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -542,8 +542,8 @@ void AudioStreamSample::_bind_methods() { ClassDB::bind_method(D_METHOD("set_stereo", "stereo"), &AudioStreamSample::set_stereo); ClassDB::bind_method(D_METHOD("is_stereo"), &AudioStreamSample::is_stereo); - ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamSample::set_data); - ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamSample::get_data); + ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamSample::set_data); + ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamSample::get_data); ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong"), "set_loop_mode", "get_loop_mode"); @@ -551,7 +551,7 @@ void AudioStreamSample::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_end"), "set_loop_end", "get_loop_end"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); BIND_ENUM_CONSTANT(FORMAT_8_BITS); BIND_ENUM_CONSTANT(FORMAT_16_BITS); diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index e99db8d9cb..ea313b5a20 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -81,7 +81,7 @@ void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) { if (p_value) b |= (1 << bbit); else - b &= !(1 << bbit); + b &= ~(1 << bbit); data[bbyte] = b; } @@ -127,7 +127,7 @@ void BitMap::set_bit(const Point2 &p_pos, bool p_value) { if (p_value) b |= (1 << bbit); else - b &= !(1 << bbit); + b &= ~(1 << bbit); bitmask[bbyte] = b; } @@ -184,7 +184,7 @@ void BitMap::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data"), &BitMap::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &BitMap::_get_data); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } BitMap::BitMap() { diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index 2fb500b8a8..935f041837 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -64,29 +64,6 @@ Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { return points; } -bool ConcavePolygonShape::_set(const StringName &p_name, const Variant &p_value) { - - if (p_name == "data") - PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_value); - else - return false; - - return true; -} - -bool ConcavePolygonShape::_get(const StringName &p_name, Variant &r_ret) const { - - if (p_name == "data") - r_ret = PhysicsServer::get_singleton()->shape_get_data(get_shape()); - else - return false; - return true; -} -void ConcavePolygonShape::_get_property_list(List<PropertyInfo> *p_list) const { - - p_list->push_back(PropertyInfo(Variant::ARRAY, "data")); -} - void ConcavePolygonShape::_update_shape() { } @@ -105,6 +82,7 @@ void ConcavePolygonShape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_faces", "faces"), &ConcavePolygonShape::set_faces); ClassDB::bind_method(D_METHOD("get_faces"), &ConcavePolygonShape::get_faces); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces"); } ConcavePolygonShape::ConcavePolygonShape() : diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index b659ac7311..2cc9095abf 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -58,9 +58,6 @@ class ConcavePolygonShape : public Shape { }; protected: - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; static void _bind_methods(); virtual void _update_shape(); diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index e95a07c8b8..5fd6f6c74d 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -511,7 +511,7 @@ void Curve::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_min_value", "get_min_value"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_max_value", "get_max_value"); ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_resolution", PROPERTY_HINT_RANGE, "1,1000,1"), "set_bake_resolution", "get_bake_resolution"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); ADD_SIGNAL(MethodInfo(SIGNAL_RANGE_CHANGED)); @@ -915,7 +915,7 @@ void Curve2D::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data"), &Curve2D::_set_data); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } Curve2D::Curve2D() { @@ -1410,7 +1410,7 @@ void Curve3D::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data"), &Curve3D::_set_data); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } Curve3D::Curve3D() { diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 00fc601779..b35a9ae963 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -631,6 +631,7 @@ bool DynamicFontAtSize::update_oversampling() { textures.clear(); char_map.clear(); oversampling = font_oversampling; + valid = false; _load(); return true; @@ -651,8 +652,8 @@ DynamicFontAtSize::~DynamicFontAtSize() { if (valid) { FT_Done_FreeType(library); - font->size_cache.erase(id); } + font->size_cache.erase(id); } ///////////////////////// @@ -973,14 +974,26 @@ void DynamicFont::finish_dynamic_fonts() { void DynamicFont::update_oversampling() { + Vector<Ref<DynamicFont> > changed; + + if (dynamic_font_mutex) + dynamic_font_mutex->lock(); + SelfList<DynamicFont> *E = dynamic_fonts.first(); while (E) { if (E->self()->data_at_size.is_valid() && E->self()->data_at_size->update_oversampling()) { - E->self()->emit_changed(); + changed.push_back(E->self()); } E = E->next(); } + + if (dynamic_font_mutex) + dynamic_font_mutex->unlock(); + + for (int i = 0; i < changed.size(); i++) { + changed[i]->emit_changed(); + } } ///////////////////////// diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 3d060ab7e3..3fab4d3cfc 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -270,19 +270,19 @@ void Environment::_validate_property(PropertyInfo &property) const { if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "ambient_light/sky_contribution") { if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } if (property.name == "background_color") { if (bg_mode != BG_COLOR && bg_mode != BG_COLOR_SKY) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } if (property.name == "background_canvas_max_layer") { if (bg_mode != BG_CANVAS) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } @@ -305,7 +305,7 @@ void Environment::_validate_property(PropertyInfo &property) const { String enabled = prefix + "enabled"; if (property.name.begins_with(prefix) && property.name != enabled && !bool(get(enabled))) { - property.usage = PROPERTY_USAGE_NOEDITOR; + property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; return; } diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 5d2e3c172a..026bcea270 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -577,9 +577,9 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_fallback", "fallback"), &BitmapFont::set_fallback); ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_textures", "_get_textures"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_chars", "_get_chars"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_kernings", "_get_kernings"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_textures", "_get_textures"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "-1024,1024,1"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ascent", PROPERTY_HINT_RANGE, "-1024,1024,1"), "set_ascent", "get_ascent"); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 28d5508698..8a1978cf85 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -103,25 +103,19 @@ Material::~Material() { bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) { - if (p_name == SceneStringNames::get_singleton()->shader) { - set_shader(p_value); - return true; - } else { - - if (shader.is_valid()) { + if (shader.is_valid()) { - StringName pr = shader->remap_param(p_name); - if (!pr) { - String n = p_name; - if (n.find("param/") == 0) { //backwards compatibility - pr = n.substr(6, n.length()); - } - } - if (pr) { - VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value); - return true; + StringName pr = shader->remap_param(p_name); + if (!pr) { + String n = p_name; + if (n.find("param/") == 0) { //backwards compatibility + pr = n.substr(6, n.length()); } } + if (pr) { + VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value); + return true; + } } return false; @@ -129,20 +123,12 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) { bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const { - if (p_name == SceneStringNames::get_singleton()->shader) { - - r_ret = get_shader(); - return true; + if (shader.is_valid()) { - } else { - - if (shader.is_valid()) { - - StringName pr = shader->remap_param(p_name); - if (pr) { - r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr); - return true; - } + StringName pr = shader->remap_param(p_name); + if (pr) { + r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr); + return true; } } @@ -151,8 +137,6 @@ bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const { void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back(PropertyInfo(Variant::OBJECT, "shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader,ShaderGraph")); - if (!shader.is_null()) { shader->get_param_list(p_list); @@ -193,6 +177,8 @@ void ShaderMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("get_shader"), &ShaderMaterial::get_shader); ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param); ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param); + + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader"), "set_shader", "get_shader"); } void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { @@ -2141,7 +2127,7 @@ SpatialMaterial::SpatialMaterial() : for (int i = 0; i < FLAG_MAX; i++) { flags[i] = 0; } - diffuse_mode = DIFFUSE_LAMBERT; + diffuse_mode = DIFFUSE_BURLEY; specular_mode = SPECULAR_SCHLICK_GGX; for (int i = 0; i < FEATURE_MAX; i++) { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index a2008fd1a7..d59390e1b8 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -559,12 +559,6 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { return true; } - if (sname == "custom_aabb/custom_aabb") { - - set_custom_aabb(p_value); - return true; - } - if (!sname.begins_with("surfaces")) return false; @@ -673,11 +667,6 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const { else if (what == "name") r_ret = surface_get_name(idx); return true; - } else if (sname == "custom_aabb/custom_aabb") { - - r_ret = custom_aabb; - return true; - } else if (!sname.begins_with("surfaces")) return false; @@ -728,13 +717,13 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const { return; if (blend_shapes.size()) { - p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::INT, "blend_shape/mode", PROPERTY_HINT_ENUM, "Normalized,Relative")); } for (int i = 0; i < surfaces.size(); i++) { - p_list->push_back(PropertyInfo(Variant::DICTIONARY, "surfaces/" + itos(i), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::DICTIONARY, "surfaces/" + itos(i), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::STRING, "surface_" + itos(i + 1) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); if (surfaces[i].is_2d) { p_list->push_back(PropertyInfo(Variant::OBJECT, "surface_" + itos(i + 1) + "/material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial", PROPERTY_USAGE_EDITOR)); @@ -742,8 +731,6 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, "surface_" + itos(i + 1) + "/material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial", PROPERTY_USAGE_EDITOR)); } } - - p_list->push_back(PropertyInfo(Variant::AABB, "custom_aabb/custom_aabb")); } void ArrayMesh::_recompute_aabb() { @@ -1286,6 +1273,9 @@ void ArrayMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &ArrayMesh::set_custom_aabb); ClassDB::bind_method(D_METHOD("get_custom_aabb"), &ArrayMesh::get_custom_aabb); + ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_shape_mode", PROPERTY_HINT_ENUM, "Normalized,Relative", PROPERTY_USAGE_NOEDITOR), "set_blend_shape_mode", "get_blend_shape_mode"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb"); + BIND_CONSTANT(NO_INDEX_ARRAY); BIND_CONSTANT(ARRAY_WEIGHTS_SIZE); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index b2564fd798..4d0a14e3aa 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -211,8 +211,8 @@ void MultiMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "transform_format", PROPERTY_HINT_ENUM, "2D,3D"), "set_transform_format", "get_transform_format"); ADD_PROPERTY(PropertyInfo(Variant::INT, "instance_count", PROPERTY_HINT_RANGE, "0,16384,1"), "set_instance_count", "get_instance_count"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_transform_array", "_get_transform_array"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_color_array", "_get_color_array"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_transform_array", "_get_transform_array"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_color_array", "_get_color_array"); BIND_ENUM_CONSTANT(TRANSFORM_2D); BIND_ENUM_CONSTANT(TRANSFORM_3D); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index c13a72698b..dd8d0e2141 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -235,6 +235,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (p_edit_state == GEN_EDIT_STATE_MAIN) { //for the main scene, use the resource as is res->configure_for_local_scene(base, resources_local_to_scene); + resources_local_to_scene[res] = res; } else { //for instances, a copy must be made @@ -244,9 +245,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const { res = local_dupe; value = local_dupe; } - - //this here may reference nodes not iniialized so this line is commented and used after loading all nodes - //res->setup_local_to_scene(); } //must make a copy, because this res is local to scene } diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index cd885d95eb..6fea2e1a8e 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -589,7 +589,7 @@ void PolygonPathFinder::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data"), &PolygonPathFinder::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &PolygonPathFinder::_get_data); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } PolygonPathFinder::PolygonPathFinder() { diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 60ba3af7d5..070cc84863 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -270,7 +270,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data"),&ShaderGraph::_set_data); ClassDB::bind_method(D_METHOD("_get_data"),&ShaderGraph::_get_data); - ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), "_set_data","_get_data"); + ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data","_get_data"); //void get_connections(ShaderType p_which,List<Connection> *p_connections) const; diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 235e398904..6811517ead 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -912,6 +912,7 @@ void StyleBoxLine::_bind_methods() { ClassDB::bind_method(D_METHOD("is_vertical"), &StyleBoxLine::is_vertical); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "grow", PROPERTY_HINT_RANGE, "-300,300,1"), "set_grow", "get_grow"); ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical"); } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 2ce102dd7a..067d123b83 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -76,10 +76,12 @@ void Texture::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data); + ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Ansiotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags"); + + BIND_ENUM_CONSTANT(FLAGS_DEFAULT); BIND_ENUM_CONSTANT(FLAG_MIPMAPS); BIND_ENUM_CONSTANT(FLAG_REPEAT); BIND_ENUM_CONSTANT(FLAG_FILTER); - BIND_ENUM_CONSTANT(FLAGS_DEFAULT); BIND_ENUM_CONSTANT(FLAG_ANISOTROPIC_FILTER); BIND_ENUM_CONSTANT(FLAG_CONVERT_TO_LINEAR); BIND_ENUM_CONSTANT(FLAG_MIRRORED_REPEAT); @@ -121,10 +123,6 @@ bool ImageTexture::_set(const StringName &p_name, const Variant &p_value) { w = s.width; h = s.height; VisualServer::get_singleton()->texture_set_size_override(texture, w, h); - } else if (p_name == "storage") { - storage = Storage(p_value.operator int()); - } else if (p_name == "lossy_quality") { - lossy_storage_quality = p_value; } else if (p_name == "_data") { _set_data(p_value); } else @@ -143,10 +141,6 @@ bool ImageTexture::_get(const StringName &p_name, Variant &r_ret) const { r_ret = flags; else if (p_name == "size") r_ret = Size2(w, h); - else if (p_name == "storage") - r_ret = storage; - else if (p_name == "lossy_quality") - r_ret = lossy_storage_quality; else return false; @@ -165,8 +159,6 @@ void ImageTexture::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic,sRGB,Mirrored Repeat")); p_list->push_back(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "size", PROPERTY_HINT_NONE, "")); - p_list->push_back(PropertyInfo(Variant::INT, "storage", PROPERTY_HINT_ENUM, "Uncompressed,Compress Lossy,Compress Lossless")); - p_list->push_back(PropertyInfo(Variant::REAL, "lossy_quality", PROPERTY_HINT_RANGE, "0.0,1.0,0.01")); } void ImageTexture::_reload_hook(const RID &p_hook) { @@ -363,6 +355,9 @@ void ImageTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size_override", "size"), &ImageTexture::set_size_override); ClassDB::bind_method(D_METHOD("_reload_hook", "rid"), &ImageTexture::_reload_hook); + ADD_PROPERTY(PropertyInfo(Variant::INT, "storage", PROPERTY_HINT_ENUM, "Uncompressed,Compress Lossy,Compress Lossless"), "set_storage", "get_storage"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "lossy_quality", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_lossy_storage_quality", "get_lossy_storage_quality"); + BIND_ENUM_CONSTANT(STORAGE_RAW); BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSY); BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSLESS); @@ -1133,7 +1128,7 @@ void LargeTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data", "data"), &LargeTexture::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &LargeTexture::_get_data); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture> &p_normal_map) const { @@ -1284,8 +1279,6 @@ bool CubeMap::_set(const StringName &p_name, const Variant &p_value) { set_side(SIDE_FRONT, p_value); } else if (p_name == "side/back") { set_side(SIDE_BACK, p_value); - } else if (p_name == "flags") { - set_flags(p_value); } else if (p_name == "storage") { storage = Storage(p_value.operator int()); } else if (p_name == "lossy_quality") { @@ -1310,8 +1303,6 @@ bool CubeMap::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_side(SIDE_FRONT); } else if (p_name == "side/back") { r_ret = get_side(SIDE_BACK); - } else if (p_name == "flags") { - r_ret = flags; } else if (p_name == "storage") { r_ret = storage; } else if (p_name == "lossy_quality") { @@ -1331,7 +1322,6 @@ void CubeMap::_get_property_list(List<PropertyInfo> *p_list) const { img_hint = PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS; } - p_list->push_back(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter")); p_list->push_back(PropertyInfo(Variant::OBJECT, "side/left", PROPERTY_HINT_RESOURCE_TYPE, "Image")); p_list->push_back(PropertyInfo(Variant::OBJECT, "side/right", PROPERTY_HINT_RESOURCE_TYPE, "Image")); p_list->push_back(PropertyInfo(Variant::OBJECT, "side/bottom", PROPERTY_HINT_RESOURCE_TYPE, "Image")); @@ -1353,6 +1343,7 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"), &CubeMap::get_lossy_storage_quality); + ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter"), "set_flags", "get_flags"); ADD_PROPERTY(PropertyInfo(Variant::INT, "storage_mode", PROPERTY_HINT_ENUM, "Raw,Lossy Compressed,Lossless Compressed"), "set_storage", "get_storage"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "lossy_storage_quality"), "set_lossy_storage_quality", "get_lossy_storage_quality"); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 710612d5f4..800710ed2a 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -260,14 +260,14 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region")); p_list->push_back(PropertyInfo(Variant::BOOL, pre + "is_autotile", PROPERTY_HINT_NONE, "")); if (tile_get_is_autotile(id)) { - p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/bitmask_flags", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/bitmask_flags", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset")); p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D")); @@ -309,6 +309,7 @@ void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) { ERR_FAIL_COND(!tile_map.has(p_id)); tile_map[p_id].texture = p_texture; emit_changed(); + _change_notify("texture"); } Ref<Texture> TileSet::tile_get_texture(int p_id) const { @@ -386,8 +387,8 @@ void TileSet::tile_set_is_autotile(int p_id, bool p_is_autotile) { ERR_FAIL_COND(!tile_map.has(p_id)); tile_map[p_id].is_autotile = p_is_autotile; - _change_notify(""); emit_changed(); + _change_notify("is_autotile"); } bool TileSet::tile_get_is_autotile(int p_id) const { diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index fff336c16f..82183d24e7 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -318,6 +318,9 @@ void World::_bind_methods() { ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); + ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); } World::World() { diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 8b1f5d630f..bed6ffd1bd 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -373,6 +373,10 @@ void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_space"), &World2D::get_space); ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); + + ADD_PROPERTY(PropertyInfo(Variant::_RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas"); + ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "Physics2DDirectSpaceState", 0), "", "get_direct_space_state"); } Physics2DDirectSpaceState *World2D::get_direct_space_state() { diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 7d8dfea2bc..fdce0eb2b6 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -49,6 +49,7 @@ SceneStringNames::SceneStringNames() { shader_unshaded = StaticCString::create("shader/unshaded"); shading_mode = StaticCString::create("shader/shading_mode"); tree_entered = StaticCString::create("tree_entered"); + tree_exiting = StaticCString::create("tree_exiting"); tree_exited = StaticCString::create("tree_exited"); item_rect_changed = StaticCString::create("item_rect_changed"); size_flags_changed = StaticCString::create("size_flags_changed"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 1b30d7c1bf..63a9a5db4d 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -69,6 +69,7 @@ public: StringName shader_unshaded; StringName shading_mode; StringName tree_entered; + StringName tree_exiting; StringName tree_exited; StringName size_flags_changed; StringName minimum_size_changed; diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index 441a7581d1..1804d97555 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -67,11 +67,11 @@ void ARVRServer::_bind_methods() { BIND_ENUM_CONSTANT(RESET_BUT_KEEP_TILT); BIND_ENUM_CONSTANT(DONT_RESET_ROTATION); - ADD_SIGNAL(MethodInfo("interface_added", PropertyInfo(Variant::STRING, "name"))); - ADD_SIGNAL(MethodInfo("interface_removed", PropertyInfo(Variant::STRING, "name"))); + ADD_SIGNAL(MethodInfo("interface_added", PropertyInfo(Variant::STRING, "interface_name"))); + ADD_SIGNAL(MethodInfo("interface_removed", PropertyInfo(Variant::STRING, "interface_name"))); - ADD_SIGNAL(MethodInfo("tracker_added", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::INT, "id"))); - ADD_SIGNAL(MethodInfo("tracker_removed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::INT, "id"))); + ADD_SIGNAL(MethodInfo("tracker_added", PropertyInfo(Variant::STRING, "tracker_name"), PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::INT, "id"))); + ADD_SIGNAL(MethodInfo("tracker_removed", PropertyInfo(Variant::STRING, "tracker_name"), PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::INT, "id"))); }; real_t ARVRServer::get_world_scale() const { diff --git a/servers/audio/effects/audio_effect_reverb.cpp b/servers/audio/effects/audio_effect_reverb.cpp index 03f5377a80..204b11746c 100644 --- a/servers/audio/effects/audio_effect_reverb.cpp +++ b/servers/audio/effects/audio_effect_reverb.cpp @@ -185,7 +185,7 @@ void AudioEffectReverb::_bind_methods() { ADD_GROUP("Predelay", "predelay_"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "predelay_msec", PROPERTY_HINT_RANGE, "20,500,1"), "set_predelay_msec", "get_predelay_msec"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "predelay_feedback", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_predelay_msec", "get_predelay_msec"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "predelay_feedback", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_predelay_feedback", "get_predelay_feedback"); ADD_GROUP("", ""); ADD_PROPERTY(PropertyInfo(Variant::REAL, "room_size", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_room_size", "get_room_size"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "damping", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_damping", "get_damping"); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 76d0154348..5c453a3113 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -1267,16 +1267,16 @@ bool AudioBusLayout::_get(const StringName &p_name, Variant &r_ret) const { void AudioBusLayout::_get_property_list(List<PropertyInfo> *p_list) const { for (int i = 0; i < buses.size(); i++) { - p_list->push_back(PropertyInfo(Variant::STRING, "bus/" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/solo", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/mute", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/bypass_fx", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::REAL, "bus/" + itos(i) + "/volume_db", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::REAL, "bus/" + itos(i) + "/send", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::STRING, "bus/" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/solo", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/mute", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/bypass_fx", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::REAL, "bus/" + itos(i) + "/volume_db", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::REAL, "bus/" + itos(i) + "/send", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); for (int j = 0; j < buses[i].effects.size(); j++) { - p_list->push_back(PropertyInfo(Variant::OBJECT, "bus/" + itos(i) + "/effect/" + itos(j) + "/effect", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/effect/" + itos(j) + "/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::OBJECT, "bus/" + itos(i) + "/effect/" + itos(j) + "/effect", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::BOOL, "bus/" + itos(i) + "/effect/" + itos(j) + "/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } } } diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index 18cb276d4c..180abc406c 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -108,6 +108,17 @@ void Physics2DDirectBodyState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_step"), &Physics2DDirectBodyState::get_step); ClassDB::bind_method(D_METHOD("integrate_forces"), &Physics2DDirectBodyState::integrate_forces); ClassDB::bind_method(D_METHOD("get_space_state"), &Physics2DDirectBodyState::get_space_state); + + ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "", "get_step"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "inverse_mass"), "", "get_inverse_mass"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "inverse_inertia"), "", "get_inverse_inertia"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_angular_damp"), "", "get_total_angular_damp"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_linear_damp"), "", "get_total_linear_damp"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "total_gravity"), "", "get_total_gravity"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_velocity"), "set_angular_velocity", "get_angular_velocity"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "linear_velocity"), "set_linear_velocity", "get_linear_velocity"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sleeping"), "set_sleep_state", "is_sleeping"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); } Physics2DDirectBodyState::Physics2DDirectBodyState() {} @@ -204,6 +215,14 @@ void Physics2DShapeQueryParameters::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &Physics2DShapeQueryParameters::set_exclude); ClassDB::bind_method(D_METHOD("get_exclude"), &Physics2DShapeQueryParameters::get_exclude); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "set_motion", "get_motion"); + //ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", ""); // FIXME: Lacks a getter + ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); } Physics2DShapeQueryParameters::Physics2DShapeQueryParameters() { @@ -436,6 +455,16 @@ void Physics2DTestMotionResult::_bind_methods() { ClassDB::bind_method(D_METHOD("get_collider_rid"), &Physics2DTestMotionResult::get_collider_rid); ClassDB::bind_method(D_METHOD("get_collider"), &Physics2DTestMotionResult::get_collider); ClassDB::bind_method(D_METHOD("get_collider_shape"), &Physics2DTestMotionResult::get_collider_shape); + + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "", "get_motion"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion_remainder"), "", "get_motion_remainder"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collision_point"), "", "get_collision_point"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collision_normal"), "", "get_collision_normal"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id", PROPERTY_HINT_OBJECT_ID), "", "get_collider_id"); + ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape"); } Physics2DTestMotionResult::Physics2DTestMotionResult() { diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 95875d2166..9d4807fcf0 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -113,6 +113,19 @@ void PhysicsDirectBodyState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState::get_step); ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState::integrate_forces); ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState::get_space_state); + + ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "", "get_step"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "inverse_mass"), "", "get_inverse_mass"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_angular_damp"), "", "get_total_angular_damp"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_linear_damp"), "", "get_total_linear_damp"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "inverse_inertia"), "", "get_inverse_inertia"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "total_gravity"), "", "get_total_gravity"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "center_of_mass"), "", "get_center_of_mass"); + ADD_PROPERTY(PropertyInfo(Variant::BASIS, "principal_inertia_axes"), "", "get_principal_inertia_axes"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "angular_velocity"), "set_angular_velocity", "get_angular_velocity"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "linear_velocity"), "set_linear_velocity", "get_linear_velocity"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sleeping"), "set_sleep_state", "is_sleeping"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); } PhysicsDirectBodyState::PhysicsDirectBodyState() {} @@ -198,6 +211,13 @@ void PhysicsShapeQueryParameters::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters::set_exclude); ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters::get_exclude); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); + //ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", ""); // FIXME: Lacks a getter + ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); } PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() { |