diff options
530 files changed, 3630 insertions, 2137 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp index c43e32868c..99ec1aeb5b 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -232,9 +232,9 @@ Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) : name(p_name), ptr(p_ptr) { #ifdef DEBUG_ENABLED - Reference *ref = Object::cast_to<Reference>(p_ptr); - if (ref && !ref->is_referenced()) { - WARN_PRINT("You must use Ref<> to ensure the lifetime of a Reference object intended to be used as a singleton."); + RefCounted *rc = Object::cast_to<RefCounted>(p_ptr); + if (rc && !rc->is_referenced()) { + WARN_PRINT("You must use Ref<> to ensure the lifetime of a RefCounted object intended to be used as a singleton."); } #endif } diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 9baec79d43..590c3ff50e 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -33,11 +33,11 @@ #include "core/core_bind.h" #include "core/core_string_names.h" #include "core/input/input_map.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_network.h" #include "core/io/file_access_pack.h" #include "core/io/marshalls.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/variant/variant_parser.h" @@ -62,7 +62,7 @@ String ProjectSettings::localize_path(const String &p_path) const { } if (p_path.begins_with("res://") || p_path.begins_with("user://") || - (p_path.is_abs_path() && !p_path.begins_with(resource_path))) { + (p_path.is_absolute_path() && !p_path.begins_with(resource_path))) { return p_path.simplify_path(); } diff --git a/core/core_bind.cpp b/core/core_bind.cpp index ed4387a1b9..b8d5572ecc 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -643,6 +643,10 @@ String _OS::get_user_data_dir() const { return OS::get_singleton()->get_user_data_dir(); } +String _OS::get_external_data_dir() const { + return OS::get_singleton()->get_external_data_dir(); +} + bool _OS::is_debug_build() const { #ifdef DEBUG_ENABLED return true; @@ -743,6 +747,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_static_memory_peak_usage"), &_OS::get_static_memory_peak_usage); ClassDB::bind_method(D_METHOD("get_user_data_dir"), &_OS::get_user_data_dir); + ClassDB::bind_method(D_METHOD("get_external_data_dir"), &_OS::get_external_data_dir); ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir); ClassDB::bind_method(D_METHOD("get_unique_id"), &_OS::get_unique_id); @@ -2069,7 +2074,7 @@ Variant _ClassDB::instance(const StringName &p_class) const { return Variant(); } - Reference *r = Object::cast_to<Reference>(obj); + RefCounted *r = Object::cast_to<RefCounted>(obj); if (r) { return REF(r); } else { @@ -2415,12 +2420,12 @@ Variant JSONParseResult::get_result() const { } void _JSON::_bind_methods() { - ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys"), &_JSON::print, DEFVAL(String()), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys", "full_precision"), &_JSON::print, DEFVAL(String()), DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("parse", "json"), &_JSON::parse); } -String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys) { - return JSON::print(p_value, p_indent, p_sort_keys); +String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys, bool p_full_precision) { + return JSON::print(p_value, p_indent, p_sort_keys, p_full_precision); } Ref<JSONParseResult> _JSON::parse(const String &p_json) { diff --git a/core/core_bind.h b/core/core_bind.h index d05353bf0f..46a6b23cf8 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -32,11 +32,11 @@ #define CORE_BIND_H #include "core/io/compression.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/image.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/os/semaphore.h" #include "core/os/thread.h" @@ -237,6 +237,7 @@ public: String get_system_dir(SystemDir p_dir) const; String get_user_data_dir() const; + String get_external_data_dir() const; Error set_thread_name(const String &p_name); Thread::ID get_thread_caller_id() const; @@ -352,8 +353,8 @@ public: _Geometry3D() { singleton = this; } }; -class _File : public Reference { - GDCLASS(_File, Reference); +class _File : public RefCounted { + GDCLASS(_File, RefCounted); FileAccess *f = nullptr; bool big_endian = false; @@ -454,8 +455,8 @@ public: VARIANT_ENUM_CAST(_File::ModeFlags); VARIANT_ENUM_CAST(_File::CompressionMode); -class _Directory : public Reference { - GDCLASS(_Directory, Reference); +class _Directory : public RefCounted { + GDCLASS(_Directory, RefCounted); DirAccess *d; bool dir_open = false; @@ -524,8 +525,8 @@ public: ~_Marshalls() { singleton = nullptr; } }; -class _Mutex : public Reference { - GDCLASS(_Mutex, Reference); +class _Mutex : public RefCounted { + GDCLASS(_Mutex, RefCounted); Mutex mutex; static void _bind_methods(); @@ -536,8 +537,8 @@ public: void unlock(); }; -class _Semaphore : public Reference { - GDCLASS(_Semaphore, Reference); +class _Semaphore : public RefCounted { + GDCLASS(_Semaphore, RefCounted); Semaphore semaphore; static void _bind_methods(); @@ -548,8 +549,8 @@ public: void post(); }; -class _Thread : public Reference { - GDCLASS(_Thread, Reference); +class _Thread : public RefCounted { + GDCLASS(_Thread, RefCounted); protected: Variant ret; @@ -665,8 +666,8 @@ public: class _JSON; -class JSONParseResult : public Reference { - GDCLASS(JSONParseResult, Reference); +class JSONParseResult : public RefCounted { + GDCLASS(JSONParseResult, RefCounted); friend class _JSON; @@ -705,7 +706,7 @@ protected: public: static _JSON *get_singleton() { return singleton; } - String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false); + String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false, bool p_full_precision = false); Ref<JSONParseResult> parse(const String &p_json); _JSON() { singleton = this; } diff --git a/core/crypto/aes_context.h b/core/crypto/aes_context.h index cc00b18fd2..2f8422f537 100644 --- a/core/crypto/aes_context.h +++ b/core/crypto/aes_context.h @@ -32,10 +32,10 @@ #define AES_CONTEXT_H #include "core/crypto/crypto_core.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class AESContext : public Reference { - GDCLASS(AESContext, Reference); +class AESContext : public RefCounted { + GDCLASS(AESContext, RefCounted); public: enum Mode { diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h index 9438fcfea5..a2ccbba58a 100644 --- a/core/crypto/crypto.h +++ b/core/crypto/crypto.h @@ -35,7 +35,7 @@ #include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" class CryptoKey : public Resource { GDCLASS(CryptoKey, Resource); @@ -67,8 +67,8 @@ public: virtual Error save(String p_path) = 0; }; -class HMACContext : public Reference { - GDCLASS(HMACContext, Reference); +class HMACContext : public RefCounted { + GDCLASS(HMACContext, RefCounted); protected: static void _bind_methods(); @@ -84,8 +84,8 @@ public: HMACContext() {} }; -class Crypto : public Reference { - GDCLASS(Crypto, Reference); +class Crypto : public RefCounted { + GDCLASS(Crypto, RefCounted); protected: static void _bind_methods(); diff --git a/core/crypto/crypto_core.h b/core/crypto/crypto_core.h index 27b380e838..7a2f4df589 100644 --- a/core/crypto/crypto_core.h +++ b/core/crypto/crypto_core.h @@ -31,7 +31,7 @@ #ifndef CRYPTO_CORE_H #define CRYPTO_CORE_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" class CryptoCore { public: diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h index 892a48a4e8..31521a147c 100644 --- a/core/crypto/hashing_context.h +++ b/core/crypto/hashing_context.h @@ -31,10 +31,10 @@ #ifndef HASHING_CONTEXT_H #define HASHING_CONTEXT_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class HashingContext : public Reference { - GDCLASS(HashingContext, Reference); +class HashingContext : public RefCounted { + GDCLASS(HashingContext, RefCounted); public: enum HashType { diff --git a/core/debugger/remote_debugger_peer.h b/core/debugger/remote_debugger_peer.h index 652e2d9d20..8cba53a81c 100644 --- a/core/debugger/remote_debugger_peer.h +++ b/core/debugger/remote_debugger_peer.h @@ -32,12 +32,12 @@ #define REMOTE_DEBUGGER_PEER_H #include "core/io/stream_peer_tcp.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/mutex.h" #include "core/os/thread.h" #include "core/string/ustring.h" -class RemoteDebuggerPeer : public Reference { +class RemoteDebuggerPeer : public RefCounted { protected: int max_queued_messages = 4096; diff --git a/core/io/config_file.h b/core/io/config_file.h index 1b28257c60..dbba43ace5 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -31,13 +31,13 @@ #ifndef CONFIG_FILE_H #define CONFIG_FILE_H -#include "core/object/reference.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" +#include "core/object/ref_counted.h" #include "core/templates/ordered_hash_map.h" #include "core/variant/variant_parser.h" -class ConfigFile : public Reference { - GDCLASS(ConfigFile, Reference); +class ConfigFile : public RefCounted { + GDCLASS(ConfigFile, RefCounted); OrderedHashMap<String, OrderedHashMap<String, Variant>> values; diff --git a/core/os/dir_access.cpp b/core/io/dir_access.cpp index 39ae475c12..dfba00067f 100644 --- a/core/os/dir_access.cpp +++ b/core/io/dir_access.cpp @@ -31,7 +31,7 @@ #include "dir_access.h" #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/memory.h" #include "core/os/os.h" diff --git a/core/os/dir_access.h b/core/io/dir_access.h index 16154a4850..16154a4850 100644 --- a/core/os/dir_access.h +++ b/core/io/dir_access.h diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp index 288b2efe0e..655fb18535 100644 --- a/core/io/dtls_server.cpp +++ b/core/io/dtls_server.cpp @@ -31,7 +31,7 @@ #include "dtls_server.h" #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" DTLSServer *(*DTLSServer::_create)() = nullptr; bool DTLSServer::available = false; diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h index 92b6caf508..02a32533e1 100644 --- a/core/io/dtls_server.h +++ b/core/io/dtls_server.h @@ -34,8 +34,8 @@ #include "core/io/net_socket.h" #include "core/io/packet_peer_dtls.h" -class DTLSServer : public Reference { - GDCLASS(DTLSServer, Reference); +class DTLSServer : public RefCounted { + GDCLASS(DTLSServer, RefCounted); protected: static DTLSServer *(*_create)(); diff --git a/core/os/file_access.cpp b/core/io/file_access.cpp index d21c0bd9a2..d21c0bd9a2 100644 --- a/core/os/file_access.cpp +++ b/core/io/file_access.cpp diff --git a/core/os/file_access.h b/core/io/file_access.h index 5804aa2c47..5804aa2c47 100644 --- a/core/os/file_access.h +++ b/core/io/file_access.h diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h index 19e4f241dd..3389e020e3 100644 --- a/core/io/file_access_compressed.h +++ b/core/io/file_access_compressed.h @@ -32,7 +32,7 @@ #define FILE_ACCESS_COMPRESSED_H #include "core/io/compression.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" class FileAccessCompressed : public FileAccess { Compression::Mode cmode = Compression::MODE_ZSTD; diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h index 00f14099f9..decffae696 100644 --- a/core/io/file_access_encrypted.h +++ b/core/io/file_access_encrypted.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_ENCRYPTED_H #define FILE_ACCESS_ENCRYPTED_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #define ENCRYPTED_HEADER_MAGIC 0x43454447 diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index d9be2a4a75..627fd2bf9c 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -31,7 +31,7 @@ #include "file_access_memory.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/templates/map.h" static Map<String, Vector<uint8_t>> *files = nullptr; diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h index 4157531d01..14135bd68c 100644 --- a/core/io/file_access_memory.h +++ b/core/io/file_access_memory.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_MEMORY_H #define FILE_ACCESS_MEMORY_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" class FileAccessMemory : public FileAccess { uint8_t *data = nullptr; diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h index 94b66c2480..1d9d761fbb 100644 --- a/core/io/file_access_network.h +++ b/core/io/file_access_network.h @@ -31,8 +31,8 @@ #ifndef FILE_ACCESS_NETWORK_H #define FILE_ACCESS_NETWORK_H +#include "core/io/file_access.h" #include "core/io/stream_peer_tcp.h" -#include "core/os/file_access.h" #include "core/os/semaphore.h" #include "core/os/thread.h" diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 7a83fc938f..2f0ee62723 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -31,8 +31,8 @@ #ifndef FILE_ACCESS_PACK_H #define FILE_ACCESS_PACK_H -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/string/print_string.h" #include "core/templates/list.h" #include "core/templates/map.h" diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index b8383fd865..b5c882e9ce 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -32,7 +32,7 @@ #include "file_access_zip.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" ZipArchive *ZipArchive::instance = nullptr; diff --git a/core/io/http_client.h b/core/io/http_client.h index ec4b86b26f..f70999836f 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -34,10 +34,10 @@ #include "core/io/ip.h" #include "core/io/stream_peer.h" #include "core/io/stream_peer_tcp.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class HTTPClient : public Reference { - GDCLASS(HTTPClient, Reference); +class HTTPClient : public RefCounted { + GDCLASS(HTTPClient, RefCounted); public: enum ResponseCode { diff --git a/core/io/image.cpp b/core/io/image.cpp index c36fa6e45f..9cd0ea7b5d 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -1428,16 +1428,23 @@ void Image::flip_x() { } } +/// Get mipmap size and offset. int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps, int *r_mm_width, int *r_mm_height) { + // Data offset in mipmaps (including the original texture). int size = 0; + int w = p_width; int h = p_height; + + // Current mipmap index in the loop below. p_mipmaps is the target mipmap index. + // In this function, mipmap 0 represents the first mipmap instead of the original texture. int mm = 0; int pixsize = get_format_pixel_size(p_format); int pixshift = get_format_pixel_rshift(p_format); int block = get_format_block_size(p_format); - //technically, you can still compress up to 1 px no matter the format, so commenting this + + // Technically, you can still compress up to 1 px no matter the format, so commenting this. //int minw, minh; //get_format_min_pixel_size(p_format, minw, minh); int minw = 1, minh = 1; @@ -1453,17 +1460,6 @@ int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int & size += s; - if (r_mm_width) { - *r_mm_width = bw; - } - if (r_mm_height) { - *r_mm_height = bh; - } - - if (p_mipmaps >= 0 && mm == p_mipmaps) { - break; - } - if (p_mipmaps >= 0) { w = MAX(minw, w >> 1); h = MAX(minh, h >> 1); @@ -1474,6 +1470,21 @@ int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int & w = MAX(minw, w >> 1); h = MAX(minh, h >> 1); } + + // Set mipmap size. + // It might be necessary to put this after the minimum mipmap size check because of the possible occurrence of "1 >> 1". + if (r_mm_width) { + *r_mm_width = bw >> 1; + } + if (r_mm_height) { + *r_mm_height = bh >> 1; + } + + // Reach target mipmap. + if (p_mipmaps >= 0 && mm == p_mipmaps) { + break; + } + mm++; } @@ -2718,10 +2729,11 @@ void (*Image::_image_decompress_bptc)(Image *) = nullptr; void (*Image::_image_decompress_etc1)(Image *) = nullptr; void (*Image::_image_decompress_etc2)(Image *) = nullptr; -Vector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = nullptr; -Ref<Image> (*Image::lossy_unpacker)(const Vector<uint8_t> &) = nullptr; -Vector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = nullptr; -Ref<Image> (*Image::lossless_unpacker)(const Vector<uint8_t> &) = nullptr; +Vector<uint8_t> (*Image::webp_lossy_packer)(const Ref<Image> &, float) = nullptr; +Vector<uint8_t> (*Image::webp_lossless_packer)(const Ref<Image> &) = nullptr; +Ref<Image> (*Image::webp_unpacker)(const Vector<uint8_t> &) = nullptr; +Vector<uint8_t> (*Image::png_packer)(const Ref<Image> &) = nullptr; +Ref<Image> (*Image::png_unpacker)(const Vector<uint8_t> &) = nullptr; Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = nullptr; Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = nullptr; diff --git a/core/io/image.h b/core/io/image.h index df8f9b35a1..060e54a308 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -148,10 +148,11 @@ public: static void (*_image_decompress_etc1)(Image *); static void (*_image_decompress_etc2)(Image *); - static Vector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality); - static Ref<Image> (*lossy_unpacker)(const Vector<uint8_t> &p_buffer); - static Vector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image); - static Ref<Image> (*lossless_unpacker)(const Vector<uint8_t> &p_buffer); + static Vector<uint8_t> (*webp_lossy_packer)(const Ref<Image> &p_image, float p_quality); + static Vector<uint8_t> (*webp_lossless_packer)(const Ref<Image> &p_image); + static Ref<Image> (*webp_unpacker)(const Vector<uint8_t> &p_buffer); + static Vector<uint8_t> (*png_packer)(const Ref<Image> &p_image); + static Ref<Image> (*png_unpacker)(const Vector<uint8_t> &p_buffer); static Vector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels); static Ref<Image> (*basis_universal_unpacker)(const Vector<uint8_t> &p_buffer); diff --git a/core/io/image_loader.h b/core/io/image_loader.h index a5d588e0b5..6d1b1e3646 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -31,9 +31,9 @@ #ifndef IMAGE_LOADER_H #define IMAGE_LOADER_H +#include "core/io/file_access.h" #include "core/io/image.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "core/string/ustring.h" #include "core/templates/list.h" diff --git a/core/io/json.cpp b/core/io/json.cpp index 394cf216e8..e3e9d6158b 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -55,7 +55,7 @@ static String _make_indent(const String &p_indent, int p_size) { return indent_text; } -String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys) { +String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, bool p_full_precision) { String colon = ":"; String end_statement = ""; @@ -71,8 +71,17 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_ return p_var.operator bool() ? "true" : "false"; case Variant::INT: return itos(p_var); - case Variant::FLOAT: - return rtos(p_var); + case Variant::FLOAT: { + double num = p_var; + if (p_full_precision) { + // Store unreliable digits (17) instead of just reliable + // digits (14) so that the value can be decoded exactly. + return String::num(num, 17 - (int)floor(log10(num))); + } else { + // Store only reliable digits (14) by default. + return String::num(num, 14 - (int)floor(log10(num))); + } + } case Variant::PACKED_INT32_ARRAY: case Variant::PACKED_INT64_ARRAY: case Variant::PACKED_FLOAT32_ARRAY: @@ -121,8 +130,8 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_ } } -String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys) { - return _print_var(p_var, p_indent, 0, p_sort_keys); +String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys, bool p_full_precision) { + return _print_var(p_var, p_indent, 0, p_sort_keys, p_full_precision); } Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) { diff --git a/core/io/json.h b/core/io/json.h index 537477666e..bfd2347725 100644 --- a/core/io/json.h +++ b/core/io/json.h @@ -31,7 +31,7 @@ #ifndef JSON_H #define JSON_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/variant/variant.h" class JSON { enum TokenType { @@ -62,7 +62,7 @@ class JSON { static const char *tk_name[TK_MAX]; - static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys); + static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, bool p_full_precision = false); static Error _get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str); static Error _parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str); @@ -70,12 +70,12 @@ class JSON { static Error _parse_object(Dictionary &object, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str); public: - static String print(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true); + static String print(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true, bool p_full_precision = false); static Error parse(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line); }; -class JSONParser : public Reference { - GDCLASS(JSONParser, Reference); +class JSONParser : public RefCounted { + GDCLASS(JSONParser, RefCounted); Variant data; String string; diff --git a/core/io/logger.cpp b/core/io/logger.cpp index 8a07459a1d..304581b4ac 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -31,7 +31,7 @@ #include "logger.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/os.h" #include "core/string/print_string.h" diff --git a/core/io/logger.h b/core/io/logger.h index a12945911c..ccf68562d6 100644 --- a/core/io/logger.h +++ b/core/io/logger.h @@ -31,7 +31,7 @@ #ifndef LOGGER_H #define LOGGER_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/string/ustring.h" #include "core/templates/vector.h" diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 18e1092c26..4c58c84c14 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -30,7 +30,7 @@ #include "marshalls.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/keyboard.h" #include "core/string/print_string.h" @@ -489,8 +489,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int obj->set(str, value); } - if (Object::cast_to<Reference>(obj)) { - REF ref = REF(Object::cast_to<Reference>(obj)); + if (Object::cast_to<RefCounted>(obj)) { + REF ref = REF(Object::cast_to<RefCounted>(obj)); r_variant = ref; } else { r_variant = obj; diff --git a/core/io/marshalls.h b/core/io/marshalls.h index cc0e9ba301..7fac708f97 100644 --- a/core/io/marshalls.h +++ b/core/io/marshalls.h @@ -31,7 +31,7 @@ #ifndef MARSHALLS_H #define MARSHALLS_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/typedefs.h" #include "core/variant/variant.h" @@ -165,8 +165,8 @@ static inline double decode_double(const uint8_t *p_arr) { return md.d; } -class EncodedObjectAsID : public Reference { - GDCLASS(EncodedObjectAsID, Reference); +class EncodedObjectAsID : public RefCounted { + GDCLASS(EncodedObjectAsID, RefCounted); ObjectID id; diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index 6a251cf77b..43804a20ec 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -32,10 +32,10 @@ #define MULTIPLAYER_API_H #include "core/io/networked_multiplayer_peer.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class MultiplayerAPI : public Reference { - GDCLASS(MultiplayerAPI, Reference); +class MultiplayerAPI : public RefCounted { + GDCLASS(MultiplayerAPI, RefCounted); public: enum RPCMode { diff --git a/core/io/net_socket.h b/core/io/net_socket.h index 98ff9562d9..fd7d50c704 100644 --- a/core/io/net_socket.h +++ b/core/io/net_socket.h @@ -32,9 +32,9 @@ #define NET_SOCKET_H #include "core/io/ip.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class NetSocket : public Reference { +class NetSocket : public RefCounted { protected: static NetSocket *(*_create)(); diff --git a/core/io/packed_data_container.h b/core/io/packed_data_container.h index 7791e21bb3..40772bb2bf 100644 --- a/core/io/packed_data_container.h +++ b/core/io/packed_data_container.h @@ -80,8 +80,8 @@ public: PackedDataContainer() {} }; -class PackedDataContainerRef : public Reference { - GDCLASS(PackedDataContainerRef, Reference); +class PackedDataContainerRef : public RefCounted { + GDCLASS(PackedDataContainerRef, RefCounted); friend class PackedDataContainer; uint32_t offset = 0; diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index 9e03c44750..9a345af3d0 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -35,8 +35,8 @@ #include "core/object/class_db.h" #include "core/templates/ring_buffer.h" -class PacketPeer : public Reference { - GDCLASS(PacketPeer, Reference); +class PacketPeer : public RefCounted { + GDCLASS(PacketPeer, RefCounted); Variant _bnd_get_var(bool p_allow_objects = false); diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp index bac98e20e7..a6d220622b 100644 --- a/core/io/packet_peer_dtls.cpp +++ b/core/io/packet_peer_dtls.cpp @@ -30,7 +30,7 @@ #include "packet_peer_dtls.h" #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" PacketPeerDTLS *(*PacketPeerDTLS::_create)() = nullptr; bool PacketPeerDTLS::available = false; diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index cadb02b5dd..806a95398f 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -31,9 +31,9 @@ #include "pck_packer.h" #include "core/crypto/crypto_core.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" #include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION -#include "core/os/file_access.h" #include "core/version.h" static int _get_pad(int p_alignment, int p_n) { diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h index dec8f8748d..3d2ce8f240 100644 --- a/core/io/pck_packer.h +++ b/core/io/pck_packer.h @@ -31,12 +31,12 @@ #ifndef PCK_PACKER_H #define PCK_PACKER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" class FileAccess; -class PCKPacker : public Reference { - GDCLASS(PCKPacker, Reference); +class PCKPacker : public RefCounted { + GDCLASS(PCKPacker, RefCounted); FileAccess *file = nullptr; int alignment = 0; diff --git a/core/io/resource.cpp b/core/io/resource.cpp index d46e9edafa..b970e85c99 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -31,9 +31,9 @@ #include "resource.h" #include "core/core_string_names.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/object/script_language.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "scene/main/node.h" //only so casting works diff --git a/core/io/resource.h b/core/io/resource.h index 75a9f928f8..028fed1c6e 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -32,7 +32,7 @@ #define RESOURCE_H #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/safe_refcount.h" #include "core/templates/self_list.h" @@ -43,8 +43,8 @@ public: \ private: -class Resource : public Reference { - GDCLASS(Resource, Reference); +class Resource : public RefCounted { + GDCLASS(Resource, RefCounted); OBJ_CATEGORY("Resources"); public: diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 385f15c0cf..f83ba30514 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -31,10 +31,10 @@ #include "resource_format_binary.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/io/file_access_compressed.h" #include "core/io/image.h" #include "core/io/marshalls.h" -#include "core/os/dir_access.h" #include "core/version.h" //#define print_bl(m_what) print_line(m_what) diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index 3592bbdbc4..abc7403935 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -31,9 +31,9 @@ #ifndef RESOURCE_FORMAT_BINARY_H #define RESOURCE_FORMAT_BINARY_H +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" class ResourceLoaderBinary { bool translation_remapped = false; diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index a14d6ba52c..2ceeb176e5 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -93,8 +93,8 @@ public: ResourceFormatImporter(); }; -class ResourceImporter : public Reference { - GDCLASS(ResourceImporter, Reference); +class ResourceImporter : public RefCounted { + GDCLASS(ResourceImporter, RefCounted); public: virtual String get_importer_name() const = 0; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index b48c48b1bc..9839a563fd 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -31,8 +31,8 @@ #include "resource_loader.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_importer.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/string/print_string.h" #include "core/string/translation.h" diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 914d988caa..c656b9a69c 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -35,8 +35,8 @@ #include "core/os/semaphore.h" #include "core/os/thread.h" -class ResourceFormatLoader : public Reference { - GDCLASS(ResourceFormatLoader, Reference); +class ResourceFormatLoader : public RefCounted { + GDCLASS(ResourceFormatLoader, RefCounted); public: enum CacheMode { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 7ebc7f34b3..f7ddea7266 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -30,9 +30,9 @@ #include "resource_saver.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/object/script_language.h" -#include "core/os/file_access.h" Ref<ResourceFormatSaver> ResourceSaver::saver[MAX_SAVERS]; diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h index 2c9e8f1aa3..07154aac4d 100644 --- a/core/io/resource_saver.h +++ b/core/io/resource_saver.h @@ -33,8 +33,8 @@ #include "core/io/resource.h" -class ResourceFormatSaver : public Reference { - GDCLASS(ResourceFormatSaver, Reference); +class ResourceFormatSaver : public RefCounted { + GDCLASS(ResourceFormatSaver, RefCounted); protected: static void _bind_methods(); diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index 1e1a3e890c..effc3850af 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -31,10 +31,10 @@ #ifndef STREAM_PEER_H #define STREAM_PEER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class StreamPeer : public Reference { - GDCLASS(StreamPeer, Reference); +class StreamPeer : public RefCounted { + GDCLASS(StreamPeer, RefCounted); OBJ_CATEGORY("Networking"); protected: diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index abefa53c6f..10985a04d5 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -36,8 +36,8 @@ #include "core/io/stream_peer.h" #include "core/io/stream_peer_tcp.h" -class TCPServer : public Reference { - GDCLASS(TCPServer, Reference); +class TCPServer : public RefCounted { + GDCLASS(TCPServer, RefCounted); protected: enum { diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 9adf912224..83d575cee8 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -30,7 +30,7 @@ #include "translation_loader_po.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/string/translation.h" #include "core/string/translation_po.h" diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index 36d33fcac3..c52820e60d 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -31,8 +31,8 @@ #ifndef TRANSLATION_LOADER_PO_H #define TRANSLATION_LOADER_PO_H +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "core/string/translation.h" class TranslationLoaderPO : public ResourceFormatLoader { diff --git a/core/io/udp_server.h b/core/io/udp_server.h index 60d03f37f0..e49a559c51 100644 --- a/core/io/udp_server.h +++ b/core/io/udp_server.h @@ -34,8 +34,8 @@ #include "core/io/net_socket.h" #include "core/io/packet_peer_udp.h" -class UDPServer : public Reference { - GDCLASS(UDPServer, Reference); +class UDPServer : public RefCounted { + GDCLASS(UDPServer, RefCounted); protected: enum { diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h index c323301eac..1113cce715 100644 --- a/core/io/xml_parser.h +++ b/core/io/xml_parser.h @@ -31,8 +31,8 @@ #ifndef XML_PARSER_H #define XML_PARSER_H -#include "core/object/reference.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" +#include "core/object/ref_counted.h" #include "core/string/ustring.h" #include "core/templates/vector.h" @@ -40,8 +40,8 @@ Based on irrXML (see their zlib license). Added mainly for compatibility with their Collada loader. */ -class XMLParser : public Reference { - GDCLASS(XMLParser, Reference); +class XMLParser : public RefCounted { + GDCLASS(XMLParser, RefCounted); public: //! Enumeration of all supported source text file formats diff --git a/core/io/zip_io.h b/core/io/zip_io.h index 52691c65e9..776473bfa1 100644 --- a/core/io/zip_io.h +++ b/core/io/zip_io.h @@ -31,7 +31,7 @@ #ifndef ZIP_IO_H #define ZIP_IO_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" // Not directly used in this header, but assumed available in downstream users // like platform/*/export/export.cpp. Could be fixed, but probably better to have diff --git a/core/math/a_star.h b/core/math/a_star.h index 4c61abd91c..44758cb046 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -31,7 +31,7 @@ #ifndef A_STAR_H #define A_STAR_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/oa_hash_map.h" /** @@ -40,8 +40,8 @@ @author Juan Linietsky <reduzio@gmail.com> */ -class AStar : public Reference { - GDCLASS(AStar, Reference); +class AStar : public RefCounted { + GDCLASS(AStar, RefCounted); friend class AStar2D; struct Point { @@ -157,8 +157,8 @@ public: ~AStar(); }; -class AStar2D : public Reference { - GDCLASS(AStar2D, Reference); +class AStar2D : public RefCounted { + GDCLASS(AStar2D, RefCounted); AStar astar; bool _solve(AStar::Point *begin_point, AStar::Point *end_point); diff --git a/core/math/delaunay_3d.h b/core/math/delaunay_3d.h index 25cc1125db..6f7209556e 100644 --- a/core/math/delaunay_3d.h +++ b/core/math/delaunay_3d.h @@ -31,10 +31,10 @@ #ifndef DELAUNAY_3D_H #define DELAUNAY_3D_H +#include "core/io/file_access.h" #include "core/math/aabb.h" #include "core/math/camera_matrix.h" #include "core/math/vector3.h" -#include "core/os/file_access.h" #include "core/string/print_string.h" #include "core/templates/local_vector.h" #include "core/templates/oa_hash_map.h" diff --git a/core/math/expression.cpp b/core/math/expression.cpp index f7ac44d321..0146c345f0 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -33,7 +33,7 @@ #include "core/io/marshalls.h" #include "core/math/math_funcs.h" #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/variant/variant_parser.h" diff --git a/core/math/expression.h b/core/math/expression.h index a6b288ed6e..aecf662d0a 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -31,10 +31,10 @@ #ifndef EXPRESSION_H #define EXPRESSION_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class Expression : public Reference { - GDCLASS(Expression, Reference); +class Expression : public RefCounted { + GDCLASS(Expression, RefCounted); private: struct Input { diff --git a/core/math/random_number_generator.h b/core/math/random_number_generator.h index a396c2b7d7..06cd3999f3 100644 --- a/core/math/random_number_generator.h +++ b/core/math/random_number_generator.h @@ -32,10 +32,10 @@ #define RANDOM_NUMBER_GENERATOR_H #include "core/math/random_pcg.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class RandomNumberGenerator : public Reference { - GDCLASS(RandomNumberGenerator, Reference); +class RandomNumberGenerator : public RefCounted { + GDCLASS(RandomNumberGenerator, RefCounted); protected: RandomPCG randbase; diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 1d1dbc114b..463b0dd5c8 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -32,10 +32,10 @@ #define TRIANGLE_MESH_H #include "core/math/face3.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class TriangleMesh : public Reference { - GDCLASS(TriangleMesh, Reference); +class TriangleMesh : public RefCounted { + GDCLASS(TriangleMesh, RefCounted); struct Triangle { Vector3 normal; diff --git a/core/object/object.cpp b/core/object/object.cpp index 7e1c3855c0..799e63a512 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -769,7 +769,7 @@ Variant Object::call(const StringName &p_method, const Variant **p_args, int p_a r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; return Variant(); } - if (Object::cast_to<Reference>(this)) { + if (Object::cast_to<RefCounted>(this)) { r_error.argument = 0; r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; ERR_FAIL_V_MSG(Variant(), "Can't 'free' a reference."); @@ -1900,7 +1900,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) { object_slots = (ObjectSlot *)memrealloc(object_slots, sizeof(ObjectSlot) * new_slot_max); for (uint32_t i = slot_max; i < new_slot_max; i++) { object_slots[i].object = nullptr; - object_slots[i].is_reference = false; + object_slots[i].is_ref_counted = false; object_slots[i].next_free = i; object_slots[i].validator = 0; } @@ -1913,7 +1913,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) { ERR_FAIL_COND_V(object_slots[slot].object != nullptr, ObjectID()); } object_slots[slot].object = p_object; - object_slots[slot].is_reference = p_object->is_reference(); + object_slots[slot].is_ref_counted = p_object->is_ref_counted(); validator_counter = (validator_counter + 1) & OBJECTDB_VALIDATOR_MASK; if (unlikely(validator_counter == 0)) { validator_counter = 1; @@ -1924,7 +1924,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) { id <<= OBJECTDB_SLOT_MAX_COUNT_BITS; id |= uint64_t(slot); - if (p_object->is_reference()) { + if (p_object->is_ref_counted()) { id |= OBJECTDB_REFERENCE_BIT; } @@ -1962,7 +1962,7 @@ void ObjectDB::remove_instance(Object *p_object) { object_slots[slot_count].next_free = slot; //invalidate, so checks against it fail object_slots[slot].validator = 0; - object_slots[slot].is_reference = false; + object_slots[slot].is_ref_counted = false; object_slots[slot].object = nullptr; spin_lock.unlock(); @@ -1997,7 +1997,7 @@ void ObjectDB::cleanup() { extra_info = " - Resource path: " + String(resource_get_path->call(obj, nullptr, 0, call_error)); } - uint64_t id = uint64_t(i) | (uint64_t(object_slots[i].validator) << OBJECTDB_VALIDATOR_BITS) | (object_slots[i].is_reference ? OBJECTDB_REFERENCE_BIT : 0); + uint64_t id = uint64_t(i) | (uint64_t(object_slots[i].validator) << OBJECTDB_VALIDATOR_BITS) | (object_slots[i].is_ref_counted ? OBJECTDB_REFERENCE_BIT : 0); print_line("Leaked instance: " + String(obj->get_class()) + ":" + itos(id) + extra_info); count--; diff --git a/core/object/object.h b/core/object/object.h index 137025f323..37b2e61dfe 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -545,7 +545,7 @@ private: _FORCE_INLINE_ void _construct_object(bool p_reference); - friend class Reference; + friend class RefCounted; bool type_is_reference = false; SafeNumeric<uint32_t> instance_binding_count; void *_script_instance_bindings[MAX_SCRIPT_INSTANCE_BINDINGS]; @@ -795,7 +795,7 @@ public: void clear_internal_resource_paths(); - _ALWAYS_INLINE_ bool is_reference() const { return type_is_reference; } + _ALWAYS_INLINE_ bool is_ref_counted() const { return type_is_reference; } Object(); virtual ~Object(); @@ -815,7 +815,7 @@ class ObjectDB { struct ObjectSlot { //128 bits per slot uint64_t validator : OBJECTDB_VALIDATOR_BITS; uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS; - uint64_t is_reference : 1; + uint64_t is_ref_counted : 1; Object *object; }; diff --git a/core/object/object_id.h b/core/object/object_id.h index 7f2496ad48..0666ec0855 100644 --- a/core/object/object_id.h +++ b/core/object/object_id.h @@ -42,7 +42,7 @@ class ObjectID { uint64_t id = 0; public: - _ALWAYS_INLINE_ bool is_reference() const { return (id & (uint64_t(1) << 63)) != 0; } + _ALWAYS_INLINE_ bool is_ref_counted() const { return (id & (uint64_t(1) << 63)) != 0; } _ALWAYS_INLINE_ bool is_valid() const { return id != 0; } _ALWAYS_INLINE_ bool is_null() const { return id == 0; } _ALWAYS_INLINE_ operator uint64_t() const { return id; } diff --git a/core/object/reference.cpp b/core/object/ref_counted.cpp index 086b761e95..9862624972 100644 --- a/core/object/reference.cpp +++ b/core/object/ref_counted.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* reference.cpp */ +/* ref_counted.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "reference.h" +#include "ref_counted.h" #include "core/object/script_language.h" -bool Reference::init_ref() { +bool RefCounted::init_ref() { if (reference()) { if (!is_referenced() && refcount_init.unref()) { unreference(); // first referencing is already 1, so compensate for the ref above @@ -44,17 +44,17 @@ bool Reference::init_ref() { } } -void Reference::_bind_methods() { - ClassDB::bind_method(D_METHOD("init_ref"), &Reference::init_ref); - ClassDB::bind_method(D_METHOD("reference"), &Reference::reference); - ClassDB::bind_method(D_METHOD("unreference"), &Reference::unreference); +void RefCounted::_bind_methods() { + ClassDB::bind_method(D_METHOD("init_ref"), &RefCounted::init_ref); + ClassDB::bind_method(D_METHOD("reference"), &RefCounted::reference); + ClassDB::bind_method(D_METHOD("unreference"), &RefCounted::unreference); } -int Reference::reference_get_count() const { +int RefCounted::reference_get_count() const { return refcount.get(); } -bool Reference::reference() { +bool RefCounted::reference() { uint32_t rc_val = refcount.refval(); bool success = rc_val != 0; @@ -77,7 +77,7 @@ bool Reference::reference() { return success; } -bool Reference::unreference() { +bool RefCounted::unreference() { uint32_t rc_val = refcount.unrefval(); bool die = rc_val == 0; @@ -102,7 +102,7 @@ bool Reference::unreference() { return die; } -Reference::Reference() : +RefCounted::RefCounted() : Object(true) { refcount.init(); refcount_init.init(); @@ -117,7 +117,7 @@ Variant WeakRef::get_ref() const { if (!obj) { return Variant(); } - Reference *r = cast_to<Reference>(obj); + RefCounted *r = cast_to<RefCounted>(obj); if (r) { return REF(r); } diff --git a/core/object/reference.h b/core/object/ref_counted.h index d02cb12069..3dd7cc456b 100644 --- a/core/object/reference.h +++ b/core/object/ref_counted.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* reference.h */ +/* ref_counted.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef REFERENCE_H -#define REFERENCE_H +#ifndef REF_COUNTED_H +#define REF_COUNTED_H #include "core/object/class_db.h" #include "core/templates/safe_refcount.h" -class Reference : public Object { - GDCLASS(Reference, Object); +class RefCounted : public Object { + GDCLASS(RefCounted, Object); SafeRefCount refcount; SafeRefCount refcount_init; @@ -49,8 +49,8 @@ public: bool unreference(); int reference_get_count() const; - Reference(); - ~Reference() {} + RefCounted(); + ~RefCounted() {} }; template <class T> @@ -78,7 +78,7 @@ class Ref { } } - //virtual Reference * get_reference() const { return reference; } + //virtual RefCounted * get_reference() const { return reference; } public: _FORCE_INLINE_ bool operator==(const T *p_ptr) const { return reference == p_ptr; @@ -130,7 +130,7 @@ public: template <class T_Other> void operator=(const Ref<T_Other> &p_from) { - Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr())); + RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr())); if (!refb) { unref(); return; @@ -179,7 +179,7 @@ public: template <class T_Other> Ref(const Ref<T_Other> &p_from) { - Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr())); + RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr())); if (!refb) { unref(); return; @@ -234,10 +234,10 @@ public: } }; -typedef Ref<Reference> REF; +typedef Ref<RefCounted> REF; -class WeakRef : public Reference { - GDCLASS(WeakRef, Reference); +class WeakRef : public RefCounted { + GDCLASS(WeakRef, RefCounted); ObjectID ref; @@ -259,7 +259,7 @@ struct PtrToArg<Ref<T>> { } _FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) { - *(Ref<Reference> *)p_ptr = p_val; + *(Ref<RefCounted> *)p_ptr = p_val; } }; @@ -294,4 +294,4 @@ struct GetTypeInfo<const Ref<T> &> { #endif // DEBUG_METHODS_ENABLED -#endif // REFERENCE_H +#endif // REF_COUNTED_H diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp index e8735e335c..96c96c1efb 100644 --- a/core/object/undo_redo.cpp +++ b/core/object/undo_redo.cpp @@ -122,8 +122,8 @@ void UndoRedo::add_do_method(Object *p_object, const StringName &p_method, VARIA ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; do_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } do_op.type = Operation::TYPE_METHOD; @@ -148,8 +148,8 @@ void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VAR Operation undo_op; undo_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } undo_op.type = Operation::TYPE_METHOD; @@ -167,8 +167,8 @@ void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, c ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; do_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } do_op.type = Operation::TYPE_PROPERTY; @@ -189,8 +189,8 @@ void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property, Operation undo_op; undo_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } undo_op.type = Operation::TYPE_PROPERTY; @@ -205,8 +205,8 @@ void UndoRedo::add_do_reference(Object *p_object) { ERR_FAIL_COND((current_action + 1) >= actions.size()); Operation do_op; do_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - do_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + do_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } do_op.type = Operation::TYPE_REFERENCE; @@ -225,8 +225,8 @@ void UndoRedo::add_undo_reference(Object *p_object) { Operation undo_op; undo_op.object = p_object->get_instance_id(); - if (Object::cast_to<Reference>(p_object)) { - undo_op.ref = Ref<Reference>(Object::cast_to<Reference>(p_object)); + if (Object::cast_to<RefCounted>(p_object)) { + undo_op.ref = Ref<RefCounted>(Object::cast_to<RefCounted>(p_object)); } undo_op.type = Operation::TYPE_REFERENCE; diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h index a08ca7792f..8f009830e3 100644 --- a/core/object/undo_redo.h +++ b/core/object/undo_redo.h @@ -32,7 +32,7 @@ #define UNDO_REDO_H #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" class UndoRedo : public Object { GDCLASS(UndoRedo, Object); @@ -61,7 +61,7 @@ private: }; Type type; - Ref<Reference> ref; + Ref<RefCounted> ref; ObjectID object; StringName name; Variant args[VARIANT_ARG_MAX]; diff --git a/core/os/main_loop.h b/core/os/main_loop.h index 25a09fe98f..34e944709b 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -32,7 +32,7 @@ #define MAIN_LOOP_H #include "core/input/input_event.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/object/script_language.h" class MainLoop : public Object { diff --git a/core/os/os.cpp b/core/os/os.cpp index ca1b798e11..e2eecae58e 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -32,8 +32,8 @@ #include "core/config/project_settings.h" #include "core/input/input.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/midi_driver.h" #include "core/version_generated.gen.h" #include "servers/audio_server.h" @@ -310,6 +310,11 @@ String OS::get_user_data_dir() const { return "."; } +// Android OS path to app's external data storage +String OS::get_external_data_dir() const { + return get_user_data_dir(); +}; + // Absolute path to res:// String OS::get_resource_dir() const { return ProjectSettings::get_singleton()->get_resource_path(); diff --git a/core/os/os.h b/core/os/os.h index 7198607237..5bf9dc9288 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -252,6 +252,7 @@ public: virtual String get_bundle_resource_dir() const; virtual String get_user_data_dir() const; + virtual String get_external_data_dir() const; virtual String get_resource_dir() const; enum SystemDir { diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index f1b1b98bea..d68fc2a2c7 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -131,7 +131,7 @@ void register_core_types() { ClassDB::register_virtual_class<Script>(); - ClassDB::register_class<Reference>(); + ClassDB::register_class<RefCounted>(); ClassDB::register_class<WeakRef>(); ClassDB::register_class<Resource>(); ClassDB::register_class<Image>(); diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp index ad768f7140..d6b84cabc9 100644 --- a/core/string/translation_po.cpp +++ b/core/string/translation_po.cpp @@ -30,7 +30,7 @@ #include "translation_po.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #ifdef DEBUG_TRANSLATION_PO void TranslationPO::print_translation_map() { diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 49cf171f2b..ec5ec3dd79 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -54,7 +54,7 @@ #define snprintf _snprintf_s #endif -#define MAX_DIGITS 6 +#define MAX_DECIMALS 32 #define UPPERCASE(m_c) (((m_c) >= 'a' && (m_c) <= 'z') ? ((m_c) - ('a' - 'A')) : (m_c)) #define LOWERCASE(m_c) (((m_c) >= 'A' && (m_c) <= 'Z') ? ((m_c) + ('a' - 'A')) : (m_c)) #define IS_DIGIT(m_d) ((m_d) >= '0' && (m_d) <= '9') @@ -1379,8 +1379,11 @@ String String::num(double p_num, int p_decimals) { } #ifndef NO_USE_STDLIB - if (p_decimals > 16) { - p_decimals = 16; + if (p_decimals < 0) { + p_decimals = 14 - (int)floor(log10(p_num)); + } + if (p_decimals > MAX_DECIMALS) { + p_decimals = MAX_DECIMALS; } char fmt[7]; @@ -1391,7 +1394,6 @@ String String::num(double p_num, int p_decimals) { fmt[1] = 'l'; fmt[2] = 'f'; fmt[3] = 0; - } else if (p_decimals < 10) { fmt[2] = '0' + p_decimals; fmt[3] = 'l'; @@ -1458,8 +1460,9 @@ String String::num(double p_num, int p_decimals) { double dec = p_num - (double)((int)p_num); int digit = 0; - if (p_decimals > MAX_DIGITS) - p_decimals = MAX_DIGITS; + if (p_decimals > MAX_DECIMALS) { + p_decimals = MAX_DECIMALS; + } int dec_int = 0; int dec_max = 0; @@ -1471,16 +1474,18 @@ String String::num(double p_num, int p_decimals) { digit++; if (p_decimals == -1) { - if (digit == MAX_DIGITS) //no point in going to infinite + if (digit == MAX_DECIMALS) { //no point in going to infinite break; + } if (dec - (double)((int)dec) < 1e-6) { break; } } - if (digit == p_decimals) + if (digit == p_decimals) { break; + } } dec *= 10; int last = (int)dec % 10; @@ -1616,7 +1621,15 @@ String String::num_real(double p_num) { double dec = p_num - (double)((int)p_num); int digit = 0; - int decimals = MAX_DIGITS; + +#if REAL_T_IS_DOUBLE + int decimals = 14 - (int)floor(log10(p_num)); +#else + int decimals = 6 - (int)floor(log10(p_num)); +#endif + if (decimals > MAX_DECIMALS) { + decimals = MAX_DECIMALS; + } int dec_int = 0; int dec_max = 0; @@ -3786,7 +3799,7 @@ String String::humanize_size(uint64_t p_size) { return String::num(p_size / divisor).pad_decimals(digits) + " " + prefixes[prefix_idx]; } -bool String::is_abs_path() const { +bool String::is_absolute_path() const { if (length() > 1) { return (operator[](0) == '/' || operator[](0) == '\\' || find(":/") != -1 || find(":\\") != -1); } else if ((length()) == 1) { @@ -4396,7 +4409,7 @@ bool String::is_resource_file() const { } bool String::is_rel_path() const { - return !is_abs_path(); + return !is_absolute_path(); } String String::get_base_dir() const { diff --git a/core/string/ustring.h b/core/string/ustring.h index a56845deff..f05865165d 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -397,7 +397,7 @@ public: _FORCE_INLINE_ bool is_empty() const { return length() == 0; } // path functions - bool is_abs_path() const; + bool is_absolute_path() const; bool is_rel_path() const; bool is_resource_file() const; String path_to(const String &p_path) const; diff --git a/core/templates/command_queue_mt.cpp b/core/templates/command_queue_mt.cpp index 238bf3975c..04a8095f0b 100644 --- a/core/templates/command_queue_mt.cpp +++ b/core/templates/command_queue_mt.cpp @@ -70,35 +70,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() { return &sync_sems[idx]; } -bool CommandQueueMT::dealloc_one() { -tryagain: - if (dealloc_ptr == (write_ptr_and_epoch >> 1)) { - // The queue is empty - return false; - } - - uint32_t size = *(uint32_t *)&command_mem[dealloc_ptr]; - - if (size == 0) { - // End of command buffer wrap down - dealloc_ptr = 0; - goto tryagain; - } - - if (size & 1) { - // Still used, nothing can be deallocated - return false; - } - - dealloc_ptr += (size >> 1) + 8; - return true; -} - CommandQueueMT::CommandQueueMT(bool p_sync) { - command_mem_size = GLOBAL_DEF_RST("memory/limits/command_queue/multithreading_queue_size_kb", DEFAULT_COMMAND_MEM_SIZE_KB); - ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/command_queue/multithreading_queue_size_kb", PropertyInfo(Variant::INT, "memory/limits/command_queue/multithreading_queue_size_kb", PROPERTY_HINT_RANGE, "1,4096,1,or_greater")); - command_mem_size *= 1024; - command_mem = (uint8_t *)memalloc(command_mem_size); if (p_sync) { sync = memnew(Semaphore); } @@ -108,5 +80,4 @@ CommandQueueMT::~CommandQueueMT() { if (sync) { memdelete(sync); } - memfree(command_mem); } diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h index 0012cea72d..acc46da0d5 100644 --- a/core/templates/command_queue_mt.h +++ b/core/templates/command_queue_mt.h @@ -34,6 +34,8 @@ #include "core/os/memory.h" #include "core/os/mutex.h" #include "core/os/semaphore.h" +#include "core/string/print_string.h" +#include "core/templates/local_vector.h" #include "core/templates/simple_type.h" #include "core/typedefs.h" @@ -334,11 +336,7 @@ class CommandQueueMT { SYNC_SEMAPHORES = 8 }; - uint8_t *command_mem = nullptr; - uint32_t read_ptr_and_epoch = 0; - uint32_t write_ptr_and_epoch = 0; - uint32_t dealloc_ptr = 0; - uint32_t command_mem_size = 0; + LocalVector<uint8_t> command_mem; SyncSemaphore sync_sems[SYNC_SEMAPHORES]; Mutex mutex; Semaphore *sync = nullptr; @@ -346,138 +344,47 @@ class CommandQueueMT { template <class T> T *allocate() { // alloc size is size+T+safeguard - uint32_t alloc_size = ((sizeof(T) + 8 - 1) & ~(8 - 1)) + 8; - - // Assert that the buffer is big enough to hold at least two messages. - ERR_FAIL_COND_V(alloc_size * 2 + sizeof(uint32_t) > command_mem_size, nullptr); - - tryagain: - uint32_t write_ptr = write_ptr_and_epoch >> 1; - - if (write_ptr < dealloc_ptr) { - // behind dealloc_ptr, check that there is room - if ((dealloc_ptr - write_ptr) <= alloc_size) { - // There is no more room, try to deallocate something - if (dealloc_one()) { - goto tryagain; - } - return nullptr; - } - } else { - // ahead of dealloc_ptr, check that there is room - - if ((command_mem_size - write_ptr) < alloc_size + sizeof(uint32_t)) { - // no room at the end, wrap down; - - if (dealloc_ptr == 0) { // don't want write_ptr to become dealloc_ptr - - // There is no more room, try to deallocate something - if (dealloc_one()) { - goto tryagain; - } - return nullptr; - } - - // if this happens, it's a bug - ERR_FAIL_COND_V((command_mem_size - write_ptr) < 8, nullptr); - // zero means, wrap to beginning - - uint32_t *p = (uint32_t *)&command_mem[write_ptr]; - *p = 1; - write_ptr_and_epoch = 0 | (1 & ~write_ptr_and_epoch); // Invert epoch. - // See if we can get the thread to run and clear up some more space while we wait. - // This is required if alloc_size * 2 + 4 > COMMAND_MEM_SIZE - if (sync) { - sync->post(); - } - goto tryagain; - } - } - // Allocate the size and the 'in use' bit. - // First bit used to mark if command is still in use (1) - // or if it has been destroyed and can be deallocated (0). - uint32_t size = (sizeof(T) + 8 - 1) & ~(8 - 1); - uint32_t *p = (uint32_t *)&command_mem[write_ptr]; - *p = (size << 1) | 1; - write_ptr += 8; - // allocate the command - T *cmd = memnew_placement(&command_mem[write_ptr], T); - write_ptr += size; - write_ptr_and_epoch = (write_ptr << 1) | (write_ptr_and_epoch & 1); + uint32_t alloc_size = ((sizeof(T) + 8 - 1) & ~(8 - 1)); + uint64_t size = command_mem.size(); + command_mem.resize(size + alloc_size + 8); + *(uint64_t *)&command_mem[size] = alloc_size; + T *cmd = memnew_placement(&command_mem[size + 8], T); return cmd; } template <class T> T *allocate_and_lock() { lock(); - T *ret; - - while ((ret = allocate<T>()) == nullptr) { - unlock(); - // sleep a little until fetch happened and some room is made - wait_for_flush(); - lock(); - } - + T *ret = allocate<T>(); return ret; } - bool flush_one(bool p_lock = true) { - if (p_lock) { - lock(); - } - tryagain: - - // tried to read an empty queue - if (read_ptr_and_epoch == write_ptr_and_epoch) { - if (p_lock) { - unlock(); - } - return false; - } - - uint32_t read_ptr = read_ptr_and_epoch >> 1; - uint32_t size_ptr = read_ptr; - uint32_t size = *(uint32_t *)&command_mem[read_ptr] >> 1; - - if (size == 0) { - *(uint32_t *)&command_mem[read_ptr] = 0; // clear in-use bit. - //end of ringbuffer, wrap - read_ptr_and_epoch = 0 | (1 & ~read_ptr_and_epoch); // Invert epoch. - goto tryagain; - } - - read_ptr += 8; + void _flush() { + lock(); - CommandBase *cmd = reinterpret_cast<CommandBase *>(&command_mem[read_ptr]); + uint64_t read_ptr = 0; + uint64_t limit = command_mem.size(); - read_ptr += size; + while (read_ptr < limit) { + uint64_t size = *(uint64_t *)&command_mem[read_ptr]; + read_ptr += 8; + CommandBase *cmd = reinterpret_cast<CommandBase *>(&command_mem[read_ptr]); - read_ptr_and_epoch = (read_ptr << 1) | (read_ptr_and_epoch & 1); + cmd->call(); //execute the function + cmd->post(); //release in case it needs sync/ret + cmd->~CommandBase(); //should be done, so erase the command - if (p_lock) { - unlock(); - } - cmd->call(); - if (p_lock) { - lock(); + read_ptr += size; } - cmd->post(); - cmd->~CommandBase(); - *(uint32_t *)&command_mem[size_ptr] &= ~1; - - if (p_lock) { - unlock(); - } - return true; + command_mem.clear(); + unlock(); } void lock(); void unlock(); void wait_for_flush(); SyncSemaphore *_alloc_sync_sem(); - bool dealloc_one(); public: /* NORMAL PUSH COMMANDS */ @@ -492,23 +399,19 @@ public: DECL_PUSH_AND_SYNC(0) SPACE_SEP_LIST(DECL_PUSH_AND_SYNC, 15) - void wait_and_flush_one() { - ERR_FAIL_COND(!sync); - sync->wait(); - flush_one(); - } - _FORCE_INLINE_ void flush_if_pending() { - if (unlikely(read_ptr_and_epoch != write_ptr_and_epoch)) { - flush_all(); + if (unlikely(command_mem.size() > 0)) { + _flush(); } } void flush_all() { - //ERR_FAIL_COND(sync); - lock(); - while (flush_one(false)) { - } - unlock(); + _flush(); + } + + void wait_and_flush() { + ERR_FAIL_COND(!sync); + sync->wait(); + _flush(); } CommandQueueMT(bool p_sync); diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp index 5c87042f6b..34b3e3ea35 100644 --- a/core/variant/callable.cpp +++ b/core/variant/callable.cpp @@ -33,7 +33,7 @@ #include "callable_bind.h" #include "core/object/message_queue.h" #include "core/object/object.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/object/script_language.h" void Callable::call_deferred(const Variant **p_arguments, int p_argcount) const { diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 2bde08742c..c3962ad873 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1115,9 +1115,9 @@ void Variant::reference(const Variant &p_variant) { case OBJECT: { memnew_placement(_data._mem, ObjData); - if (p_variant._get_obj().obj && p_variant._get_obj().id.is_reference()) { - Reference *reference = static_cast<Reference *>(p_variant._get_obj().obj); - if (!reference->reference()) { + if (p_variant._get_obj().obj && p_variant._get_obj().id.is_ref_counted()) { + RefCounted *ref_counted = static_cast<RefCounted *>(p_variant._get_obj().obj); + if (!ref_counted->reference()) { _get_obj().obj = nullptr; _get_obj().id = ObjectID(); break; @@ -1301,11 +1301,11 @@ void Variant::_clear_internal() { reinterpret_cast<NodePath *>(_data._mem)->~NodePath(); } break; case OBJECT: { - if (_get_obj().id.is_reference()) { + if (_get_obj().id.is_ref_counted()) { //we are safe that there is a reference here - Reference *reference = static_cast<Reference *>(_get_obj().obj); - if (reference->unreference()) { - memdelete(reference); + RefCounted *ref_counted = static_cast<RefCounted *>(_get_obj().obj); + if (ref_counted->unreference()) { + memdelete(ref_counted); } } _get_obj().obj = nullptr; @@ -1830,7 +1830,7 @@ String Variant::stringify(List<const void *> &stack) const { } break; case OBJECT: { if (_get_obj().obj) { - if (!_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + if (!_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { return "[Freed Object]"; } @@ -2530,9 +2530,9 @@ Variant::Variant(const Object *p_object) { memnew_placement(_data._mem, ObjData); if (p_object) { - if (p_object->is_reference()) { - Reference *reference = const_cast<Reference *>(static_cast<const Reference *>(p_object)); - if (!reference->init_ref()) { + if (p_object->is_ref_counted()) { + RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_object)); + if (!ref_counted->init_ref()) { _get_obj().obj = nullptr; _get_obj().id = ObjectID(); return; @@ -2756,17 +2756,17 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast<::RID *>(_data._mem) = *reinterpret_cast<const ::RID *>(p_variant._data._mem); } break; case OBJECT: { - if (_get_obj().id.is_reference()) { + if (_get_obj().id.is_ref_counted()) { //we are safe that there is a reference here - Reference *reference = static_cast<Reference *>(_get_obj().obj); - if (reference->unreference()) { - memdelete(reference); + RefCounted *ref_counted = static_cast<RefCounted *>(_get_obj().obj); + if (ref_counted->unreference()) { + memdelete(ref_counted); } } - if (p_variant._get_obj().obj && p_variant._get_obj().id.is_reference()) { - Reference *reference = static_cast<Reference *>(p_variant._get_obj().obj); - if (!reference->reference()) { + if (p_variant._get_obj().obj && p_variant._get_obj().id.is_ref_counted()) { + RefCounted *ref_counted = static_cast<RefCounted *>(p_variant._get_obj().obj); + if (!ref_counted->reference()) { _get_obj().obj = nullptr; _get_obj().id = ObjectID(); break; @@ -3323,7 +3323,7 @@ bool Variant::hash_compare(const Variant &p_variant) const { } bool Variant::is_ref() const { - return type == OBJECT && _get_obj().id.is_reference(); + return type == OBJECT && _get_obj().id.is_ref_counted(); } Vector<Variant> varray() { diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index a1314a11f3..05ed35c760 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -972,7 +972,7 @@ void Variant::call(const StringName &p_method, const Variant **p_args, int p_arg return; } #ifdef DEBUG_ENABLED - if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return; } @@ -1365,7 +1365,7 @@ static void _register_variant_builtin_methods() { // FIXME: Static function, not sure how to bind //bind_method(String, humanize_size, sarray("size"), varray()); - bind_method(String, is_abs_path, sarray(), varray()); + bind_method(String, is_absolute_path, sarray(), varray()); bind_method(String, is_rel_path, sarray(), varray()); bind_method(String, get_base_dir, sarray(), varray()); bind_method(String, get_file, sarray(), varray()); diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index f66f33ef93..9e3ab5897b 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -836,9 +836,9 @@ String Variant::get_constructor_argument_name(Variant::Type p_type, int p_constr void VariantInternal::object_assign(Variant *v, const Object *o) { if (o) { - if (o->is_reference()) { - Reference *reference = const_cast<Reference *>(static_cast<const Reference *>(o)); - if (!reference->init_ref()) { + if (o->is_ref_counted()) { + RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(o)); + if (!ref_counted->init_ref()) { v->_get_obj().obj = nullptr; v->_get_obj().id = ObjectID(); return; diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 9e5811a082..78e1ad06ae 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -285,7 +285,7 @@ public: v->clear(); } - static void object_assign(Variant *v, const Object *o); // Needs Reference, so it's implemented elsewhere. + static void object_assign(Variant *v, const Object *o); // Needs RefCounted, so it's implemented elsewhere. _FORCE_INLINE_ static void object_assign(Variant *v, const Variant *o) { object_assign(v, o->_get_obj().obj); diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp index b58f60c149..12b5aa6590 100644 --- a/core/variant/variant_parser.cpp +++ b/core/variant/variant_parser.cpp @@ -742,7 +742,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - REF ref = REF(Object::cast_to<Reference>(obj)); + REF ref = REF(Object::cast_to<RefCounted>(obj)); get_token(p_stream, token, line, r_err_str); if (token.type != TK_COMMA) { @@ -1516,7 +1516,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str case Variant::STRING_NAME: { String str = p_variant; - str = "@\"" + str.c_escape() + "\""; + str = "&\"" + str.c_escape() + "\""; p_store_string_func(p_store_string_ud, str); } break; diff --git a/core/variant/variant_parser.h b/core/variant/variant_parser.h index 5703f0200c..05fc29b5e0 100644 --- a/core/variant/variant_parser.h +++ b/core/variant/variant_parser.h @@ -31,8 +31,8 @@ #ifndef VARIANT_PARSER_H #define VARIANT_PARSER_H +#include "core/io/file_access.h" #include "core/io/resource.h" -#include "core/os/file_access.h" #include "core/variant/variant.h" class VariantParser { diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index 4f4a80e807..ae2795f2fd 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -1453,7 +1453,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { #ifdef DEBUG_ENABLED - if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { valid = false; return false; } @@ -1680,7 +1680,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { #ifdef DEBUG_ENABLED - if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { valid = false; return false; } @@ -1865,7 +1865,7 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { return Variant(); } #ifdef DEBUG_ENABLED - if (EngineDebugger::is_active() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + if (EngineDebugger::is_active() && !_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { r_valid = false; return Variant(); } diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 553f2b23a2..5d1efb4166 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -32,7 +32,7 @@ #include "core/core_string_names.h" #include "core/io/marshalls.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/templates/oa_hash_map.h" #include "core/variant/binder_common.h" diff --git a/doc/classes/AESContext.xml b/doc/classes/AESContext.xml index f577bab992..9dde25028e 100644 --- a/doc/classes/AESContext.xml +++ b/doc/classes/AESContext.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AESContext" inherits="Reference" version="4.0"> +<class name="AESContext" inherits="RefCounted" version="4.0"> <brief_description> Interface to low level AES encryption features. </brief_description> diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml index fce2b90197..cc7f7072b9 100644 --- a/doc/classes/AStar.xml +++ b/doc/classes/AStar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AStar" inherits="Reference" version="4.0"> +<class name="AStar" inherits="RefCounted" version="4.0"> <brief_description> An implementation of A* to find the shortest paths among connected points in space. </brief_description> diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml index 3efd2f604c..9edc300169 100644 --- a/doc/classes/AStar2D.xml +++ b/doc/classes/AStar2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AStar2D" inherits="Reference" version="4.0"> +<class name="AStar2D" inherits="RefCounted" version="4.0"> <brief_description> AStar class representation that uses 2D vectors as edges. </brief_description> diff --git a/doc/classes/AnimatedSprite2D.xml b/doc/classes/AnimatedSprite2D.xml index 969e9cc85b..d18419f163 100644 --- a/doc/classes/AnimatedSprite2D.xml +++ b/doc/classes/AnimatedSprite2D.xml @@ -22,7 +22,7 @@ <method name="play"> <return type="void"> </return> - <argument index="0" name="anim" type="StringName" default="@"""> + <argument index="0" name="anim" type="StringName" default="&"""> </argument> <argument index="1" name="backwards" type="bool" default="false"> </argument> @@ -39,7 +39,7 @@ </method> </methods> <members> - <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="@"default""> + <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. </member> <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true"> diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index 02ccab4e05..39ab317b79 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -20,7 +20,7 @@ <method name="play"> <return type="void"> </return> - <argument index="0" name="anim" type="StringName" default="@"""> + <argument index="0" name="anim" type="StringName" default="&"""> </argument> <description> Plays the animation named [code]anim[/code]. If no [code]anim[/code] is provided, the current animation is played. @@ -35,7 +35,7 @@ </method> </methods> <members> - <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="@"default""> + <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> diff --git a/doc/classes/AnimationNodeAnimation.xml b/doc/classes/AnimationNodeAnimation.xml index 3f0843c112..75dae6a48e 100644 --- a/doc/classes/AnimationNodeAnimation.xml +++ b/doc/classes/AnimationNodeAnimation.xml @@ -14,7 +14,7 @@ <methods> </methods> <members> - <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="@"""> + <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"""> Animation to use as an output. It is one of the animations provided by [member AnimationTree.anim_player]. </member> </members> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index 2f0ebd7de6..7f07afecee 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -10,7 +10,7 @@ <methods> </methods> <members> - <member name="advance_condition" type="StringName" setter="set_advance_condition" getter="get_advance_condition" default="@"""> + <member name="advance_condition" type="StringName" setter="set_advance_condition" getter="get_advance_condition" default="&"""> Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the [AnimationTree] that can be controlled from code (see [url=https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code][/url]). For example, if [member AnimationTree.tree_root] is an [AnimationNodeStateMachine] and [member advance_condition] is set to [code]"idle"[/code]: [codeblocks] [gdscript] diff --git a/doc/classes/AnimationTrackEditPlugin.xml b/doc/classes/AnimationTrackEditPlugin.xml index 8490d48718..7b96808581 100644 --- a/doc/classes/AnimationTrackEditPlugin.xml +++ b/doc/classes/AnimationTrackEditPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimationTrackEditPlugin" inherits="Reference" version="4.0"> +<class name="AnimationTrackEditPlugin" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index f7a116b934..96333988f8 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -54,7 +54,7 @@ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. See [member ProjectSettings.physics/2d/default_angular_damp] for more details about damping. </member> - <member name="audio_bus_name" type="StringName" setter="set_audio_bus_name" getter="get_audio_bus_name" default="@"Master""> + <member name="audio_bus_name" type="StringName" setter="set_audio_bus_name" getter="get_audio_bus_name" default="&"Master""> The name of the area's audio bus. </member> <member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus" default="false"> diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml index 108387823b..a2724f3f23 100644 --- a/doc/classes/Area3D.xml +++ b/doc/classes/Area3D.xml @@ -52,7 +52,7 @@ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. See [member ProjectSettings.physics/3d/default_angular_damp] for more details about damping. </member> - <member name="audio_bus_name" type="StringName" setter="set_audio_bus_name" getter="get_audio_bus_name" default="@"Master""> + <member name="audio_bus_name" type="StringName" setter="set_audio_bus_name" getter="get_audio_bus_name" default="&"Master""> The name of the area's audio bus. </member> <member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus" default="false"> @@ -89,7 +89,7 @@ <member name="reverb_bus_enable" type="bool" setter="set_use_reverb_bus" getter="is_using_reverb_bus" default="false"> If [code]true[/code], the area applies reverb to its associated audio. </member> - <member name="reverb_bus_name" type="StringName" setter="set_reverb_bus" getter="get_reverb_bus" default="@"Master""> + <member name="reverb_bus_name" type="StringName" setter="set_reverb_bus" getter="get_reverb_bus" default="&"Master""> The reverb bus name to use for this area's associated audio. </member> <member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity" default="0.0"> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 49775fa28b..543ec096c7 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -33,8 +33,8 @@ [/gdscript] [csharp] // Array concatenation is not possible with C# arrays, but is with Godot.Collections.Array. - var array1 = new Godot.Collections.Array("One", 2); - var array2 = new Godot.Collections.Array(3, "Four"); + var array1 = new Godot.Collections.Array{"One", 2}; + var array2 = new Godot.Collections.Array{3, "Four"}; GD.Print(array1 + array2); // Prints [One, 2, 3, Four] [/csharp] [/codeblocks] diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml index 3117978d8a..4e924bcb65 100644 --- a/doc/classes/AudioEffectCompressor.xml +++ b/doc/classes/AudioEffectCompressor.xml @@ -32,7 +32,7 @@ <member name="release_ms" type="float" setter="set_release_ms" getter="get_release_ms" default="250.0"> Compressor's delay time to stop reducing the signal after the signal level falls below the threshold, in milliseconds. Value can range from 20 to 2000. </member> - <member name="sidechain" type="StringName" setter="set_sidechain" getter="get_sidechain" default="@"""> + <member name="sidechain" type="StringName" setter="set_sidechain" getter="get_sidechain" default="&"""> Reduce the sound level using another audio bus for threshold detection. </member> <member name="threshold" type="float" setter="set_threshold" getter="get_threshold" default="0.0"> diff --git a/doc/classes/AudioEffectInstance.xml b/doc/classes/AudioEffectInstance.xml index dc76880a36..9ab6028901 100644 --- a/doc/classes/AudioEffectInstance.xml +++ b/doc/classes/AudioEffectInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectInstance" inherits="Reference" version="4.0"> +<class name="AudioEffectInstance" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml index da75ff206c..cb01aa75e8 100644 --- a/doc/classes/AudioStreamPlayback.xml +++ b/doc/classes/AudioStreamPlayback.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayback" inherits="Reference" version="4.0"> +<class name="AudioStreamPlayback" inherits="RefCounted" version="4.0"> <brief_description> Meta class for playing back audio. </brief_description> diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml index 113cc64b9d..7c7f7e0cea 100644 --- a/doc/classes/AudioStreamPlayer.xml +++ b/doc/classes/AudioStreamPlayer.xml @@ -60,7 +60,7 @@ <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled" default="false"> If [code]true[/code], audio plays when added to scene tree. </member> - <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@"Master""> + <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="&"Master""> Bus on which this audio is playing. </member> <member name="mix_target" type="int" setter="set_mix_target" getter="get_mix_target" enum="AudioStreamPlayer.MixTarget" default="0"> diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml index e7c276f463..b1e18ab550 100644 --- a/doc/classes/AudioStreamPlayer2D.xml +++ b/doc/classes/AudioStreamPlayer2D.xml @@ -62,7 +62,7 @@ <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled" default="false"> If [code]true[/code], audio plays when added to scene tree. </member> - <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@"Master""> + <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="&"Master""> Bus on which this audio is playing. </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="2000.0"> diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index a1759bd588..3bd20b4b9b 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -69,7 +69,7 @@ <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled" default="false"> If [code]true[/code], audio plays when the AudioStreamPlayer3D node is added to scene tree. </member> - <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@"Master""> + <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="&"Master""> The bus on which this audio is playing. </member> <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="AudioStreamPlayer3D.DopplerTracking" default="0"> diff --git a/doc/classes/CameraFeed.xml b/doc/classes/CameraFeed.xml index 4fc124592f..fc7dcd3772 100644 --- a/doc/classes/CameraFeed.xml +++ b/doc/classes/CameraFeed.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CameraFeed" inherits="Reference" version="4.0"> +<class name="CameraFeed" inherits="RefCounted" version="4.0"> <brief_description> A camera feed gives you access to a single physical camera attached to your device. </brief_description> diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml index 7b57dc05f8..7a6a18f532 100644 --- a/doc/classes/CharFXTransform.xml +++ b/doc/classes/CharFXTransform.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CharFXTransform" inherits="Reference" version="4.0"> +<class name="CharFXTransform" inherits="RefCounted" version="4.0"> <brief_description> Controls how an individual character will be displayed in a [RichTextEffect]. </brief_description> diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index c3bb3d28e0..0e6ca073a7 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -101,6 +101,9 @@ <member name="floor_max_angle" type="float" setter="set_floor_max_angle" getter="get_floor_max_angle" default="0.785398"> Maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall, when calling [method move_and_slide]. The default value equals 45 degrees. </member> + <member name="floor_max_angle_degrees" type="float" setter="set_floor_max_angle_degrees" getter="get_floor_max_angle_degrees" default="45.0"> + Maximum angle (in degrees) where a slope is still considered a floor (or a ceiling), rather than a wall, when calling [method move_and_slide]. + </member> <member name="infinite_inertia" type="bool" setter="set_infinite_inertia_enabled" getter="is_infinite_inertia_enabled" default="true"> If [code]true[/code], the body will be able to push [RigidBody2D] nodes when calling [method move_and_slide], but it also won't detect any collisions with them. If [code]false[/code], it will interact with [RigidBody2D] nodes like with [StaticBody2D]. </member> diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 986874df3b..790edfcad1 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -87,6 +87,9 @@ <member name="floor_max_angle" type="float" setter="set_floor_max_angle" getter="get_floor_max_angle" default="0.785398"> Maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall, when calling [method move_and_slide]. The default value equals 45 degrees. </member> + <member name="floor_max_angle_degrees" type="float" setter="set_floor_max_angle_degrees" getter="get_floor_max_angle_degrees" default="45.0"> + Maximum angle (in degrees) where a slope is still considered a floor (or a ceiling), rather than a wall, when calling [method move_and_slide]. + </member> <member name="infinite_inertia" type="bool" setter="set_infinite_inertia_enabled" getter="is_infinite_inertia_enabled" default="true"> If [code]true[/code], the body will be able to push [RigidBody3D] nodes when calling [method move_and_slide], but it also won't detect any collisions with them. If [code]false[/code], it will interact with [RigidBody3D] nodes like with [StaticBody3D]. </member> diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index 38948a2d6e..8b903d8dbc 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConfigFile" inherits="Reference" version="4.0"> +<class name="ConfigFile" inherits="RefCounted" version="4.0"> <brief_description> Helper class to handle INI-style files. </brief_description> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 12344712a0..9c61fca598 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -1175,7 +1175,7 @@ <member name="theme" type="Theme" setter="set_theme" getter="get_theme"> The [Theme] resource this node and all its [Control] children use. If a child node has its own [Theme] resource set, theme items are merged with child's definitions having higher priority. </member> - <member name="theme_custom_type" type="StringName" setter="set_theme_custom_type" getter="get_theme_custom_type" default="@"""> + <member name="theme_custom_type" type="StringName" setter="set_theme_custom_type" getter="get_theme_custom_type" default="&"""> The type name used by this [Control] to look up its own theme items. By default, the class name of the node is used (e.g. [code]Button[/code] for the [Button] control), as well as the class names of all parent classes (in order of inheritance). Setting this property gives the highest priority to the type of the specified name, then falls back on the class names. [b]Note:[/b] To look up [Control]'s own items use various [code]get_theme_*[/code] methods without specifying [code]theme_type[/code]. [b]Note:[/b] Theme items are looked for in the tree order, from branch to root, where each [Control] node is checked for its [member theme] property. The earliest match against any type/class name is returned. The project-level Theme and the default Theme are checked last. diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index 1f6cb40cde..deda6116f4 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Crypto" inherits="Reference" version="4.0"> +<class name="Crypto" inherits="RefCounted" version="4.0"> <brief_description> Access to advanced cryptographic functionalities. </brief_description> diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml index 91a04b1f28..28d68d309f 100644 --- a/doc/classes/DTLSServer.xml +++ b/doc/classes/DTLSServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DTLSServer" inherits="Reference" version="4.0"> +<class name="DTLSServer" inherits="RefCounted" version="4.0"> <brief_description> Helper class to implement a DTLS server. </brief_description> diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml index 2c61d723cd..dae8d83f0c 100644 --- a/doc/classes/Directory.xml +++ b/doc/classes/Directory.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Directory" inherits="Reference" version="4.0"> +<class name="Directory" inherits="RefCounted" version="4.0"> <brief_description> Type used to handle the filesystem. </brief_description> diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml index b29734de1c..d9e3003fbb 100644 --- a/doc/classes/EditorExportPlugin.xml +++ b/doc/classes/EditorExportPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorExportPlugin" inherits="Reference" version="4.0"> +<class name="EditorExportPlugin" inherits="RefCounted" version="4.0"> <brief_description> A script that is executed when exporting the project. </brief_description> diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml index e05a685dd7..0cd839f370 100644 --- a/doc/classes/EditorFeatureProfile.xml +++ b/doc/classes/EditorFeatureProfile.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorFeatureProfile" inherits="Reference" version="4.0"> +<class name="EditorFeatureProfile" inherits="RefCounted" version="4.0"> <brief_description> An editor feature profile which can be used to disable specific features. </brief_description> diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index 8204dc931e..b092a53676 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorInspectorPlugin" inherits="Reference" version="4.0"> +<class name="EditorInspectorPlugin" inherits="RefCounted" version="4.0"> <brief_description> Plugin for adding custom property editors on inspector. </brief_description> diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index f568263ff8..fd9fae435b 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -25,7 +25,7 @@ </argument> <argument index="1" name="value" type="Variant"> </argument> - <argument index="2" name="field" type="StringName" default="@"""> + <argument index="2" name="field" type="StringName" default="&"""> </argument> <argument index="3" name="changing" type="bool" default="false"> </argument> diff --git a/doc/classes/EditorResourceConversionPlugin.xml b/doc/classes/EditorResourceConversionPlugin.xml index 1976eb802c..1d7e98c99d 100644 --- a/doc/classes/EditorResourceConversionPlugin.xml +++ b/doc/classes/EditorResourceConversionPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorResourceConversionPlugin" inherits="Reference" version="4.0"> +<class name="EditorResourceConversionPlugin" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml index e935bf19fc..c191c9db12 100644 --- a/doc/classes/EditorResourcePreviewGenerator.xml +++ b/doc/classes/EditorResourcePreviewGenerator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorResourcePreviewGenerator" inherits="Reference" version="4.0"> +<class name="EditorResourcePreviewGenerator" inherits="RefCounted" version="4.0"> <brief_description> Custom generator of previews. </brief_description> diff --git a/doc/classes/EditorSceneImporter.xml b/doc/classes/EditorSceneImporter.xml index aa55a1653d..8df3091057 100644 --- a/doc/classes/EditorSceneImporter.xml +++ b/doc/classes/EditorSceneImporter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSceneImporter" inherits="Reference" version="4.0"> +<class name="EditorSceneImporter" inherits="RefCounted" version="4.0"> <brief_description> Imports scenes from third-parties' 3D files. </brief_description> diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml index d1cdc4e43e..789366c2a4 100644 --- a/doc/classes/EditorScenePostImport.xml +++ b/doc/classes/EditorScenePostImport.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorScenePostImport" inherits="Reference" version="4.0"> +<class name="EditorScenePostImport" inherits="RefCounted" version="4.0"> <brief_description> Post-processes scenes after import. </brief_description> diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml index 60ccf451b8..a91ea0eb14 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorScript" inherits="Reference" version="4.0"> +<class name="EditorScript" inherits="RefCounted" version="4.0"> <brief_description> Base script that can be used to add extension functions to the editor. </brief_description> diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index c97459d9dc..349d2ec934 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorTranslationParserPlugin" inherits="Reference" version="4.0"> +<class name="EditorTranslationParserPlugin" inherits="RefCounted" version="4.0"> <brief_description> Plugin for adding custom parsers to extract strings that are to be translated from custom files (.csv, .json etc.). </brief_description> diff --git a/doc/classes/EncodedObjectAsID.xml b/doc/classes/EncodedObjectAsID.xml index 1e4fde453b..e3e36590a3 100644 --- a/doc/classes/EncodedObjectAsID.xml +++ b/doc/classes/EncodedObjectAsID.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EncodedObjectAsID" inherits="Reference" version="4.0"> +<class name="EncodedObjectAsID" inherits="RefCounted" version="4.0"> <brief_description> Holds a reference to an [Object]'s instance ID. </brief_description> diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml index d777c6fd9d..e41de4c4ed 100644 --- a/doc/classes/Expression.xml +++ b/doc/classes/Expression.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Expression" inherits="Reference" version="4.0"> +<class name="Expression" inherits="RefCounted" version="4.0"> <brief_description> A class that stores an expression you can execute. </brief_description> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index ea3b82dc54..8002f7dcb9 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="File" inherits="Reference" version="4.0"> +<class name="File" inherits="RefCounted" version="4.0"> <brief_description> Type to handle file reading and writing operations. </brief_description> diff --git a/doc/classes/HMACContext.xml b/doc/classes/HMACContext.xml index 00d528ef8f..9fa96e5ddf 100644 --- a/doc/classes/HMACContext.xml +++ b/doc/classes/HMACContext.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HMACContext" inherits="Reference" version="4.0"> +<class name="HMACContext" inherits="RefCounted" version="4.0"> <brief_description> Used to create an HMAC for a message using a key. </brief_description> diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index ddfcdf7724..a549994a69 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HTTPClient" inherits="Reference" version="4.0"> +<class name="HTTPClient" inherits="RefCounted" version="4.0"> <brief_description> Low-level hyper-text transfer protocol client. </brief_description> diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index e020293d76..1c7b7ca937 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HashingContext" inherits="Reference" version="4.0"> +<class name="HashingContext" inherits="RefCounted" version="4.0"> <brief_description> Context to compute cryptographic hashes over multiple iterations. </brief_description> diff --git a/doc/classes/InputEventAction.xml b/doc/classes/InputEventAction.xml index ed290fc7e2..42326f344f 100644 --- a/doc/classes/InputEventAction.xml +++ b/doc/classes/InputEventAction.xml @@ -14,7 +14,7 @@ <methods> </methods> <members> - <member name="action" type="StringName" setter="set_action" getter="get_action" default="@"""> + <member name="action" type="StringName" setter="set_action" getter="get_action" default="&"""> The action's name. Actions are accessed via this [String]. </member> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false"> diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml index a9fb50c262..7baff7aa39 100644 --- a/doc/classes/JSON.xml +++ b/doc/classes/JSON.xml @@ -27,9 +27,12 @@ </argument> <argument index="2" name="sort_keys" type="bool" default="false"> </argument> + <argument index="3" name="full_precision" type="bool" default="false"> + </argument> <description> Converts a [Variant] var to JSON text and returns the result. Useful for serializing data to store or send over the network. [b]Note:[/b] The JSON specification does not define integer or float types, but only a [i]number[/i] type. Therefore, converting a Variant to JSON text will convert all numerical values to [float] types. + [b]Note:[/b] If [code]full_precision[/code] is true, when printing floats, the unreliable digits are printed in addition to the reliable digits to guarantee exact decoding. Use [code]indent[/code] parameter to pretty print the output. [b]Example output:[/b] [codeblock] diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml index bc94f74b07..7311343b68 100644 --- a/doc/classes/JSONParseResult.xml +++ b/doc/classes/JSONParseResult.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JSONParseResult" inherits="Reference" version="4.0"> +<class name="JSONParseResult" inherits="RefCounted" version="4.0"> <brief_description> Data class wrapper for decoded JSON. </brief_description> diff --git a/doc/classes/JSONParser.xml b/doc/classes/JSONParser.xml index 31ba295418..991629f255 100644 --- a/doc/classes/JSONParser.xml +++ b/doc/classes/JSONParser.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JSONParser" inherits="Reference" version="4.0"> +<class name="JSONParser" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/JavaClass.xml b/doc/classes/JavaClass.xml index 69b7a9b718..0b6a44fe14 100644 --- a/doc/classes/JavaClass.xml +++ b/doc/classes/JavaClass.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JavaClass" inherits="Reference" version="4.0"> +<class name="JavaClass" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/JavaScriptObject.xml b/doc/classes/JavaScriptObject.xml index a9e9c77e89..087fe163b4 100644 --- a/doc/classes/JavaScriptObject.xml +++ b/doc/classes/JavaScriptObject.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JavaScriptObject" inherits="Reference" version="4.0"> +<class name="JavaScriptObject" inherits="RefCounted" version="4.0"> <brief_description> A wrapper class for native JavaScript objects. </brief_description> diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml index 8748f89618..5480d7d55f 100644 --- a/doc/classes/KinematicCollision2D.xml +++ b/doc/classes/KinematicCollision2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicCollision2D" inherits="Reference" version="4.0"> +<class name="KinematicCollision2D" inherits="RefCounted" version="4.0"> <brief_description> Collision data for [method PhysicsBody2D.move_and_collide] collisions. </brief_description> diff --git a/doc/classes/KinematicCollision3D.xml b/doc/classes/KinematicCollision3D.xml index 8eac15ebf4..329efab474 100644 --- a/doc/classes/KinematicCollision3D.xml +++ b/doc/classes/KinematicCollision3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicCollision3D" inherits="Reference" version="4.0"> +<class name="KinematicCollision3D" inherits="RefCounted" version="4.0"> <brief_description> Collision data for [method PhysicsBody3D.move_and_collide] collisions. </brief_description> diff --git a/doc/classes/Lightmapper.xml b/doc/classes/Lightmapper.xml index e80194858a..79fae42d68 100644 --- a/doc/classes/Lightmapper.xml +++ b/doc/classes/Lightmapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Lightmapper" inherits="Reference" version="4.0"> +<class name="Lightmapper" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml index 3c679047a0..da02511dc0 100644 --- a/doc/classes/MeshDataTool.xml +++ b/doc/classes/MeshDataTool.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MeshDataTool" inherits="Reference" version="4.0"> +<class name="MeshDataTool" inherits="RefCounted" version="4.0"> <brief_description> Helper tool to access and edit [Mesh] data. </brief_description> diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml index b2be92dbbd..5de5703d95 100644 --- a/doc/classes/MultiplayerAPI.xml +++ b/doc/classes/MultiplayerAPI.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiplayerAPI" inherits="Reference" version="4.0"> +<class name="MultiplayerAPI" inherits="RefCounted" version="4.0"> <brief_description> High-level multiplayer API. </brief_description> diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml index f5f6308401..dfda614f8e 100644 --- a/doc/classes/Mutex.xml +++ b/doc/classes/Mutex.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Mutex" inherits="Reference" version="4.0"> +<class name="Mutex" inherits="RefCounted" version="4.0"> <brief_description> A synchronization mutex (mutual exclusion). </brief_description> diff --git a/doc/classes/Node3DGizmo.xml b/doc/classes/Node3DGizmo.xml index 55080614fc..c561047332 100644 --- a/doc/classes/Node3DGizmo.xml +++ b/doc/classes/Node3DGizmo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Node3DGizmo" inherits="Reference" version="4.0"> +<class name="Node3DGizmo" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index b8b437f78f..c755c73465 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -221,6 +221,13 @@ Returns the path to the current engine executable. </description> </method> + <method name="get_external_data_dir" qualifiers="const"> + <return type="String"> + </return> + <description> + On Android, returns the absolute directory path where user data can be written to external storage if available. On all other platforms, this will return the same location as [method get_user_data_dir]. + </description> + </method> <method name="get_granted_permissions" qualifiers="const"> <return type="PackedStringArray"> </return> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 7da9c1ac38..f5dcd6bcdc 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -7,7 +7,7 @@ Every class which is not a built-in type inherits from this class. You can construct Objects from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript. Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the [method free] method from your script or delete the instance from C++. - Some classes that extend Object add memory management. This is the case of [Reference], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory. + Some classes that extend Object add memory management. This is the case of [RefCounted], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them. Property membership can be tested directly in GDScript using [code]in[/code]: [codeblocks] @@ -26,7 +26,7 @@ [/codeblocks] The [code]in[/code] operator will evaluate to [code]true[/code] as long as the key exists, even if the value is [code]null[/code]. Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification]. - [b]Note:[/b] Unlike references to a [Reference], references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use [Reference] for data classes instead of [Object]. + [b]Note:[/b] Unlike references to a [RefCounted], references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use [RefCounted] for data classes instead of [Object]. </description> <tutorials> <link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link> diff --git a/doc/classes/PCKPacker.xml b/doc/classes/PCKPacker.xml index e3c78e08f1..40e8683c93 100644 --- a/doc/classes/PCKPacker.xml +++ b/doc/classes/PCKPacker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PCKPacker" inherits="Reference" version="4.0"> +<class name="PCKPacker" inherits="RefCounted" version="4.0"> <brief_description> Creates packages that can be loaded into a running project. </brief_description> diff --git a/doc/classes/PackedDataContainerRef.xml b/doc/classes/PackedDataContainerRef.xml index f0f59675de..bfd5a6f1c1 100644 --- a/doc/classes/PackedDataContainerRef.xml +++ b/doc/classes/PackedDataContainerRef.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PackedDataContainerRef" inherits="Reference" version="4.0"> +<class name="PackedDataContainerRef" inherits="RefCounted" version="4.0"> <brief_description> - Reference version of [PackedDataContainer]. + Reference-counted version of [PackedDataContainer]. </brief_description> <description> </description> diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml index e3e2f63e14..0a758c2cd6 100644 --- a/doc/classes/PacketPeer.xml +++ b/doc/classes/PacketPeer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PacketPeer" inherits="Reference" version="4.0"> +<class name="PacketPeer" inherits="RefCounted" version="4.0"> <brief_description> Abstraction and base class for packet-based protocols. </brief_description> diff --git a/doc/classes/PhysicsShapeQueryParameters2D.xml b/doc/classes/PhysicsShapeQueryParameters2D.xml index 4d7fc61517..92bd9b136a 100644 --- a/doc/classes/PhysicsShapeQueryParameters2D.xml +++ b/doc/classes/PhysicsShapeQueryParameters2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryParameters2D" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryParameters2D" inherits="RefCounted" version="4.0"> <brief_description> Parameters to be sent to a 2D shape physics query. </brief_description> diff --git a/doc/classes/PhysicsShapeQueryParameters3D.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml index 79bc29057f..087c52a650 100644 --- a/doc/classes/PhysicsShapeQueryParameters3D.xml +++ b/doc/classes/PhysicsShapeQueryParameters3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryParameters3D" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryParameters3D" inherits="RefCounted" version="4.0"> <brief_description> Parameters to be sent to a 3D shape physics query. </brief_description> diff --git a/doc/classes/PhysicsShapeQueryResult2D.xml b/doc/classes/PhysicsShapeQueryResult2D.xml index 227683cc33..07b7bc90e2 100644 --- a/doc/classes/PhysicsShapeQueryResult2D.xml +++ b/doc/classes/PhysicsShapeQueryResult2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryResult2D" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryResult2D" inherits="RefCounted" version="4.0"> <brief_description> Result of a 2D shape query in [PhysicsServer2D]. </brief_description> diff --git a/doc/classes/PhysicsShapeQueryResult3D.xml b/doc/classes/PhysicsShapeQueryResult3D.xml index 4555c4e242..d0ca227a68 100644 --- a/doc/classes/PhysicsShapeQueryResult3D.xml +++ b/doc/classes/PhysicsShapeQueryResult3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryResult3D" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryResult3D" inherits="RefCounted" version="4.0"> <brief_description> Result of a 3D shape query in [PhysicsServer3D]. </brief_description> diff --git a/doc/classes/PhysicsTestMotionResult2D.xml b/doc/classes/PhysicsTestMotionResult2D.xml index 301cff2885..2744aa17a1 100644 --- a/doc/classes/PhysicsTestMotionResult2D.xml +++ b/doc/classes/PhysicsTestMotionResult2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsTestMotionResult2D" inherits="Reference" version="4.0"> +<class name="PhysicsTestMotionResult2D" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index b74a1f848b..bf8bad3bbd 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1139,8 +1139,6 @@ <member name="layer_names/3d_render/layer_9" type="String" setter="" getter="" default=""""> Optional name for the 3D render layer 9. If left empty, the layer will display as "Layer 9". </member> - <member name="memory/limits/command_queue/multithreading_queue_size_kb" type="int" setter="" getter="" default="256"> - </member> <member name="memory/limits/message_queue/max_size_kb" type="int" setter="" getter="" default="4096"> Godot uses a message queue to defer some function calls. If you run out of space on it (you will see an error), you can increase the size here. </member> @@ -1576,20 +1574,31 @@ <member name="rendering/textures/default_filters/use_nearest_mipmap_filter" type="bool" setter="" getter="" default="false"> If [code]true[/code], uses nearest-neighbor mipmap filtering when using mipmaps (also called "bilinear filtering"), which will result in visible seams appearing between mipmap stages. This may increase performance in mobile as less memory bandwidth is used. If [code]false[/code], linear mipmap filtering (also called "trilinear filtering") is used. </member> + <member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false"> + If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP. + </member> + <member name="rendering/textures/lossless_compression/webp_compression_level" type="int" setter="" getter="" default="2"> + The default compression level for lossless WebP. Higher levels result in smaller files at the cost of compression speed. Decompression speed is mostly unaffected by the compression level. Supported values are 0 to 9. Note that compression levels above 6 are very slow and offer very little savings. + </member> <member name="rendering/textures/vram_compression/import_bptc" type="bool" setter="" getter="" default="false"> If [code]true[/code], the texture importer will import VRAM-compressed textures using the BPTC algorithm. This texture compression algorithm is only supported on desktop platforms, and only when using the Vulkan renderer. + [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor. </member> <member name="rendering/textures/vram_compression/import_etc" type="bool" setter="" getter="" default="false"> If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression algorithm. This algorithm doesn't support alpha channels in textures. + [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor. </member> <member name="rendering/textures/vram_compression/import_etc2" type="bool" setter="" getter="" default="true"> If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm. This texture compression algorithm is only supported when using the Vulkan renderer. + [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor. </member> <member name="rendering/textures/vram_compression/import_pvrtc" type="bool" setter="" getter="" default="false"> If [code]true[/code], the texture importer will import VRAM-compressed textures using the PowerVR Texture Compression algorithm. This texture compression algorithm is only supported on iOS. + [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor. </member> <member name="rendering/textures/vram_compression/import_s3tc" type="bool" setter="" getter="" default="true"> If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm. This algorithm is only supported on desktop platforms and consoles. + [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor. </member> <member name="rendering/vulkan/descriptor_pools/max_descriptors_per_pool" type="int" setter="" getter="" default="64"> </member> diff --git a/doc/classes/RDAttachmentFormat.xml b/doc/classes/RDAttachmentFormat.xml index 4ee7b9b28e..b73377bf77 100644 --- a/doc/classes/RDAttachmentFormat.xml +++ b/doc/classes/RDAttachmentFormat.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDAttachmentFormat" inherits="Reference" version="4.0"> +<class name="RDAttachmentFormat" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDPipelineColorBlendState.xml b/doc/classes/RDPipelineColorBlendState.xml index adc6f1f6a3..1424a0d653 100644 --- a/doc/classes/RDPipelineColorBlendState.xml +++ b/doc/classes/RDPipelineColorBlendState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDPipelineColorBlendState" inherits="Reference" version="4.0"> +<class name="RDPipelineColorBlendState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDPipelineColorBlendStateAttachment.xml b/doc/classes/RDPipelineColorBlendStateAttachment.xml index 7f118b5f0b..a6a1900cb5 100644 --- a/doc/classes/RDPipelineColorBlendStateAttachment.xml +++ b/doc/classes/RDPipelineColorBlendStateAttachment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDPipelineColorBlendStateAttachment" inherits="Reference" version="4.0"> +<class name="RDPipelineColorBlendStateAttachment" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDPipelineDepthStencilState.xml b/doc/classes/RDPipelineDepthStencilState.xml index 562ff52819..76e0506bca 100644 --- a/doc/classes/RDPipelineDepthStencilState.xml +++ b/doc/classes/RDPipelineDepthStencilState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDPipelineDepthStencilState" inherits="Reference" version="4.0"> +<class name="RDPipelineDepthStencilState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDPipelineMultisampleState.xml b/doc/classes/RDPipelineMultisampleState.xml index 4658c7d9ba..8c90f02301 100644 --- a/doc/classes/RDPipelineMultisampleState.xml +++ b/doc/classes/RDPipelineMultisampleState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDPipelineMultisampleState" inherits="Reference" version="4.0"> +<class name="RDPipelineMultisampleState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDPipelineRasterizationState.xml b/doc/classes/RDPipelineRasterizationState.xml index 5064dd6deb..3f8c50cf42 100644 --- a/doc/classes/RDPipelineRasterizationState.xml +++ b/doc/classes/RDPipelineRasterizationState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDPipelineRasterizationState" inherits="Reference" version="4.0"> +<class name="RDPipelineRasterizationState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDSamplerState.xml b/doc/classes/RDSamplerState.xml index ab31960b7c..9a9d55948c 100644 --- a/doc/classes/RDSamplerState.xml +++ b/doc/classes/RDSamplerState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDSamplerState" inherits="Reference" version="4.0"> +<class name="RDSamplerState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDShaderFile.xml b/doc/classes/RDShaderFile.xml index 14e70d53ea..346a97a1c0 100644 --- a/doc/classes/RDShaderFile.xml +++ b/doc/classes/RDShaderFile.xml @@ -10,7 +10,7 @@ <method name="get_bytecode" qualifiers="const"> <return type="RDShaderBytecode"> </return> - <argument index="0" name="version" type="StringName" default="@"""> + <argument index="0" name="version" type="StringName" default="&"""> </argument> <description> </description> @@ -26,7 +26,7 @@ </return> <argument index="0" name="bytecode" type="RDShaderBytecode"> </argument> - <argument index="1" name="version" type="StringName" default="@"""> + <argument index="1" name="version" type="StringName" default="&"""> </argument> <description> </description> diff --git a/doc/classes/RDShaderSource.xml b/doc/classes/RDShaderSource.xml index c1cfd34bb7..68fc43d8ef 100644 --- a/doc/classes/RDShaderSource.xml +++ b/doc/classes/RDShaderSource.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDShaderSource" inherits="Reference" version="4.0"> +<class name="RDShaderSource" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDTextureFormat.xml b/doc/classes/RDTextureFormat.xml index e41ddff368..ccfa6d1b95 100644 --- a/doc/classes/RDTextureFormat.xml +++ b/doc/classes/RDTextureFormat.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDTextureFormat" inherits="Reference" version="4.0"> +<class name="RDTextureFormat" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDTextureView.xml b/doc/classes/RDTextureView.xml index 73b2a7ae4a..db140ae775 100644 --- a/doc/classes/RDTextureView.xml +++ b/doc/classes/RDTextureView.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDTextureView" inherits="Reference" version="4.0"> +<class name="RDTextureView" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDUniform.xml b/doc/classes/RDUniform.xml index bc8a21e985..666935d663 100644 --- a/doc/classes/RDUniform.xml +++ b/doc/classes/RDUniform.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDUniform" inherits="Reference" version="4.0"> +<class name="RDUniform" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RDVertexAttribute.xml b/doc/classes/RDVertexAttribute.xml index 56fe40b51d..3499918cc8 100644 --- a/doc/classes/RDVertexAttribute.xml +++ b/doc/classes/RDVertexAttribute.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDVertexAttribute" inherits="Reference" version="4.0"> +<class name="RDVertexAttribute" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RandomNumberGenerator.xml b/doc/classes/RandomNumberGenerator.xml index 6312cd18aa..6fcb79b5fe 100644 --- a/doc/classes/RandomNumberGenerator.xml +++ b/doc/classes/RandomNumberGenerator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RandomNumberGenerator" inherits="Reference" version="4.0"> +<class name="RandomNumberGenerator" inherits="RefCounted" version="4.0"> <brief_description> A class for generating pseudo-random numbers. </brief_description> diff --git a/doc/classes/Reference.xml b/doc/classes/RefCounted.xml index 724d2db924..cf96514203 100644 --- a/doc/classes/Reference.xml +++ b/doc/classes/RefCounted.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Reference" inherits="Object" version="4.0"> +<class name="RefCounted" inherits="Object" version="4.0"> <brief_description> Base class for reference-counted objects. </brief_description> <description> Base class for any object that keeps a reference count. [Resource] and many other helper objects inherit this class. Unlike other [Object] types, References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with [method Object.free]. - In the vast majority of use cases, instantiating and using [Reference]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused. + In the vast majority of use cases, instantiating and using [RefCounted]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused. [b]Note:[/b] In C#, references will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free references that are no longer in use. This means that unused references will linger on for a while before being removed. </description> <tutorials> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index 75736798fd..6edb3b1a11 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Resource" inherits="Reference" version="4.0"> +<class name="Resource" inherits="RefCounted" version="4.0"> <brief_description> Base class for all resources. </brief_description> <description> - Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Since they inherit from [Reference], resources are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. + Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Since they inherit from [RefCounted], resources are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. [b]Note:[/b] In C#, resources will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free resources that are no longer in use. This means that unused resources will linger on for a while before being removed. </description> <tutorials> diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index 9943f644cf..aed194095b 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoader" inherits="Reference" version="4.0"> +<class name="ResourceFormatLoader" inherits="RefCounted" version="4.0"> <brief_description> Loads a specific resource type from a file. </brief_description> diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml index 69f8b43898..edbf8d73f8 100644 --- a/doc/classes/ResourceFormatSaver.xml +++ b/doc/classes/ResourceFormatSaver.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaver" inherits="Reference" version="4.0"> +<class name="ResourceFormatSaver" inherits="RefCounted" version="4.0"> <brief_description> Saves a specific resource type to a file. </brief_description> diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml index 0475d2c94d..59900b1b73 100644 --- a/doc/classes/ResourceImporter.xml +++ b/doc/classes/ResourceImporter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceImporter" inherits="Reference" version="4.0"> +<class name="ResourceImporter" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SceneState.xml b/doc/classes/SceneState.xml index abc429d5fe..f9e0ef76b9 100644 --- a/doc/classes/SceneState.xml +++ b/doc/classes/SceneState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SceneState" inherits="Reference" version="4.0"> +<class name="SceneState" inherits="RefCounted" version="4.0"> <brief_description> A script interface to a scene file's data. </brief_description> diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml index b223bf6821..4eef754345 100644 --- a/doc/classes/SceneTreeTimer.xml +++ b/doc/classes/SceneTreeTimer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SceneTreeTimer" inherits="Reference" version="4.0"> +<class name="SceneTreeTimer" inherits="RefCounted" version="4.0"> <brief_description> One-shot timer. </brief_description> diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml index f311e1c72f..e8b405e52a 100644 --- a/doc/classes/Semaphore.xml +++ b/doc/classes/Semaphore.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Semaphore" inherits="Reference" version="4.0"> +<class name="Semaphore" inherits="RefCounted" version="4.0"> <brief_description> A synchronization semaphore. </brief_description> diff --git a/doc/classes/SkeletonIK3D.xml b/doc/classes/SkeletonIK3D.xml index 5949ad54fd..dccc45d0ec 100644 --- a/doc/classes/SkeletonIK3D.xml +++ b/doc/classes/SkeletonIK3D.xml @@ -46,13 +46,13 @@ </member> <member name="override_tip_basis" type="bool" setter="set_override_tip_basis" getter="is_override_tip_basis" default="true"> </member> - <member name="root_bone" type="StringName" setter="set_root_bone" getter="get_root_bone" default="@"""> + <member name="root_bone" type="StringName" setter="set_root_bone" getter="get_root_bone" default="&"""> </member> <member name="target" type="Transform3D" setter="set_target_transform" getter="get_target_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )"> </member> <member name="target_node" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath("")"> </member> - <member name="tip_bone" type="StringName" setter="set_tip_bone" getter="get_tip_bone" default="@"""> + <member name="tip_bone" type="StringName" setter="set_tip_bone" getter="get_tip_bone" default="&"""> </member> <member name="use_magnet" type="bool" setter="set_use_magnet" getter="is_using_magnet" default="false"> </member> diff --git a/doc/classes/SkinReference.xml b/doc/classes/SkinReference.xml index 8fc163f88d..3f8bc3be82 100644 --- a/doc/classes/SkinReference.xml +++ b/doc/classes/SkinReference.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SkinReference" inherits="Reference" version="4.0"> +<class name="SkinReference" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml index f120103916..5367a572f1 100644 --- a/doc/classes/StreamPeer.xml +++ b/doc/classes/StreamPeer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeer" inherits="Reference" version="4.0"> +<class name="StreamPeer" inherits="RefCounted" version="4.0"> <brief_description> Abstraction and base class for stream-based protocols. </brief_description> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index a81defa16c..d0c5f0ea86 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -275,7 +275,7 @@ Returns a copy of the string with the substring [code]what[/code] inserted at the given position. </description> </method> - <method name="is_abs_path" qualifiers="const"> + <method name="is_absolute_path" qualifiers="const"> <return type="bool"> </return> <description> diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml index d434f5c2c9..56b47f4a24 100644 --- a/doc/classes/SurfaceTool.xml +++ b/doc/classes/SurfaceTool.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SurfaceTool" inherits="Reference" version="4.0"> +<class name="SurfaceTool" inherits="RefCounted" version="4.0"> <brief_description> Helper tool to create geometry. </brief_description> diff --git a/doc/classes/TCPServer.xml b/doc/classes/TCPServer.xml index 28f06ad3ae..7160055c6d 100644 --- a/doc/classes/TCPServer.xml +++ b/doc/classes/TCPServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TCPServer" inherits="Reference" version="4.0"> +<class name="TCPServer" inherits="RefCounted" version="4.0"> <brief_description> A TCP server. </brief_description> diff --git a/doc/classes/TextLine.xml b/doc/classes/TextLine.xml index c21da09edb..ddbae0e977 100644 --- a/doc/classes/TextLine.xml +++ b/doc/classes/TextLine.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextLine" inherits="Reference" version="4.0"> +<class name="TextLine" inherits="RefCounted" version="4.0"> <brief_description> Holds a line of text. </brief_description> diff --git a/doc/classes/TextParagraph.xml b/doc/classes/TextParagraph.xml index 8df53b8423..e9afe47ee8 100644 --- a/doc/classes/TextParagraph.xml +++ b/doc/classes/TextParagraph.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextParagraph" inherits="Reference" version="4.0"> +<class name="TextParagraph" inherits="RefCounted" version="4.0"> <brief_description> Holds a paragraph of text. </brief_description> diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml index 88f46e3937..5ac9416b72 100644 --- a/doc/classes/Thread.xml +++ b/doc/classes/Thread.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Thread" inherits="Reference" version="4.0"> +<class name="Thread" inherits="RefCounted" version="4.0"> <brief_description> A unit of execution in a process. </brief_description> diff --git a/doc/classes/TriangleMesh.xml b/doc/classes/TriangleMesh.xml index 39bee0c2b3..cfdb6fe33e 100644 --- a/doc/classes/TriangleMesh.xml +++ b/doc/classes/TriangleMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TriangleMesh" inherits="Reference" version="4.0"> +<class name="TriangleMesh" inherits="RefCounted" version="4.0"> <brief_description> Internal mesh type. </brief_description> diff --git a/doc/classes/UDPServer.xml b/doc/classes/UDPServer.xml index 6f3ccb8a17..5e2906450c 100644 --- a/doc/classes/UDPServer.xml +++ b/doc/classes/UDPServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="UDPServer" inherits="Reference" version="4.0"> +<class name="UDPServer" inherits="RefCounted" version="4.0"> <brief_description> Helper class to implement a UDP server. </brief_description> diff --git a/doc/classes/Variant.xml b/doc/classes/Variant.xml index 775bd58bcf..240c1c909f 100644 --- a/doc/classes/Variant.xml +++ b/doc/classes/Variant.xml @@ -5,20 +5,30 @@ </brief_description> <description> In computer programming, a Variant class is a class that is designed to store a variety of other types. Dynamic programming languages like PHP, Lua, JavaScript and GDScript like to use them to store variables' data on the backend. With these Variants, properties are able to change value types freely. - [codeblock] + [codeblocks] + [gdscript] var foo = 2 # foo is dynamically an integer foo = "Now foo is a string!" - foo = Reference.new() # foo is an Object + foo = RefCounted.new() # foo is an Object var bar: int = 2 # bar is a statically typed integer. # bar = "Uh oh! I can't make static variables become a different type!" - [/codeblock] + [/gdscript] + [csharp] + // ... but C# is statically typed. Once a variable has a type it cannot be changed. However you can use the var keyword in methods to let the compiler decide the type automatically. + var foo = 2; // Foo is a 32-bit integer (int). Be cautious, integers in GDScript are 64-bit and the direct C# equivalent is "long". + // foo = "foo was and will always be an integer. It cannot be turned into a string!"; + var boo = "Boo is a string!"; + var ref = new Reference(); // var is especially useful when used together with a constructor. + [/csharp] + [/codeblocks] Godot tracks all scripting API variables within Variants. Without even realizing it, you use Variants all the time. When a particular language enforces its own rules for keeping data typed, then that language is applying its own custom logic over the base Variant scripting API. - GDScript automatically wrap values in them. It keeps all data in plain Variants by default and then optionally enforces custom static typing rules on variable types. - VisualScript tracks properties inside Variants as well, but it also uses static typing. The GUI interface enforces that properties have a particular type that doesn't change over time. - C# is statically typed, but uses the Mono [code]object[/code] type in place of Godot's Variant class when it needs to represent a dynamic value. [code]object[/code] is the Mono runtime's equivalent of the same concept. - The statically-typed language NativeScript C++ does not define a built-in Variant-like class. Godot's GDNative bindings provide their own godot::Variant class for users; Any point at which the C++ code starts interacting with the Godot runtime is a place where you might have to start wrapping data inside Variant objects. The global [method @GlobalScope.typeof] function returns the enumerated value of the Variant type stored in the current variable (see [enum Variant.Type]). - [codeblock] + [codeblocks] + [gdscript] var foo = 2 match typeof(foo): TYPE_NIL: @@ -32,7 +42,19 @@ # Note also that there is not yet any way to get a script's `class_name` string easily. # To fetch that value, you need to dig deeply into a hidden ProjectSettings setting: an Array of Dictionaries called "_global_script_classes". # Open your project.godot file to see it up close. - [/codeblock] + [/gdscript] + [csharp] + int foo = 2; + if (foo == null) + { + GD.Print("foo is null"); + } + if (foo is int) + { + GD.Print("foo is an integer"); + } + [/csharp] + [/codeblocks] A Variant takes up only 20 bytes and can store almost any engine datatype inside of it. Variants are rarely used to hold information for long periods of time. Instead, they are used mainly for communication, editing, serialization and moving data around. Godot has specifically invested in making its Variant class as flexible as possible; so much so that it is used for a multitude of operations to facilitate communication between all of Godot's systems. A Variant: diff --git a/doc/classes/VelocityTracker3D.xml b/doc/classes/VelocityTracker3D.xml index 98f7533c76..2d5e3a4d30 100644 --- a/doc/classes/VelocityTracker3D.xml +++ b/doc/classes/VelocityTracker3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VelocityTracker3D" inherits="Reference" version="4.0"> +<class name="VelocityTracker3D" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index d905ce4054..12558ebbbc 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -60,7 +60,7 @@ <member name="buffering_msec" type="int" setter="set_buffering_msec" getter="get_buffering_msec" default="500"> Amount of time in milliseconds to store in buffer while playing. </member> - <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@"Master""> + <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="&"Master""> Audio bus to use for sound playback. </member> <member name="expand" type="bool" setter="set_expand" getter="has_expand" default="true"> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 7f05b14765..2f3782c517 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -81,10 +81,16 @@ <description> Returns the viewport's texture. [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_image] to flip it back, for example: - [codeblock] + [codeblocks] + [gdscript] var img = get_viewport().get_texture().get_image() img.flip_y() - [/codeblock] + [/gdscript] + [csharp] + Image img = GetViewport().GetTexture().GetImage(); + img.FlipY(); + [/csharp] + [/codeblocks] </description> </method> <method name="get_viewport_rid" qualifiers="const"> diff --git a/doc/classes/VisualShader.xml b/doc/classes/VisualShader.xml index ff00a848b9..775ac88eff 100644 --- a/doc/classes/VisualShader.xml +++ b/doc/classes/VisualShader.xml @@ -222,15 +222,19 @@ <constant name="TYPE_LIGHT" value="2" enum="Type"> A shader for light calculations. </constant> - <constant name="TYPE_EMIT" value="3" enum="Type"> + <constant name="TYPE_START" value="3" enum="Type"> </constant> <constant name="TYPE_PROCESS" value="4" enum="Type"> </constant> - <constant name="TYPE_END" value="5" enum="Type"> + <constant name="TYPE_COLLIDE" value="5" enum="Type"> </constant> - <constant name="TYPE_SKY" value="6" enum="Type"> + <constant name="TYPE_START_CUSTOM" value="6" enum="Type"> </constant> - <constant name="TYPE_MAX" value="7" enum="Type"> + <constant name="TYPE_PROCESS_CUSTOM" value="7" enum="Type"> + </constant> + <constant name="TYPE_SKY" value="8" enum="Type"> + </constant> + <constant name="TYPE_MAX" value="9" enum="Type"> Represents the size of the [enum Type] enum. </constant> <constant name="NODE_ID_INVALID" value="-1"> diff --git a/doc/classes/VisualShaderNodeParticleAccelerator.xml b/doc/classes/VisualShaderNodeParticleAccelerator.xml new file mode 100644 index 0000000000..82aae1df63 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleAccelerator.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleAccelerator" inherits="VisualShaderNodeOutput" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="VisualShaderNodeParticleAccelerator.Mode" default="0"> + </member> + </members> + <constants> + <constant name="MODE_LINEAR" value="0" enum="Mode"> + </constant> + <constant name="MODE_RADIAL" value="1" enum="Mode"> + </constant> + <constant name="MODE_TANGENTIAL" value="2" enum="Mode"> + </constant> + <constant name="MODE_MAX" value="3" enum="Mode"> + </constant> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleBoxEmitter.xml b/doc/classes/VisualShaderNodeParticleBoxEmitter.xml new file mode 100644 index 0000000000..af33b285d2 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleBoxEmitter.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleBoxEmitter" inherits="VisualShaderNodeParticleEmitter" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleConeVelocity.xml b/doc/classes/VisualShaderNodeParticleConeVelocity.xml new file mode 100644 index 0000000000..7a40c2a7d0 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleConeVelocity.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleConeVelocity" inherits="VisualShaderNode" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleEmit.xml b/doc/classes/VisualShaderNodeParticleEmit.xml new file mode 100644 index 0000000000..120b12d643 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleEmit.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleEmit" inherits="VisualShaderNode" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="flags" type="int" setter="set_flags" getter="get_flags" enum="VisualShaderNodeParticleEmit.EmitFlags" default="31"> + </member> + </members> + <constants> + <constant name="EMIT_FLAG_POSITION" value="1" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_ROT_SCALE" value="2" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_VELOCITY" value="4" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_COLOR" value="8" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_CUSTOM" value="16" enum="EmitFlags"> + </constant> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleEmitter.xml b/doc/classes/VisualShaderNodeParticleEmitter.xml new file mode 100644 index 0000000000..3a25fc1c7f --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleEmitter.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleEmitter" inherits="VisualShaderNode" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleMultiplyByAxisAngle.xml b/doc/classes/VisualShaderNodeParticleMultiplyByAxisAngle.xml new file mode 100644 index 0000000000..89a53699c9 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleMultiplyByAxisAngle.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleMultiplyByAxisAngle" inherits="VisualShaderNode" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="degrees_mode" type="bool" setter="set_degrees_mode" getter="is_degrees_mode" default="true"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleOutput.xml b/doc/classes/VisualShaderNodeParticleOutput.xml new file mode 100644 index 0000000000..c8fc66f2ff --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleOutput.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleOutput" inherits="VisualShaderNodeOutput" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleRandomness.xml b/doc/classes/VisualShaderNodeParticleRandomness.xml new file mode 100644 index 0000000000..f19723a663 --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleRandomness.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleRandomness" inherits="VisualShaderNode" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="op_type" type="int" setter="set_op_type" getter="get_op_type" enum="VisualShaderNodeParticleRandomness.OpType" default="0"> + </member> + </members> + <constants> + <constant name="OP_TYPE_SCALAR" value="0" enum="OpType"> + </constant> + <constant name="OP_TYPE_VECTOR" value="1" enum="OpType"> + </constant> + <constant name="OP_TYPE_MAX" value="2" enum="OpType"> + </constant> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleRingEmitter.xml b/doc/classes/VisualShaderNodeParticleRingEmitter.xml new file mode 100644 index 0000000000..ee3fbe7faf --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleRingEmitter.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleRingEmitter" inherits="VisualShaderNodeParticleEmitter" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualShaderNodeParticleSphereEmitter.xml b/doc/classes/VisualShaderNodeParticleSphereEmitter.xml new file mode 100644 index 0000000000..d43ac518cf --- /dev/null +++ b/doc/classes/VisualShaderNodeParticleSphereEmitter.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeParticleSphereEmitter" inherits="VisualShaderNodeParticleEmitter" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml index 4140df5828..6c9a7de67f 100644 --- a/doc/classes/WeakRef.xml +++ b/doc/classes/WeakRef.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WeakRef" inherits="Reference" version="4.0"> +<class name="WeakRef" inherits="RefCounted" version="4.0"> <brief_description> Holds an [Object], but does not contribute to the reference count if the object is a reference. </brief_description> <description> - A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GlobalScope.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released. + A weakref can hold a [RefCounted], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GlobalScope.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released. </description> <tutorials> </tutorials> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 37709753bc..9c320747d1 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -340,7 +340,7 @@ </member> <member name="theme" type="Theme" setter="set_theme" getter="get_theme"> </member> - <member name="theme_custom_type" type="StringName" setter="set_theme_custom_type" getter="get_theme_custom_type" default="@"""> + <member name="theme_custom_type" type="StringName" setter="set_theme_custom_type" getter="get_theme_custom_type" default="&"""> </member> <member name="title" type="String" setter="set_title" getter="get_title" default=""""> </member> diff --git a/doc/classes/XMLParser.xml b/doc/classes/XMLParser.xml index 2849ea62ab..ab5c58c51c 100644 --- a/doc/classes/XMLParser.xml +++ b/doc/classes/XMLParser.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XMLParser" inherits="Reference" version="4.0"> +<class name="XMLParser" inherits="RefCounted" version="4.0"> <brief_description> Low-level class for creating parsers for [url=https://en.wikipedia.org/wiki/XML]XML[/url] files. </brief_description> diff --git a/doc/classes/XRInterface.xml b/doc/classes/XRInterface.xml index 034cb51be3..3bc4adcf94 100644 --- a/doc/classes/XRInterface.xml +++ b/doc/classes/XRInterface.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XRInterface" inherits="Reference" version="4.0"> +<class name="XRInterface" inherits="RefCounted" version="4.0"> <brief_description> Base class for an AR/VR interface implementation. </brief_description> diff --git a/doc/classes/XRPositionalTracker.xml b/doc/classes/XRPositionalTracker.xml index 2cf8e1d6f5..cd8cb71cd9 100644 --- a/doc/classes/XRPositionalTracker.xml +++ b/doc/classes/XRPositionalTracker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XRPositionalTracker" inherits="Reference" version="4.0"> +<class name="XRPositionalTracker" inherits="RefCounted" version="4.0"> <brief_description> A tracked object. </brief_description> diff --git a/doc/translations/ar.po b/doc/translations/ar.po index b4ae664714..77a3d39f27 100644 --- a/doc/translations/ar.po +++ b/doc/translations/ar.po @@ -33036,7 +33036,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33055,12 +33055,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34557,7 +34557,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41765,30 +41765,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41796,7 +41796,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54060,7 +54060,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59139,7 +59139,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/ca.po b/doc/translations/ca.po index 6485111b20..8ea801181d 100644 --- a/doc/translations/ca.po +++ b/doc/translations/ca.po @@ -33067,7 +33067,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33086,12 +33086,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34588,7 +34588,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41796,30 +41796,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41827,7 +41827,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54091,7 +54091,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59170,7 +59170,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index d14b0d9b1f..d12fa78b0e 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -33037,7 +33037,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33056,12 +33056,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34558,7 +34558,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41766,30 +41766,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41797,7 +41797,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54061,7 +54061,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59140,7 +59140,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/cs.po b/doc/translations/cs.po index 7b958a5049..a267656497 100644 --- a/doc/translations/cs.po +++ b/doc/translations/cs.po @@ -33536,7 +33536,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33555,12 +33555,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -35058,7 +35058,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42266,30 +42266,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42297,7 +42297,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54562,7 +54562,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59645,7 +59645,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/de.po b/doc/translations/de.po index 2e3e219ba6..181d64d525 100644 --- a/doc/translations/de.po +++ b/doc/translations/de.po @@ -33453,7 +33453,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33472,12 +33472,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 #, fuzzy msgid "" @@ -34984,7 +34984,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42226,30 +42226,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42257,7 +42257,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54558,7 +54558,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59796,7 +59796,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/es.po b/doc/translations/es.po index 3078c1bf90..7df36316b7 100644 --- a/doc/translations/es.po +++ b/doc/translations/es.po @@ -44834,7 +44834,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -44853,9 +44853,9 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" "Toda clase que no es un tipo integrado hereda de esta clase.\n" "Puedes construir Objetos desde lenguajes de scripting, usando [code]Object." @@ -44866,7 +44866,7 @@ msgstr "" "llama al método [method free] desde tu script o elimina la instancia desde C+" "+.\n" "Algunas clases que extienden a Object añaden gestión de memoria. Este es el " -"caso de [Reference], que cuenta las referencias y se borra a sí misma " +"caso de [RefCounted], que cuenta las referencias y se borra a sí misma " "automáticamente cuando deja de estar referenciada. [Node], otro tipo " "fundamental, borra todos sus hijos cuando se libera de la memoria.\n" "Los objetos exportan propiedades, que son principalmente útiles para el " @@ -44887,7 +44887,7 @@ msgstr "" "sencilla de notificar al objeto sobre diferentes eventos, de modo que todos " "ellos pueden ser manejados juntos. Véase [method _notification]." -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 #, fuzzy msgid "" @@ -46525,7 +46525,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -53779,30 +53779,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -53810,7 +53810,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -66189,7 +66189,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -71348,7 +71348,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/fa.po b/doc/translations/fa.po index 733d3bb969..e440146dd3 100644 --- a/doc/translations/fa.po +++ b/doc/translations/fa.po @@ -33042,7 +33042,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33061,12 +33061,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34563,7 +34563,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41771,30 +41771,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41802,7 +41802,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54066,7 +54066,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59145,7 +59145,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/fi.po b/doc/translations/fi.po index 0a40863a52..92ec4f29dd 100644 --- a/doc/translations/fi.po +++ b/doc/translations/fi.po @@ -33055,7 +33055,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33074,12 +33074,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34576,7 +34576,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41784,30 +41784,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41815,7 +41815,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54080,7 +54080,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59168,7 +59168,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/fr.po b/doc/translations/fr.po index f3e26ebc61..7717474c0f 100644 --- a/doc/translations/fr.po +++ b/doc/translations/fr.po @@ -33403,7 +33403,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33422,12 +33422,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34927,7 +34927,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42142,30 +42142,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42173,7 +42173,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54519,7 +54519,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59618,7 +59618,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/id.po b/doc/translations/id.po index 1bce3d6b50..edfd392f4f 100644 --- a/doc/translations/id.po +++ b/doc/translations/id.po @@ -33068,7 +33068,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33087,12 +33087,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34589,7 +34589,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41797,30 +41797,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41828,7 +41828,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54092,7 +54092,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59171,7 +59171,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/it.po b/doc/translations/it.po index 18e162476c..353eae4116 100644 --- a/doc/translations/it.po +++ b/doc/translations/it.po @@ -33334,7 +33334,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33353,12 +33353,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34856,7 +34856,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42067,30 +42067,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42098,7 +42098,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54365,7 +54365,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59459,7 +59459,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/ja.po b/doc/translations/ja.po index ede80a35ef..1424b24153 100644 --- a/doc/translations/ja.po +++ b/doc/translations/ja.po @@ -34306,7 +34306,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -34325,12 +34325,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 #, fuzzy msgid "" @@ -35830,7 +35830,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -43046,30 +43046,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -43077,7 +43077,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -55349,7 +55349,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -60446,7 +60446,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/ko.po b/doc/translations/ko.po index e71cd06ba7..8e8aef2eaf 100644 --- a/doc/translations/ko.po +++ b/doc/translations/ko.po @@ -33044,7 +33044,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33063,12 +33063,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34565,7 +34565,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41773,30 +41773,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41804,7 +41804,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54068,7 +54068,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59149,7 +59149,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/nl.po b/doc/translations/nl.po index 032ff95bdb..096e59f497 100644 --- a/doc/translations/nl.po +++ b/doc/translations/nl.po @@ -33070,7 +33070,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33089,12 +33089,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34591,7 +34591,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41799,30 +41799,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41830,7 +41830,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54094,7 +54094,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59173,7 +59173,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/pl.po b/doc/translations/pl.po index b0c94b55be..5ef41b155a 100644 --- a/doc/translations/pl.po +++ b/doc/translations/pl.po @@ -33089,7 +33089,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33108,12 +33108,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34610,7 +34610,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41818,30 +41818,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41849,7 +41849,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54117,7 +54117,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59203,7 +59203,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/pt_BR.po b/doc/translations/pt_BR.po index a508d38859..ef62950d51 100644 --- a/doc/translations/pt_BR.po +++ b/doc/translations/pt_BR.po @@ -33083,7 +33083,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33102,12 +33102,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34604,7 +34604,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41812,30 +41812,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41843,7 +41843,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54108,7 +54108,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59194,7 +59194,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/ro.po b/doc/translations/ro.po index 96c0161312..5f018aa497 100644 --- a/doc/translations/ro.po +++ b/doc/translations/ro.po @@ -33044,7 +33044,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33063,12 +33063,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34565,7 +34565,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41773,30 +41773,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41804,7 +41804,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54068,7 +54068,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59147,7 +59147,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/ru.po b/doc/translations/ru.po index 1108967bc9..0d227beff7 100644 --- a/doc/translations/ru.po +++ b/doc/translations/ru.po @@ -33581,7 +33581,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33600,12 +33600,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -35104,7 +35104,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42362,30 +42362,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42393,7 +42393,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54666,7 +54666,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59891,7 +59891,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/sr_Cyrl.po b/doc/translations/sr_Cyrl.po index d7d2911b97..d53711d996 100644 --- a/doc/translations/sr_Cyrl.po +++ b/doc/translations/sr_Cyrl.po @@ -33054,7 +33054,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33073,12 +33073,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34575,7 +34575,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41783,30 +41783,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41814,7 +41814,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54078,7 +54078,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59157,7 +59157,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/th.po b/doc/translations/th.po index 5031ecfb0e..7686e22f19 100644 --- a/doc/translations/th.po +++ b/doc/translations/th.po @@ -33060,7 +33060,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33079,12 +33079,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34581,7 +34581,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41789,30 +41789,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41820,7 +41820,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54084,7 +54084,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59163,7 +59163,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/tr.po b/doc/translations/tr.po index a317f4ee83..df9897f1d6 100644 --- a/doc/translations/tr.po +++ b/doc/translations/tr.po @@ -33036,7 +33036,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33055,12 +33055,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34557,7 +34557,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41765,30 +41765,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41796,7 +41796,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54060,7 +54060,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59139,7 +59139,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/uk.po b/doc/translations/uk.po index 8ca75e8b19..d1296da87a 100644 --- a/doc/translations/uk.po +++ b/doc/translations/uk.po @@ -33122,7 +33122,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33141,12 +33141,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34643,7 +34643,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41851,30 +41851,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41882,7 +41882,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54147,7 +54147,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59237,7 +59237,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/zh_Hans.po b/doc/translations/zh_Hans.po index aee852699c..edfb11dec1 100644 --- a/doc/translations/zh_Hans.po +++ b/doc/translations/zh_Hans.po @@ -33272,7 +33272,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33291,12 +33291,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34794,7 +34794,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -42002,30 +42002,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -42033,7 +42033,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54298,7 +54298,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59381,7 +59381,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/doc/translations/zh_Hant.po b/doc/translations/zh_Hant.po index 242c8cc086..3afec7ead8 100644 --- a/doc/translations/zh_Hant.po +++ b/doc/translations/zh_Hant.po @@ -33073,7 +33073,7 @@ msgid "" "to delete instances of it manually. To do so, call the [method free] method " "from your script or delete the instance from C++.\n" "Some classes that extend Object add memory management. This is the case of " -"[Reference], which counts references and deletes itself automatically when " +"[RefCounted], which counts references and deletes itself automatically when " "no longer referenced. [Node], another fundamental type, deletes all its " "children when freed from memory.\n" "Objects export properties, which are mainly useful for storage and editing, " @@ -33092,12 +33092,12 @@ msgid "" "Objects also receive notifications. Notifications are a simple way to notify " "the object about different events, so they can all be handled together. See " "[method _notification].\n" -"[b]Note:[/b] Unlike references to a [Reference], references to an Object " +"[b]Note:[/b] Unlike references to a [RefCounted], references to an Object " "stored in a variable can become invalid without warning. Therefore, it's " -"recommended to use [Reference] for data classes instead of [Object]." +"recommended to use [RefCounted] for data classes instead of [Object]." msgstr "" -#: doc/classes/Object.xml:23 doc/classes/Reference.xml:12 +#: doc/classes/Object.xml:23 doc/classes/RefCounted.xml:12 #: doc/classes/Resource.xml:11 msgid "" "https://docs.godotengine.org/en/latest/getting_started/workflow/" @@ -34594,7 +34594,7 @@ msgid "Changes the [Color] at the given index." msgstr "" #: doc/classes/PackedDataContainerRef.xml:4 -msgid "Reference version of [PackedDataContainer]." +msgid "RefCounted version of [PackedDataContainer]." msgstr "" #: doc/classes/PackedFloat32Array.xml:4 @@ -41802,30 +41802,30 @@ msgid "" "the half extents." msgstr "" -#: doc/classes/Reference.xml:4 +#: doc/classes/RefCounted.xml:4 msgid "Base class for reference-counted objects." msgstr "" -#: doc/classes/Reference.xml:7 +#: doc/classes/RefCounted.xml:7 msgid "" "Base class for any object that keeps a reference count. [Resource] and many " "other helper objects inherit this class.\n" "Unlike [Object]s, References keep an internal reference counter so that they " "are automatically released when no longer in use, and only then. References " "therefore do not need to be freed manually with [method Object.free].\n" -"In the vast majority of use cases, instantiating and using [Reference]-" +"In the vast majority of use cases, instantiating and using [RefCounted]-" "derived types is all you need to do. The methods provided in this class are " "only for advanced users, and can cause issues if misused." msgstr "" -#: doc/classes/Reference.xml:19 +#: doc/classes/RefCounted.xml:19 msgid "" "Initializes the internal reference counter. Use this only if you really know " "what you are doing.\n" "Returns whether the initialization was successful." msgstr "" -#: doc/classes/Reference.xml:27 +#: doc/classes/RefCounted.xml:27 msgid "" "Increments the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -41833,7 +41833,7 @@ msgid "" "code] otherwise." msgstr "" -#: doc/classes/Reference.xml:35 +#: doc/classes/RefCounted.xml:35 msgid "" "Decrements the internal reference counter. Use this only if you really know " "what you are doing.\n" @@ -54098,7 +54098,7 @@ msgid "" "[codeblock]\n" "var foo = 2 # foo is dynamically an integer\n" "foo = \"Now foo is a string!\"\n" -"foo = Reference.new() # foo is an Object\n" +"foo = RefCounted.new() # foo is an Object\n" "var bar: int = 2 # bar is a statically typed integer.\n" "# bar = \"Uh oh! I can't make static variables become a different type!\"\n" "[/codeblock]\n" @@ -59181,7 +59181,7 @@ msgstr "" #: doc/classes/WeakRef.xml:7 msgid "" -"A weakref can hold a [Reference], without contributing to the reference " +"A weakref can hold a [RefCounted], without contributing to the reference " "counter. A weakref can be created from an [Object] using [method @GDScript." "weakref]. If this object is not a reference, weakref still works, however, " "it does not have any effect on the object. Weakrefs are useful in cases " diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 8b2e786146..8cc76b01e1 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -101,6 +101,6 @@ Vector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) { ImageLoaderPNG::ImageLoaderPNG() { Image::_png_mem_loader_func = load_mem_png; - Image::lossless_unpacker = lossless_unpack_png; - Image::lossless_packer = lossless_pack_png; + Image::png_unpacker = lossless_unpack_png; + Image::png_packer = lossless_pack_png; } diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index b737a287d1..2971880985 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -30,8 +30,8 @@ #include "resource_saver_png.h" +#include "core/io/file_access.h" #include "core/io/image.h" -#include "core/os/file_access.h" #include "drivers/png/png_driver_common.h" #include "scene/resources/texture.h" diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index 28a7053d25..8b19308967 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -33,7 +33,7 @@ #if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED) -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include <dirent.h> #include <sys/stat.h> diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h index 5b1599c67f..8b27c308e1 100644 --- a/drivers/unix/file_access_unix.h +++ b/drivers/unix/file_access_unix.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_UNIX_H #define FILE_ACCESS_UNIX_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/memory.h" #include <stdio.h> diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index dc92e04a43..4cb878eb4d 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -31,7 +31,7 @@ #include "rendering_device_vulkan.h" #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "core/templates/hashfuncs.h" #include "drivers/vulkan/vulkan_context.h" diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 38455bdbed..23c0a64568 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -694,8 +694,25 @@ Error VulkanContext::_create_physical_device() { free(physical_devices); ERR_FAIL_V(ERR_CANT_CREATE); } - /* for now, just grab the first physical device */ + + // TODO: At least on Linux Laptops integrated GPUs fail with Vulkan in many instances. + // The device should really be a preference, but for now choosing a discrete GPU over the + // integrated one is better than the default. + + // Default to first device uint32_t device_index = 0; + + for (uint32_t i = 0; i < gpu_count; ++i) { + VkPhysicalDeviceProperties props; + vkGetPhysicalDeviceProperties(physical_devices[i], &props); + + if (props.deviceType == VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) { + // Prefer discrete GPU. + device_index = i; + break; + } + } + gpu = physical_devices[device_index]; free(physical_devices); diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 55f9e6de17..325bae5b56 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -208,7 +208,7 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) { bool DirAccessWindows::file_exists(String p_file) { GLOBAL_LOCK_FUNCTION - if (!p_file.is_abs_path()) { + if (!p_file.is_absolute_path()) { p_file = get_current_dir().plus_file(p_file); } diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index b151b631e9..1ba4e70e42 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -33,7 +33,7 @@ #ifdef WINDOWS_ENABLED -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" /** @author Juan Linietsky <reduz@gmail.com> diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h index 95f3a75548..7280fc3237 100644 --- a/drivers/windows/file_access_windows.h +++ b/drivers/windows/file_access_windows.h @@ -33,7 +33,7 @@ #ifdef WINDOWS_ENABLED -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/memory.h" #include <stdio.h> diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 756eb4acb6..f1d8139511 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -236,8 +236,8 @@ public: AnimationTrackEdit(); }; -class AnimationTrackEditPlugin : public Reference { - GDCLASS(AnimationTrackEditPlugin, Reference); +class AnimationTrackEditPlugin : public RefCounted { + GDCLASS(AnimationTrackEditPlugin, RefCounted); public: virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage); diff --git a/editor/array_property_edit.h b/editor/array_property_edit.h index fa3dcbe038..d7e11936a3 100644 --- a/editor/array_property_edit.h +++ b/editor/array_property_edit.h @@ -33,8 +33,8 @@ #include "scene/main/node.h" -class ArrayPropertyEdit : public Reference { - GDCLASS(ArrayPropertyEdit, Reference); +class ArrayPropertyEdit : public RefCounted { + GDCLASS(ArrayPropertyEdit, RefCounted); int page; ObjectID obj; diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h index accc7275c0..61567598ed 100644 --- a/editor/audio_stream_preview.h +++ b/editor/audio_stream_preview.h @@ -36,8 +36,8 @@ #include "scene/main/node.h" #include "servers/audio/audio_stream.h" -class AudioStreamPreview : public Reference { - GDCLASS(AudioStreamPreview, Reference); +class AudioStreamPreview : public RefCounted { + GDCLASS(AudioStreamPreview, RefCounted); friend class AudioStream; Vector<uint8_t> preview; float length; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index be42eab636..7b96858ec7 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -583,15 +583,29 @@ void FindReplaceBar::set_error(const String &p_label) { emit_signal("error", p_label); } -void FindReplaceBar::set_text_edit(CodeEdit *p_text_edit) { +void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) { + if (p_text_editor == base_text_editor) { + return; + } + + if (base_text_editor) { + base_text_editor->remove_find_replace_bar(); + base_text_editor = nullptr; + text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); + text_editor = nullptr; + } + results_count = -1; - text_editor = p_text_edit; + base_text_editor = p_text_editor; + text_editor = base_text_editor->get_text_editor(); text_editor->connect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); + + _update_results_count(); + _update_matches_label(); } void FindReplaceBar::_bind_methods() { ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input); - ClassDB::bind_method("_search_current", &FindReplaceBar::search_current); ADD_SIGNAL(MethodInfo("search")); @@ -939,6 +953,25 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); } +void CodeTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) { + if (find_replace_bar) { + return; + } + + find_replace_bar = p_bar; + find_replace_bar->set_text_edit(this); + find_replace_bar->connect("error", callable_mp(error, &Label::set_text)); +} + +void CodeTextEditor::remove_find_replace_bar() { + if (!find_replace_bar) { + return; + } + + find_replace_bar->disconnect("error", callable_mp(error, &Label::set_text)); + find_replace_bar = nullptr; +} + void CodeTextEditor::trim_trailing_whitespace() { bool trimed_whitespace = false; for (int i = 0; i < text_editor->get_line_count(); i++) { @@ -1760,14 +1793,6 @@ CodeTextEditor::CodeTextEditor() { } break; } - // Added second so it opens at the bottom, so it won't shift the entire text editor when opening. - find_replace_bar = memnew(FindReplaceBar); - add_child(find_replace_bar); - find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); - find_replace_bar->hide(); - - find_replace_bar->set_text_edit(text_editor); - text_editor->set_draw_line_numbers(true); text_editor->set_brace_matching(true); text_editor->set_auto_indent(true); @@ -1808,7 +1833,6 @@ CodeTextEditor::CodeTextEditor() { error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); error->set_mouse_filter(MOUSE_FILTER_STOP); error->connect("gui_input", callable_mp(this, &CodeTextEditor::_error_pressed)); - find_replace_bar->connect("error", callable_mp(error, &Label::set_text)); // Warnings warning_button = memnew(Button); diff --git a/editor/code_editor.h b/editor/code_editor.h index e6dadbd6fa..9fc659b611 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -57,6 +57,8 @@ public: GotoLineDialog(); }; +class CodeTextEditor; + class FindReplaceBar : public HBoxContainer { GDCLASS(FindReplaceBar, HBoxContainer); @@ -77,6 +79,7 @@ class FindReplaceBar : public HBoxContainer { HBoxContainer *hbc_button_replace; HBoxContainer *hbc_option_replace; + CodeTextEditor *base_text_editor = nullptr; CodeEdit *text_editor; int result_line; @@ -120,7 +123,7 @@ public: bool is_selection_only() const; void set_error(const String &p_label); - void set_text_edit(CodeEdit *p_text_edit); + void set_text_edit(CodeTextEditor *p_text_editor); void popup_search(bool p_show_only = false); void popup_replace(); @@ -138,7 +141,7 @@ class CodeTextEditor : public VBoxContainer { GDCLASS(CodeTextEditor, VBoxContainer); CodeEdit *text_editor; - FindReplaceBar *find_replace_bar; + FindReplaceBar *find_replace_bar = nullptr; HBoxContainer *status_bar; Button *toggle_scripts_button; @@ -243,6 +246,8 @@ public: void update_line_and_column() { _line_col_changed(); } CodeEdit *get_text_editor() { return text_editor; } FindReplaceBar *get_find_replace_bar() { return find_replace_bar; } + void set_find_replace_bar(FindReplaceBar *p_bar); + void remove_find_replace_bar(); virtual void apply_code() {} void goto_error(); diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h index 6458421e7a..6216d0df3d 100644 --- a/editor/debugger/editor_debugger_server.h +++ b/editor/debugger/editor_debugger_server.h @@ -32,9 +32,9 @@ #define EDITOR_DEBUGGER_CONNECTION_H #include "core/debugger/remote_debugger_peer.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class EditorDebuggerServer : public Reference { +class EditorDebuggerServer : public RefCounted { public: typedef EditorDebuggerServer *(*CreateServerFunc)(const String &p_uri); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index c085205f63..7534b419fe 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -30,8 +30,8 @@ #include "dependency_editor.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "editor_node.h" #include "editor_scale.h" #include "scene/gui/margin_container.h" diff --git a/editor/dictionary_property_edit.h b/editor/dictionary_property_edit.h index e0fd945491..d1401c5e5f 100644 --- a/editor/dictionary_property_edit.h +++ b/editor/dictionary_property_edit.h @@ -33,8 +33,8 @@ #include "scene/main/node.h" -class DictionaryPropertyEdit : public Reference { - GDCLASS(DictionaryPropertyEdit, Reference); +class DictionaryPropertyEdit : public RefCounted { + GDCLASS(DictionaryPropertyEdit, RefCounted); ObjectID obj; StringName property; diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index e29c9593c3..d3df4d91a6 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -34,9 +34,9 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" #include "core/io/compression.h" +#include "core/io/dir_access.h" #include "core/io/marshalls.h" #include "core/object/script_language.h" -#include "core/os/dir_access.h" #include "core/version.h" #include "scene/resources/theme.h" diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index e7937a8e3c..38f417a8ce 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -30,9 +30,9 @@ #include "editor_asset_installer.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "editor_node.h" #include "progress_dialog.h" diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 6405af3876..56c6a416af 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -31,9 +31,9 @@ #include "editor_data.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "editor_node.h" #include "editor_settings.h" #include "scene/resources/packed_scene.h" @@ -83,7 +83,7 @@ void EditorHistory::cleanup_history() { void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only) { Object *obj = ObjectDB::get_instance(p_object); ERR_FAIL_COND(!obj); - Reference *r = Object::cast_to<Reference>(obj); + RefCounted *r = Object::cast_to<RefCounted>(obj); Obj o; if (r) { o.ref = REF(r); diff --git a/editor/editor_dir_dialog.h b/editor/editor_dir_dialog.h index 05451b7bda..ef473b0779 100644 --- a/editor/editor_dir_dialog.h +++ b/editor/editor_dir_dialog.h @@ -31,7 +31,7 @@ #ifndef EDITOR_DIR_DIALOG_H #define EDITOR_DIR_DIALOG_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "editor/editor_file_system.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 40313fbeff..7c5a06107d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -33,14 +33,14 @@ #include "core/config/project_settings.h" #include "core/crypto/crypto_core.h" #include "core/io/config_file.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" #include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" #include "core/object/script_language.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/version.h" #include "editor/editor_file_system.h" #include "editor/plugins/script_editor_plugin.h" @@ -151,7 +151,7 @@ void EditorExportPreset::set_export_path(const String &p_path) { export_path = p_path; /* NOTE(SonerSound): if there is a need to implement a PropertyHint that specifically indicates a relative path, * this should be removed. */ - if (export_path.is_abs_path()) { + if (export_path.is_absolute_path()) { String res_path = OS::get_singleton()->get_resource_dir(); export_path = res_path.path_to_file(export_path); } diff --git a/editor/editor_export.h b/editor/editor_export.h index c96c8fdbce..c9401df9c2 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -31,8 +31,8 @@ #ifndef EDITOR_EXPORT_H #define EDITOR_EXPORT_H +#include "core/io/dir_access.h" #include "core/io/resource.h" -#include "core/os/dir_access.h" #include "scene/main/node.h" #include "scene/main/timer.h" #include "scene/resources/texture.h" @@ -42,8 +42,8 @@ class EditorExportPlatform; class EditorFileSystemDirectory; struct EditorProgress; -class EditorExportPreset : public Reference { - GDCLASS(EditorExportPreset, Reference); +class EditorExportPreset : public RefCounted { + GDCLASS(EditorExportPreset, RefCounted); public: enum ExportFilter { @@ -161,8 +161,8 @@ struct SharedObject { SharedObject() {} }; -class EditorExportPlatform : public Reference { - GDCLASS(EditorExportPlatform, Reference); +class EditorExportPlatform : public RefCounted { + GDCLASS(EditorExportPlatform, RefCounted); public: typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key); @@ -284,8 +284,8 @@ public: EditorExportPlatform(); }; -class EditorExportPlugin : public Reference { - GDCLASS(EditorExportPlugin, Reference); +class EditorExportPlugin : public RefCounted { + GDCLASS(EditorExportPlugin, RefCounted); friend class EditorExportPlatform; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index d232153206..51c6b473ad 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -30,8 +30,8 @@ #include "editor_feature_profile.h" +#include "core/io/dir_access.h" #include "core/io/json.h" -#include "core/os/dir_access.h" #include "editor/editor_settings.h" #include "editor_node.h" #include "editor_scale.h" diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h index e118b5f287..d31498bfc6 100644 --- a/editor/editor_feature_profile.h +++ b/editor/editor_feature_profile.h @@ -31,8 +31,8 @@ #ifndef EDITOR_FEATURE_PROFILE_H #define EDITOR_FEATURE_PROFILE_H -#include "core/object/reference.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" +#include "core/object/ref_counted.h" #include "editor/editor_file_dialog.h" #include "editor_help.h" #include "scene/gui/dialogs.h" @@ -41,8 +41,8 @@ #include "scene/gui/split_container.h" #include "scene/gui/tree.h" -class EditorFeatureProfile : public Reference { - GDCLASS(EditorFeatureProfile, Reference); +class EditorFeatureProfile : public RefCounted { + GDCLASS(EditorFeatureProfile, RefCounted); public: enum Feature { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 75815fa750..e7d536e08e 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -30,7 +30,7 @@ #include "editor_file_dialog.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/print_string.h" diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 5a5e3a8807..f7879838d4 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -31,7 +31,7 @@ #ifndef EDITORFILEDIALOG_H #define EDITORFILEDIALOG_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "scene/gui/box_container.h" #include "scene/gui/dialogs.h" #include "scene/gui/item_list.h" diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 69663b9ed9..050e55c624 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -31,10 +31,10 @@ #include "editor_file_system.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_importer.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/variant/variant_parser.h" #include "editor_node.h" diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 855c320856..04879bad6d 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -31,7 +31,7 @@ #ifndef EDITOR_FILE_SYSTEM_H #define EDITOR_FILE_SYSTEM_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/thread.h" #include "core/os/thread_safe.h" #include "core/templates/safe_refcount.h" diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index 97a2c67c26..4030aecbf5 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -30,7 +30,7 @@ #include "editor_folding.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "editor_inspector.h" #include "editor_settings.h" diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 8a5142459c..2f5451fba3 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -31,7 +31,7 @@ #include "editor_fonts.h" #include "builtin_fonts.gen.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "editor_scale.h" #include "editor_settings.h" #include "scene/resources/default_theme/default_theme.h" diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index 350a02315f..75da2d5aba 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -83,7 +83,7 @@ public: EditorHelpSearch(); }; -class EditorHelpSearch::Runner : public Reference { +class EditorHelpSearch::Runner : public RefCounted { enum Phase { PHASE_MATCH_CLASSES_INIT, PHASE_MATCH_CLASSES, diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 348dea7086..e4bcab3e3f 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -175,8 +175,8 @@ public: EditorProperty(); }; -class EditorInspectorPlugin : public Reference { - GDCLASS(EditorInspectorPlugin, Reference); +class EditorInspectorPlugin : public RefCounted { + GDCLASS(EditorInspectorPlugin, RefCounted); friend class EditorInspector; struct AddedEditor { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 1c2fd50f0b..275af0f09e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -34,13 +34,13 @@ #include "core/core_bind.h" #include "core/input/input.h" #include "core/io/config_file.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/stream_peer_ssl.h" #include "core/object/class_db.h" #include "core/object/message_queue.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/print_string.h" @@ -770,7 +770,7 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) { if (!res->editor_can_reload_from_file()) { continue; } - if (!res->get_path().is_resource_file() && !res->get_path().is_abs_path()) { + if (!res->get_path().is_resource_file() && !res->get_path().is_absolute_path()) { continue; } if (!FileAccess::exists(res->get_path())) { @@ -2161,9 +2161,14 @@ void EditorNode::_edit_current() { if (!inspector_only) { EditorPlugin *main_plugin = editor_data.get_editor(current_obj); - for (int i = 0; i < editor_table.size(); i++) { - if (editor_table[i] == main_plugin && !main_editor_buttons[i]->is_visible()) { - main_plugin = nullptr; //if button is not visible, then no plugin active + int plugin_index = 0; + for (; plugin_index < editor_table.size(); plugin_index++) { + if (editor_table[plugin_index] == main_plugin) { + if (!main_editor_buttons[plugin_index]->is_visible()) { + main_plugin = nullptr; //if button is not visible, then no plugin active + } + + break; } } @@ -2177,26 +2182,8 @@ void EditorNode::_edit_current() { else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) { // update screen main_plugin - - if (!changing_scene) { - if (editor_plugin_screen) { - editor_plugin_screen->make_visible(false); - } - editor_plugin_screen = main_plugin; - editor_plugin_screen->edit(current_obj); - - editor_plugin_screen->make_visible(true); - - int plugin_count = editor_data.get_editor_plugin_count(); - for (int i = 0; i < plugin_count; i++) { - editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name()); - } - - for (int i = 0; i < editor_table.size(); i++) { - main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin); - } - } - + _editor_select(plugin_index); + main_plugin->edit(current_obj); } else { editor_plugin_screen->edit(current_obj); } diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp index 474da4fb96..ddba36c187 100644 --- a/editor/editor_paths.cpp +++ b/editor/editor_paths.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "editor_paths.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/os.h" EditorPaths *EditorPaths::singleton = nullptr; diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index e5b62513ff..1db24bb908 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -32,7 +32,7 @@ #include "core/config/project_settings.h" #include "core/io/config_file.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/main_loop.h" #include "editor_node.h" #include "editor_scale.h" diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index ece7094767..0feee447a4 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2261,7 +2261,7 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) { base_node = get_edited_object()->call("get_root_path"); } - if (!base_node && Object::cast_to<Reference>(get_edited_object())) { + if (!base_node && Object::cast_to<RefCounted>(get_edited_object())) { Node *to_node = get_node(p_path); ERR_FAIL_COND(!to_node); path = get_tree()->get_edited_scene_root()->get_path_to(to_node); diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index fa5adc788d..aa2d8744b1 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -36,8 +36,8 @@ #include "editor/filesystem_dock.h" #include "scene/gui/button.h" -class EditorPropertyArrayObject : public Reference { - GDCLASS(EditorPropertyArrayObject, Reference); +class EditorPropertyArrayObject : public RefCounted { + GDCLASS(EditorPropertyArrayObject, RefCounted); Variant array; @@ -52,8 +52,8 @@ public: EditorPropertyArrayObject(); }; -class EditorPropertyDictionaryObject : public Reference { - GDCLASS(EditorPropertyDictionaryObject, Reference); +class EditorPropertyDictionaryObject : public RefCounted { + GDCLASS(EditorPropertyDictionaryObject, RefCounted); Variant new_item_key; Variant new_item_value; diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 35cf08b4d7..d9520e0aa8 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -31,10 +31,10 @@ #include "editor_resource_preview.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/object/message_queue.h" -#include "core/os/file_access.h" #include "editor_node.h" #include "editor_scale.h" #include "editor_settings.h" diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index ffeb22162e..67f83220d0 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -37,8 +37,8 @@ #include "scene/main/node.h" #include "scene/resources/texture.h" -class EditorResourcePreviewGenerator : public Reference { - GDCLASS(EditorResourcePreviewGenerator, Reference); +class EditorResourcePreviewGenerator : public RefCounted { + GDCLASS(EditorResourcePreviewGenerator, RefCounted); protected: static void _bind_methods(); diff --git a/editor/editor_run_script.h b/editor/editor_run_script.h index 83987ecba1..c8412c3c92 100644 --- a/editor/editor_run_script.h +++ b/editor/editor_run_script.h @@ -31,11 +31,11 @@ #ifndef EDITOR_RUN_SCRIPT_H #define EDITOR_RUN_SCRIPT_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "editor_plugin.h" class EditorNode; -class EditorScript : public Reference { - GDCLASS(EditorScript, Reference); +class EditorScript : public RefCounted { + GDCLASS(EditorScript, RefCounted); EditorNode *editor; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 71dc1b531a..949638f0c9 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -35,13 +35,13 @@ #include "core/io/certs_compressed.gen.h" #include "core/io/compression.h" #include "core/io/config_file.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_memory.h" #include "core/io/ip.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/translation_loader_po.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/version.h" diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp index 49d5cf1fd3..75bdfa4796 100644 --- a/editor/editor_translation_parser.cpp +++ b/editor/editor_translation_parser.cpp @@ -31,8 +31,8 @@ #include "editor_translation_parser.h" #include "core/error/error_macros.h" +#include "core/io/file_access.h" #include "core/object/script_language.h" -#include "core/os/file_access.h" #include "core/templates/set.h" EditorTranslationParser *EditorTranslationParser::singleton = nullptr; diff --git a/editor/editor_translation_parser.h b/editor/editor_translation_parser.h index 4f8f3537f2..7013bbb8c4 100644 --- a/editor/editor_translation_parser.h +++ b/editor/editor_translation_parser.h @@ -32,10 +32,10 @@ #define EDITOR_TRANSLATION_PARSER_H #include "core/error/error_list.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class EditorTranslationParserPlugin : public Reference { - GDCLASS(EditorTranslationParserPlugin, Reference); +class EditorTranslationParserPlugin : public RefCounted { + GDCLASS(EditorTranslationParserPlugin, RefCounted); protected: static void _bind_methods(); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 39d7c7acd4..76c6fcc3d3 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -31,9 +31,9 @@ #include "export_template_manager.h" #include "core/input/input.h" +#include "core/io/dir_access.h" #include "core/io/json.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" #include "core/os/keyboard.h" #include "core/version.h" #include "editor_node.h" diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 400fe4f746..6654bbabb9 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -31,9 +31,9 @@ #include "filesystem_dock.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/templates/list.h" diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 8783c402cd..12c567fb69 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -43,7 +43,7 @@ #include "scene/gui/tree.h" #include "scene/main/timer.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/thread.h" #include "create_dialog.h" diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index d9b956ed08..17d24a295c 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -30,7 +30,7 @@ #include "find_in_files.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/os.h" #include "editor_node.h" #include "editor_scale.h" diff --git a/editor/icons/Quat.svg b/editor/icons/Quaternion.svg index cf29160ff4..cf29160ff4 100644 --- a/editor/icons/Quat.svg +++ b/editor/icons/Quaternion.svg diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp index 4a4d9d8f06..c9e446a1a2 100644 --- a/editor/import/resource_importer_csv_translation.cpp +++ b/editor/import/resource_importer_csv_translation.cpp @@ -30,8 +30,8 @@ #include "resource_importer_csv_translation.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "core/string/optimized_translation.h" #include "core/string/translation.h" diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp index c5b2a8dc3a..2dea359188 100644 --- a/editor/import/resource_importer_image.cpp +++ b/editor/import/resource_importer_image.cpp @@ -30,9 +30,9 @@ #include "resource_importer_image.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "scene/resources/texture.h" String ResourceImporterImage::get_importer_name() const { diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index dd62c72d8a..3aa17ee581 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -30,8 +30,8 @@ #include "resource_importer_obj.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "editor/import/scene_importer_mesh.h" #include "editor/import/scene_importer_mesh_node_3d.h" #include "scene/3d/mesh_instance_3d.h" @@ -126,7 +126,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand String p = l.replace("map_Kd", "").replace("\\", "/").strip_edges(); String path; - if (p.is_abs_path()) { + if (p.is_absolute_path()) { path = p; } else { path = base_path.plus_file(p); @@ -146,7 +146,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand String p = l.replace("map_Ks", "").replace("\\", "/").strip_edges(); String path; - if (p.is_abs_path()) { + if (p.is_absolute_path()) { path = p; } else { path = base_path.plus_file(p); @@ -166,7 +166,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Stand String p = l.replace("map_Ns", "").replace("\\", "/").strip_edges(); String path; - if (p.is_abs_path()) { + if (p.is_absolute_path()) { path = p; } else { path = base_path.plus_file(p); diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index 8cb84abce2..c6e5836a23 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -42,8 +42,8 @@ class Material; class AnimationPlayer; class EditorSceneImporterMesh; -class EditorSceneImporter : public Reference { - GDCLASS(EditorSceneImporter, Reference); +class EditorSceneImporter : public RefCounted { + GDCLASS(EditorSceneImporter, RefCounted); protected: static void _bind_methods(); @@ -69,8 +69,8 @@ public: EditorSceneImporter() {} }; -class EditorScenePostImport : public Reference { - GDCLASS(EditorScenePostImport, Reference); +class EditorScenePostImport : public RefCounted { + GDCLASS(EditorScenePostImport, RefCounted); String source_file; diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp index f4d20a6296..70119bfd1c 100644 --- a/editor/import/resource_importer_shader_file.cpp +++ b/editor/import/resource_importer_shader_file.cpp @@ -30,9 +30,9 @@ #include "resource_importer_shader_file.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "editor/editor_node.h" #include "editor/plugins/shader_file_editor_plugin.h" #include "servers/rendering/rendering_device_binds.h" diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 74b30f4e3e..809f47bad9 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -218,14 +218,21 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options, void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image> &p_image, CompressMode p_compress_mode, Image::UsedChannels p_channels, Image::CompressMode p_compress_format, float p_lossy_quality) { switch (p_compress_mode) { case COMPRESS_LOSSLESS: { - f->store_32(StreamTexture2D::DATA_FORMAT_LOSSLESS); + bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png"); + bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit + f->store_32(use_webp ? StreamTexture2D::DATA_FORMAT_WEBP : StreamTexture2D::DATA_FORMAT_PNG); f->store_16(p_image->get_width()); f->store_16(p_image->get_height()); f->store_32(p_image->get_mipmap_count()); f->store_32(p_image->get_format()); for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) { - Vector<uint8_t> data = Image::lossless_packer(p_image->get_image_from_mipmap(i)); + Vector<uint8_t> data; + if (use_webp) { + data = Image::webp_lossless_packer(p_image->get_image_from_mipmap(i)); + } else { + data = Image::png_packer(p_image->get_image_from_mipmap(i)); + } int data_len = data.size(); f->store_32(data_len); @@ -235,14 +242,14 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image } break; case COMPRESS_LOSSY: { - f->store_32(StreamTexture2D::DATA_FORMAT_LOSSY); + f->store_32(StreamTexture2D::DATA_FORMAT_WEBP); f->store_16(p_image->get_width()); f->store_16(p_image->get_height()); f->store_32(p_image->get_mipmap_count()); f->store_32(p_image->get_format()); for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) { - Vector<uint8_t> data = Image::lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality); + Vector<uint8_t> data = Image::webp_lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality); int data_len = data.size(); f->store_32(data_len); diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index 0d551a965c..41220009cd 100644 --- a/editor/import/resource_importer_texture.h +++ b/editor/import/resource_importer_texture.h @@ -31,9 +31,9 @@ #ifndef RESOURCEIMPORTTEXTURE_H #define RESOURCEIMPORTTEXTURE_H +#include "core/io/file_access.h" #include "core/io/image.h" #include "core/io/resource_importer.h" -#include "core/os/file_access.h" #include "scene/resources/texture.h" #include "servers/rendering_server.h" diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 4c3ae59951..d5d1a14be3 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -31,10 +31,10 @@ #include "resource_importer_texture_atlas.h" #include "atlas_import_failed.xpm" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/resource_saver.h" #include "core/math/geometry_2d.h" -#include "core/os/file_access.h" #include "editor/editor_atlas_packer.h" #include "scene/resources/mesh.h" #include "scene/resources/texture.h" diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index bcc55b330b..e615212569 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -30,9 +30,9 @@ #include "resource_importer_wav.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "scene/resources/audio_stream_sample.h" const float TRIM_DB_LIMIT = -50; diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index 0544eb2d50..2efecb9f65 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -33,8 +33,8 @@ #include "scene/main/node.h" -class MultiNodeEdit : public Reference { - GDCLASS(MultiNodeEdit, Reference); +class MultiNodeEdit : public RefCounted { + GDCLASS(MultiNodeEdit, RefCounted); List<NodePath> nodes; struct PLData { diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 7dda61f0bf..f55d77d782 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -30,7 +30,7 @@ #include "plugin_config_dialog.h" #include "core/io/config_file.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "editor/editor_scale.h" diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index 6e71133c4f..a0df7e289e 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -32,8 +32,8 @@ #include "canvas_item_editor_plugin.h" #include "core/input/input.h" +#include "core/io/file_access.h" #include "core/math/geometry_2d.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "editor/editor_settings.h" #include "node_3d_editor_plugin.h" diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index cf237f5a4a..235ccb18cb 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -832,7 +832,7 @@ struct FSample { }; static FSample _samples[] = { - { "hani", U"漢語" }, + { "hani", U"漢字" }, { "armn", U"Աբ" }, { "copt", U"Αα" }, { "cyrl", U"Аб" }, diff --git a/editor/plugins/font_editor_plugin.cpp b/editor/plugins/font_editor_plugin.cpp index fa58eb5480..8de7dc2447 100644 --- a/editor/plugins/font_editor_plugin.cpp +++ b/editor/plugins/font_editor_plugin.cpp @@ -56,7 +56,7 @@ struct FSample { }; static FSample _samples[] = { - { "hani", U"漢語" }, + { "hani", U"漢字" }, { "armn", U"Աբ" }, { "copt", U"Αα" }, { "cyrl", U"Аб" }, diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 208abeb87f..838e67b5e7 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "path_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/keyboard.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index d2ea7a10dc..8a14db0cfd 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -32,8 +32,8 @@ #include "canvas_item_editor_plugin.h" #include "core/input/input.h" +#include "core/io/file_access.h" #include "core/math/geometry_2d.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 4b7faec228..b89992b03c 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -32,8 +32,8 @@ #include "core/config/project_settings.h" #include "core/input/input.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "editor/debugger/editor_debugger_node.h" @@ -1640,10 +1640,13 @@ void ScriptEditor::ensure_select_current() { ScriptEditorBase *se = _get_current_editor(); if (se) { se->enable_editor(); + se->set_find_replace_bar(find_replace_bar); if (!grab_focus_block && is_visible_in_tree()) { se->ensure_focus(); } + } else { + find_replace_bar->hide(); } } @@ -3379,11 +3382,19 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing help_overview->set_v_size_flags(SIZE_EXPAND_FILL); + VBoxContainer *code_editor_container = memnew(VBoxContainer); + script_split->add_child(code_editor_container); + tab_container = memnew(TabContainer); tab_container->set_tabs_visible(false); tab_container->set_custom_minimum_size(Size2(200, 0) * EDSCALE); - script_split->add_child(tab_container); + code_editor_container->add_child(tab_container); tab_container->set_h_size_flags(SIZE_EXPAND_FILL); + tab_container->set_v_size_flags(SIZE_EXPAND_FILL); + + find_replace_bar = memnew(FindReplaceBar); + code_editor_container->add_child(find_replace_bar); + find_replace_bar->hide(); ED_SHORTCUT("script_editor/window_sort", TTR("Sort")); ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 9ae63b7c4f..1d379059d4 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -162,6 +162,7 @@ public: virtual void set_tooltip_request_func(String p_method, Object *p_obj) = 0; virtual Control *get_edit_menu() = 0; virtual void clear_edit_menu() = 0; + virtual void set_find_replace_bar(FindReplaceBar *p_bar) = 0; virtual Control *get_base_editor() const = 0; @@ -270,6 +271,7 @@ class ScriptEditor : public PanelContainer { ConfirmationDialog *erase_tab_confirm; ScriptCreateDialog *script_create_dialog; Button *scripts_visible; + FindReplaceBar *find_replace_bar; String current_theme; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index a29e51e8fb..8fa6b66eda 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1358,6 +1358,10 @@ void ScriptTextEditor::clear_edit_menu() { memdelete(edit_hb); } +void ScriptTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) { + code_editor->set_find_replace_bar(p_bar); +} + void ScriptTextEditor::reload(bool p_soft) { CodeEdit *te = code_editor->get_text_editor(); Ref<Script> scr = script; diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index f784bbe1f8..7bb961bf19 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -233,6 +233,8 @@ public: Control *get_edit_menu() override; virtual void clear_edit_menu() override; + virtual void set_find_replace_bar(FindReplaceBar *p_bar) override; + static void register_editor(); virtual Control *get_base_editor() const override; diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 3beef78bfc..e4a5a3796e 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -751,6 +751,11 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { editor_box->set_v_size_flags(SIZE_EXPAND_FILL); editor_box->add_child(shader_editor); + FindReplaceBar *bar = memnew(FindReplaceBar); + main_container->add_child(bar); + bar->hide(); + shader_editor->set_find_replace_bar(bar); + warnings_panel = memnew(RichTextLabel); warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 1edcbd2cc9..dc7f85a790 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -281,6 +281,10 @@ void TextEditor::clear_edit_menu() { memdelete(edit_hb); } +void TextEditor::set_find_replace_bar(FindReplaceBar *p_bar) { + code_editor->set_find_replace_bar(p_bar); +} + void TextEditor::_edit_option(int p_op) { CodeEdit *tx = code_editor->get_text_editor(); @@ -538,7 +542,7 @@ TextEditor::TextEditor() { edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO); - edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("un_redo"), EDIT_REDO); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_redo"), EDIT_REDO); edit_menu->get_popup()->add_separator(); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_cut"), EDIT_CUT); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_copy"), EDIT_COPY); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index abb75cc9d8..4e667dc676 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -139,6 +139,7 @@ public: virtual Control *get_edit_menu() override; virtual void clear_edit_menu() override; + virtual void set_find_replace_bar(FindReplaceBar *p_bar) override; virtual void validate() override; diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index f1c73f99dc..7d38a8cb98 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "theme_editor_plugin.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/keyboard.h" #include "core/version.h" #include "editor/editor_scale.h" diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 7ef5e9e8ce..2bb9e64262 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -44,6 +44,7 @@ #include "scene/gui/panel.h" #include "scene/main/window.h" #include "scene/resources/visual_shader_nodes.h" +#include "scene/resources/visual_shader_particle_nodes.h" #include "scene/resources/visual_shader_sdf_nodes.h" #include "servers/display_server.h" #include "servers/rendering/shader_types.h" @@ -417,6 +418,11 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { } } + Ref<VisualShaderNodeParticleEmit> emit = vsnode; + if (emit.is_valid()) { + node->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); + } + Ref<VisualShaderNodeUniform> uniform = vsnode; if (uniform.is_valid()) { VisualShaderEditor::get_singleton()->graph->add_child(node); @@ -1013,13 +1019,13 @@ bool VisualShaderEditor::_is_available(int p_mode) { if (p_mode != -1) { switch (current_mode) { - case 0: // Vertex or Emit + case 0: // Vertex / Emit current_mode = 1; break; - case 1: // Fragment or Process + case 1: // Fragment / Process current_mode = 2; break; - case 2: // Light or End + case 2: // Light / Collide current_mode = 4; break; default: @@ -1235,22 +1241,29 @@ void VisualShaderEditor::_update_options_menu() { void VisualShaderEditor::_set_mode(int p_which) { if (p_which == VisualShader::MODE_SKY) { - edit_type_standart->set_visible(false); + edit_type_standard->set_visible(false); edit_type_particles->set_visible(false); edit_type_sky->set_visible(true); edit_type = edit_type_sky; + custom_mode_box->set_visible(false); mode = MODE_FLAGS_SKY; } else if (p_which == VisualShader::MODE_PARTICLES) { - edit_type_standart->set_visible(false); + edit_type_standard->set_visible(false); edit_type_particles->set_visible(true); edit_type_sky->set_visible(false); edit_type = edit_type_particles; + if ((edit_type->get_selected() + 3) > VisualShader::TYPE_PROCESS) { + custom_mode_box->set_visible(false); + } else { + custom_mode_box->set_visible(true); + } mode = MODE_FLAGS_PARTICLES; } else { edit_type_particles->set_visible(false); - edit_type_standart->set_visible(true); + edit_type_standard->set_visible(true); edit_type_sky->set_visible(false); - edit_type = edit_type_standart; + edit_type = edit_type_standard; + custom_mode_box->set_visible(false); mode = MODE_FLAGS_SPATIAL_CANVASITEM; } visual_shader->set_shader_type(get_current_shader_type()); @@ -1403,9 +1416,9 @@ void VisualShaderEditor::_update_graph() { VisualShader::Type VisualShaderEditor::get_current_shader_type() const { VisualShader::Type type; if (mode & MODE_FLAGS_PARTICLES) { - type = VisualShader::Type(edit_type->get_selected() + 3); + type = VisualShader::Type(edit_type->get_selected() + 3 + (custom_mode_enabled ? 3 : 0)); } else if (mode & MODE_FLAGS_SKY) { - type = VisualShader::Type(edit_type->get_selected() + 6); + type = VisualShader::Type(edit_type->get_selected() + 8); } else { type = VisualShader::Type(edit_type->get_selected()); } @@ -3224,8 +3237,18 @@ void VisualShaderEditor::_mode_selected(int p_id) { int offset = 0; if (mode & MODE_FLAGS_PARTICLES) { offset = 3; + if (p_id + offset > VisualShader::TYPE_PROCESS) { + custom_mode_box->set_visible(false); + custom_mode_enabled = false; + } else { + custom_mode_box->set_visible(true); + if (custom_mode_box->is_pressed()) { + custom_mode_enabled = true; + offset += 3; + } + } } else if (mode & MODE_FLAGS_SKY) { - offset = 6; + offset = 8; } visual_shader->set_shader_type(VisualShader::Type(p_id + offset)); @@ -3233,6 +3256,21 @@ void VisualShaderEditor::_mode_selected(int p_id) { _update_graph(); } +void VisualShaderEditor::_custom_mode_toggled(bool p_enabled) { + if (!(mode & MODE_FLAGS_PARTICLES)) { + return; + } + custom_mode_enabled = p_enabled; + int id = edit_type->get_selected() + 3; + if (p_enabled) { + visual_shader->set_shader_type(VisualShader::Type(id + 3)); + } else { + visual_shader->set_shader_type(VisualShader::Type(id)); + } + _update_options_menu(); + _update_graph(); +} + void VisualShaderEditor::_input_select_item(Ref<VisualShaderNodeInput> p_input, String p_name) { String prev_name = p_input->get_input_name(); @@ -3731,17 +3769,23 @@ VisualShaderEditor::VisualShaderEditor() { graph->get_zoom_hbox()->add_child(vs); graph->get_zoom_hbox()->move_child(vs, 0); - edit_type_standart = memnew(OptionButton); - edit_type_standart->add_item(TTR("Vertex")); - edit_type_standart->add_item(TTR("Fragment")); - edit_type_standart->add_item(TTR("Light")); - edit_type_standart->select(1); - edit_type_standart->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected)); + custom_mode_box = memnew(CheckBox); + custom_mode_box->set_text(TTR("Custom")); + custom_mode_box->set_pressed(false); + custom_mode_box->set_visible(false); + custom_mode_box->connect("toggled", callable_mp(this, &VisualShaderEditor::_custom_mode_toggled)); + + edit_type_standard = memnew(OptionButton); + edit_type_standard->add_item(TTR("Vertex")); + edit_type_standard->add_item(TTR("Fragment")); + edit_type_standard->add_item(TTR("Light")); + edit_type_standard->select(1); + edit_type_standard->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected)); edit_type_particles = memnew(OptionButton); - edit_type_particles->add_item(TTR("Emit")); + edit_type_particles->add_item(TTR("Start")); edit_type_particles->add_item(TTR("Process")); - edit_type_particles->add_item(TTR("End")); + edit_type_particles->add_item(TTR("Collide")); edit_type_particles->select(0); edit_type_particles->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected)); @@ -3750,14 +3794,16 @@ VisualShaderEditor::VisualShaderEditor() { edit_type_sky->select(0); edit_type_sky->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected)); - edit_type = edit_type_standart; + edit_type = edit_type_standard; + graph->get_zoom_hbox()->add_child(custom_mode_box); + graph->get_zoom_hbox()->move_child(custom_mode_box, 0); + graph->get_zoom_hbox()->add_child(edit_type_standard); + graph->get_zoom_hbox()->move_child(edit_type_standard, 0); graph->get_zoom_hbox()->add_child(edit_type_particles); graph->get_zoom_hbox()->move_child(edit_type_particles, 0); graph->get_zoom_hbox()->add_child(edit_type_sky); graph->get_zoom_hbox()->move_child(edit_type_sky, 0); - graph->get_zoom_hbox()->add_child(edit_type_standart); - graph->get_zoom_hbox()->move_child(edit_type_standart, 0); add_node = memnew(Button); add_node->set_flat(true); @@ -3977,9 +4023,10 @@ VisualShaderEditor::VisualShaderEditor() { // INPUT + const String input_param_shader_modes = TTR("'%s' input parameter for all shader modes."); + // SPATIAL-FOR-ALL - const String input_param_shader_modes = TTR("'%s' input parameter for all shader modes."); add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "camera"), "camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_camera"), "inv_camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_projection"), "inv_projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); @@ -3998,6 +4045,23 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("UV", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "uv"), "uv", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM)); + // PARTICLES-FOR-ALL + + add_options.push_back(AddOption("Active", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "active"), "active", VisualShaderNode::PORT_TYPE_BOOLEAN, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Alpha", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("AttractorForce", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "attractor_force"), "attractor_force", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Color", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Custom", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom"), "custom", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("CustomAlpha", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom_alpha"), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Delta", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "delta"), "delta", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("EmissionTransform", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "emission_transform"), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Index", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "index"), "index", VisualShaderNode::PORT_TYPE_SCALAR_INT, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("LifeTime", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "lifetime"), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Restart", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "restart"), "restart", VisualShaderNode::PORT_TYPE_BOOLEAN, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Transform", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("Velocity", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_PARTICLES)); + ///////////////// add_options.push_back(AddOption("Input", "Input", "Common", "VisualShaderNodeInput", TTR("Input parameter."))); @@ -4010,11 +4074,12 @@ VisualShaderEditor::VisualShaderEditor() { const String input_param_for_sky_shader_mode = TTR("'%s' input parameter for sky shader mode."); const String input_param_for_light_shader_mode = TTR("'%s' input parameter for light shader mode."); const String input_param_for_vertex_shader_mode = TTR("'%s' input parameter for vertex shader mode."); - const String input_param_for_emit_shader_mode = TTR("'%s' input parameter for emit shader mode."); + const String input_param_for_start_shader_mode = TTR("'%s' input parameter for start shader mode."); const String input_param_for_process_shader_mode = TTR("'%s' input parameter for process shader mode."); - const String input_param_for_end_shader_mode = TTR("'%s' input parameter for end shader mode."); - const String input_param_for_emit_and_process_shader_mode = TTR("'%s' input parameter for emit and process shader mode."); - const String input_param_for_vertex_and_fragment_shader_mode = TTR("'%s' input parameter for vertex and fragment shader mode."); + const String input_param_for_collide_shader_mode = TTR("'%s' input parameter for collide shader mode."); + const String input_param_for_start_and_process_shader_mode = TTR("'%s' input parameter for start and process shader modes."); + const String input_param_for_process_and_collide_shader_mode = TTR("'%s' input parameter for process and collide shader modes."); + const String input_param_for_vertex_and_fragment_shader_mode = TTR("'%s' input parameter for vertex and fragment shader modes."); add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "binormal"), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); @@ -4091,50 +4156,6 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "vertex"), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("World", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "world"), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); - // PARTICLES INPUTS - - add_options.push_back(AddOption("Active", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "active"), "active", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Alpha", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Color", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Custom", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom"), "custom", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("CustomAlpha", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom_alpha"), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Delta", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "delta"), "delta", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("EmissionTransform", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "emission_transform"), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Index", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "index"), "index", VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("LifeTime", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "lifetime"), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Restart", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "restart"), "restart", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Time", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Transform", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Velocity", "Input", "Emit", "VisualShaderNodeInput", vformat(input_param_shader_modes, "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); - - add_options.push_back(AddOption("Active", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "active"), "active", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Alpha", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Color", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Custom", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom"), "custom", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("CustomAlpha", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom_alpha"), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Delta", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "delta"), "delta", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("EmissionTransform", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "emission_transform"), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Index", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "index"), "index", VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("LifeTime", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "lifetime"), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Restart", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "restart"), "restart", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Time", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Transform", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Velocity", "Input", "Process", "VisualShaderNodeInput", vformat(input_param_shader_modes, "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); - - add_options.push_back(AddOption("Active", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "active"), "active", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Alpha", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Color", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Custom", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom"), "custom", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("CustomAlpha", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "custom_alpha"), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Delta", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "delta"), "delta", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("EmissionTransform", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "emission_transform"), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Index", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "index"), "index", VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("LifeTime", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "lifetime"), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Restart", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "restart"), "restart", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Time", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Transform", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - add_options.push_back(AddOption("Velocity", "Input", "End", "VisualShaderNodeInput", vformat(input_param_shader_modes, "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_END, Shader::MODE_PARTICLES)); - // SKY INPUTS add_options.push_back(AddOption("AtCubeMapPass", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "at_cubemap_pass"), "at_cubemap_pass", VisualShaderNode::PORT_TYPE_BOOLEAN, TYPE_FLAGS_SKY, Shader::MODE_SKY)); @@ -4167,6 +4188,22 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("SkyCoords", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "sky_coords"), "sky_coords", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_SKY, Shader::MODE_SKY)); add_options.push_back(AddOption("Time", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_SKY, Shader::MODE_SKY)); + // PARTICLES + + add_options.push_back(AddOption("CollisionDepth", "Input", "Collide", "VisualShaderNodeInput", vformat(input_param_for_collide_shader_mode, "collision_depth"), "collision_depth", VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("CollisionNormal", "Input", "Collide", "VisualShaderNodeInput", vformat(input_param_for_collide_shader_mode, "collision_normal"), "collision_normal", VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES)); + + add_options.push_back(AddOption("EmitParticle", "Particles", "", "VisualShaderNodeParticleEmit", "", -1, -1, -1, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("ParticleAccelerator", "Particles", "", "VisualShaderNodeParticleAccelerator", "", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_PROCESS, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("ParticleRandomness", "Particles", "", "VisualShaderNodeParticleRandomness", "", -1, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("MultiplyByAxisAngle", "Particles", "Transform", "VisualShaderNodeParticleMultiplyByAxisAngle", "A node for help to multiply a position input vector by rotation using specific axis. Intended to work with emitters.", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES)); + + add_options.push_back(AddOption("BoxEmitter", "Particles", "Emitters", "VisualShaderNodeParticleBoxEmitter", "", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("RingEmitter", "Particles", "Emitters", "VisualShaderNodeParticleRingEmitter", "", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("SphereEmitter", "Particles", "Emitters", "VisualShaderNodeParticleSphereEmitter", "", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + + add_options.push_back(AddOption("ConeVelocity", "Particles", "Velocity", "VisualShaderNodeParticleConeVelocity", "", -1, VisualShaderNode::PORT_TYPE_VECTOR, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + // SCALAR add_options.push_back(AddOption("FloatFunc", "Scalar", "Common", "VisualShaderNodeFloatFunc", TTR("Float function."), -1, VisualShaderNode::PORT_TYPE_SCALAR)); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index f12d05f7ed..fa98c6b780 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -41,8 +41,8 @@ #include "scene/gui/tree.h" #include "scene/resources/visual_shader.h" -class VisualShaderNodePlugin : public Reference { - GDCLASS(VisualShaderNodePlugin, Reference); +class VisualShaderNodePlugin : public RefCounted { + GDCLASS(VisualShaderNodePlugin, RefCounted); protected: static void _bind_methods(); @@ -51,8 +51,8 @@ public: virtual Control *create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node); }; -class VisualShaderGraphPlugin : public Reference { - GDCLASS(VisualShaderGraphPlugin, Reference); +class VisualShaderGraphPlugin : public RefCounted { + GDCLASS(VisualShaderGraphPlugin, RefCounted); private: struct InputPort { @@ -142,9 +142,11 @@ class VisualShaderEditor : public VBoxContainer { Button *preview_shader; OptionButton *edit_type = nullptr; - OptionButton *edit_type_standart; + OptionButton *edit_type_standard; OptionButton *edit_type_particles; OptionButton *edit_type_sky; + CheckBox *custom_mode_box; + bool custom_mode_enabled = false; bool pending_update_preview; bool shader_error; @@ -189,7 +191,9 @@ class VisualShaderEditor : public VBoxContainer { enum ParticlesTypeFlags { TYPE_FLAGS_EMIT = 1, TYPE_FLAGS_PROCESS = 2, - TYPE_FLAGS_END = 4 + TYPE_FLAGS_COLLIDE = 4, + TYPE_FLAGS_EMIT_CUSTOM = 8, + TYPE_FLAGS_PROCESS_CUSTOM = 16, }; enum SkyTypeFlags { @@ -385,6 +389,7 @@ class VisualShaderEditor : public VBoxContainer { Ref<VisualShaderGraphPlugin> graph_plugin; void _mode_selected(int p_id); + void _custom_mode_toggled(bool p_enabled); void _input_select_item(Ref<VisualShaderNodeInput> input, String name); void _uniform_select_item(Ref<VisualShaderNodeUniformRef> p_uniform, String p_name); diff --git a/editor/pot_generator.h b/editor/pot_generator.h index ab055e0c0e..61300064ba 100644 --- a/editor/pot_generator.h +++ b/editor/pot_generator.h @@ -31,7 +31,7 @@ #ifndef POT_GENERATOR_H #define POT_GENERATOR_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/templates/ordered_hash_map.h" #include "core/templates/set.h" diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 9b99372735..d72028cd0a 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -31,11 +31,11 @@ #include "project_export.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/string/optimized_translation.h" #include "editor_data.h" diff --git a/editor/project_export.h b/editor/project_export.h index cfd4934c34..aeace708b8 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -31,7 +31,7 @@ #ifndef PROJECT_EXPORT_SETTINGS_H #define PROJECT_EXPORT_SETTINGS_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/thread.h" #include "editor/editor_export.h" #include "editor/editor_file_dialog.h" diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 1b596ce599..12490f687e 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -31,11 +31,11 @@ #include "project_manager.h" #include "core/io/config_file.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "core/io/stream_peer_ssl.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/translation.h" diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 7a4b0964fa..c44f8d9a4b 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -1446,6 +1446,8 @@ void CustomPropertyEditor::_modified(String p_string) { return; } + Variant prev_v = v; + updating = true; switch (type) { case Variant::INT: { @@ -1459,14 +1461,18 @@ void CustomPropertyEditor::_modified(String p_string) { } else { v = expr->execute(Array(), nullptr, false); } - emit_signal("variant_changed"); + if (v != prev_v) { + emit_signal("variant_changed"); + } } break; case Variant::FLOAT: { if (hint != PROPERTY_HINT_EXP_EASING) { String text = TS->parse_number(value_editor[0]->get_text()); v = _parse_real_expression(text); - emit_signal("variant_changed"); + if (v != prev_v) { + emit_signal("variant_changed"); + } } } break; @@ -1479,7 +1485,9 @@ void CustomPropertyEditor::_modified(String p_string) { vec.x = _parse_real_expression(value_editor[0]->get_text()); vec.y = _parse_real_expression(value_editor[1]->get_text()); v = vec; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::RECT2: { @@ -1490,7 +1498,9 @@ void CustomPropertyEditor::_modified(String p_string) { r2.size.x = _parse_real_expression(value_editor[2]->get_text()); r2.size.y = _parse_real_expression(value_editor[3]->get_text()); v = r2; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; @@ -1500,7 +1510,9 @@ void CustomPropertyEditor::_modified(String p_string) { vec.y = _parse_real_expression(value_editor[1]->get_text()); vec.z = _parse_real_expression(value_editor[2]->get_text()); v = vec; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::PLANE: { @@ -1510,7 +1522,9 @@ void CustomPropertyEditor::_modified(String p_string) { pl.normal.z = _parse_real_expression(value_editor[2]->get_text()); pl.d = _parse_real_expression(value_editor[3]->get_text()); v = pl; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::QUATERNION: { @@ -1520,7 +1534,9 @@ void CustomPropertyEditor::_modified(String p_string) { q.z = _parse_real_expression(value_editor[2]->get_text()); q.w = _parse_real_expression(value_editor[3]->get_text()); v = q; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::AABB: { @@ -1534,7 +1550,9 @@ void CustomPropertyEditor::_modified(String p_string) { size.y = _parse_real_expression(value_editor[4]->get_text()); size.z = _parse_real_expression(value_editor[5]->get_text()); v = AABB(pos, size); - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::TRANSFORM2D: { @@ -1544,7 +1562,9 @@ void CustomPropertyEditor::_modified(String p_string) { } v = m; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::BASIS: { @@ -1554,7 +1574,9 @@ void CustomPropertyEditor::_modified(String p_string) { } v = m; - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::TRANSFORM3D: { @@ -1570,7 +1592,9 @@ void CustomPropertyEditor::_modified(String p_string) { origin.z = _parse_real_expression(value_editor[11]->get_text()); v = Transform3D(basis, origin); - _emit_changed_whole_or_field(); + if (v != prev_v) { + _emit_changed_whole_or_field(); + } } break; case Variant::COLOR: { @@ -1578,7 +1602,9 @@ void CustomPropertyEditor::_modified(String p_string) { case Variant::NODE_PATH: { v = NodePath(value_editor[0]->get_text()); - emit_signal("variant_changed"); + if (v != prev_v) { + emit_signal("variant_changed"); + } } break; case Variant::DICTIONARY: { } break; @@ -1654,25 +1680,7 @@ void CustomPropertyEditor::_focus_enter() { } void CustomPropertyEditor::_focus_exit() { - switch (type) { - case Variant::FLOAT: - case Variant::STRING: - case Variant::VECTOR2: - case Variant::RECT2: - case Variant::VECTOR3: - case Variant::PLANE: - case Variant::QUATERNION: - case Variant::AABB: - case Variant::TRANSFORM2D: - case Variant::BASIS: - case Variant::TRANSFORM3D: { - for (int i = 0; i < MAX_VALUE_EDITORS; ++i) { - value_editor[i]->select(0, 0); - } - } break; - default: { - } - } + _modified(String()); } void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) { diff --git a/editor/property_editor.h b/editor/property_editor.h index c6929f3b42..8a587b50b0 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -50,8 +50,8 @@ class PropertyValueEvaluator; class CreateDialog; class PropertySelector; -class EditorResourceConversionPlugin : public Reference { - GDCLASS(EditorResourceConversionPlugin, Reference); +class EditorResourceConversionPlugin : public RefCounted { + GDCLASS(EditorResourceConversionPlugin, RefCounted); protected: static void _bind_methods(); diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index bf31be536c..d6db7a988f 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -125,18 +125,23 @@ void PropertySelector::_update_search() { search_options->get_theme_icon("float", "EditorIcons"), search_options->get_theme_icon("String", "EditorIcons"), search_options->get_theme_icon("Vector2", "EditorIcons"), + search_options->get_theme_icon("Vector2i", "EditorIcons"), search_options->get_theme_icon("Rect2", "EditorIcons"), + search_options->get_theme_icon("Rect2i", "EditorIcons"), search_options->get_theme_icon("Vector3", "EditorIcons"), + search_options->get_theme_icon("Vector3i", "EditorIcons"), search_options->get_theme_icon("Transform2D", "EditorIcons"), search_options->get_theme_icon("Plane", "EditorIcons"), - search_options->get_theme_icon("Quat", "EditorIcons"), + search_options->get_theme_icon("Quaternion", "EditorIcons"), search_options->get_theme_icon("AABB", "EditorIcons"), search_options->get_theme_icon("Basis", "EditorIcons"), search_options->get_theme_icon("Transform", "EditorIcons"), search_options->get_theme_icon("Color", "EditorIcons"), - search_options->get_theme_icon("Path", "EditorIcons"), + search_options->get_theme_icon("NodePath", "EditorIcons"), search_options->get_theme_icon("RID", "EditorIcons"), - search_options->get_theme_icon("Object", "EditorIcons"), + search_options->get_theme_icon("MiniObject", "EditorIcons"), + search_options->get_theme_icon("Callable", "EditorIcons"), + search_options->get_theme_icon("Signal", "EditorIcons"), search_options->get_theme_icon("Dictionary", "EditorIcons"), search_options->get_theme_icon("Array", "EditorIcons"), search_options->get_theme_icon("PackedByteArray", "EditorIcons"), diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index c2bfdaae96..650decfd49 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -31,9 +31,9 @@ #include "script_create_dialog.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "core/object/script_language.h" -#include "core/os/file_access.h" #include "core/string/string_builder.h" #include "editor/create_dialog.h" #include "editor/editor_node.h" diff --git a/main/main.cpp b/main/main.cpp index d67761db55..c2e3cc8d58 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -36,6 +36,7 @@ #include "core/debugger/engine_debugger.h" #include "core/input/input.h" #include "core/input/input_map.h" +#include "core/io/dir_access.h" #include "core/io/file_access_network.h" #include "core/io/file_access_pack.h" #include "core/io/file_access_zip.h" @@ -43,7 +44,6 @@ #include "core/io/ip.h" #include "core/io/resource_loader.h" #include "core/object/message_queue.h" -#include "core/os/dir_access.h" #include "core/os/os.h" #include "core/register_core_types.h" #include "core/string/translation.h" diff --git a/modules/csg/csg.h b/modules/csg/csg.h index 4bd79e15a9..c872860486 100644 --- a/modules/csg/csg.h +++ b/modules/csg/csg.h @@ -36,7 +36,7 @@ #include "core/math/transform_3d.h" #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/list.h" #include "core/templates/map.h" #include "core/templates/oa_hash_map.h" diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 2fef576b77..fced61a600 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -30,7 +30,7 @@ #include "texture_loader_dds.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #define PF_FOURCC(s) ((uint32_t)(((s)[3] << 24U) | ((s)[2] << 16U) | ((s)[1] << 8U) | ((s)[0]))) diff --git a/modules/fbx/data/fbx_bone.h b/modules/fbx/data/fbx_bone.h index efba147b89..83918ad1e2 100644 --- a/modules/fbx/data/fbx_bone.h +++ b/modules/fbx/data/fbx_bone.h @@ -38,7 +38,7 @@ struct PivotTransform; -struct FBXBone : public Reference { +struct FBXBone : public RefCounted { uint64_t parent_bone_id = 0; uint64_t bone_id = 0; diff --git a/modules/fbx/data/fbx_material.h b/modules/fbx/data/fbx_material.h index 23310b8e1d..5fd4d9212b 100644 --- a/modules/fbx/data/fbx_material.h +++ b/modules/fbx/data/fbx_material.h @@ -33,10 +33,10 @@ #include "tools/import_utils.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/string/ustring.h" -struct FBXMaterial : public Reference { +struct FBXMaterial : public RefCounted { String material_name = String(); bool warning_non_pbr_material = false; FBXDocParser::Material *material = nullptr; @@ -266,7 +266,7 @@ struct FBXMaterial : public Reference { /* storing the texture properties like color */ template <class T> - struct TexturePropertyMapping : Reference { + struct TexturePropertyMapping : RefCounted { StandardMaterial3D::TextureParam map_mode = StandardMaterial3D::TextureParam::TEXTURE_ALBEDO; const T property = T(); }; diff --git a/modules/fbx/data/fbx_mesh_data.h b/modules/fbx/data/fbx_mesh_data.h index c4eaa7d170..7486c5c59c 100644 --- a/modules/fbx/data/fbx_mesh_data.h +++ b/modules/fbx/data/fbx_mesh_data.h @@ -78,7 +78,7 @@ struct VertexData { }; // Caches mesh information and instantiates meshes for you using helper functions. -struct FBXMeshData : Reference { +struct FBXMeshData : RefCounted { struct MorphVertexData { // TODO we have only these?? /// Each element is a vertex. Not supposed to be void. diff --git a/modules/fbx/data/fbx_node.h b/modules/fbx/data/fbx_node.h index a6f62f3388..75461e397d 100644 --- a/modules/fbx/data/fbx_node.h +++ b/modules/fbx/data/fbx_node.h @@ -40,7 +40,7 @@ class Node3D; struct PivotTransform; -struct FBXNode : Reference, ModelAbstraction { +struct FBXNode : RefCounted, ModelAbstraction { uint64_t current_node_id = 0; String node_name = String(); Node3D *godot_node = nullptr; diff --git a/modules/fbx/data/fbx_skeleton.h b/modules/fbx/data/fbx_skeleton.h index df937cde49..b6103df949 100644 --- a/modules/fbx/data/fbx_skeleton.h +++ b/modules/fbx/data/fbx_skeleton.h @@ -35,14 +35,14 @@ #include "fbx_node.h" #include "model_abstraction.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "scene/3d/skeleton_3d.h" struct FBXNode; struct ImportState; struct FBXBone; -struct FBXSkeleton : Reference { +struct FBXSkeleton : RefCounted { Ref<FBXNode> fbx_node = Ref<FBXNode>(); Vector<Ref<FBXBone>> skeleton_bones = Vector<Ref<FBXBone>>(); Skeleton3D *skeleton = nullptr; diff --git a/modules/fbx/data/pivot_transform.h b/modules/fbx/data/pivot_transform.h index 29cf7a3d0e..099b268075 100644 --- a/modules/fbx/data/pivot_transform.h +++ b/modules/fbx/data/pivot_transform.h @@ -32,7 +32,7 @@ #define PIVOT_TRANSFORM_H #include "core/math/transform_3d.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "model_abstraction.h" @@ -55,7 +55,7 @@ enum TransformationComp { TransformationComp_MAXIMUM }; // Abstract away pivot data so its simpler to handle -struct PivotTransform : Reference, ModelAbstraction { +struct PivotTransform : RefCounted, ModelAbstraction { // at the end we want to keep geometric_ everything, post and pre rotation // these are used during animation data processing / keyframe ingestion the rest can be simplified down / out. Quaternion pre_rotation = Quaternion(); diff --git a/modules/fbx/tools/validation_tools.h b/modules/fbx/tools/validation_tools.h index fe0c92b22f..6c15eb7e12 100644 --- a/modules/fbx/tools/validation_tools.h +++ b/modules/fbx/tools/validation_tools.h @@ -33,8 +33,8 @@ #ifdef TOOLS_ENABLED +#include "core/io/file_access.h" #include "core/io/json.h" -#include "core/os/file_access.h" #include "core/string/ustring.h" #include "core/templates/local_vector.h" #include "core/templates/map.h" diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index 44d9e32ed8..4f1530598c 100644 --- a/modules/gdnative/doc_classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNative" inherits="Reference" version="4.0"> +<class name="GDNative" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 7c3b76e4d7..e552f443cf 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -32,9 +32,9 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "scene/main/scene_tree.h" diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index a28c58ec0d..0cc6487ea4 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -138,8 +138,8 @@ struct GDNativeCallRegistry { Vector<StringName> get_native_call_types(); }; -class GDNative : public Reference { - GDCLASS(GDNative, Reference); +class GDNative : public RefCounted { + GDCLASS(GDNative, RefCounted); Ref<GDNativeLibrary> library; diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 24f50a94f5..cfb57137bb 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -30,7 +30,7 @@ #include "gdnative/variant.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/variant/variant.h" #ifdef __cplusplus @@ -200,17 +200,17 @@ void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj) { Variant *dest = (Variant *)r_dest; const Object *obj = (const Object *)p_obj; - const Reference *reference = Object::cast_to<Reference>(obj); + const RefCounted *ref_counted = Object::cast_to<RefCounted>(obj); REF ref; - if (reference) { - ref = REF(reference); + if (ref_counted) { + ref = REF(ref_counted); } if (!ref.is_null()) { memnew_placement_custom(dest, Variant, Variant(ref)); } else { #if defined(DEBUG_METHODS_ENABLED) - if (reference) { - ERR_PRINT("Reference object has 0 refcount in godot_variant_new_object - you lost it somewhere."); + if (ref_counted) { + ERR_PRINT("RefCounted object has 0 refcount in godot_variant_new_object - you lost it somewhere."); } #endif memnew_placement_custom(dest, Variant, Variant(obj)); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index f184c84615..4ad8901f32 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -34,8 +34,8 @@ #include "core/config/engine.h" #include "core/core_constants.h" +#include "core/io/file_access.h" #include "core/object/class_db.h" -#include "core/os/file_access.h" #include "core/string/string_builder.h" #include "core/templates/pair.h" @@ -121,7 +121,7 @@ struct ClassAPI { String singleton_name; bool is_instantiable = false; // @Unclear - bool is_reference = false; + bool is_ref_counted = false; bool has_indexing = false; // For builtin types. String indexed_type; // For builtin types. bool is_keyed = false; // For builtin types. @@ -254,10 +254,10 @@ List<ClassAPI> generate_c_api_classes() { { List<StringName> inheriters; - ClassDB::get_inheriters_from_class("Reference", &inheriters); - bool is_reference = !!inheriters.find(class_name) || class_name == "Reference"; + ClassDB::get_inheriters_from_class("RefCounted", &inheriters); + bool is_ref_counted = !!inheriters.find(class_name) || class_name == "RefCounted"; // @Unclear - class_api.is_reference = !class_api.is_singleton && is_reference; + class_api.is_ref_counted = !class_api.is_singleton && is_ref_counted; } // constants @@ -509,10 +509,10 @@ List<ClassAPI> generate_c_builtin_api_types() { case Variant::PACKED_VECTOR2_ARRAY: case Variant::PACKED_VECTOR3_ARRAY: case Variant::PACKED_COLOR_ARRAY: - class_api.is_reference = true; + class_api.is_ref_counted = true; break; default: - class_api.is_reference = false; + class_api.is_ref_counted = false; break; } @@ -652,7 +652,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n"); source.push_back("\t\t\"singleton_name\": \"" + api.singleton_name + "\",\n"); source.push_back(String("\t\t\"instantiable\": ") + (api.is_instantiable ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\"is_ref_counted\": ") + (api.is_ref_counted ? "true" : "false") + ",\n"); source.push_back("\t\t\"constants\": {\n"); for (List<ConstantAPI>::Element *e = api.constants.front(); e; e = e->next()) { @@ -794,7 +794,7 @@ static List<String> generate_c_builtin_api_json(const List<ClassAPI> &p_api) { append_indented(source, vformat(R"("name": "%s",)", class_api.class_name)); append_indented(source, vformat(R"("is_instantiable": %s,)", class_api.is_instantiable ? "true" : "false")); - append_indented(source, vformat(R"("is_reference": %s,)", class_api.is_reference ? "true" : "false")); + append_indented(source, vformat(R"("is_ref_counted": %s,)", class_api.is_ref_counted ? "true" : "false")); append_indented(source, vformat(R"("has_indexing": %s,)", class_api.has_indexing ? "true" : "false")); append_indented(source, vformat(R"("indexed_type": "%s",)", class_api.has_indexing && class_api.indexed_type == "Nil" ? "Variant" : class_api.indexed_type)); append_indented(source, vformat(R"("is_keyed": %s,)", class_api.is_keyed ? "true" : "false")); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 03e25f49e6..6c2d038654 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -37,8 +37,8 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" #include "core/core_string_names.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "main/main.h" @@ -505,7 +505,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal if (!(script_data->base_native_type == "")) { owner = ClassDB::instance(script_data->base_native_type); } else { - owner = memnew(Reference); + owner = memnew(RefCounted); } if (!owner) { @@ -513,7 +513,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal return Variant(); } - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index 1360cf0299..0291ae560b 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -30,7 +30,7 @@ // Godot imports #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" // PluginScript imports #include "pluginscript_language.h" diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp index f2165cd225..462452a897 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.cpp +++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ // Godot imports -#include "core/os/file_access.h" +#include "core/io/file_access.h" // Pythonscript imports #include "pluginscript_language.h" #include "pluginscript_loader.h" diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 6bb11d3e8f..1dabb1db63 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ // Godot imports -#include "core/os/file_access.h" +#include "core/io/file_access.h" // PluginScript imports #include "pluginscript_instance.h" #include "pluginscript_script.h" @@ -94,7 +94,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal Object *owner = nullptr; if (get_instance_base_type() == "") { - owner = memnew(Reference); + owner = memnew(RefCounted); } else { owner = ClassDB::instance(get_instance_base_type()); } @@ -104,7 +104,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal return Variant(); } - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp index b94538b2f7..433544178f 100644 --- a/modules/gdnative/pluginscript/register_types.cpp +++ b/modules/gdnative/pluginscript/register_types.cpp @@ -31,9 +31,9 @@ #include "register_types.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/dir_access.h" #include "core/os/os.h" #include "scene/main/scene_tree.h" diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index 140888cd4b..c605dbb433 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -32,7 +32,7 @@ #define VIDEO_STREAM_GDNATIVE_H #include "../gdnative.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "scene/resources/texture.h" #include "scene/resources/video_stream.h" diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 9e974b6fdc..58620f2b3e 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -240,10 +240,10 @@ </method> </methods> <constants> - <constant name="PI" value="3.141593"> + <constant name="PI" value="3.14159265358979"> Constant that represents how many times the diameter of a circle fits around its perimeter. This is equivalent to [code]TAU / 2[/code]. </constant> - <constant name="TAU" value="6.283185"> + <constant name="TAU" value="6.28318530717959"> The circle constant, the circumference of the unit circle in radians. </constant> <constant name="INF" value="inf"> diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index e99c3d6cca..1aafaf9351 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -36,8 +36,8 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" #include "core/core_string_names.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "gdscript_analyzer.h" #include "gdscript_cache.h" @@ -75,9 +75,9 @@ Variant GDScriptNativeClass::_new() { Object *o = instance(); ERR_FAIL_COND_V_MSG(!o, Variant(), "Class type: '" + String(name) + "' is not instantiable."); - Reference *ref = Object::cast_to<Reference>(o); - if (ref) { - return REF(ref); + RefCounted *rc = Object::cast_to<RefCounted>(o); + if (rc) { + return REF(rc); } else { return o; } @@ -98,11 +98,11 @@ void GDScript::_super_implicit_constructor(GDScript *p_script, GDScriptInstance p_script->implicit_initializer->call(p_instance, nullptr, 0, r_error); } -GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) { +GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error) { /* STEP 1, CREATE */ GDScriptInstance *instance = memnew(GDScriptInstance); - instance->base_ref = p_isref; + instance->base_ref_counted = p_is_ref_counted; instance->members.resize(member_indices.size()); instance->script = Ref<GDScript>(this); instance->owner = p_owner; @@ -172,11 +172,11 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr if (_baseptr->native.ptr()) { owner = _baseptr->native->instance(); } else { - owner = memnew(Reference); //by default, no base means use reference + owner = memnew(RefCounted); //by default, no base means use reference } ERR_FAIL_COND_V_MSG(!owner, Variant(), "Can't inherit from a virtual class."); - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } @@ -353,7 +353,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) { } Callable::CallError unchecked_error; - return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error); + return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error); } PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) { @@ -1576,7 +1576,7 @@ void GDScriptInstance::reload_members() { GDScriptInstance::GDScriptInstance() { owner = nullptr; - base_ref = false; + base_ref_counted = false; } GDScriptInstance::~GDScriptInstance() { @@ -2064,7 +2064,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b if (err == OK) { const GDScriptParser::ClassNode *c = parser.get_tree(); if (r_icon_path) { - if (c->icon_path.is_empty() || c->icon_path.is_abs_path()) { + if (c->icon_path.is_empty() || c->icon_path.is_absolute_path()) { *r_icon_path = c->icon_path; } else if (c->icon_path.is_rel_path()) { *r_icon_path = p_path.get_base_dir().plus_file(c->icon_path).simplify_path(); @@ -2132,7 +2132,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b break; } } else { - *r_base_type = "Reference"; + *r_base_type = "RefCounted"; subclass = nullptr; } } diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 8b1b859ca2..0584ced35e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -39,8 +39,8 @@ #include "core/object/script_language.h" #include "gdscript_function.h" -class GDScriptNativeClass : public Reference { - GDCLASS(GDScriptNativeClass, Reference); +class GDScriptNativeClass : public RefCounted { + GDCLASS(GDScriptNativeClass, RefCounted); StringName name; @@ -132,7 +132,7 @@ class GDScript : public Script { SelfList<GDScriptFunctionState>::List pending_func_states; void _super_implicit_constructor(GDScript *p_script, GDScriptInstance *p_instance, Callable::CallError &r_error); - GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error); + GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error); void _set_subclass_path(Ref<GDScript> &p_sc, const String &p_path); @@ -157,7 +157,7 @@ class GDScript : public Script { void _get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const; void _get_script_signal_list(List<MethodInfo> *r_list, bool p_include_base) const; - // This method will map the class name from "Reference" to "MyClass.InnerClass". + // This method will map the class name from "RefCounted" to "MyClass.InnerClass". static String _get_gdscript_reference_class_name(const GDScript *p_gdscript); protected: @@ -270,7 +270,7 @@ class GDScriptInstance : public ScriptInstance { Map<StringName, int> member_indices_cache; //used only for hot script reloading #endif Vector<Variant> members; - bool base_ref; + bool base_ref_counted; SelfList<GDScriptFunctionState>::List pending_func_states; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index e92adee8e8..c3edc813d2 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -31,10 +31,10 @@ #include "gdscript_analyzer.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/object/class_db.h" #include "core/object/script_language.h" -#include "core/os/file_access.h" #include "core/templates/hash_map.h" #include "gdscript.h" #include "gdscript_utility_functions.h" @@ -163,7 +163,7 @@ Error GDScriptAnalyzer::resolve_inheritance(GDScriptParser::ClassNode *p_class, if (!p_class->extends_used) { result.type_source = GDScriptParser::DataType::ANNOTATED_INFERRED; result.kind = GDScriptParser::DataType::NATIVE; - result.native_type = "Reference"; + result.native_type = "RefCounted"; } else { result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index aabf407c76..8cd3fcf837 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -32,7 +32,7 @@ #define GDSCRIPT_ANALYZER_H #include "core/object/object.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/set.h" #include "gdscript_cache.h" #include "gdscript_parser.h" diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 601cdb4080..a3b1fb93f9 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -30,7 +30,7 @@ #include "gdscript_cache.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/templates/vector.h" #include "gdscript.h" #include "gdscript_analyzer.h" diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h index d1d2a2abbf..943638d29f 100644 --- a/modules/gdscript/gdscript_cache.h +++ b/modules/gdscript/gdscript_cache.h @@ -31,7 +31,7 @@ #ifndef GDSCRIPT_CACHE_H #define GDSCRIPT_CACHE_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/mutex.h" #include "core/templates/hash_map.h" #include "core/templates/set.h" @@ -40,7 +40,7 @@ class GDScriptAnalyzer; class GDScriptParser; -class GDScriptParserRef : public Reference { +class GDScriptParserRef : public RefCounted { public: enum Status { EMPTY, diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index c7ca9449c2..6d6b9e15af 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -2282,9 +2282,10 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar } prop_info.hint = export_info.hint; prop_info.hint_string = export_info.hint_string; - prop_info.usage = export_info.usage; + prop_info.usage = export_info.usage | PROPERTY_USAGE_SCRIPT_VARIABLE; + } else { + prop_info.usage = PROPERTY_USAGE_SCRIPT_VARIABLE; } - prop_info.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE; #ifdef TOOLS_ENABLED p_script->doc_variables[name] = variable->doc_description; #endif @@ -2511,7 +2512,7 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa p_script->placeholders.erase(psi); //remove placeholder GDScriptInstance *instance = memnew(GDScriptInstance); - instance->base_ref = Object::cast_to<Reference>(E->get()); + instance->base_ref_counted = Object::cast_to<RefCounted>(E->get()); instance->members.resize(p_script->member_indices.size()); instance->script = Ref<GDScript>(p_script); instance->owner = E->get(); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 504c7414f6..9aad14c2be 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -32,7 +32,7 @@ #include "core/config/engine.h" #include "core/core_constants.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "gdscript_analyzer.h" #include "gdscript_compiler.h" #include "gdscript_parser.h" diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index cd1704cb03..553c2ecc01 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -31,7 +31,7 @@ #ifndef GDSCRIPT_FUNCTION_H #define GDSCRIPT_FUNCTION_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/object/script_language.h" #include "core/os/thread.h" #include "core/string/string_name.h" @@ -597,8 +597,8 @@ public: ~GDScriptFunction(); }; -class GDScriptFunctionState : public Reference { - GDCLASS(GDScriptFunctionState, Reference); +class GDScriptFunctionState : public RefCounted { + GDCLASS(GDScriptFunctionState, RefCounted); friend class GDScriptFunction; GDScriptFunction *function = nullptr; GDScriptFunction::CallState state; diff --git a/modules/gdscript/gdscript_lambda_callable.h b/modules/gdscript/gdscript_lambda_callable.h index 357c845250..336778d549 100644 --- a/modules/gdscript/gdscript_lambda_callable.h +++ b/modules/gdscript/gdscript_lambda_callable.h @@ -31,7 +31,7 @@ #ifndef GDSCRIPT_LAMBDA_CALLABLE #define GDSCRIPT_LAMBDA_CALLABLE -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/vector.h" #include "core/variant/callable.h" #include "core/variant/variant.h" diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 1af54ea8df..ab40b99bb4 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -31,9 +31,9 @@ #include "gdscript_parser.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/math/math_defs.h" -#include "core/os/file_access.h" #include "gdscript.h" #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index ee5e411cad..9e0b60a407 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -33,7 +33,7 @@ #include "core/io/multiplayer_api.h" #include "core/io/resource.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/object/script_language.h" #include "core/string/string_name.h" #include "core/string/ustring.h" diff --git a/modules/gdscript/language_server/gdscript_language_protocol.h b/modules/gdscript/language_server/gdscript_language_protocol.h index a5c5a233b1..969c38eab6 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.h +++ b/modules/gdscript/language_server/gdscript_language_protocol.h @@ -46,7 +46,7 @@ class GDScriptLanguageProtocol : public JSONRPC { GDCLASS(GDScriptLanguageProtocol, JSONRPC) private: - struct LSPeer : Reference { + struct LSPeer : RefCounted { Ref<StreamPeerTCP> connection; uint8_t req_buf[LSP_MAX_BUFFER_SIZE]; diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp index 340a7b9343..33597c286f 100644 --- a/modules/gdscript/language_server/gdscript_language_server.cpp +++ b/modules/gdscript/language_server/gdscript_language_server.cpp @@ -30,7 +30,7 @@ #include "gdscript_language_server.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "editor/editor_log.h" #include "editor/editor_node.h" diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h index 792e601bc1..17f1d5d5e3 100644 --- a/modules/gdscript/language_server/gdscript_text_document.h +++ b/modules/gdscript/language_server/gdscript_text_document.h @@ -31,12 +31,12 @@ #ifndef GDSCRIPT_TEXT_DOCUMENT_H #define GDSCRIPT_TEXT_DOCUMENT_H -#include "core/object/reference.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" +#include "core/object/ref_counted.h" #include "lsp.hpp" -class GDScriptTextDocument : public Reference { - GDCLASS(GDScriptTextDocument, Reference) +class GDScriptTextDocument : public RefCounted { + GDCLASS(GDScriptTextDocument, RefCounted) protected: static void _bind_methods(); diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h index 27616a2989..8b166a873c 100644 --- a/modules/gdscript/language_server/gdscript_workspace.h +++ b/modules/gdscript/language_server/gdscript_workspace.h @@ -37,8 +37,8 @@ #include "gdscript_extend_parser.h" #include "lsp.hpp" -class GDScriptWorkspace : public Reference { - GDCLASS(GDScriptWorkspace, Reference); +class GDScriptWorkspace : public RefCounted { + GDCLASS(GDScriptWorkspace, RefCounted); private: void _get_owners(EditorFileSystemDirectory *efsd, String p_path, List<String> &owners); diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp index 47bcfeaefc..a7dcfdb22d 100644 --- a/modules/gdscript/language_server/lsp.hpp +++ b/modules/gdscript/language_server/lsp.hpp @@ -766,7 +766,7 @@ struct MarkupContent { // Use namespace instead of enumeration to follow the LSP specifications // lsp::EnumName::EnumValue is OK but lsp::EnumValue is not -// And here C++ compilers are unhappy with our enumeration name like Color, File, Reference etc. +// And here C++ compilers are unhappy with our enumeration name like Color, File, RefCounted etc. /** * The kind of a completion entry. */ @@ -788,7 +788,7 @@ static const int Keyword = 14; static const int Snippet = 15; static const int Color = 16; static const int File = 17; -static const int Reference = 18; +static const int RefCounted = 18; static const int Folder = 19; static const int EnumMember = 20; static const int Constant = 21; diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 2d2f94f5e0..867142019f 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -30,10 +30,10 @@ #include "register_types.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" #include "core/io/resource_loader.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "gdscript.h" #include "gdscript_analyzer.h" #include "gdscript_cache.h" diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index e20e427597..67bc927517 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -37,8 +37,8 @@ #include "core/config/project_settings.h" #include "core/core_string_names.h" +#include "core/io/dir_access.h" #include "core/io/file_access_pack.h" -#include "core/os/dir_access.h" #include "core/os/os.h" #include "core/string/string_builder.h" #include "scene/resources/packed_scene.h" @@ -511,9 +511,9 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { // Create object instance for test. Object *obj = ClassDB::instance(script->get_native()->get_name()); - Ref<Reference> obj_ref; - if (obj->is_reference()) { - obj_ref = Ref<Reference>(Object::cast_to<Reference>(obj)); + Ref<RefCounted> obj_ref; + if (obj->is_ref_counted()) { + obj_ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj)); } obj->set_script(script); GDScriptInstance *instance = static_cast<GDScriptInstance *>(obj->get_script_instance()); diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h index 8fd77239cd..cf4e61f07d 100644 --- a/modules/gdscript/tests/gdscript_test_runner_suite.h +++ b/modules/gdscript/tests/gdscript_test_runner_suite.h @@ -51,7 +51,7 @@ TEST_SUITE("[Modules][GDScript]") { TEST_CASE("[Modules][GDScript] Load source code dynamically and run it") { Ref<GDScript> gdscript = memnew(GDScript); gdscript->set_source_code(R"( -extends Reference +extends RefCounted func _init(): set_meta("result", 42) @@ -64,9 +64,9 @@ func _init(): CHECK_MESSAGE(error == OK, "The script should parse successfully."); // Run the script by assigning it to a reference-counted object. - Ref<Reference> reference = memnew(Reference); - reference->set_script(gdscript); - CHECK_MESSAGE(int(reference->get_meta("result")) == 42, "The script should assign object metadata successfully."); + Ref<RefCounted> ref_counted = memnew(RefCounted); + ref_counted->set_script(gdscript); + CHECK_MESSAGE(int(ref_counted->get_meta("result")) == 42, "The script should assign object metadata successfully."); } } // namespace GDScriptTests diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp index fc73b5bb72..c37d52febd 100644 --- a/modules/gdscript/tests/test_gdscript.cpp +++ b/modules/gdscript/tests/test_gdscript.cpp @@ -31,8 +31,8 @@ #include "test_gdscript.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/file_access_pack.h" -#include "core/os/file_access.h" #include "core/os/main_loop.h" #include "core/os/os.h" #include "core/string/string_builder.h" diff --git a/modules/gltf/editor_scene_importer_gltf.cpp b/modules/gltf/editor_scene_importer_gltf.cpp index 35f44ca122..21b4bb75fb 100644 --- a/modules/gltf/editor_scene_importer_gltf.cpp +++ b/modules/gltf/editor_scene_importer_gltf.cpp @@ -29,10 +29,10 @@ /*************************************************************************/ #include "core/crypto/crypto_core.h" +#include "core/io/file_access.h" #include "core/io/json.h" #include "core/math/disjoint_set.h" #include "core/math/math_defs.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "editor/import/resource_importer_scene.h" #include "modules/gltf/gltf_state.h" diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index fa93704fd9..bc4de76344 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -49,9 +49,9 @@ #include "core/core_bind.h" #include "core/crypto/crypto_core.h" +#include "core/io/file_access.h" #include "core/io/json.h" #include "core/math/disjoint_set.h" -#include "core/os/file_access.h" #include "core/variant/typed_array.h" #include "core/version.h" #include "core/version_hash.gen.h" diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp index c389609984..3cd2da3d85 100644 --- a/modules/mbedtls/crypto_mbedtls.cpp +++ b/modules/mbedtls/crypto_mbedtls.cpp @@ -30,7 +30,7 @@ #include "crypto_mbedtls.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/config/engine.h" #include "core/config/project_settings.h" diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index d77d946a77..11c9f64e21 100644 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -31,8 +31,8 @@ #include "packet_peer_mbed_dtls.h" #include "mbedtls/platform_util.h" +#include "core/io/file_access.h" #include "core/io/stream_peer_ssl.h" -#include "core/os/file_access.h" int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) { if (buf == nullptr || len <= 0) { diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h index 30632018a8..1b55a54a10 100644 --- a/modules/mbedtls/ssl_context_mbedtls.h +++ b/modules/mbedtls/ssl_context_mbedtls.h @@ -33,9 +33,9 @@ #include "crypto_mbedtls.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include <mbedtls/config.h> #include <mbedtls/ctr_drbg.h> @@ -46,7 +46,7 @@ class SSLContextMbedTLS; -class CookieContextMbedTLS : public Reference { +class CookieContextMbedTLS : public RefCounted { friend class SSLContextMbedTLS; protected: @@ -63,7 +63,7 @@ public: ~CookieContextMbedTLS(); }; -class SSLContextMbedTLS : public Reference { +class SSLContextMbedTLS : public RefCounted { protected: bool inited = false; diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp index 8e40451806..bc72b04fa4 100644 --- a/modules/mbedtls/stream_peer_mbedtls.cpp +++ b/modules/mbedtls/stream_peer_mbedtls.cpp @@ -30,8 +30,8 @@ #include "stream_peer_mbedtls.h" +#include "core/io/file_access.h" #include "core/io/stream_peer_tcp.h" -#include "core/os/file_access.h" int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) { if (buf == nullptr || len <= 0) { diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index 24ec206191..600bbe9bb5 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -35,7 +35,7 @@ #include "audio_stream_mp3.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" void AudioStreamPlaybackMP3::_mix_internal(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND(!active); diff --git a/modules/minimp3/resource_importer_mp3.cpp b/modules/minimp3/resource_importer_mp3.cpp index f5137965da..dc16125726 100644 --- a/modules/minimp3/resource_importer_mp3.cpp +++ b/modules/minimp3/resource_importer_mp3.cpp @@ -30,8 +30,8 @@ #include "resource_importer_mp3.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "scene/resources/texture.h" String ResourceImporterMP3::get_importer_name() const { diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp index 553c6eca53..bd02ec0eac 100644 --- a/modules/mono/class_db_api_json.cpp +++ b/modules/mono/class_db_api_json.cpp @@ -33,8 +33,8 @@ #ifdef DEBUG_METHODS_ENABLED #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/json.h" -#include "core/os/file_access.h" #include "core/version.h" void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index ac248bcff8..6fbefd88ac 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -37,8 +37,8 @@ #include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" +#include "core/io/file_access.h" #include "core/io/json.h" -#include "core/os/file_access.h" #include "core/os/mutex.h" #include "core/os/os.h" #include "core/os/thread.h" @@ -863,13 +863,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { List<Ref<CSharpScript>> to_reload; // We need to keep reference instances alive during reloading - List<Ref<Reference>> ref_instances; + List<Ref<RefCounted>> rc_instances; for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) { CSharpScriptBinding &script_binding = E->value(); - Reference *ref = Object::cast_to<Reference>(script_binding.owner); - if (ref) { - ref_instances.push_back(Ref<Reference>(ref)); + RefCounted *rc = Object::cast_to<RefCounted>(script_binding.owner); + if (rc) { + rc_instances.push_back(Ref<RefCounted>(rc)); } } @@ -892,9 +892,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { Object *obj = F->get(); script->pending_reload_instances.insert(obj->get_instance_id()); - Reference *ref = Object::cast_to<Reference>(obj); - if (ref) { - ref_instances.push_back(Ref<Reference>(ref)); + RefCounted *rc = Object::cast_to<RefCounted>(obj); + if (rc) { + rc_instances.push_back(Ref<RefCounted>(rc)); } } @@ -903,9 +903,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { Object *obj = F->get()->get_owner(); script->pending_reload_instances.insert(obj->get_instance_id()); - Reference *ref = Object::cast_to<Reference>(obj); - if (ref) { - ref_instances.push_back(Ref<Reference>(ref)); + RefCounted *rc = Object::cast_to<RefCounted>(obj); + if (rc) { + rc_instances.push_back(Ref<RefCounted>(rc)); } } #endif @@ -1438,16 +1438,16 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b r_script_binding.owner = p_object; // Tie managed to unmanaged - Reference *ref = Object::cast_to<Reference>(p_object); + RefCounted *rc = Object::cast_to<RefCounted>(p_object); - if (ref) { + if (rc) { // Unsafe refcount increment. The managed instance also counts as a reference. // This way if the unmanaged world has no references to our owner // but the managed instance is alive, the refcount will be 1 instead of 0. // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr) - ref->reference(); - CSharpLanguage::get_singleton()->post_unsafe_reference(ref); + rc->reference(); + CSharpLanguage::get_singleton()->post_unsafe_reference(rc); } return true; @@ -1511,10 +1511,10 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) { } void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) { - Reference *ref_owner = Object::cast_to<Reference>(p_object); + RefCounted *rc_owner = Object::cast_to<RefCounted>(p_object); #ifdef DEBUG_ENABLED - CRASH_COND(!ref_owner); + CRASH_COND(!rc_owner); CRASH_COND(!p_object->has_script_instance_binding(get_language_index())); #endif @@ -1528,7 +1528,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) { return; } - if (ref_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0 + if (rc_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0 GD_MONO_SCOPE_THREAD_ATTACH; // The reference count was increased after the managed side was the only one referencing our owner. @@ -1548,10 +1548,10 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) { } bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) { - Reference *ref_owner = Object::cast_to<Reference>(p_object); + RefCounted *rc_owner = Object::cast_to<RefCounted>(p_object); #ifdef DEBUG_ENABLED - CRASH_COND(!ref_owner); + CRASH_COND(!rc_owner); CRASH_COND(!p_object->has_script_instance_binding(get_language_index())); #endif @@ -1561,7 +1561,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) { CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get(); MonoGCHandleData &gchandle = script_binding.gchandle; - int refcount = ref_owner->reference_get_count(); + int refcount = rc_owner->reference_get_count(); if (!script_binding.inited) { return refcount == 0; @@ -1592,13 +1592,13 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) { CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const MonoGCHandleData &p_gchandle) { CSharpInstance *instance = memnew(CSharpInstance(Ref<CSharpScript>(p_script))); - Reference *ref = Object::cast_to<Reference>(p_owner); + RefCounted *rc = Object::cast_to<RefCounted>(p_owner); - instance->base_ref = ref != nullptr; + instance->base_ref_counted = rc != nullptr; instance->owner = p_owner; instance->gchandle = p_gchandle; - if (instance->base_ref) { + if (instance->base_ref_counted) { instance->_reference_owner_unsafe(); } @@ -1900,7 +1900,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, bool CSharpInstance::_reference_owner_unsafe() { #ifdef DEBUG_ENABLED - CRASH_COND(!base_ref); + CRASH_COND(!base_ref_counted); CRASH_COND(owner == nullptr); CRASH_COND(unsafe_referenced); // already referenced #endif @@ -1911,7 +1911,7 @@ bool CSharpInstance::_reference_owner_unsafe() { // See: _unreference_owner_unsafe() // May not me referenced yet, so we must use init_ref() instead of reference() - if (static_cast<Reference *>(owner)->init_ref()) { + if (static_cast<RefCounted *>(owner)->init_ref()) { CSharpLanguage::get_singleton()->post_unsafe_reference(owner); unsafe_referenced = true; } @@ -1921,7 +1921,7 @@ bool CSharpInstance::_reference_owner_unsafe() { bool CSharpInstance::_unreference_owner_unsafe() { #ifdef DEBUG_ENABLED - CRASH_COND(!base_ref); + CRASH_COND(!base_ref_counted); CRASH_COND(owner == nullptr); #endif @@ -1938,7 +1938,7 @@ bool CSharpInstance::_unreference_owner_unsafe() { // Destroying the owner here means self destructing, so we defer the owner destruction to the caller. CSharpLanguage::get_singleton()->pre_unsafe_unreference(owner); - return static_cast<Reference *>(owner)->unreference(); + return static_cast<RefCounted *>(owner)->unreference(); } MonoObject *CSharpInstance::_internal_new_managed() { @@ -1970,7 +1970,7 @@ MonoObject *CSharpInstance::_internal_new_managed() { // Tie managed to unmanaged gchandle = MonoGCHandleData::new_strong_handle(mono_object); - if (base_ref) { + if (base_ref_counted) { _reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback) } @@ -1987,7 +1987,7 @@ void CSharpInstance::mono_object_disposed(MonoObject *p_obj) { disconnect_event_signals(); #ifdef DEBUG_ENABLED - CRASH_COND(base_ref); + CRASH_COND(base_ref_counted); CRASH_COND(gchandle.is_released()); #endif CSharpLanguage::get_singleton()->release_script_gchandle(p_obj, gchandle); @@ -1995,7 +1995,7 @@ void CSharpInstance::mono_object_disposed(MonoObject *p_obj) { void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_delete_owner, bool &r_remove_script_instance) { #ifdef DEBUG_ENABLED - CRASH_COND(!base_ref); + CRASH_COND(!base_ref_counted); CRASH_COND(gchandle.is_released()); #endif @@ -2056,13 +2056,13 @@ void CSharpInstance::disconnect_event_signals() { void CSharpInstance::refcount_incremented() { #ifdef DEBUG_ENABLED - CRASH_COND(!base_ref); + CRASH_COND(!base_ref_counted); CRASH_COND(owner == nullptr); #endif - Reference *ref_owner = Object::cast_to<Reference>(owner); + RefCounted *rc_owner = Object::cast_to<RefCounted>(owner); - if (ref_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0 + if (rc_owner->reference_get_count() > 1 && gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0 GD_MONO_SCOPE_THREAD_ATTACH; // The reference count was increased after the managed side was the only one referencing our owner. @@ -2078,13 +2078,13 @@ void CSharpInstance::refcount_incremented() { bool CSharpInstance::refcount_decremented() { #ifdef DEBUG_ENABLED - CRASH_COND(!base_ref); + CRASH_COND(!base_ref_counted); CRASH_COND(owner == nullptr); #endif - Reference *ref_owner = Object::cast_to<Reference>(owner); + RefCounted *rc_owner = Object::cast_to<RefCounted>(owner); - int refcount = ref_owner->reference_get_count(); + int refcount = rc_owner->reference_get_count(); if (refcount == 1 && !gchandle.is_weak()) { // The managed side also holds a reference, hence 1 instead of 0 GD_MONO_SCOPE_THREAD_ATTACH; @@ -2119,12 +2119,12 @@ void CSharpInstance::notification(int p_notification) { predelete_notified = true; - if (base_ref) { - // It's not safe to proceed if the owner derives Reference and the refcount reached 0. + if (base_ref_counted) { + // It's not safe to proceed if the owner derives RefCounted and the refcount reached 0. // At this point, Dispose() was already called (manually or from the finalizer) so // that's not a problem. The refcount wouldn't have reached 0 otherwise, since the // managed side references it and Dispose() needs to be called to release it. - // However, this means C# Reference scripts can't receive NOTIFICATION_PREDELETE, but + // However, this means C# RefCounted scripts can't receive NOTIFICATION_PREDELETE, but // this is likely the case with GDScript as well: https://github.com/godotengine/godot/issues/6784 return; } @@ -2250,15 +2250,15 @@ CSharpInstance::~CSharpInstance() { } // If not being called from the owner's destructor, and we still hold a reference to the owner - if (base_ref && !ref_dying && owner && unsafe_referenced) { + if (base_ref_counted && !ref_dying && owner && unsafe_referenced) { // The owner's script or script instance is being replaced (or removed) // Transfer ownership to an "instance binding" - Reference *ref_owner = static_cast<Reference *>(owner); + RefCounted *rc_owner = static_cast<RefCounted *>(owner); // We will unreference the owner before referencing it again, so we need to keep it alive - Ref<Reference> scope_keep_owner_alive(ref_owner); + Ref<RefCounted> scope_keep_owner_alive(rc_owner); (void)scope_keep_owner_alive; // Unreference the owner here, before the new "instance binding" references it. @@ -2283,7 +2283,7 @@ CSharpInstance::~CSharpInstance() { #ifdef DEBUG_ENABLED // The "instance binding" holds a reference so the refcount should be at least 2 before `scope_keep_owner_alive` goes out of scope - CRASH_COND(ref_owner->reference_get_count() <= 1); + CRASH_COND(rc_owner->reference_get_count() <= 1); #endif } @@ -2511,7 +2511,7 @@ bool CSharpScript::_update_exports() { #ifdef TOOLS_ENABLED if (is_editor) { // Need to check this here, before disposal - bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr; + bool base_ref_counted = Object::cast_to<RefCounted>(tmp_native) != nullptr; // Dispose the temporary managed instance @@ -2526,7 +2526,7 @@ bool CSharpScript::_update_exports() { GDMonoUtils::free_gchandle(tmp_pinned_gchandle); tmp_object = nullptr; - if (tmp_native && !base_ref) { + if (tmp_native && !base_ref_counted) { Node *node = Object::cast_to<Node>(tmp_native); if (node && node->is_inside_tree()) { ERR_PRINT("Temporary instance was added to the scene tree."); @@ -3077,7 +3077,7 @@ StringName CSharpScript::get_instance_base_type() const { } } -CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) { +CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error) { GD_MONO_ASSERT_THREAD_ATTACHED; /* STEP 1, CREATE */ @@ -3093,10 +3093,10 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg ERR_FAIL_V_MSG(nullptr, "Constructor not found."); } - Ref<Reference> ref; - if (p_isref) { + Ref<RefCounted> ref; + if (p_is_ref_counted) { // Hold it alive. Important if we have to dispose a script instance binding before creating the CSharpInstance. - ref = Ref<Reference>(static_cast<Reference *>(p_owner)); + ref = Ref<RefCounted>(static_cast<RefCounted *>(p_owner)); } // If the object had a script instance binding, dispose it before adding the CSharpInstance @@ -3122,7 +3122,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg } CSharpInstance *instance = memnew(CSharpInstance(Ref<CSharpScript>(this))); - instance->base_ref = p_isref; + instance->base_ref_counted = p_is_ref_counted; instance->owner = p_owner; instance->owner->set_script_instance(instance); @@ -3147,7 +3147,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg // Tie managed to unmanaged instance->gchandle = MonoGCHandleData::new_strong_handle(mono_object); - if (instance->base_ref) { + if (instance->base_ref_counted) { instance->_reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback) } @@ -3182,7 +3182,7 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::Cal Object *owner = ClassDB::instance(NATIVE_GDMONOCLASS_NAME(native)); REF ref; - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } @@ -3223,7 +3223,7 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) { GD_MONO_SCOPE_THREAD_ATTACH; Callable::CallError unchecked_error; - return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error); + return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error); } PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_this) { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index b389e900f4..c347a902ed 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -170,7 +170,7 @@ private: static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string); #endif - CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error); + CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_is_ref_counted, Callable::CallError &r_error); Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); // Do not use unless you know what you are doing @@ -251,7 +251,7 @@ class CSharpInstance : public ScriptInstance { friend class CSharpLanguage; Object *owner = nullptr; - bool base_ref = false; + bool base_ref_counted = false; bool ref_dying = false; bool unsafe_referenced = false; bool predelete_notified = false; diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs index 51055dc9b9..27737c3da0 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs @@ -7,7 +7,7 @@ using Path = System.IO.Path; namespace GodotTools.Build { [Serializable] - public sealed class BuildInfo : Reference // TODO Remove Reference once we have proper serialization + public sealed class BuildInfo : RefCounted // TODO Remove RefCounted once we have proper serialization { public string Solution { get; } public string[] Targets { get; } diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs index 1a1639aac7..c380707587 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs @@ -11,7 +11,7 @@ namespace GodotTools.Build public class BuildOutputView : VBoxContainer, ISerializationListener { [Serializable] - private class BuildIssue : Reference // TODO Remove Reference once we have proper serialization + private class BuildIssue : RefCounted // TODO Remove RefCounted once we have proper serialization { public bool Warning { get; set; } public string File { get; set; } diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 94c5195b83..b6bff58610 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -35,8 +35,8 @@ #include "core/config/engine.h" #include "core/core_constants.h" #include "core/io/compression.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "core/string/ucaps.h" #include "main/main.h" @@ -1260,7 +1260,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str CRASH_COND(itype.cname != name_cache.type_Object); CRASH_COND(!itype.is_instantiable); CRASH_COND(itype.api_type != ClassDB::API_CORE); - CRASH_COND(itype.is_reference); + CRASH_COND(itype.is_ref_counted); CRASH_COND(itype.is_singleton); } @@ -2284,8 +2284,8 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte } if (return_type->is_object_type) { - ptrcall_return_type = return_type->is_reference ? "Ref<Reference>" : return_type->c_type; - initialization = return_type->is_reference ? "" : " = nullptr"; + ptrcall_return_type = return_type->is_ref_counted ? "Ref<RefCounted>" : return_type->c_type; + initialization = return_type->is_ref_counted ? "" : " = nullptr"; } else { ptrcall_return_type = return_type->c_type; } @@ -2600,12 +2600,12 @@ bool BindingsGenerator::_populate_object_type_interfaces() { itype.base_name = ClassDB::get_parent_class(type_cname); itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name); itype.is_instantiable = class_info->creation_func && !itype.is_singleton; - itype.is_reference = ClassDB::is_parent_class(type_cname, name_cache.type_Reference); - itype.memory_own = itype.is_reference; + itype.is_ref_counted = ClassDB::is_parent_class(type_cname, name_cache.type_RefCounted); + itype.memory_own = itype.is_ref_counted; itype.c_out = "\treturn "; itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED; - itype.c_out += itype.is_reference ? "(%1.ptr());\n" : "(%1);\n"; + itype.c_out += itype.is_ref_counted ? "(%1.ptr());\n" : "(%1);\n"; itype.cs_in = itype.is_singleton ? BINDINGS_PTR_FIELD : "Object." CS_SMETHOD_GETINSTANCE "(%0)"; @@ -2741,7 +2741,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { imethod.return_type.cname = return_info.class_name; bool bad_reference_hint = !imethod.is_virtual && return_info.hint != PROPERTY_HINT_RESOURCE_TYPE && - ClassDB::is_parent_class(return_info.class_name, name_cache.type_Reference); + ClassDB::is_parent_class(return_info.class_name, name_cache.type_RefCounted); ERR_FAIL_COND_V_MSG(bad_reference_hint, false, String() + "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'." + " Are you returning a reference type by pointer? Method: '" + itype.name + "." + imethod.name + "'."); diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 876046176b..48c0e02723 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -216,7 +216,7 @@ class BindingsGenerator { bool is_enum = false; bool is_object_type = false; bool is_singleton = false; - bool is_reference = false; + bool is_ref_counted = false; /** * Used only by Object-derived types. @@ -228,7 +228,7 @@ class BindingsGenerator { /** * Used only by Object-derived types. * Determines if the C# class owns the native handle and must free it somehow when disposed. - * e.g.: Reference types must notify when the C# instance is disposed, for proper refcounting. + * e.g.: RefCounted types must notify when the C# instance is disposed, for proper refcounting. */ bool memory_own = false; @@ -295,7 +295,7 @@ class BindingsGenerator { * VarArg (fictitious type to represent variable arguments): Array * float: double (because ptrcall only supports double) * int: int64_t (because ptrcall only supports int64_t and uint64_t) - * Reference types override this for the type of the return variable: Ref<Reference> + * RefCounted types override this for the type of the return variable: Ref<RefCounted> */ String c_type; @@ -534,7 +534,7 @@ class BindingsGenerator { StringName type_Variant = StaticCString::create("Variant"); StringName type_VarArg = StaticCString::create("VarArg"); StringName type_Object = StaticCString::create("Object"); - StringName type_Reference = StaticCString::create("Reference"); + StringName type_RefCounted = StaticCString::create("RefCounted"); StringName type_RID = StaticCString::create("RID"); StringName type_String = StaticCString::create("String"); StringName type_StringName = StaticCString::create("StringName"); @@ -623,7 +623,7 @@ class BindingsGenerator { } inline String get_unique_sig(const TypeInterface &p_type) { - if (p_type.is_reference) { + if (p_type.is_ref_counted) { return "Ref"; } else if (p_type.is_object_type) { return "Obj"; diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp index 34a96eba17..c1b50b9951 100644 --- a/modules/mono/glue/base_object_glue.cpp +++ b/modules/mono/glue/base_object_glue.cpp @@ -31,7 +31,7 @@ #ifdef MONO_GLUE_ENABLED #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/string/string_name.h" #include "../csharp_script.h" @@ -81,13 +81,13 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) { void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer) { #ifdef DEBUG_ENABLED CRASH_COND(p_ptr == nullptr); - // This is only called with Reference derived classes - CRASH_COND(!Object::cast_to<Reference>(p_ptr)); + // This is only called with RefCounted derived classes + CRASH_COND(!Object::cast_to<RefCounted>(p_ptr)); #endif - Reference *ref = static_cast<Reference *>(p_ptr); + RefCounted *rc = static_cast<RefCounted *>(p_ptr); - if (ref->get_script_instance()) { + if (rc->get_script_instance()) { CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(ref->get_script_instance()); if (cs_instance) { if (!cs_instance->is_destructing_script_instance()) { @@ -97,9 +97,9 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea cs_instance->mono_object_disposed_baseref(p_obj, p_is_finalizer, delete_owner, remove_script_instance); if (delete_owner) { - memdelete(ref); + memdelete(rc); } else if (remove_script_instance) { - ref->set_script_instance(nullptr); + rc->set_script_instance(nullptr); } } return; @@ -145,10 +145,10 @@ MonoObject *godot_icall_Object_weakref(Object *p_ptr) { } Ref<WeakRef> wref; - Reference *ref = Object::cast_to<Reference>(p_ptr); + RefCounted *rc = Object::cast_to<RefCounted>(p_ptr); - if (ref) { - REF r = ref; + if (rc) { + REF r = rc; if (!r.is_valid()) { return nullptr; } diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 3db52d7c30..eed3bd2167 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -61,7 +61,7 @@ void godot_register_glue_header_icalls() { #include "core/config/engine.h" #include "core/object/class_db.h" #include "core/object/method_bind.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/string/node_path.h" #include "core/string/ustring.h" #include "core/typedefs.h" diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 68134b9b20..375ad413c4 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -31,7 +31,7 @@ #include "godotsharp_dirs.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/os.h" #ifdef TOOLS_ENABLED diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h index f435aab3dd..d0e51d159f 100644 --- a/modules/mono/mono_gc_handle.h +++ b/modules/mono/mono_gc_handle.h @@ -33,7 +33,7 @@ #include <mono/jit/jit.h> -#include "core/object/reference.h" +#include "core/object/ref_counted.h" namespace gdmono { @@ -79,8 +79,8 @@ struct MonoGCHandleData { static MonoGCHandleData new_weak_handle(MonoObject *p_object); }; -class MonoGCHandleRef : public Reference { - GDCLASS(MonoGCHandleRef, Reference); +class MonoGCHandleRef : public RefCounted { + GDCLASS(MonoGCHandleRef, RefCounted); MonoGCHandleData data; diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index c523d381f6..a3acfbd995 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -39,8 +39,8 @@ #include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "core/os/thread.h" diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index a1556bace5..67d6f3ef29 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -34,8 +34,8 @@ #include <mono/metadata/tokentype.h> #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/file_access_pack.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/list.h" diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index fa93c6533a..65fb23b128 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -51,7 +51,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { // All mono objects created from the managed world (e.g.: 'new Player()') // need to have a CSharpScript in order for their methods to be callable from the unmanaged side - Reference *ref = Object::cast_to<Reference>(unmanaged); + RefCounted *rc = Object::cast_to<RefCounted>(unmanaged); GDMonoClass *klass = GDMonoUtils::get_object_class(managed); @@ -73,18 +73,18 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { script_binding.inited = true; script_binding.type_name = NATIVE_GDMONOCLASS_NAME(klass); script_binding.wrapper_class = klass; - script_binding.gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); + script_binding.gchandle = rc ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); script_binding.owner = unmanaged; - if (ref) { + if (rc) { // Unsafe refcount increment. The managed instance also counts as a reference. // This way if the unmanaged world has no references to our owner // but the managed instance is alive, the refcount will be 1 instead of 0. // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr) // May not me referenced yet, so we must use init_ref() instead of reference() - if (ref->init_ref()) { - CSharpLanguage::get_singleton()->post_unsafe_reference(ref); + if (rc->init_ref()) { + CSharpLanguage::get_singleton()->post_unsafe_reference(rc); } } @@ -99,7 +99,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { return; } - MonoGCHandleData gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); + MonoGCHandleData gchandle = rc ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native); diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp index dafd36c36b..0537dc2ca3 100644 --- a/modules/mono/mono_gd/gd_mono_log.cpp +++ b/modules/mono/mono_gd/gd_mono_log.cpp @@ -32,7 +32,7 @@ #include <stdlib.h> // abort -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/os/os.h" #include "../godotsharp_dirs.h" diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h index f7a53156ab..9ddbd251ac 100644 --- a/modules/mono/mono_gd/gd_mono_log.h +++ b/modules/mono/mono_gd/gd_mono_log.h @@ -41,7 +41,7 @@ #endif #ifdef GD_MONO_LOG_ENABLED -#include "core/os/file_access.h" +#include "core/io/file_access.h" #endif class GDMonoLog { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index c8f80e7777..9f2977bfa2 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -1136,8 +1136,8 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj)); if (ptr != nullptr) { - Reference *ref = Object::cast_to<Reference>(ptr); - return ref ? Variant(Ref<Reference>(ref)) : Variant(ptr); + RefCounted *rc = Object::cast_to<RefCounted>(ptr); + return rc ? Variant(Ref<RefCounted>(rc)) : Variant(ptr); } return Variant(); } diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 6e0a263c7f..cf2859c319 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -35,8 +35,8 @@ #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" -#include "core/object/reference.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" +#include "core/object/ref_counted.h" #include "core/os/mutex.h" #include "core/os/os.h" @@ -108,15 +108,15 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) { gchandle = MonoGCHandleData::new_strong_handle(mono_object); // Tie managed to unmanaged - Reference *ref = Object::cast_to<Reference>(unmanaged); + RefCounted *rc = Object::cast_to<RefCounted>(unmanaged); - if (ref) { + if (rc) { // Unsafe refcount increment. The managed instance also counts as a reference. // This way if the unmanaged world has no references to our owner // but the managed instance is alive, the refcount will be 1 instead of 0. // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr) - ref->reference(); - CSharpLanguage::get_singleton()->post_unsafe_reference(ref); + rc->reference(); + CSharpLanguage::get_singleton()->post_unsafe_reference(rc); } return mono_object; diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index 9e024418e1..773501e93d 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -41,7 +41,7 @@ #endif #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #define UNHANDLED_EXCEPTION(m_exc) \ if (unlikely(m_exc != nullptr)) { \ diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h index 4c77f8cfed..e12ea45b3f 100644 --- a/modules/mono/signal_awaiter_utils.h +++ b/modules/mono/signal_awaiter_utils.h @@ -31,7 +31,7 @@ #ifndef SIGNAL_AWAITER_UTILS_H #define SIGNAL_AWAITER_UTILS_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "csharp_script.h" #include "mono_gc_handle.h" diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp index bb1265e959..6b616dd52d 100644 --- a/modules/mono/utils/mono_reg_utils.cpp +++ b/modules/mono/utils/mono_reg_utils.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "mono_reg_utils.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #ifdef WINDOWS_ENABLED diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index 93d44628ac..ec04d50704 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -31,8 +31,8 @@ #include "path_utils.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #ifdef WINDOWS_ENABLED @@ -80,7 +80,7 @@ String cwd() { } String abspath(const String &p_path) { - if (p_path.is_abs_path()) { + if (p_path.is_absolute_path()) { return p_path.simplify_path(); } else { return path::join(path::cwd(), p_path).simplify_path(); diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index ee68458268..053618ebe4 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -30,7 +30,7 @@ #include "string_utils.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include <stdio.h> #include <stdlib.h> diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h index 20a53bb58b..6237b6460d 100644 --- a/modules/opensimplex/noise_texture.h +++ b/modules/opensimplex/noise_texture.h @@ -34,7 +34,7 @@ #include "open_simplex_noise.h" #include "core/io/image.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "editor/property_editor.h" diff --git a/modules/opensimplex/open_simplex_noise.h b/modules/opensimplex/open_simplex_noise.h index bb50c523d2..dcf922a8bf 100644 --- a/modules/opensimplex/open_simplex_noise.h +++ b/modules/opensimplex/open_simplex_noise.h @@ -32,7 +32,7 @@ #define OPEN_SIMPLEX_NOISE_H #include "core/io/image.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "scene/resources/texture.h" #include "thirdparty/misc/open-simplex-noise.h" diff --git a/modules/pvr/image_compress_pvrtc.cpp b/modules/pvr/image_compress_pvrtc.cpp index 6cb9837f49..4d0430fa92 100644 --- a/modules/pvr/image_compress_pvrtc.cpp +++ b/modules/pvr/image_compress_pvrtc.cpp @@ -31,7 +31,7 @@ #include "image_compress_pvrtc.h" #include "core/io/image.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include <PvrTcEncoder.h> #include <RgbaBitmap.h> diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 83f032ca2b..cb12976090 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -30,7 +30,7 @@ #include "texture_loader_pvr.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" static void _pvrtc_decompress(Image *p_img); diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h index d9ca57cf24..85710a790c 100644 --- a/modules/raycast/raycast_occlusion_cull.h +++ b/modules/raycast/raycast_occlusion_cull.h @@ -34,7 +34,7 @@ #include "core/io/image.h" #include "core/math/camera_matrix.h" #include "core/object/object.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/local_vector.h" #include "core/templates/rid_owner.h" #include "scene/resources/mesh.h" diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml index b21f5d1e7a..7f5a0dfecb 100644 --- a/modules/regex/doc_classes/RegEx.xml +++ b/modules/regex/doc_classes/RegEx.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RegEx" inherits="Reference" version="4.0"> +<class name="RegEx" inherits="RefCounted" version="4.0"> <brief_description> Class for searching text for patterns using regular expressions. </brief_description> diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml index a45de60aef..cfe00f83ee 100644 --- a/modules/regex/doc_classes/RegExMatch.xml +++ b/modules/regex/doc_classes/RegExMatch.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RegExMatch" inherits="Reference" version="4.0"> +<class name="RegExMatch" inherits="RefCounted" version="4.0"> <brief_description> Contains the results of a [RegEx] search. </brief_description> diff --git a/modules/regex/regex.h b/modules/regex/regex.h index f5773042fb..68fe2bc6e0 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -31,15 +31,15 @@ #ifndef REGEX_H #define REGEX_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/string/ustring.h" #include "core/templates/map.h" #include "core/templates/vector.h" #include "core/variant/array.h" #include "core/variant/dictionary.h" -class RegExMatch : public Reference { - GDCLASS(RegExMatch, Reference); +class RegExMatch : public RefCounted { + GDCLASS(RegExMatch, RefCounted); struct Range { int start = 0; @@ -68,8 +68,8 @@ public: int get_end(const Variant &p_name) const; }; -class RegEx : public Reference { - GDCLASS(RegEx, Reference); +class RegEx : public RefCounted { + GDCLASS(RegEx, RefCounted); void *general_ctx; void *code = nullptr; diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index e8e481de2d..78b4749939 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -30,7 +30,7 @@ #include "audio_stream_ogg_vorbis.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND(!active); diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index e3aa630cef..a0de5e5f0f 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -30,8 +30,8 @@ #include "resource_importer_ogg_vorbis.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "scene/resources/texture.h" String ResourceImporterOGGVorbis::get_importer_name() const { diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 7eff3f8dee..906ebe4993 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -2352,24 +2352,22 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) { sd->glyphs.push_back(gl); } else { Vector<RID> fonts; - // Push fonts with the language and script support first. - for (int l = 0; l < span.fonts.size(); l++) { - if ((font_is_language_supported(span.fonts[l], span.language)) && (font_is_script_supported(span.fonts[l], script))) { - fonts.push_back(sd->spans[k].fonts[l]); - } - } - // Push fonts with the script support. - for (int l = 0; l < sd->spans[k].fonts.size(); l++) { - if (!(font_is_language_supported(span.fonts[l], span.language)) && (font_is_script_supported(span.fonts[l], script))) { - fonts.push_back(sd->spans[k].fonts[l]); - } - } - // Push the rest valid fonts. - for (int l = 0; l < sd->spans[k].fonts.size(); l++) { - if (!(font_is_language_supported(span.fonts[l], span.language)) && !(font_is_script_supported(span.fonts[l], script))) { - fonts.push_back(sd->spans[k].fonts[l]); + Vector<RID> fonts_scr_only; + Vector<RID> fonts_no_match; + int font_count = span.fonts.size(); + for (int l = 0; l < font_count; l++) { + if (font_is_script_supported(span.fonts[l], script)) { + if (font_is_language_supported(span.fonts[l], span.language)) { + fonts.push_back(sd->spans[k].fonts[l]); + } else { + fonts_scr_only.push_back(sd->spans[k].fonts[l]); + } + } else { + fonts_no_match.push_back(sd->spans[k].fonts[l]); } } + fonts.append_array(fonts_scr_only); + fonts.append_array(fonts_no_match); _shape_run(sd, MAX(sd->spans[k].start, script_run_start), MIN(sd->spans[k].end, script_run_end), sd->script_iter->script_ranges[j].script, bidi_run_direction, fonts, k, 0); } } diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 98a67ef309..a22559efdd 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -634,17 +634,17 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te span.start = sd->text.length(); span.end = span.start + p_text.length(); // Pre-sort fonts, push fonts with the language support first. - for (int i = 0; i < p_fonts.size(); i++) { + Vector<RID> fonts_no_match; + int font_count = p_fonts.size(); + for (int i = 0; i < font_count; i++) { if (font_is_language_supported(p_fonts[i], p_language)) { span.fonts.push_back(p_fonts[i]); + } else { + fonts_no_match.push_back(p_fonts[i]); } } - // Push the rest valid fonts. - for (int i = 0; i < p_fonts.size(); i++) { - if (!font_is_language_supported(p_fonts[i], p_language)) { - span.fonts.push_back(p_fonts[i]); - } - } + span.fonts.append_array(fonts_no_match); + ERR_FAIL_COND_V(span.fonts.is_empty(), false); span.font_size = p_size; span.language = p_language; diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index 2685a8a013..760173d0df 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -31,8 +31,8 @@ #ifndef VIDEO_STREAM_THEORA_H #define VIDEO_STREAM_THEORA_H +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "core/os/semaphore.h" #include "core/os/thread.h" #include "core/templates/ring_buffer.h" diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml index 785c8dad50..09a2c8a88c 100644 --- a/modules/upnp/doc_classes/UPNP.xml +++ b/modules/upnp/doc_classes/UPNP.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="UPNP" inherits="Reference" version="4.0"> +<class name="UPNP" inherits="RefCounted" version="4.0"> <brief_description> UPNP network functions. </brief_description> diff --git a/modules/upnp/doc_classes/UPNPDevice.xml b/modules/upnp/doc_classes/UPNPDevice.xml index f3b96bb89d..f7b5386d86 100644 --- a/modules/upnp/doc_classes/UPNPDevice.xml +++ b/modules/upnp/doc_classes/UPNPDevice.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="UPNPDevice" inherits="Reference" version="4.0"> +<class name="UPNPDevice" inherits="RefCounted" version="4.0"> <brief_description> UPNP device. </brief_description> diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h index a0cca96bc8..b961a9667f 100644 --- a/modules/upnp/upnp.h +++ b/modules/upnp/upnp.h @@ -31,14 +31,14 @@ #ifndef GODOT_UPNP_H #define GODOT_UPNP_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "upnp_device.h" #include <miniupnpc/miniupnpc.h> -class UPNP : public Reference { - GDCLASS(UPNP, Reference); +class UPNP : public RefCounted { + GDCLASS(UPNP, RefCounted); private: String discover_multicast_if = ""; diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h index 126e761a56..0a66c36ab9 100644 --- a/modules/upnp/upnp_device.h +++ b/modules/upnp/upnp_device.h @@ -31,10 +31,10 @@ #ifndef GODOT_UPNP_DEVICE_H #define GODOT_UPNP_DEVICE_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class UPNPDevice : public Reference { - GDCLASS(UPNPDevice, Reference); +class UPNPDevice : public RefCounted { + GDCLASS(UPNPDevice, RefCounted); public: enum IGDStatus { diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml index de5d731cc0..d6b96957f5 100644 --- a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml @@ -15,10 +15,10 @@ <methods> </methods> <members> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> The constant's parent class. </member> - <member name="constant" type="StringName" setter="set_class_constant" getter="get_class_constant" default="@"""> + <member name="constant" type="StringName" setter="set_class_constant" getter="get_class_constant" default="&"""> The constant to return. See the given class for its available constants. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml index 5c9c8d3eca..df3121d093 100644 --- a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml +++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml @@ -15,7 +15,7 @@ <methods> </methods> <members> - <member name="signal" type="StringName" setter="set_signal" getter="get_signal" default="@"""> + <member name="signal" type="StringName" setter="set_signal" getter="get_signal" default="&"""> The signal to emit. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml index 2d0fac1fa0..48104afcf7 100644 --- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml @@ -11,13 +11,13 @@ <members> <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> </member> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> </member> <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> </member> <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptFunctionCall.CallMode" default="0"> </member> - <member name="function" type="StringName" setter="set_function" getter="get_function" default="@"""> + <member name="function" type="StringName" setter="set_function" getter="get_function" default="&"""> </member> <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> </member> diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml index 68083614a6..f5bf195bbf 100644 --- a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptFunctionState" inherits="Reference" version="4.0"> +<class name="VisualScriptFunctionState" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml index 6c296fdb4b..9ca67feacb 100644 --- a/modules/visual_script/doc_classes/VisualScriptInputAction.xml +++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml @@ -9,7 +9,7 @@ <methods> </methods> <members> - <member name="action" type="StringName" setter="set_action_name" getter="get_action_name" default="@"""> + <member name="action" type="StringName" setter="set_action_name" getter="get_action_name" default="&"""> </member> <member name="mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="VisualScriptInputAction.Mode" default="0"> </member> diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml index c3741eea89..185f0f1ffb 100644 --- a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml +++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml @@ -18,7 +18,7 @@ <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type" default="0"> The local variable's type. </member> - <member name="var_name" type="StringName" setter="set_var_name" getter="get_var_name" default="@"new_local""> + <member name="var_name" type="StringName" setter="set_var_name" getter="get_var_name" default="&"new_local""> The local variable's name. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml index 619bbb90ca..865f0153c9 100644 --- a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml +++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml @@ -20,7 +20,7 @@ <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type" default="0"> The local variable's type. </member> - <member name="var_name" type="StringName" setter="set_var_name" getter="get_var_name" default="@"new_local""> + <member name="var_name" type="StringName" setter="set_var_name" getter="get_var_name" default="&"new_local""> The local variable's name. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml index 1c22070ab1..ff6c723a3e 100644 --- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml @@ -11,7 +11,7 @@ <members> <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> </member> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> </member> <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> </member> @@ -19,7 +19,7 @@ </member> <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> </member> - <member name="property" type="StringName" setter="set_property" getter="get_property" default="@"""> + <member name="property" type="StringName" setter="set_property" getter="get_property" default="&"""> </member> <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode" default="0"> </member> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml index 629576e261..71bfc4c8a5 100644 --- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml @@ -13,7 +13,7 @@ </member> <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> </member> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> </member> <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> </member> @@ -21,7 +21,7 @@ </member> <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> </member> - <member name="property" type="StringName" setter="set_property" getter="get_property" default="@"""> + <member name="property" type="StringName" setter="set_property" getter="get_property" default="&"""> </member> <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode" default="0"> </member> diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml index 80a8d31041..9e3e020f2d 100644 --- a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml +++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml @@ -11,7 +11,7 @@ <members> <member name="base_script" type="String" setter="set_base_script" getter="get_base_script" default=""""> </member> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> </member> </members> <constants> diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml index d182e14e4d..df20ac53f2 100644 --- a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml @@ -15,7 +15,7 @@ <methods> </methods> <members> - <member name="var_name" type="StringName" setter="set_variable" getter="get_variable" default="@"""> + <member name="var_name" type="StringName" setter="set_variable" getter="get_variable" default="&"""> The variable's name. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml index 3bd392dd85..eb8ebbe338 100644 --- a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml +++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml @@ -16,7 +16,7 @@ <methods> </methods> <members> - <member name="var_name" type="StringName" setter="set_variable" getter="get_variable" default="@"""> + <member name="var_name" type="StringName" setter="set_variable" getter="get_variable" default="&"""> The variable's name. </member> </members> diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml index 483cdfeaf8..c59234433f 100644 --- a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml +++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml @@ -9,13 +9,13 @@ <methods> </methods> <members> - <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="@"Object""> + <member name="base_type" type="StringName" setter="set_base_type" getter="get_base_type" default="&"Object""> </member> <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptYieldSignal.CallMode" default="0"> </member> <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> </member> - <member name="signal" type="StringName" setter="set_signal" getter="get_signal" default="@"""> + <member name="signal" type="StringName" setter="set_signal" getter="get_signal" default="&"""> </member> </members> <constants> diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 3c4a26a2a3..438ec99a56 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -449,8 +449,8 @@ public: ~VisualScriptInstance(); }; -class VisualScriptFunctionState : public Reference { - GDCLASS(VisualScriptFunctionState, Reference); +class VisualScriptFunctionState : public RefCounted { + GDCLASS(VisualScriptFunctionState, RefCounted); friend class VisualScriptInstance; ObjectID instance_id; diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index df34ec22ce..a3133f126d 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -33,7 +33,7 @@ #include "core/io/marshalls.h" #include "core/math/math_funcs.h" #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/variant/variant_parser.h" diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 98325bcdf1..5cfc228fae 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -624,7 +624,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Control::get_theme_icon("Vector3i", "EditorIcons"), Control::get_theme_icon("Transform2D", "EditorIcons"), Control::get_theme_icon("Plane", "EditorIcons"), - Control::get_theme_icon("Quat", "EditorIcons"), + Control::get_theme_icon("Quaternion", "EditorIcons"), Control::get_theme_icon("AABB", "EditorIcons"), Control::get_theme_icon("Basis", "EditorIcons"), Control::get_theme_icon("Transform", "EditorIcons"), @@ -1075,7 +1075,7 @@ void VisualScriptEditor::_update_members() { Control::get_theme_icon("Vector3i", "EditorIcons"), Control::get_theme_icon("Transform2D", "EditorIcons"), Control::get_theme_icon("Plane", "EditorIcons"), - Control::get_theme_icon("Quat", "EditorIcons"), + Control::get_theme_icon("Quaternion", "EditorIcons"), Control::get_theme_icon("AABB", "EditorIcons"), Control::get_theme_icon("Basis", "EditorIcons"), Control::get_theme_icon("Transform", "EditorIcons"), @@ -1853,7 +1853,7 @@ void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) { } member_name = ti->get_text(0); } - if (ED_IS_SHORTCUT("visual_script_editor/delete_selected", p_event)) { + if (ED_IS_SHORTCUT("ui_graph_delete", p_event)) { _member_option(MEMBER_REMOVE); } if (ED_IS_SHORTCUT("visual_script_editor/edit_member", p_event)) { @@ -4121,7 +4121,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { member_name = ti->get_text(0); member_popup->add_icon_shortcut(edit_icon, ED_GET_SHORTCUT("visual_script_editor/edit_member"), MEMBER_EDIT); member_popup->add_separator(); - member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE); + member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("ui_graph_delete"), MEMBER_REMOVE); member_popup->popup(); return; } @@ -4131,7 +4131,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { member_name = ti->get_text(0); member_popup->add_icon_shortcut(edit_icon, ED_GET_SHORTCUT("visual_script_editor/edit_member"), MEMBER_EDIT); member_popup->add_separator(); - member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE); + member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("ui_graph_delete"), MEMBER_REMOVE); member_popup->popup(); return; } @@ -4141,7 +4141,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { member_name = ti->get_text(0); member_popup->add_icon_shortcut(edit_icon, ED_GET_SHORTCUT("visual_script_editor/edit_member"), MEMBER_EDIT); member_popup->add_separator(); - member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE); + member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("ui_graph_delete"), MEMBER_REMOVE); member_popup->popup(); return; } diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index ef3a5d11c0..ca06b807cc 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -317,6 +317,7 @@ public: virtual void set_tooltip_request_func(String p_method, Object *p_obj) override; virtual Control *get_edit_menu() override; virtual void clear_edit_menu() override; + virtual void set_find_replace_bar(FindReplaceBar *p_bar) override { p_bar->hide(); }; // Not needed here. virtual bool can_lose_focus_on_node_selection() override { return false; } virtual void validate() override; diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 93e14f60d0..7a3cd5c0d1 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -108,7 +108,7 @@ void VisualScriptPropertySelector::_update_search() { vbc->get_theme_icon("Vector3", "EditorIcons"), vbc->get_theme_icon("Transform2D", "EditorIcons"), vbc->get_theme_icon("Plane", "EditorIcons"), - vbc->get_theme_icon("Quat", "EditorIcons"), + vbc->get_theme_icon("Quaternion", "EditorIcons"), vbc->get_theme_icon("AABB", "EditorIcons"), vbc->get_theme_icon("Basis", "EditorIcons"), vbc->get_theme_icon("Transform", "EditorIcons"), diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 34addb5c9f..6ec0bde7bd 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -31,7 +31,7 @@ #include "video_stream_webm.h" #include "core/config/project_settings.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "servers/audio_server.h" diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 1f2a456619..772445190c 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -30,6 +30,7 @@ #include "image_loader_webp.h" +#include "core/config/project_settings.h" #include "core/io/marshalls.h" #include "core/os/os.h" #include "core/string/print_string.h" @@ -69,12 +70,77 @@ static Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quali w[2] = 'B'; w[3] = 'P'; memcpy(&w[4], dst_buff, dst_size); - free(dst_buff); + WebPFree(dst_buff); return dst; } -static Ref<Image> _webp_lossy_unpack(const Vector<uint8_t> &p_buffer) { +static Vector<uint8_t> _webp_lossless_pack(const Ref<Image> &p_image) { + ERR_FAIL_COND_V(p_image.is_null() || p_image->is_empty(), Vector<uint8_t>()); + + int compression_level = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/webp_compression_level"); + compression_level = CLAMP(compression_level, 0, 9); + + Ref<Image> img = p_image->duplicate(); + if (img->detect_alpha()) { + img->convert(Image::FORMAT_RGBA8); + } else { + img->convert(Image::FORMAT_RGB8); + } + + Size2 s(img->get_width(), img->get_height()); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); + + // we need to use the more complex API in order to access the 'exact' flag... + + WebPConfig config; + WebPPicture pic; + if (!WebPConfigInit(&config) || !WebPConfigLosslessPreset(&config, compression_level) || !WebPPictureInit(&pic)) { + ERR_FAIL_V(Vector<uint8_t>()); + } + + WebPMemoryWriter wrt; + config.exact = 1; + pic.use_argb = 1; + pic.width = s.width; + pic.height = s.height; + pic.writer = WebPMemoryWrite; + pic.custom_ptr = &wrt; + WebPMemoryWriterInit(&wrt); + + bool success_import = false; + if (img->get_format() == Image::FORMAT_RGB8) { + success_import = WebPPictureImportRGB(&pic, r, 3 * s.width); + } else { + success_import = WebPPictureImportRGBA(&pic, r, 4 * s.width); + } + bool success_encode = false; + if (success_import) { + success_encode = WebPEncode(&config, &pic); + } + WebPPictureFree(&pic); + + if (!success_encode) { + WebPMemoryWriterClear(&wrt); + ERR_FAIL_V_MSG(Vector<uint8_t>(), "WebP packing failed."); + } + + // copy from wrt + Vector<uint8_t> dst; + dst.resize(4 + wrt.size); + uint8_t *w = dst.ptrw(); + w[0] = 'W'; + w[1] = 'E'; + w[2] = 'B'; + w[3] = 'P'; + memcpy(&w[4], wrt.mem, wrt.size); + WebPMemoryWriterClear(&wrt); + + return dst; +} + +static Ref<Image> _webp_unpack(const Vector<uint8_t> &p_buffer) { int size = p_buffer.size() - 4; ERR_FAIL_COND_V(size <= 0, Ref<Image>()); const uint8_t *r = p_buffer.ptr(); @@ -168,6 +234,7 @@ void ImageLoaderWEBP::get_recognized_extensions(List<String> *p_extensions) cons ImageLoaderWEBP::ImageLoaderWEBP() { Image::_webp_mem_loader_func = _webp_mem_loader_func; - Image::lossy_packer = _webp_lossy_pack; - Image::lossy_unpacker = _webp_lossy_unpack; + Image::webp_lossy_packer = _webp_lossy_pack; + Image::webp_lossless_packer = _webp_lossless_pack; + Image::webp_unpacker = _webp_unpack; } diff --git a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml index 3b53892a3d..62e524825d 100644 --- a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml +++ b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WebRTCPeerConnection" inherits="Reference" version="4.0"> +<class name="WebRTCPeerConnection" inherits="RefCounted" version="4.0"> <brief_description> Interface to a WebRTC peer connection. </brief_description> diff --git a/modules/webrtc/webrtc_multiplayer.h b/modules/webrtc/webrtc_multiplayer.h index 6b4ae6fcc8..2ddb98f656 100644 --- a/modules/webrtc/webrtc_multiplayer.h +++ b/modules/webrtc/webrtc_multiplayer.h @@ -48,7 +48,7 @@ private: CH_RESERVED_MAX = 3 }; - class ConnectedPeer : public Reference { + class ConnectedPeer : public RefCounted { public: Ref<WebRTCPeerConnection> connection; List<Ref<WebRTCDataChannel>> channels; diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h index ae75864489..fcfb9ae9ae 100644 --- a/modules/webrtc/webrtc_peer_connection.h +++ b/modules/webrtc/webrtc_peer_connection.h @@ -34,8 +34,8 @@ #include "core/io/packet_peer.h" #include "modules/webrtc/webrtc_data_channel.h" -class WebRTCPeerConnection : public Reference { - GDCLASS(WebRTCPeerConnection, Reference); +class WebRTCPeerConnection : public RefCounted { + GDCLASS(WebRTCPeerConnection, RefCounted); public: enum ConnectionState { diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h index e7285ccb86..d36e3a3557 100644 --- a/modules/websocket/emws_server.h +++ b/modules/websocket/emws_server.h @@ -33,7 +33,7 @@ #ifdef JAVASCRIPT_ENABLED -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "emws_peer.h" #include "websocket_server.h" diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h index 10da51fce5..bc5e591e7b 100644 --- a/modules/websocket/websocket_server.h +++ b/modules/websocket/websocket_server.h @@ -32,7 +32,7 @@ #define WEBSOCKET_H #include "core/crypto/crypto.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "websocket_multiplayer_peer.h" #include "websocket_peer.h" diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h index c2cf9df58b..39177a16a8 100644 --- a/modules/websocket/wsl_server.h +++ b/modules/websocket/wsl_server.h @@ -46,7 +46,7 @@ class WSLServer : public WebSocketServer { GDCIIMPL(WSLServer, WebSocketServer); private: - class PendingPeer : public Reference { + class PendingPeer : public RefCounted { private: bool _parse_request(const Vector<String> p_protocols); diff --git a/platform/android/SCsub b/platform/android/SCsub index 7e9dac926c..56fbd2f7e4 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -9,7 +9,6 @@ android_files = [ "dir_access_jandroid.cpp", "thread_jandroid.cpp", "net_socket_android.cpp", - "audio_driver_jandroid.cpp", "java_godot_lib_jni.cpp", "java_class_wrapper.cpp", "java_godot_wrapper.cpp", diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index d6c7a1abe5..ff7bf43573 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -31,7 +31,7 @@ #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #ifdef ANDROID_ENABLED #include <android/log.h> @@ -42,8 +42,8 @@ class JavaObject; #endif -class JavaClass : public Reference { - GDCLASS(JavaClass, Reference); +class JavaClass : public RefCounted { + GDCLASS(JavaClass, RefCounted); #ifdef ANDROID_ENABLED enum ArgumentType{ @@ -184,8 +184,8 @@ public: JavaClass(); }; -class JavaObject : public Reference { - GDCLASS(JavaObject, Reference); +class JavaObject : public RefCounted { + GDCLASS(JavaObject, RefCounted); #ifdef ANDROID_ENABLED Ref<JavaClass> base_class; diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp deleted file mode 100644 index 3a2ccac481..0000000000 --- a/platform/android/audio_driver_jandroid.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/*************************************************************************/ -/* audio_driver_jandroid.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "audio_driver_jandroid.h" - -#include "core/config/project_settings.h" -#include "core/os/os.h" -#include "thread_jandroid.h" - -AudioDriverAndroid *AudioDriverAndroid::s_ad = nullptr; - -jobject AudioDriverAndroid::io; -jmethodID AudioDriverAndroid::_init_audio; -jmethodID AudioDriverAndroid::_write_buffer; -jmethodID AudioDriverAndroid::_quit; -jmethodID AudioDriverAndroid::_pause; -bool AudioDriverAndroid::active = false; -jclass AudioDriverAndroid::cls; -int AudioDriverAndroid::audioBufferFrames = 0; -int AudioDriverAndroid::mix_rate = 44100; -bool AudioDriverAndroid::quit = false; -jobject AudioDriverAndroid::audioBuffer = nullptr; -void *AudioDriverAndroid::audioBufferPinned = nullptr; -Mutex AudioDriverAndroid::mutex; -int32_t *AudioDriverAndroid::audioBuffer32 = nullptr; - -const char *AudioDriverAndroid::get_name() const { - return "Android"; -} - -Error AudioDriverAndroid::init() { - /* - // TODO: pass in/return a (Java) device ID, also whether we're opening for input or output - this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples); - SDL_CalculateAudioSpec(&this->spec); - - if (this->spec.samples == 0) { - // Init failed? - SDL_SetError("Java-side initialization failed!"); - return 0; - } -*/ - - //Android_JNI_SetupThread(); - - // __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device"); - - JNIEnv *env = get_jni_env(); - int mix_rate = GLOBAL_GET("audio/driver/mix_rate"); - - int latency = GLOBAL_GET("audio/driver/output_latency"); - unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000); - print_verbose("Audio buffer size: " + itos(buffer_size)); - - audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size); - - ERR_FAIL_COND_V(audioBuffer == nullptr, ERR_INVALID_PARAMETER); - - audioBuffer = env->NewGlobalRef(audioBuffer); - - jboolean isCopy = JNI_FALSE; - audioBufferPinned = env->GetShortArrayElements((jshortArray)audioBuffer, &isCopy); - audioBufferFrames = env->GetArrayLength((jshortArray)audioBuffer); - audioBuffer32 = memnew_arr(int32_t, audioBufferFrames); - - return OK; -} - -void AudioDriverAndroid::start() { - active = true; -} - -void AudioDriverAndroid::setup(jobject p_io) { - JNIEnv *env = get_jni_env(); - io = p_io; - - jclass c = env->GetObjectClass(io); - cls = (jclass)env->NewGlobalRef(c); - - _init_audio = env->GetMethodID(cls, "audioInit", "(II)Ljava/lang/Object;"); - _write_buffer = env->GetMethodID(cls, "audioWriteShortBuffer", "([S)V"); - _quit = env->GetMethodID(cls, "audioQuit", "()V"); - _pause = env->GetMethodID(cls, "audioPause", "(Z)V"); -} - -void AudioDriverAndroid::thread_func(JNIEnv *env) { - jclass cls = env->FindClass("org/godotengine/godot/Godot"); - if (cls) { - cls = (jclass)env->NewGlobalRef(cls); - } - jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;"); - jobject ob = env->GetStaticObjectField(cls, fid); - jobject gob = env->NewGlobalRef(ob); - jclass c = env->GetObjectClass(gob); - jclass lcls = (jclass)env->NewGlobalRef(c); - _write_buffer = env->GetMethodID(lcls, "audioWriteShortBuffer", "([S)V"); - - while (!quit) { - int16_t *ptr = (int16_t *)audioBufferPinned; - int fc = audioBufferFrames; - - if (!s_ad->active || mutex.try_lock() != OK) { - for (int i = 0; i < fc; i++) { - ptr[i] = 0; - } - - } else { - s_ad->audio_server_process(fc / 2, audioBuffer32); - - mutex.unlock(); - - for (int i = 0; i < fc; i++) { - ptr[i] = audioBuffer32[i] >> 16; - } - } - env->ReleaseShortArrayElements((jshortArray)audioBuffer, (jshort *)ptr, JNI_COMMIT); - env->CallVoidMethod(gob, _write_buffer, (jshortArray)audioBuffer); - } -} - -int AudioDriverAndroid::get_mix_rate() const { - return mix_rate; -} - -AudioDriver::SpeakerMode AudioDriverAndroid::get_speaker_mode() const { - return SPEAKER_MODE_STEREO; -} - -void AudioDriverAndroid::lock() { - mutex.lock(); -} - -void AudioDriverAndroid::unlock() { - mutex.unlock(); -} - -void AudioDriverAndroid::finish() { - JNIEnv *env = get_jni_env(); - env->CallVoidMethod(io, _quit); - - if (audioBuffer) { - env->DeleteGlobalRef(audioBuffer); - audioBuffer = nullptr; - audioBufferPinned = nullptr; - } - - active = false; -} - -void AudioDriverAndroid::set_pause(bool p_pause) { - JNIEnv *env = get_jni_env(); - env->CallVoidMethod(io, _pause, p_pause); -} - -AudioDriverAndroid::AudioDriverAndroid() { - s_ad = this; - active = false; -} diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h deleted file mode 100644 index 9007fd2f81..0000000000 --- a/platform/android/audio_driver_jandroid.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************/ -/* audio_driver_jandroid.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef AUDIO_DRIVER_ANDROID_H -#define AUDIO_DRIVER_ANDROID_H - -#include "servers/audio_server.h" - -#include "java_godot_lib_jni.h" - -class AudioDriverAndroid : public AudioDriver { - static Mutex mutex; - static AudioDriverAndroid *s_ad; - static jobject io; - static jmethodID _init_audio; - static jmethodID _write_buffer; - static jmethodID _quit; - static jmethodID _pause; - static bool active; - static bool quit; - - static jclass cls; - - static jobject audioBuffer; - static void *audioBufferPinned; - static int32_t *audioBuffer32; - static int audioBufferFrames; - static int mix_rate; - -public: - void set_singleton(); - - virtual const char *get_name() const; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - virtual void set_pause(bool p_pause); - - static void setup(jobject p_io); - static void thread_func(JNIEnv *env); - - AudioDriverAndroid(); -}; - -#endif // AUDIO_DRIVER_ANDROID_H diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 7b9cbeea47..cdf98187ed 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -31,7 +31,7 @@ #ifndef DIR_ACCESS_JANDROID_H #define DIR_ACCESS_JANDROID_H -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "java_godot_lib_jni.h" #include <stdio.h> diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index c45828e194..fe7c4d1b08 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/marshalls.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/safe_refcount.h" #include "core/version.h" diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 0bb94dcc97..6ab678b8a1 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -31,9 +31,9 @@ #ifndef GODOT_GRADLE_EXPORT_UTIL_H #define GODOT_GRADLE_EXPORT_UTIL_H +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "editor/editor_export.h" diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 8890e0f645..bb4ce36947 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_ANDROID_H #define FILE_ACCESS_ANDROID_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <stdio.h> diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java index c7c7c1b40c..12a8bdb90b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -328,95 +328,6 @@ public class GodotIO { } ///////////////////////// - // AUDIO - ///////////////////////// - - private Object buf; - private Thread mAudioThread; - private AudioTrack mAudioTrack; - - public Object audioInit(int sampleRate, int desiredFrames) { - int channelConfig = AudioFormat.CHANNEL_OUT_STEREO; - int audioFormat = AudioFormat.ENCODING_PCM_16BIT; - int frameSize = 4; - - System.out.printf("audioInit: initializing audio:\n"); - - //Log.v("Godot", "Godot audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - // Let the user pick a larger buffer if they really want -- but ye - // gods they probably shouldn't, the minimums are horrifyingly high - // latency already - desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize); - - mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, - channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); - - audioStartThread(); - - //Log.v("Godot", "Godot audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - buf = new short[desiredFrames * 2]; - return buf; - } - - public void audioStartThread() { - mAudioThread = new Thread(new Runnable() { - public void run() { - mAudioTrack.play(); - GodotLib.audio(); - } - }); - - // I'd take REALTIME if I could get it! - mAudioThread.setPriority(Thread.MAX_PRIORITY); - mAudioThread.start(); - } - - public void audioWriteShortBuffer(short[] buffer) { - for (int i = 0; i < buffer.length;) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch (InterruptedException e) { - // Nom nom - } - } else { - Log.w("Godot", "Godot audio: error return from write(short)"); - return; - } - } - } - - public void audioQuit() { - if (mAudioThread != null) { - try { - mAudioThread.join(); - } catch (Exception e) { - Log.v("Godot", "Problem stopping audio thread: " + e); - } - mAudioThread = null; - - //Log.v("Godot", "Finished waiting for audio thread"); - } - - if (mAudioTrack != null) { - mAudioTrack.stop(); - mAudioTrack = null; - } - } - - public void audioPause(boolean p_pause) { - if (p_pause) - mAudioTrack.pause(); - else - mAudioTrack.play(); - } - - ///////////////////////// // MISCELLANEOUS OS IO ///////////////////////// @@ -452,6 +363,10 @@ public class GodotIO { return activity.getFilesDir().getAbsolutePath(); } + public String getExternalDataDir() { + return activity.getExternalFilesDir(null).getAbsolutePath(); + } + public String getLocale() { return Locale.getDefault().toString(); } diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java index 534a50e9ed..8108118388 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java @@ -175,11 +175,6 @@ public class GodotLib { public static native void focusout(); /** - * Invoked when the audio thread is started. - */ - public static native void audio(); - - /** * Used to access Godot global properties. * @param p_key Property key * @return String value of the property diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index f49b0e843a..ed6b5c3e14 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -102,7 +102,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, if (p_args[i]->get_type() != Variant::OBJECT) arg_expected = Variant::OBJECT; else { - Ref<Reference> ref = *p_args[i]; + Ref<RefCounted> ref = *p_args[i]; if (!ref.is_null()) { if (Object::cast_to<JavaObject>(ref.ptr())) { Ref<JavaObject> jo = ref; @@ -488,7 +488,7 @@ Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int return ret; } - return Reference::call(p_method, p_args, p_argcount, r_error); + return RefCounted::call(p_method, p_args, p_argcount, r_error); } JavaClass::JavaClass() { diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp index ec3b6f8ac0..5e99135498 100644 --- a/platform/android/java_godot_io_wrapper.cpp +++ b/platform/android/java_godot_io_wrapper.cpp @@ -49,6 +49,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc _open_URI = p_env->GetMethodID(cls, "openURI", "(Ljava/lang/String;)I"); _get_data_dir = p_env->GetMethodID(cls, "getDataDir", "()Ljava/lang/String;"); + _get_external_data_dir = p_env->GetMethodID(cls, "getExternalDataDir", "()Ljava/lang/String;"); _get_locale = p_env->GetMethodID(cls, "getLocale", "()Ljava/lang/String;"); _get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;"); _get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I"); @@ -92,6 +93,17 @@ String GodotIOJavaWrapper::get_user_data_dir() { } } +String GodotIOJavaWrapper::get_external_data_dir() { + if (_get_external_data_dir) { + JNIEnv *env = get_jni_env(); + ERR_FAIL_COND_V(env == nullptr, String()); + jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_external_data_dir); + return jstring_to_string(s, env); + } else { + return String(); + } +} + String GodotIOJavaWrapper::get_locale() { if (_get_locale) { JNIEnv *env = get_jni_env(); diff --git a/platform/android/java_godot_io_wrapper.h b/platform/android/java_godot_io_wrapper.h index 394e97effa..e4c0a4b2c7 100644 --- a/platform/android/java_godot_io_wrapper.h +++ b/platform/android/java_godot_io_wrapper.h @@ -47,6 +47,7 @@ private: jmethodID _open_URI = 0; jmethodID _get_data_dir = 0; + jmethodID _get_external_data_dir = 0; jmethodID _get_locale = 0; jmethodID _get_model = 0; jmethodID _get_screen_DPI = 0; @@ -66,6 +67,7 @@ public: Error open_uri(const String &p_uri); String get_user_data_dir(); + String get_external_data_dir(); String get_locale(); String get_model(); int get_screen_dpi(); diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index c7ff6cb2c0..d59366bb64 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -36,7 +36,6 @@ #include "android/asset_manager_jni.h" #include "api/java_class_wrapper.h" #include "api/jni_singleton.h" -#include "audio_driver_jandroid.h" #include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/input/input.h" @@ -94,7 +93,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en FileAccessAndroid::asset_manager = AAssetManager_fromJava(env, amgr); DirAccessJAndroid::setup(godot_io_java->get_instance()); - AudioDriverAndroid::setup(godot_io_java->get_instance()); NetSocketAndroid::setup(godot_java->get_member_object("netUtils", "Lorg/godotengine/godot/utils/GodotNetUtils;", env)); os_android = new OS_Android(godot_java, godot_io_java, p_use_apk_expansion); @@ -385,11 +383,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, os_android->main_loop_focusout(); } -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jclass clazz) { - setup_android_thread(); - AudioDriverAndroid::thread_func(env); -} - JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) { String js = jstring_to_string(path, env); diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h index a3e2933185..63e9e6d8e5 100644 --- a/platform/android/java_godot_lib_jni.h +++ b/platform/android/java_godot_lib_jni.h @@ -56,7 +56,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name); -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jclass clazz); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 422814dd50..222976d948 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -45,6 +45,23 @@ #include "java_godot_io_wrapper.h" #include "java_godot_wrapper.h" +String _remove_symlink(const String &dir) { + // Workaround for Android 6.0+ using a symlink. + // Save the current directory. + char current_dir_name[2048]; + getcwd(current_dir_name, 2048); + // Change directory to the external data directory. + chdir(dir.utf8().get_data()); + // Get the actual directory without the potential symlink. + char dir_name_wihout_symlink[2048]; + getcwd(dir_name_wihout_symlink, 2048); + // Convert back to a String. + String dir_without_symlink(dir_name_wihout_symlink); + // Restore original current directory. + chdir(current_dir_name); + return dir_without_symlink; +} + class AndroidLogger : public Logger { public: virtual void logv(const char *p_format, va_list p_list, bool p_err) { @@ -199,26 +216,18 @@ String OS_Android::get_user_data_dir() const { String data_dir = godot_io_java->get_user_data_dir(); if (data_dir != "") { - //store current dir - char real_current_dir_name[2048]; - getcwd(real_current_dir_name, 2048); - - //go to data dir - chdir(data_dir.utf8().get_data()); - - //get actual data dir, so we resolve potential symlink (Android 6.0+ seems to use symlink) - char data_current_dir_name[2048]; - getcwd(data_current_dir_name, 2048); - - //cache by parsing utf8 - data_dir_cache.parse_utf8(data_current_dir_name); - - //restore original dir so we don't mess things up - chdir(real_current_dir_name); - + data_dir_cache = _remove_symlink(data_dir); return data_dir_cache; } + return "."; +} +String OS_Android::get_external_data_dir() const { + String data_dir = godot_io_java->get_external_data_dir(); + if (data_dir != "") { + data_dir = _remove_symlink(data_dir); + return data_dir; + } return "."; } diff --git a/platform/android/os_android.h b/platform/android/os_android.h index dd14b69cf9..1e89e9211d 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -31,7 +31,6 @@ #ifndef OS_ANDROID_H #define OS_ANDROID_H -#include "audio_driver_jandroid.h" #include "audio_driver_opensl.h" #include "core/os/main_loop.h" #include "drivers/unix/os_unix.h" @@ -59,7 +58,6 @@ private: mutable String data_dir_cache; - //AudioDriverAndroid audio_driver_android; AudioDriverOpenSL audio_driver_android; MainLoop *main_loop; @@ -111,6 +109,7 @@ public: virtual Error shell_open(String p_uri) override; virtual String get_user_data_dir() const override; + virtual String get_external_data_dir() const override; virtual String get_resource_dir() const override; virtual String get_locale() const override; virtual String get_model_name() const override; diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h index c5c1c690a2..6b708548ae 100644 --- a/platform/android/plugin/godot_plugin_config.h +++ b/platform/android/plugin/godot_plugin_config.h @@ -102,7 +102,7 @@ struct PluginConfigAndroid { static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) { String absolute_path; if (!dependency_path.is_empty()) { - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { absolute_path = ProjectSettings::get_singleton()->globalize_path(dependency_path); } else { absolute_path = plugin_config_dir.plus_file(dependency_path); diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 73723b98a0..e2df573b09 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/safe_refcount.h" #include "core/version.h" diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index 458834ce3a..1f08901082 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -33,9 +33,9 @@ #include "os_iphone.h" #import "app_delegate.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_pack.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "display_server_iphone.h" #include "drivers/unix/syslog_logger.h" #import "godot_view.h" diff --git a/platform/iphone/plugin/godot_plugin_config.h b/platform/iphone/plugin/godot_plugin_config.h index e2546e733c..4d0c67bfff 100644 --- a/platform/iphone/plugin/godot_plugin_config.h +++ b/platform/iphone/plugin/godot_plugin_config.h @@ -104,7 +104,7 @@ static inline String resolve_local_dependency_path(String plugin_config_dir, Str return absolute_path; } - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { return dependency_path; } @@ -121,7 +121,7 @@ static inline String resolve_system_dependency_path(String dependency_path) { return absolute_path; } - if (dependency_path.is_abs_path()) { + if (dependency_path.is_absolute_path()) { return dependency_path; } diff --git a/platform/javascript/api/javascript_singleton.h b/platform/javascript/api/javascript_singleton.h index 1615efa87e..9d7a392278 100644 --- a/platform/javascript/api/javascript_singleton.h +++ b/platform/javascript/api/javascript_singleton.h @@ -32,11 +32,11 @@ #define JAVASCRIPT_SINGLETON_H #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" -class JavaScriptObject : public Reference { +class JavaScriptObject : public RefCounted { private: - GDCLASS(JavaScriptObject, Reference); + GDCLASS(JavaScriptObject, RefCounted); protected: virtual bool _set(const StringName &p_name, const Variant &p_value) { return false; } diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp index b35ccd087f..83a0fcc68f 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.cpp +++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp @@ -33,8 +33,8 @@ #include "core/config/engine.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "editor/editor_node.h" #include <emscripten/emscripten.h> diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 8ce294f31b..7e49feee61 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -39,7 +39,7 @@ #include "platform/javascript/logo.gen.h" #include "platform/javascript/run_icon.gen.h" -class EditorHTTPServer : public Reference { +class EditorHTTPServer : public RefCounted { private: Ref<TCPServer> server; Map<String, String> mimes; diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp index cb95068314..3ee088dd35 100644 --- a/platform/linuxbsd/export/export.cpp +++ b/platform/linuxbsd/export/export.cpp @@ -30,7 +30,7 @@ #include "export.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "editor/editor_export.h" #include "platform/linuxbsd/logo.gen.h" #include "scene/resources/texture.h" diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 23e448fbd7..adae059552 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -30,7 +30,7 @@ #include "os_linuxbsd.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "main/main.h" #ifdef X11_ENABLED @@ -166,7 +166,7 @@ bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) { String OS_LinuxBSD::get_config_path() const { if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.config` or `.` per the XDG Base Directory specification."); @@ -181,7 +181,7 @@ String OS_LinuxBSD::get_config_path() const { String OS_LinuxBSD::get_data_path() const { if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.local/share` or `get_config_path()` per the XDG Base Directory specification."); @@ -196,7 +196,7 @@ String OS_LinuxBSD::get_data_path() const { String OS_LinuxBSD::get_cache_path() const { if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/.cache` or `get_config_path()` per the XDG Base Directory specification."); diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index f61581979f..a894723e64 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -38,7 +38,7 @@ #include <sys/types.h> #include <unistd.h> -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "drivers/unix/dir_access_unix.h" class DirAccessOSX : public DirAccessUnix { diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 6d995412ab..4055cae586 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -31,11 +31,11 @@ #include "export.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/version.h" #include "editor/editor_export.h" diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 9e3f0350e9..b65d84d900 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -190,7 +190,7 @@ MainLoop *OS_OSX::get_main_loop() const { String OS_OSX::get_config_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Library/Application Support` or `.` per the XDG Base Directory specification."); @@ -205,7 +205,7 @@ String OS_OSX::get_config_path() const { String OS_OSX::get_data_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification."); @@ -217,7 +217,7 @@ String OS_OSX::get_data_path() const { String OS_OSX::get_cache_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on macOS as well. if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `$HOME/Libary/Caches` or `get_config_path()` per the XDG Base Directory specification."); diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index bac8620086..67f054aeaa 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -34,8 +34,8 @@ #include "app.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/keyboard.h" #include "main/main.h" diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 351aaa5957..1b14aac3da 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -33,11 +33,11 @@ #include "core/config/project_settings.h" #include "core/core_bind.h" #include "core/crypto/crypto_core.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" #include "core/io/zip_io.h" #include "core/object/class_db.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 222597b3ff..803d9371f5 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/os.h" #include "editor/editor_export.h" #include "editor/editor_node.h" diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index ccf13488ab..dcaa42cd1f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -633,7 +633,7 @@ MainLoop *OS_Windows::get_main_loop() const { String OS_Windows::get_config_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_CONFIG_HOME")) { - if (get_environment("XDG_CONFIG_HOME").is_abs_path()) { + if (get_environment("XDG_CONFIG_HOME").is_absolute_path()) { return get_environment("XDG_CONFIG_HOME"); } else { WARN_PRINT_ONCE("`XDG_CONFIG_HOME` is a relative path. Ignoring its value and falling back to `%APPDATA%` or `.` per the XDG Base Directory specification."); @@ -648,7 +648,7 @@ String OS_Windows::get_config_path() const { String OS_Windows::get_data_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_DATA_HOME")) { - if (get_environment("XDG_DATA_HOME").is_abs_path()) { + if (get_environment("XDG_DATA_HOME").is_absolute_path()) { return get_environment("XDG_DATA_HOME"); } else { WARN_PRINT_ONCE("`XDG_DATA_HOME` is a relative path. Ignoring its value and falling back to `get_config_path()` per the XDG Base Directory specification."); @@ -660,7 +660,7 @@ String OS_Windows::get_data_path() const { String OS_Windows::get_cache_path() const { // The XDG Base Directory specification technically only applies on Linux/*BSD, but it doesn't hurt to support it on Windows as well. if (has_environment("XDG_CACHE_HOME")) { - if (get_environment("XDG_CACHE_HOME").is_abs_path()) { + if (get_environment("XDG_CACHE_HOME").is_absolute_path()) { return get_environment("XDG_CACHE_HOME"); } else { WARN_PRINT_ONCE("`XDG_CACHE_HOME` is a relative path. Ignoring its value and falling back to `%TEMP%` or `get_config_path()` per the XDG Base Directory specification."); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 8f6e1c4695..4b72043a46 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1203,8 +1203,16 @@ real_t CharacterBody2D::get_floor_max_angle() const { return floor_max_angle; } -void CharacterBody2D::set_floor_max_angle(real_t p_floor_max_angle) { - floor_max_angle = p_floor_max_angle; +void CharacterBody2D::set_floor_max_angle(real_t p_radians) { + floor_max_angle = p_radians; +} + +real_t CharacterBody2D::get_floor_max_angle_degrees() const { + return Math::rad2deg(floor_max_angle); +} + +void CharacterBody2D::set_floor_max_angle_degrees(real_t p_degrees) { + floor_max_angle = Math::deg2rad(p_degrees); } const Vector2 &CharacterBody2D::get_snap() const { @@ -1262,7 +1270,9 @@ void CharacterBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_max_slides"), &CharacterBody2D::get_max_slides); ClassDB::bind_method(D_METHOD("set_max_slides", "max_slides"), &CharacterBody2D::set_max_slides); ClassDB::bind_method(D_METHOD("get_floor_max_angle"), &CharacterBody2D::get_floor_max_angle); - ClassDB::bind_method(D_METHOD("set_floor_max_angle", "floor_max_angle"), &CharacterBody2D::set_floor_max_angle); + ClassDB::bind_method(D_METHOD("set_floor_max_angle", "radians"), &CharacterBody2D::set_floor_max_angle); + ClassDB::bind_method(D_METHOD("get_floor_max_angle_degrees"), &CharacterBody2D::get_floor_max_angle_degrees); + ClassDB::bind_method(D_METHOD("set_floor_max_angle_degrees", "degrees"), &CharacterBody2D::set_floor_max_angle_degrees); ClassDB::bind_method(D_METHOD("get_snap"), &CharacterBody2D::get_snap); ClassDB::bind_method(D_METHOD("set_snap", "snap"), &CharacterBody2D::set_snap); ClassDB::bind_method(D_METHOD("get_up_direction"), &CharacterBody2D::get_up_direction); @@ -1283,7 +1293,8 @@ void CharacterBody2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stop_on_slope"), "set_stop_on_slope_enabled", "is_stop_on_slope_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "infinite_inertia"), "set_infinite_inertia_enabled", "is_infinite_inertia_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides"), "set_max_slides", "get_max_slides"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle"), "set_floor_max_angle", "get_floor_max_angle"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_floor_max_angle", "get_floor_max_angle"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle_degrees", PROPERTY_HINT_RANGE, "0,180,0.1", PROPERTY_USAGE_EDITOR), "set_floor_max_angle_degrees", "get_floor_max_angle_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "snap"), "set_snap", "get_snap"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "up_direction"), "set_up_direction", "get_up_direction"); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 5a44d31cc2..423f792132 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -301,7 +301,10 @@ private: void set_max_slides(int p_max_slides); real_t get_floor_max_angle() const; - void set_floor_max_angle(real_t p_floor_max_angle); + void set_floor_max_angle(real_t p_radians); + + real_t get_floor_max_angle_degrees() const; + void set_floor_max_angle_degrees(real_t p_degrees); const Vector2 &get_snap() const; void set_snap(const Vector2 &p_snap); @@ -335,8 +338,8 @@ public: ~CharacterBody2D(); }; -class KinematicCollision2D : public Reference { - GDCLASS(KinematicCollision2D, Reference); +class KinematicCollision2D : public RefCounted { + GDCLASS(KinematicCollision2D, RefCounted); PhysicsBody2D *owner = nullptr; friend class PhysicsBody2D; diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index cc1177d541..a3f681e53c 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -31,11 +31,11 @@ #include "lightmap_gi.h" #include "core/io/config_file.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "core/math/camera_matrix.h" #include "core/math/delaunay_3d.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/sort_array.h" #include "lightmap_probe.h" diff --git a/scene/3d/lightmapper.h b/scene/3d/lightmapper.h index f63515f666..3a6a88d435 100644 --- a/scene/3d/lightmapper.h +++ b/scene/3d/lightmapper.h @@ -44,8 +44,8 @@ #endif -class LightmapDenoiser : public Reference { - GDCLASS(LightmapDenoiser, Reference) +class LightmapDenoiser : public RefCounted { + GDCLASS(LightmapDenoiser, RefCounted) protected: static LightmapDenoiser *(*create_function)(); @@ -54,8 +54,8 @@ public: static Ref<LightmapDenoiser> create(); }; -class LightmapRaycaster : public Reference { - GDCLASS(LightmapRaycaster, Reference) +class LightmapRaycaster : public RefCounted { + GDCLASS(LightmapRaycaster, RefCounted) protected: static LightmapRaycaster *(*create_function)(); @@ -121,8 +121,8 @@ public: static Ref<LightmapRaycaster> create(); }; -class Lightmapper : public Reference { - GDCLASS(Lightmapper, Reference) +class Lightmapper : public RefCounted { + GDCLASS(Lightmapper, RefCounted) public: enum GenerateProbes { GENERATE_PROBES_DISABLED, diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 09a96bf8ca..5f076ceb12 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -34,8 +34,8 @@ #include "scene/main/node.h" #include "scene/main/scene_tree.h" -class Node3DGizmo : public Reference { - GDCLASS(Node3DGizmo, Reference); +class Node3DGizmo : public RefCounted { + GDCLASS(Node3DGizmo, RefCounted); public: virtual void create() = 0; diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 3496ed1a56..25c7c3d798 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1204,8 +1204,16 @@ real_t CharacterBody3D::get_floor_max_angle() const { return floor_max_angle; } -void CharacterBody3D::set_floor_max_angle(real_t p_floor_max_angle) { - floor_max_angle = p_floor_max_angle; +void CharacterBody3D::set_floor_max_angle(real_t p_radians) { + floor_max_angle = p_radians; +} + +real_t CharacterBody3D::get_floor_max_angle_degrees() const { + return Math::rad2deg(floor_max_angle); +} + +void CharacterBody3D::set_floor_max_angle_degrees(real_t p_degrees) { + floor_max_angle = Math::deg2rad(p_degrees); } const Vector3 &CharacterBody3D::get_snap() const { @@ -1251,7 +1259,9 @@ void CharacterBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_max_slides"), &CharacterBody3D::get_max_slides); ClassDB::bind_method(D_METHOD("set_max_slides", "max_slides"), &CharacterBody3D::set_max_slides); ClassDB::bind_method(D_METHOD("get_floor_max_angle"), &CharacterBody3D::get_floor_max_angle); - ClassDB::bind_method(D_METHOD("set_floor_max_angle", "floor_max_angle"), &CharacterBody3D::set_floor_max_angle); + ClassDB::bind_method(D_METHOD("set_floor_max_angle", "radians"), &CharacterBody3D::set_floor_max_angle); + ClassDB::bind_method(D_METHOD("get_floor_max_angle_degrees"), &CharacterBody3D::get_floor_max_angle_degrees); + ClassDB::bind_method(D_METHOD("set_floor_max_angle_degrees", "degrees"), &CharacterBody3D::set_floor_max_angle_degrees); ClassDB::bind_method(D_METHOD("get_snap"), &CharacterBody3D::get_snap); ClassDB::bind_method(D_METHOD("set_snap", "snap"), &CharacterBody3D::set_snap); ClassDB::bind_method(D_METHOD("get_up_direction"), &CharacterBody3D::get_up_direction); @@ -1270,7 +1280,8 @@ void CharacterBody3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stop_on_slope"), "set_stop_on_slope_enabled", "is_stop_on_slope_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "infinite_inertia"), "set_infinite_inertia_enabled", "is_infinite_inertia_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides"), "set_max_slides", "get_max_slides"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle"), "set_floor_max_angle", "get_floor_max_angle"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_floor_max_angle", "get_floor_max_angle"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle_degrees", PROPERTY_HINT_RANGE, "0,180,0.1", PROPERTY_USAGE_EDITOR), "set_floor_max_angle_degrees", "get_floor_max_angle_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap"), "set_snap", "get_snap"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "up_direction"), "set_up_direction", "get_up_direction"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin"); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index d5e474c5d5..8df3635be0 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -305,7 +305,10 @@ private: void set_max_slides(int p_max_slides); real_t get_floor_max_angle() const; - void set_floor_max_angle(real_t p_floor_max_angle); + void set_floor_max_angle(real_t p_radians); + + real_t get_floor_max_angle_degrees() const; + void set_floor_max_angle_degrees(real_t p_degrees); const Vector3 &get_snap() const; void set_snap(const Vector3 &p_snap); @@ -336,8 +339,8 @@ public: ~CharacterBody3D(); }; -class KinematicCollision3D : public Reference { - GDCLASS(KinematicCollision3D, Reference); +class KinematicCollision3D : public RefCounted { + GDCLASS(KinematicCollision3D, RefCounted); PhysicsBody3D *owner = nullptr; friend class PhysicsBody3D; diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h index 9be7dce5d2..2f6e416c8c 100644 --- a/scene/3d/skeleton_3d.h +++ b/scene/3d/skeleton_3d.h @@ -40,8 +40,8 @@ typedef int BoneId; class PhysicalBone3D; class Skeleton3D; -class SkinReference : public Reference { - GDCLASS(SkinReference, Reference) +class SkinReference : public RefCounted { + GDCLASS(SkinReference, RefCounted) friend class Skeleton3D; Skeleton3D *skeleton_node; diff --git a/scene/3d/velocity_tracker_3d.h b/scene/3d/velocity_tracker_3d.h index e971f4755a..827c3f5bd8 100644 --- a/scene/3d/velocity_tracker_3d.h +++ b/scene/3d/velocity_tracker_3d.h @@ -33,8 +33,8 @@ #include "scene/3d/node_3d.h" -class VelocityTracker3D : public Reference { - GDCLASS(VelocityTracker3D, Reference); +class VelocityTracker3D : public RefCounted { + GDCLASS(VelocityTracker3D, RefCounted); struct PositionHistory { uint64_t frame = 0; diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 7922635438..7cd9de1fa1 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -37,8 +37,8 @@ #include "scene/resources/animation.h" #ifdef TOOLS_ENABLED -class AnimatedValuesBackup : public Reference { - GDCLASS(AnimatedValuesBackup, Reference); +class AnimatedValuesBackup : public RefCounted { + GDCLASS(AnimatedValuesBackup, RefCounted); struct Entry { Object *object = nullptr; diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index ac067aa001..66155958cf 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -98,17 +98,14 @@ void BaseButton::_notification(int p_what) { } if (p_what == NOTIFICATION_FOCUS_ENTER) { - status.hovering = true; update(); } if (p_what == NOTIFICATION_FOCUS_EXIT) { if (status.press_attempt) { status.press_attempt = false; - status.hovering = false; update(); } else if (status.hovering) { - status.hovering = false; update(); } } @@ -175,10 +172,9 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) { status.hovering = false; } } - // pressed state should be correct with button_up signal - emit_signal("button_up"); status.press_attempt = false; status.pressing_inside = false; + emit_signal("button_up"); } update(); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 4996f00cb3..55774b488c 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -32,7 +32,7 @@ #define FILE_DIALOG_H #include "box_container.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 5a4dacd897..78ab30699a 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -824,7 +824,7 @@ void GraphEdit::_bake_segment2d(Vector<Vector2> &points, Vector<Color> &colors, } } -void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, const Color &p_to_color, float p_width, float p_bezier_ratio = 1.0) { +void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, const Color &p_to_color, float p_width, float p_bezier_ratio) { //cubic bezier code float diff = p_to.x - p_from.x; float cp_offset; diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index fa3b113705..8a51bcb11e 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -163,7 +163,7 @@ private: void _bake_segment2d(Vector<Vector2> &points, Vector<Color> &colors, float p_begin, float p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_min_depth, int p_max_depth, float p_tol, const Color &p_color, const Color &p_to_color, int &lines) const; - void _draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, const Color &p_to_color, float p_width, float p_bezier_ratio); + void _draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, const Color &p_to_color, float p_width, float p_bezier_ratio = 1.0); void _graph_node_raised(Node *p_gn); void _graph_node_moved(Node *p_gn); diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h index f2e2823eff..d809fd502f 100644 --- a/scene/gui/rich_text_effect.h +++ b/scene/gui/rich_text_effect.h @@ -47,8 +47,8 @@ public: RichTextEffect(); }; -class CharFXTransform : public Reference { - GDCLASS(CharFXTransform, Reference); +class CharFXTransform : public RefCounted { + GDCLASS(CharFXTransform, RefCounted); protected: static void _bind_methods(); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 92b0ff28e9..22e822253f 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -31,8 +31,8 @@ #ifndef HTTPREQUEST_H #define HTTPREQUEST_H +#include "core/io/file_access.h" #include "core/io/http_client.h" -#include "core/os/file_access.h" #include "core/os/thread.h" #include "core/templates/safe_refcount.h" #include "node.h" diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 3e08f86fc9..e4ba93feec 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -33,10 +33,10 @@ #include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" #include "core/input/input.h" +#include "core/io/dir_access.h" #include "core/io/marshalls.h" #include "core/io/resource_loader.h" #include "core/object/message_queue.h" -#include "core/os/dir_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/print_string.h" diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index a2f2adb8f8..78c4c14e97 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -48,8 +48,8 @@ class Material; class Mesh; class SceneDebugger; -class SceneTreeTimer : public Reference { - GDCLASS(SceneTreeTimer, Reference); +class SceneTreeTimer : public RefCounted { + GDCLASS(SceneTreeTimer, RefCounted); float time_left = 0.0; bool process_always = true; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 4faba0b9d2..332976a18d 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -183,6 +183,7 @@ #include "scene/resources/video_stream.h" #include "scene/resources/visual_shader.h" #include "scene/resources/visual_shader_nodes.h" +#include "scene/resources/visual_shader_particle_nodes.h" #include "scene/resources/visual_shader_sdf_nodes.h" #include "scene/resources/world_2d.h" #include "scene/resources/world_3d.h" @@ -613,6 +614,17 @@ void register_scene_types() { ClassDB::register_class<VisualShaderNodeTextureSDFNormal>(); ClassDB::register_class<VisualShaderNodeSDFRaymarch>(); + ClassDB::register_class<VisualShaderNodeParticleOutput>(); + ClassDB::register_virtual_class<VisualShaderNodeParticleEmitter>(); + ClassDB::register_class<VisualShaderNodeParticleSphereEmitter>(); + ClassDB::register_class<VisualShaderNodeParticleBoxEmitter>(); + ClassDB::register_class<VisualShaderNodeParticleRingEmitter>(); + ClassDB::register_class<VisualShaderNodeParticleMultiplyByAxisAngle>(); + ClassDB::register_class<VisualShaderNodeParticleConeVelocity>(); + ClassDB::register_class<VisualShaderNodeParticleRandomness>(); + ClassDB::register_class<VisualShaderNodeParticleAccelerator>(); + ClassDB::register_class<VisualShaderNodeParticleEmit>(); + ClassDB::register_class<ShaderMaterial>(); ClassDB::register_virtual_class<CanvasItem>(); ClassDB::register_class<CanvasTexture>(); diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 9a9f019dda..81062feb46 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -30,8 +30,8 @@ #include "audio_stream_sample.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" -#include "core/os/file_access.h" void AudioStreamPlaybackSample::start(float p_from_pos) { if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM) { diff --git a/scene/resources/mesh_data_tool.h b/scene/resources/mesh_data_tool.h index f5c8f11437..b0ebfba7ee 100644 --- a/scene/resources/mesh_data_tool.h +++ b/scene/resources/mesh_data_tool.h @@ -33,8 +33,8 @@ #include "scene/resources/mesh.h" -class MeshDataTool : public Reference { - GDCLASS(MeshDataTool, Reference); +class MeshDataTool : public RefCounted { + GDCLASS(MeshDataTool, RefCounted); int format = 0; struct Vertex { diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 78a0aeaa9a..e85b933439 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -34,8 +34,8 @@ #include "core/io/resource.h" #include "scene/main/node.h" -class SceneState : public Reference { - GDCLASS(SceneState, Reference); +class SceneState : public RefCounted { + GDCLASS(SceneState, RefCounted); Vector<StringName> names; Vector<Variant> variants; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 2414704a57..2a60f54fdd 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -31,14 +31,14 @@ #include "resource_format_text.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/io/resource_format_binary.h" -#include "core/os/dir_access.h" #include "core/version.h" //version 2: changed names for basis, aabb, Vectors, etc. #define FORMAT_VERSION 2 -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/version.h" #define _printerr() ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data()); diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 2dc683415d..f5d9cca859 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -31,9 +31,9 @@ #ifndef RESOURCE_FORMAT_TEXT_H #define RESOURCE_FORMAT_TEXT_H +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "core/variant/variant_parser.h" #include "scene/resources/packed_scene.h" diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 0ad21b0f0f..cbd44315b7 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -30,7 +30,7 @@ #include "shader.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "scene/scene_string_names.h" #include "servers/rendering/shader_language.h" #include "servers/rendering_server.h" diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h index 4674f0cc69..bde6702759 100644 --- a/scene/resources/surface_tool.h +++ b/scene/resources/surface_tool.h @@ -35,8 +35,8 @@ #include "scene/resources/mesh.h" #include "thirdparty/misc/mikktspace.h" -class SurfaceTool : public Reference { - GDCLASS(SurfaceTool, Reference); +class SurfaceTool : public RefCounted { + GDCLASS(SurfaceTool, RefCounted); public: struct Vertex { diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp index 564c65adb9..33bb0a83e9 100644 --- a/scene/resources/text_file.cpp +++ b/scene/resources/text_file.cpp @@ -30,7 +30,7 @@ #include "text_file.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" bool TextFile::has_text() const { return text != ""; diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h index 74d4f2c32c..1b5c1a3123 100644 --- a/scene/resources/text_line.h +++ b/scene/resources/text_line.h @@ -36,8 +36,8 @@ /*************************************************************************/ -class TextLine : public Reference { - GDCLASS(TextLine, Reference); +class TextLine : public RefCounted { + GDCLASS(TextLine, RefCounted); RID rid; int spacing_top = 0; diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h index 4396b07130..a34e745090 100644 --- a/scene/resources/text_paragraph.h +++ b/scene/resources/text_paragraph.h @@ -36,8 +36,8 @@ /*************************************************************************/ -class TextParagraph : public Reference { - GDCLASS(TextParagraph, Reference); +class TextParagraph : public RefCounted { + GDCLASS(TextParagraph, RefCounted); RID dropcap_rid; int dropcap_lines = 0; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 4475179431..064563d4b5 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -327,7 +327,7 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit uint32_t mipmaps = f->get_32(); Image::Format format = Image::Format(f->get_32()); - if (data_format == DATA_FORMAT_LOSSLESS || data_format == DATA_FORMAT_LOSSY || data_format == DATA_FORMAT_BASIS_UNIVERSAL) { + if (data_format == DATA_FORMAT_PNG || data_format == DATA_FORMAT_WEBP || data_format == DATA_FORMAT_BASIS_UNIVERSAL) { //look for a PNG or WEBP file inside int sw = w; @@ -360,10 +360,10 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit Ref<Image> img; if (data_format == DATA_FORMAT_BASIS_UNIVERSAL) { img = Image::basis_universal_unpacker(pv); - } else if (data_format == DATA_FORMAT_LOSSLESS) { - img = Image::lossless_unpacker(pv); + } else if (data_format == DATA_FORMAT_PNG) { + img = Image::png_unpacker(pv); } else { - img = Image::lossy_unpacker(pv); + img = Image::webp_unpacker(pv); } if (img.is_null() || img->is_empty()) { diff --git a/scene/resources/texture.h b/scene/resources/texture.h index df8c00f8ff..3b1815266d 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -31,10 +31,10 @@ #ifndef TEXTURE_H #define TEXTURE_H +#include "core/io/file_access.h" #include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/math/rect2.h" -#include "core/os/file_access.h" #include "core/os/mutex.h" #include "core/os/rw_lock.h" #include "core/os/thread_safe.h" @@ -136,8 +136,8 @@ class StreamTexture2D : public Texture2D { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -146,9 +146,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, FORMAT_BIT_DETECT_3D = 1 << 24, @@ -389,8 +386,8 @@ class StreamTextureLayered : public TextureLayered { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -399,9 +396,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, }; @@ -532,8 +526,8 @@ class StreamTexture3D : public Texture3D { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -542,9 +536,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, }; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 12309f7488..d6a6f31fad 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "theme.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/string/print_string.h" void Theme::_emit_theme_changed() { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index fd0b568f71..5759948fe6 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -33,6 +33,7 @@ #include "core/templates/vmap.h" #include "servers/rendering/shader_types.h" #include "visual_shader_nodes.h" +#include "visual_shader_particle_nodes.h" #include "visual_shader_sdf_nodes.h" bool VisualShaderNode::is_simple_decl() const { @@ -1079,9 +1080,11 @@ static const char *type_string[VisualShader::TYPE_MAX] = { "vertex", "fragment", "light", - "emit", + "start", "process", - "end", + "collide", + "start_custom", + "process_custom", "sky", }; @@ -1357,7 +1360,8 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui return OK; } - code += "// " + vsnode->get_caption() + ":" + itos(node) + "\n"; + String node_name = "// " + vsnode->get_caption() + ":" + itos(node) + "\n"; + String node_code; Vector<String> input_vars; input_vars.resize(vsnode->get_input_port_count()); @@ -1428,19 +1432,19 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui if (defval.get_type() == Variant::FLOAT) { float val = defval; inputs[i] = "n_in" + itos(node) + "p" + itos(i); - code += "\tfloat " + inputs[i] + " = " + vformat("%.5f", val) + ";\n"; + node_code += "\tfloat " + inputs[i] + " = " + vformat("%.5f", val) + ";\n"; } else if (defval.get_type() == Variant::INT) { int val = defval; inputs[i] = "n_in" + itos(node) + "p" + itos(i); - code += "\tint " + inputs[i] + " = " + itos(val) + ";\n"; + node_code += "\tint " + inputs[i] + " = " + itos(val) + ";\n"; } else if (defval.get_type() == Variant::BOOL) { bool val = defval; inputs[i] = "n_in" + itos(node) + "p" + itos(i); - code += "\tbool " + inputs[i] + " = " + (val ? "true" : "false") + ";\n"; + node_code += "\tbool " + inputs[i] + " = " + (val ? "true" : "false") + ";\n"; } else if (defval.get_type() == Variant::VECTOR3) { Vector3 val = defval; inputs[i] = "n_in" + itos(node) + "p" + itos(i); - code += "\tvec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z); + node_code += "\tvec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z); } else if (defval.get_type() == Variant::TRANSFORM3D) { Transform3D val = defval; val.basis.transpose(); @@ -1455,7 +1459,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui values.push_back(val.origin.y); values.push_back(val.origin.z); bool err = false; - code += "\tmat4 " + inputs[i] + " = " + String("mat4(vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 1.0));\n").sprintf(values, &err); + node_code += "\tmat4 " + inputs[i] + " = " + String("mat4(vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 0.0), vec4(%.5f, %.5f, %.5f, 1.0));\n").sprintf(values, &err); } else { //will go empty, node is expected to know what it is doing at this point and handle it } @@ -1543,7 +1547,12 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui } } - code += vsnode->generate_code(get_mode(), type, node, inputs, outputs, for_preview); + node_code += vsnode->generate_code(get_mode(), type, node, inputs, outputs, for_preview); + if (node_code != String()) { + code += node_name; + code += node_code; + code += "\n"; + } for (int i = 0; i < output_count; i++) { bool new_line_inserted = false; @@ -1593,7 +1602,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui bool VisualShader::has_func_name(RenderingServer::ShaderMode p_mode, const String &p_func_name) const { if (!ShaderTypes::get_singleton()->get_functions(p_mode).has(p_func_name)) { if (p_mode == RenderingServer::ShaderMode::SHADER_PARTICLES) { - if (p_func_name == "emit" || p_func_name == "process" || p_func_name == "end") { + if (p_func_name == "start_custom" || p_func_name == "process_custom" || p_func_name == "collide") { return true; } } @@ -1674,11 +1683,12 @@ void VisualShader::_update_shader() const { global_code += "render_mode " + render_mode + ";\n\n"; } - static const char *func_name[TYPE_MAX] = { "vertex", "fragment", "light", "emit", "process", "end", "sky" }; + static const char *func_name[TYPE_MAX] = { "vertex", "fragment", "light", "start", "process", "collide", "start_custom", "process_custom", "sky" }; String global_expressions; Set<String> used_uniform_names; List<VisualShaderNodeUniform *> uniforms; + Map<int, List<int>> emitters; for (int i = 0, index = 0; i < TYPE_MAX; i++) { if (!has_func_name(RenderingServer::ShaderMode(shader_mode), func_name[i])) { @@ -1703,6 +1713,19 @@ void VisualShader::_update_shader() const { if (uniform.is_valid()) { uniforms.push_back(uniform.ptr()); } + Ref<VisualShaderNodeParticleEmit> emit_particle = Object::cast_to<VisualShaderNodeParticleEmit>(E->get().node.ptr()); + if (emit_particle.is_valid()) { + if (!emitters.has(i)) { + emitters.insert(i, List<int>()); + } + + for (Map<int, Node>::Element *M = graph[i].nodes.front(); M; M = M->next()) { + if (M->get().node == emit_particle.ptr()) { + emitters[i].push_back(M->key()); + break; + } + } + } } } @@ -1751,6 +1774,13 @@ void VisualShader::_update_shader() const { Error err = _write_node(Type(i), global_code, global_code_per_node, global_code_per_func, func_code, default_tex_params, input_connections, output_connections, NODE_ID_OUTPUT, processed, false, classes); ERR_FAIL_COND(err != OK); + if (emitters.has(i)) { + for (List<int>::Element *E = emitters[i].front(); E; E = E->next()) { + err = _write_node(Type(i), global_code, global_code_per_node, global_code_per_func, func_code, default_tex_params, input_connections, output_connections, E->get(), processed, false, classes); + ERR_FAIL_COND(err != OK); + } + } + if (shader_mode == Shader::MODE_PARTICLES) { code_map.insert(i, func_code); } else { @@ -1759,19 +1789,130 @@ void VisualShader::_update_shader() const { } } + String global_compute_code; + if (shader_mode == Shader::MODE_PARTICLES) { - code += "\nvoid compute() {\n"; - code += "\tif (RESTART) {\n"; - code += code_map[TYPE_EMIT]; - code += "\t} else {\n"; - code += code_map[TYPE_PROCESS]; + bool has_start = !code_map[TYPE_START].is_empty(); + bool has_start_custom = !code_map[TYPE_START_CUSTOM].is_empty(); + bool has_process = !code_map[TYPE_PROCESS].is_empty(); + bool has_process_custom = !code_map[TYPE_PROCESS_CUSTOM].is_empty(); + bool has_collide = !code_map[TYPE_COLLIDE].is_empty(); + + code += "void start() {\n"; + if (has_start || has_start_custom) { + code += "\tuint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n"; + code += "\tvec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n"; + code += "\tfloat __radians;\n"; + code += "\tvec3 __vec3_buff1;\n"; + code += "\tvec3 __vec3_buff2;\n"; + code += "\tfloat __scalar_buff1;\n"; + code += "\tfloat __scalar_buff2;\n"; + code += "\tvec3 __ndiff = normalize(__diff);\n\n"; + } + if (has_start) { + code += "\t{\n"; + code += code_map[TYPE_START].replace("\n\t", "\n\t\t"); + code += "\t}\n"; + if (has_start_custom) { + code += "\t\n"; + } + } + if (has_start_custom) { + code += "\t{\n"; + code += code_map[TYPE_START_CUSTOM].replace("\n\t", "\n\t\t"); + code += "\t}\n"; + } + code += "}\n\n"; + code += "void process() {\n"; + if (has_process || has_process_custom || has_collide) { + code += "\tuint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n"; + code += "\tvec3 __vec3_buff1;\n"; + code += "\tvec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n"; + code += "\tvec3 __ndiff = normalize(__diff);\n\n"; + } + code += "\t{\n"; + String tab = "\t"; + if (has_collide) { + code += "\t\tif (COLLIDED) {\n\n"; + code += code_map[TYPE_COLLIDE].replace("\n\t", "\n\t\t\t"); + if (has_process) { + code += "\t\t} else {\n\n"; + tab += "\t"; + } + } + if (has_process) { + code += code_map[TYPE_PROCESS].replace("\n\t", "\n\t" + tab); + } + if (has_collide) { + code += "\t\t}\n"; + } code += "\t}\n"; - code += "}\n"; + + if (has_process_custom) { + code += "\t{\n\n"; + code += code_map[TYPE_PROCESS_CUSTOM].replace("\n\t", "\n\t\t"); + code += "\t}\n"; + } + + code += "}\n\n"; + + global_compute_code += "float __rand_from_seed(inout uint seed) {\n"; + global_compute_code += "\tint k;\n"; + global_compute_code += "\tint s = int(seed);\n"; + global_compute_code += "\tif (s == 0)\n"; + global_compute_code += "\ts = 305420679;\n"; + global_compute_code += "\tk = s / 127773;\n"; + global_compute_code += "\ts = 16807 * (s - k * 127773) - 2836 * k;\n"; + global_compute_code += "\tif (s < 0)\n"; + global_compute_code += "\t\ts += 2147483647;\n"; + global_compute_code += "\tseed = uint(s);\n"; + global_compute_code += "\treturn float(seed % uint(65536)) / 65535.0;\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "float __rand_from_seed_m1_p1(inout uint seed) {\n"; + global_compute_code += "\treturn __rand_from_seed(seed) * 2.0 - 1.0;\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "float __randf_range(inout uint seed, float from, float to) {\n"; + global_compute_code += "\treturn __rand_from_seed(seed) * (to - from) + from;\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "vec3 __randv_range(inout uint seed, vec3 from, vec3 to) {\n"; + global_compute_code += "\treturn vec3(__randf_range(seed, from.x, to.x), __randf_range(seed, from.y, to.y), __randf_range(seed, from.z, to.z));\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "uint __hash(uint x) {\n"; + global_compute_code += "\tx = ((x >> uint(16)) ^ x) * uint(73244475);\n"; + global_compute_code += "\tx = ((x >> uint(16)) ^ x) * uint(73244475);\n"; + global_compute_code += "\tx = (x >> uint(16)) ^ x;\n"; + global_compute_code += "\treturn x;\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "mat3 __build_rotation_mat3(vec3 axis, float angle) {\n"; + global_compute_code += "\taxis = normalize(axis);\n"; + global_compute_code += "\tfloat s = sin(angle);\n"; + global_compute_code += "\tfloat c = cos(angle);\n"; + global_compute_code += "\tfloat oc = 1.0 - c;\n"; + global_compute_code += "\treturn mat3(vec3(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s), vec3(oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s), vec3(oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c));\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "mat4 __build_rotation_mat4(vec3 axis, float angle) {\n"; + global_compute_code += "\taxis = normalize(axis);\n"; + global_compute_code += "\tfloat s = sin(angle);\n"; + global_compute_code += "\tfloat c = cos(angle);\n"; + global_compute_code += "\tfloat oc = 1.0 - c;\n"; + global_compute_code += "\treturn mat4(vec4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0), vec4(oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0), vec4(oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0), vec4(0, 0, 0, 1));\n"; + global_compute_code += "}\n\n"; + + global_compute_code += "vec3 __get_random_unit_vec3(inout uint seed) {\n"; + global_compute_code += "\treturn normalize(vec3(__rand_from_seed_m1_p1(seed), __rand_from_seed_m1_p1(seed), __rand_from_seed_m1_p1(seed)));\n"; + global_compute_code += "}\n\n"; } //set code secretly global_code += "\n\n"; String final_code = global_code; + final_code += global_compute_code; final_code += global_code_per_node; final_code += global_expressions; String tcode = code; @@ -1862,9 +2003,11 @@ void VisualShader::_bind_methods() { BIND_ENUM_CONSTANT(TYPE_VERTEX); BIND_ENUM_CONSTANT(TYPE_FRAGMENT); BIND_ENUM_CONSTANT(TYPE_LIGHT); - BIND_ENUM_CONSTANT(TYPE_EMIT); + BIND_ENUM_CONSTANT(TYPE_START); BIND_ENUM_CONSTANT(TYPE_PROCESS); - BIND_ENUM_CONSTANT(TYPE_END); + BIND_ENUM_CONSTANT(TYPE_COLLIDE); + BIND_ENUM_CONSTANT(TYPE_START_CUSTOM); + BIND_ENUM_CONSTANT(TYPE_PROCESS_CUSTOM); BIND_ENUM_CONSTANT(TYPE_SKY); BIND_ENUM_CONSTANT(TYPE_MAX); @@ -1875,11 +2018,20 @@ void VisualShader::_bind_methods() { VisualShader::VisualShader() { dirty.set(); for (int i = 0; i < TYPE_MAX; i++) { - Ref<VisualShaderNodeOutput> output; - output.instance(); - output->shader_type = Type(i); - output->shader_mode = shader_mode; - graph[i].nodes[NODE_ID_OUTPUT].node = output; + if (i > (int)TYPE_LIGHT && i < (int)TYPE_SKY) { + Ref<VisualShaderNodeParticleOutput> output; + output.instance(); + output->shader_type = Type(i); + output->shader_mode = shader_mode; + graph[i].nodes[NODE_ID_OUTPUT].node = output; + } else { + Ref<VisualShaderNodeOutput> output; + output.instance(); + output->shader_type = Type(i); + output->shader_mode = shader_mode; + graph[i].nodes[NODE_ID_OUTPUT].node = output; + } + graph[i].nodes[NODE_ID_OUTPUT].position = Vector2(400, 150); } } @@ -2008,27 +2160,45 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "specular_shininess", "SPECULAR_SHININESS.rgb" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "specular_shininess_alpha", "SPECULAR_SHININESS.a" }, - // Particles, Emit - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "restart", "float(RESTART ? 1.0 : 0.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "active", "float(ACTIVE ? 1.0 : 0.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + // Particles, Start + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_VECTOR, "attractor_force", "ATTRACTOR_FORCE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_BOOLEAN, "restart", "RESTART" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + + // Particles, Start (Custom) + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "attractor_force", "ATTRACTOR_FORCE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_BOOLEAN, "restart", "RESTART" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, // Particles, Process + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "attractor_force", "ATTRACTOR_FORCE" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "restart", "float(RESTART ? 1.0 : 0.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "active", "float(ACTIVE ? 1.0 : 0.0)" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_BOOLEAN, "restart", "RESTART" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, @@ -2038,20 +2208,39 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - // Particles, End - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "restart", "float(RESTART ? 1.0 : 0.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "active", "float(ACTIVE ? 1.0 : 0.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + // Particles, Process (Custom) + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "attractor_force", "ATTRACTOR_FORCE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_BOOLEAN, "restart", "RESTART" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + + // Particles, Collide + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_VECTOR, "attractor_force", "ATTRACTOR_FORCE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "collision_depth", "COLLISION_DEPTH" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_VECTOR, "collision_normal", "COLLISION_NORMAL" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_BOOLEAN, "restart", "RESTART" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, // Sky, Sky { Shader::MODE_SKY, VisualShader::TYPE_SKY, VisualShaderNode::PORT_TYPE_BOOLEAN, "at_cubemap_pass", "AT_CUBEMAP_PASS" }, @@ -2127,11 +2316,13 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = { { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "screen_uv", "vec3(SCREEN_UV, 0.0)" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, - // Particles, Vertex - { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "color", "vec3(1.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "1.0" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "vec3(0.0, 0.0, 1.0)" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + + // Particles + { Shader::MODE_PARTICLES, VisualShader::TYPE_START, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_COLLIDE, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_START_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, + { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS_CUSTOM, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr }, }; @@ -2624,30 +2815,7 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = { // Canvas Item, Light { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "light", "LIGHT.rgb" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "light_alpha", "LIGHT.a" }, - // Particles, Emit - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_EMIT, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, - // Particles, Process - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_PROCESS, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, - // Particles, End - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "VELOCITY" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" }, - { Shader::MODE_PARTICLES, VisualShader::TYPE_END, VisualShaderNode::PORT_TYPE_BOOLEAN, "active", "ACTIVE" }, + // Sky, Sky { Shader::MODE_SKY, VisualShader::TYPE_SKY, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR" }, { Shader::MODE_SKY, VisualShader::TYPE_SKY, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "ALPHA" }, diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index 21c4d23819..53b165fe0f 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -51,9 +51,11 @@ public: TYPE_VERTEX, TYPE_FRAGMENT, TYPE_LIGHT, - TYPE_EMIT, + TYPE_START, TYPE_PROCESS, - TYPE_END, + TYPE_COLLIDE, + TYPE_START_CUSTOM, + TYPE_PROCESS_CUSTOM, TYPE_SKY, TYPE_MAX }; diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 5bcc6dda97..d3b094de31 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -860,7 +860,7 @@ String VisualShaderNodeCurveTexture::generate_code(Shader::Mode p_mode, VisualSh } String id = make_unique_id(p_type, p_id, "curve"); String code; - code += "\t" + p_output_vars[0] + " = texture(" + id + ", vec2(" + p_input_vars[0] + ", 0.0)).r;\n"; + code += "\t" + p_output_vars[0] + " = texture(" + id + ", vec2(" + p_input_vars[0] + ")).r;\n"; return code; } diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader_particle_nodes.cpp new file mode 100644 index 0000000000..29d583a82a --- /dev/null +++ b/scene/resources/visual_shader_particle_nodes.cpp @@ -0,0 +1,1025 @@ +/*************************************************************************/ +/* visual_shader_particle_nodes.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "visual_shader_particle_nodes.h" + +// VisualShaderNodeParticleEmitter + +int VisualShaderNodeParticleEmitter::get_output_port_count() const { + return 1; +} + +VisualShaderNodeParticleEmitter::PortType VisualShaderNodeParticleEmitter::get_output_port_type(int p_port) const { + return PORT_TYPE_VECTOR; +} + +String VisualShaderNodeParticleEmitter::get_output_port_name(int p_port) const { + if (p_port == 0) { + return "position"; + } + return String(); +} + +VisualShaderNodeParticleEmitter::VisualShaderNodeParticleEmitter() { +} + +// VisualShaderNodeParticleSphereEmitter + +String VisualShaderNodeParticleSphereEmitter::get_caption() const { + return "SphereEmitter"; +} + +int VisualShaderNodeParticleSphereEmitter::get_input_port_count() const { + return 2; +} + +VisualShaderNodeParticleSphereEmitter::PortType VisualShaderNodeParticleSphereEmitter::get_input_port_type(int p_port) const { + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleSphereEmitter::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "radius"; + } else if (p_port == 1) { + return "inner_radius"; + } + return String(); +} + +String VisualShaderNodeParticleSphereEmitter::generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const { + String code; + code += "vec3 __get_random_point_in_sphere(inout uint seed, float radius, float inner_radius) {\n"; + code += "\treturn __get_random_unit_vec3(seed) * __randf_range(seed, inner_radius, radius);\n"; + code += "}\n\n"; + return code; +} + +String VisualShaderNodeParticleSphereEmitter::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + code += "\t" + p_output_vars[0] + " = __get_random_point_in_sphere(__seed, " + (p_input_vars[0].is_empty() ? (String)get_input_port_default_value(0) : p_input_vars[0]) + ", " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ");\n"; + return code; +} + +VisualShaderNodeParticleSphereEmitter::VisualShaderNodeParticleSphereEmitter() { + set_input_port_default_value(0, 10.0); + set_input_port_default_value(1, 0.0); +} + +// VisualShaderNodeParticleBoxEmitter + +String VisualShaderNodeParticleBoxEmitter::get_caption() const { + return "BoxEmitter"; +} + +int VisualShaderNodeParticleBoxEmitter::get_input_port_count() const { + return 1; +} + +VisualShaderNodeParticleBoxEmitter::PortType VisualShaderNodeParticleBoxEmitter::get_input_port_type(int p_port) const { + if (p_port == 0) { + return PORT_TYPE_VECTOR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleBoxEmitter::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "extents"; + } + return String(); +} + +String VisualShaderNodeParticleBoxEmitter::generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const { + String code; + code += "vec3 __get_random_point_in_box(inout uint seed, vec3 extents) {\n"; + code += "\tvec3 half_extents = extents / 2.0;\n"; + code += "\treturn vec3(__randf_range(seed, -half_extents.x, half_extents.x), __randf_range(seed, -half_extents.y, half_extents.y), __randf_range(seed, -half_extents.z, half_extents.z));\n"; + code += "}\n\n"; + return code; +} + +String VisualShaderNodeParticleBoxEmitter::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + code += "\t" + p_output_vars[0] + " = __get_random_point_in_box(__seed, " + (p_input_vars[0].is_empty() ? (String)get_input_port_default_value(0) : p_input_vars[0]) + ");\n"; + return code; +} + +VisualShaderNodeParticleBoxEmitter::VisualShaderNodeParticleBoxEmitter() { + set_input_port_default_value(0, Vector3(1.0, 1.0, 1.0)); +} + +// VisualShaderNodeParticleRingEmitter + +String VisualShaderNodeParticleRingEmitter::get_caption() const { + return "RingEmitter"; +} + +int VisualShaderNodeParticleRingEmitter::get_input_port_count() const { + return 3; +} + +VisualShaderNodeParticleRingEmitter::PortType VisualShaderNodeParticleRingEmitter::get_input_port_type(int p_port) const { + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleRingEmitter::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "radius"; + } else if (p_port == 1) { + return "inner_radius"; + } else if (p_port == 2) { + return "height"; + } + return String(); +} + +String VisualShaderNodeParticleRingEmitter::generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const { + String code; + code += "vec3 __get_random_point_on_ring(inout uint seed, float radius, float inner_radius, float height) {\n"; + code += "\tfloat angle = __rand_from_seed(seed) * PI * 2.0;\n"; + code += "\tvec2 ring = vec2(sin(angle), cos(angle)) * __randf_range(seed, inner_radius, radius);\n"; + code += "\treturn vec3(ring.x, __randf_range(seed, min(0.0, height), max(0.0, height)), ring.y);\n"; + code += "}\n\n"; + return code; +} + +String VisualShaderNodeParticleRingEmitter::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + code = "\t" + p_output_vars[0] + " = __get_random_point_on_ring(__seed, " + (p_input_vars[0].is_empty() ? (String)get_input_port_default_value(0) : p_input_vars[0]) + ", " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ", " + (p_input_vars[2].is_empty() ? (String)get_input_port_default_value(2) : p_input_vars[2]) + ");\n"; + return code; +} + +VisualShaderNodeParticleRingEmitter::VisualShaderNodeParticleRingEmitter() { + set_input_port_default_value(0, 10.0); + set_input_port_default_value(1, 0.0); + set_input_port_default_value(2, 0.0); +} + +// VisualShaderNodeParticleMultiplyByAxisAngle + +void VisualShaderNodeParticleMultiplyByAxisAngle::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_degrees_mode", "enabled"), &VisualShaderNodeParticleMultiplyByAxisAngle::set_degrees_mode); + ClassDB::bind_method(D_METHOD("is_degrees_mode"), &VisualShaderNodeParticleMultiplyByAxisAngle::is_degrees_mode); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "degrees_mode"), "set_degrees_mode", "is_degrees_mode"); +} + +String VisualShaderNodeParticleMultiplyByAxisAngle::get_caption() const { + return "MultiplyByAxisAngle"; +} + +int VisualShaderNodeParticleMultiplyByAxisAngle::get_input_port_count() const { + return 3; +} + +VisualShaderNodeParticleMultiplyByAxisAngle::PortType VisualShaderNodeParticleMultiplyByAxisAngle::get_input_port_type(int p_port) const { + if (p_port == 0 || p_port == 1) { // position, rotation_axis + return PORT_TYPE_VECTOR; + } + return PORT_TYPE_SCALAR; // angle (degrees/radians) +} + +String VisualShaderNodeParticleMultiplyByAxisAngle::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "position"; + } + if (p_port == 1) { + return "axis"; + } + if (p_port == 2) { + if (degrees_mode) { + return "angle (degrees)"; + } else { + return "angle (radians)"; + } + } + return String(); +} + +bool VisualShaderNodeParticleMultiplyByAxisAngle::is_show_prop_names() const { + return true; +} + +int VisualShaderNodeParticleMultiplyByAxisAngle::get_output_port_count() const { + return 1; +} + +VisualShaderNodeParticleMultiplyByAxisAngle::PortType VisualShaderNodeParticleMultiplyByAxisAngle::get_output_port_type(int p_port) const { + return PORT_TYPE_VECTOR; +} + +String VisualShaderNodeParticleMultiplyByAxisAngle::get_output_port_name(int p_port) const { + return "position"; +} + +String VisualShaderNodeParticleMultiplyByAxisAngle::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + if (degrees_mode) { + code += "\t" + p_output_vars[0] + " = __build_rotation_mat3(" + (p_input_vars[1].is_empty() ? ("vec3" + (String)get_input_port_default_value(1)) : p_input_vars[1]) + ", radians(" + (p_input_vars[2].is_empty() ? (String)get_input_port_default_value(2) : p_input_vars[2]) + ")) * " + (p_input_vars[0].is_empty() ? "vec3(0.0)" : p_input_vars[0]) + ";\n"; + } else { + code += "\t" + p_output_vars[0] + " = __build_rotation_mat3(" + (p_input_vars[1].is_empty() ? ("vec3" + (String)get_input_port_default_value(1)) : p_input_vars[1]) + ", " + (p_input_vars[2].is_empty() ? (String)get_input_port_default_value(2) : p_input_vars[2]) + ") * " + (p_input_vars[0].is_empty() ? "vec3(0.0)" : p_input_vars[0]) + ";\n"; + } + return code; +} + +void VisualShaderNodeParticleMultiplyByAxisAngle::set_degrees_mode(bool p_enabled) { + degrees_mode = p_enabled; + emit_changed(); +} + +bool VisualShaderNodeParticleMultiplyByAxisAngle::is_degrees_mode() const { + return degrees_mode; +} + +Vector<StringName> VisualShaderNodeParticleMultiplyByAxisAngle::get_editable_properties() const { + Vector<StringName> props; + props.push_back("degrees_mode"); + props.push_back("axis_amount"); + return props; +} + +VisualShaderNodeParticleMultiplyByAxisAngle::VisualShaderNodeParticleMultiplyByAxisAngle() { + set_input_port_default_value(1, Vector3(1, 0, 0)); + set_input_port_default_value(2, 0.0); +} + +// VisualShaderNodeParticleConeVelocity + +String VisualShaderNodeParticleConeVelocity::get_caption() const { + return "ConeVelocity"; +} + +int VisualShaderNodeParticleConeVelocity::get_input_port_count() const { + return 2; +} + +VisualShaderNodeParticleConeVelocity::PortType VisualShaderNodeParticleConeVelocity::get_input_port_type(int p_port) const { + if (p_port == 0) { + return PORT_TYPE_VECTOR; + } else if (p_port == 1) { + return PORT_TYPE_SCALAR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleConeVelocity::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "direction"; + } else if (p_port == 1) { + return "spread(degrees)"; + } + return String(); +} + +int VisualShaderNodeParticleConeVelocity::get_output_port_count() const { + return 1; +} + +VisualShaderNodeParticleConeVelocity::PortType VisualShaderNodeParticleConeVelocity::get_output_port_type(int p_port) const { + return PORT_TYPE_VECTOR; +} + +String VisualShaderNodeParticleConeVelocity::get_output_port_name(int p_port) const { + if (p_port == 0) { + return "velocity"; + } + return String(); +} + +String VisualShaderNodeParticleConeVelocity::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + code += "\t__radians = radians(" + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ");\n"; + code += "\t__scalar_buff1 = __rand_from_seed_m1_p1(__seed) * __radians;\n"; + code += "\t__scalar_buff2 = __rand_from_seed_m1_p1(__seed) * __radians;\n"; + code += "\t__vec3_buff1 = " + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + ";\n"; + code += "\t__scalar_buff1 += __vec3_buff1.z != 0.0 ? atan(__vec3_buff1.x, __vec3_buff1.z) : sign(__vec3_buff1.x) * (PI / 2.0);\n"; + code += "\t__scalar_buff2 += __vec3_buff1.z != 0.0 ? atan(__vec3_buff1.y, abs(__vec3_buff1.z)) : (__vec3_buff1.x != 0.0 ? atan(__vec3_buff1.y, abs(__vec3_buff1.x)) : sign(__vec3_buff1.y) * (PI / 2.0));\n"; + code += "\t__vec3_buff1 = vec3(sin(__scalar_buff1), 0.0, cos(__scalar_buff1));\n"; + code += "\t__vec3_buff2 = vec3(0.0, sin(__scalar_buff2), cos(__scalar_buff2));\n"; + code += "\t__vec3_buff2.z = __vec3_buff2.z / max(0.0001, sqrt(abs(__vec3_buff2.z)));\n"; + code += "\t" + p_output_vars[0] + " = normalize(vec3(__vec3_buff1.x * __vec3_buff2.z, __vec3_buff2.y, __vec3_buff1.z * __vec3_buff2.z));\n"; + return code; +} + +VisualShaderNodeParticleConeVelocity::VisualShaderNodeParticleConeVelocity() { + set_input_port_default_value(0, Vector3(1, 0, 0)); + set_input_port_default_value(1, 45.0); +} + +// VisualShaderNodeParticleRandomness + +void VisualShaderNodeParticleRandomness::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_op_type", "type"), &VisualShaderNodeParticleRandomness::set_op_type); + ClassDB::bind_method(D_METHOD("get_op_type"), &VisualShaderNodeParticleRandomness::get_op_type); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Scalar,Vector"), "set_op_type", "get_op_type"); + + BIND_ENUM_CONSTANT(OP_TYPE_SCALAR); + BIND_ENUM_CONSTANT(OP_TYPE_VECTOR); + BIND_ENUM_CONSTANT(OP_TYPE_MAX); +} + +Vector<StringName> VisualShaderNodeParticleRandomness::get_editable_properties() const { + Vector<StringName> props; + props.push_back("op_type"); + return props; +} + +String VisualShaderNodeParticleRandomness::get_caption() const { + return "ParticleRandomness"; +} + +int VisualShaderNodeParticleRandomness::get_output_port_count() const { + return 1; +} + +VisualShaderNodeParticleRandomness::PortType VisualShaderNodeParticleRandomness::get_output_port_type(int p_port) const { + if (op_type == OP_TYPE_VECTOR) { + return PORT_TYPE_VECTOR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleRandomness::get_output_port_name(int p_port) const { + return "random"; +} + +int VisualShaderNodeParticleRandomness::get_input_port_count() const { + return 2; +} + +VisualShaderNodeParticleRandomness::PortType VisualShaderNodeParticleRandomness::get_input_port_type(int p_port) const { + if (op_type == OP_TYPE_VECTOR) { + return PORT_TYPE_VECTOR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleRandomness::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "min"; + } else if (p_port == 1) { + return "max"; + } + return String(); +} + +String VisualShaderNodeParticleRandomness::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + if (op_type == OP_TYPE_SCALAR) { + code += vformat("\t%s = __randf_range(__seed, %s, %s);\n", p_output_vars[0], p_input_vars[0].is_empty() ? (String)get_input_port_default_value(0) : p_input_vars[0], p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]); + } else if (op_type == OP_TYPE_VECTOR) { + code += vformat("\t%s = __randv_range(__seed, %s, %s);\n", p_output_vars[0], p_input_vars[0].is_empty() ? (String)get_input_port_default_value(0) : p_input_vars[0], p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]); + } + return code; +} + +void VisualShaderNodeParticleRandomness::set_op_type(OpType p_op_type) { + ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX); + if (p_op_type != op_type) { + if (p_op_type == OP_TYPE_SCALAR) { + set_input_port_default_value(0, 0.0); + set_input_port_default_value(1, 1.0); + } else { + set_input_port_default_value(0, Vector3(-1.0, -1.0, -1.0)); + set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0)); + } + } + op_type = p_op_type; + emit_changed(); +} + +VisualShaderNodeParticleRandomness::OpType VisualShaderNodeParticleRandomness::get_op_type() const { + return op_type; +} + +VisualShaderNodeParticleRandomness::VisualShaderNodeParticleRandomness() { + set_input_port_default_value(0, 0.0); + set_input_port_default_value(1, 1.0); +} + +// VisualShaderNodeParticleAccelerator + +void VisualShaderNodeParticleAccelerator::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_mode", "mode"), &VisualShaderNodeParticleAccelerator::set_mode); + ClassDB::bind_method(D_METHOD("get_mode"), &VisualShaderNodeParticleAccelerator::get_mode); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Linear,Radial,Tangential"), "set_mode", "get_mode"); + + BIND_ENUM_CONSTANT(MODE_LINEAR); + BIND_ENUM_CONSTANT(MODE_RADIAL) + BIND_ENUM_CONSTANT(MODE_TANGENTIAL); + BIND_ENUM_CONSTANT(MODE_MAX); +} + +Vector<StringName> VisualShaderNodeParticleAccelerator::get_editable_properties() const { + Vector<StringName> props; + props.push_back("mode"); + return props; +} + +String VisualShaderNodeParticleAccelerator::get_caption() const { + return "ParticleAccelerator"; +} + +int VisualShaderNodeParticleAccelerator::get_output_port_count() const { + return 1; +} + +VisualShaderNodeParticleAccelerator::PortType VisualShaderNodeParticleAccelerator::get_output_port_type(int p_port) const { + return PORT_TYPE_VECTOR; +} + +String VisualShaderNodeParticleAccelerator::get_output_port_name(int p_port) const { + return String(); +} + +int VisualShaderNodeParticleAccelerator::get_input_port_count() const { + return 3; +} + +VisualShaderNodeParticleAccelerator::PortType VisualShaderNodeParticleAccelerator::get_input_port_type(int p_port) const { + if (p_port == 0) { + return PORT_TYPE_VECTOR; + } else if (p_port == 1) { + return PORT_TYPE_SCALAR; + } else if (p_port == 2) { + return PORT_TYPE_VECTOR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleAccelerator::get_input_port_name(int p_port) const { + if (p_port == 0) { + return "amount"; + } else if (p_port == 1) { + return "randomness"; + } else if (p_port == 2) { + return "axis"; + } + return String(); +} + +String VisualShaderNodeParticleAccelerator::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + switch (mode) { + case MODE_LINEAR: + code += "\t" + p_output_vars[0] + " = length(VELOCITY) > 0.0 ? " + "normalize(VELOCITY) * " + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + " * mix(1.0, __rand_from_seed(__seed), " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ") : vec3(0.0);\n"; + break; + case MODE_RADIAL: + code += "\t" + p_output_vars[0] + " = length(__diff) > 0.0 ? __ndiff * " + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + " * mix(1.0, __rand_from_seed(__seed), " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ") : vec3(0.0);\n"; + break; + case MODE_TANGENTIAL: + code += "\t__vec3_buff1 = cross(__ndiff, normalize(" + (p_input_vars[2].is_empty() ? "vec3" + (String)get_input_port_default_value(2) : p_input_vars[2]) + "));\n"; + code += "\t" + p_output_vars[0] + " = length(__vec3_buff1) > 0.0 ? normalize(__vec3_buff1) * (" + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + " * mix(1.0, __rand_from_seed(__seed), " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ")) : vec3(0.0);\n"; + break; + case MODE_MAX: + break; + default: + break; + } + + return code; +} + +void VisualShaderNodeParticleAccelerator::set_mode(Mode p_mode) { + mode = p_mode; + emit_changed(); +} + +VisualShaderNodeParticleAccelerator::Mode VisualShaderNodeParticleAccelerator::get_mode() const { + return mode; +} + +VisualShaderNodeParticleAccelerator::VisualShaderNodeParticleAccelerator() { + set_input_port_default_value(0, Vector3(1, 1, 1)); + set_input_port_default_value(1, 0.0); + set_input_port_default_value(2, Vector3(0, -9.8, 0)); +} + +// VisualShaderNodeParticleOutput + +String VisualShaderNodeParticleOutput::get_caption() const { + if (shader_type == VisualShader::TYPE_START) { + return "StartOutput"; + } else if (shader_type == VisualShader::TYPE_PROCESS) { + return "ProcessOutput"; + } else if (shader_type == VisualShader::TYPE_COLLIDE) { + return "CollideOutput"; + } else if (shader_type == VisualShader::TYPE_START_CUSTOM) { + return "CustomStartOutput"; + } else if (shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + return "CustomProcessOutput"; + } + return String(); +} + +int VisualShaderNodeParticleOutput::get_input_port_count() const { + if (shader_type == VisualShader::TYPE_START) { + return 8; + } else if (shader_type == VisualShader::TYPE_COLLIDE) { + return 5; + } else if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + return 6; + } else { // TYPE_PROCESS + return 7; + } + return 0; +} + +VisualShaderNodeParticleOutput::PortType VisualShaderNodeParticleOutput::get_input_port_type(int p_port) const { + switch (p_port) { + case 0: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + return PORT_TYPE_VECTOR; // custom.rgb + } + return PORT_TYPE_BOOLEAN; // active + case 1: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + break; // custom.a (scalar) + } + return PORT_TYPE_VECTOR; // velocity + case 2: + return PORT_TYPE_VECTOR; // color & velocity + case 3: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + return PORT_TYPE_VECTOR; // color + } + break; // alpha (scalar) + case 4: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + break; // alpha + } + if (shader_type == VisualShader::TYPE_PROCESS) { + break; // scale + } + if (shader_type == VisualShader::TYPE_COLLIDE) { + return PORT_TYPE_TRANSFORM; // transform + } + return PORT_TYPE_VECTOR; // position + case 5: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + return PORT_TYPE_TRANSFORM; // transform + } + if (shader_type == VisualShader::TYPE_PROCESS) { + return PORT_TYPE_VECTOR; // rotation_axis + } + break; // scale (scalar) + case 6: + if (shader_type == VisualShader::TYPE_START) { + return PORT_TYPE_VECTOR; // rotation_axis + } + break; + case 7: + break; // angle (scalar) + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleOutput::get_input_port_name(int p_port) const { + String port_name; + switch (p_port) { + case 0: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "custom"; + break; + } + port_name = "active"; + break; + case 1: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "custom_alpha"; + break; + } + port_name = "velocity"; + break; + case 2: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "velocity"; + break; + } + port_name = "color"; + break; + case 3: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "color"; + break; + } + port_name = "alpha"; + break; + case 4: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "alpha"; + break; + } + if (shader_type == VisualShader::TYPE_PROCESS) { + port_name = "scale"; + break; + } + if (shader_type == VisualShader::TYPE_COLLIDE) { + port_name = "transform"; + break; + } + port_name = "position"; + break; + case 5: + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + port_name = "transform"; + break; + } + if (shader_type == VisualShader::TYPE_PROCESS) { + port_name = "rotation_axis"; + break; + } + port_name = "scale"; + break; + case 6: + if (shader_type == VisualShader::TYPE_PROCESS) { + port_name = "angle_in_radians"; + break; + } + port_name = "rotation_axis"; + break; + case 7: + port_name = "angle_in_radians"; + break; + default: + break; + } + if (!port_name.is_empty()) { + return port_name.capitalize(); + } + return String(); +} + +bool VisualShaderNodeParticleOutput::is_port_separator(int p_index) const { + if (shader_type == VisualShader::TYPE_START || shader_type == VisualShader::TYPE_PROCESS) { + String name = get_input_port_name(p_index); + return bool(name == "Scale"); + } + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + String name = get_input_port_name(p_index); + return bool(name == "Velocity"); + } + return false; +} + +String VisualShaderNodeParticleOutput::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + String tab = "\t"; + + if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { + if (!p_input_vars[0].is_empty()) { // custom.rgb + code += tab + "CUSTOM.rgb = " + p_input_vars[0] + ";\n"; + } + if (!p_input_vars[1].is_empty()) { // custom.a + code += tab + "CUSTOM.a = " + p_input_vars[1] + ";\n"; + } + if (!p_input_vars[2].is_empty()) { // velocity + code += tab + "VELOCITY = " + p_input_vars[2] + ";\n"; + } + if (!p_input_vars[3].is_empty()) { // color.rgb + code += tab + "COLOR.rgb = " + p_input_vars[3] + ";\n"; + } + if (!p_input_vars[4].is_empty()) { // color.a + code += tab + "COLOR.a = " + p_input_vars[4] + ";\n"; + } + if (!p_input_vars[5].is_empty()) { // transform + code += tab + "TRANSFORM = " + p_input_vars[5] + ";\n"; + } + } else { + if (!p_input_vars[0].is_empty()) { // active (begin) + code += tab + "ACTIVE = " + p_input_vars[0] + ";\n"; + code += tab + "if(ACTIVE) {\n"; + tab += "\t"; + } + if (!p_input_vars[1].is_empty()) { // velocity + code += tab + "VELOCITY = " + p_input_vars[1] + ";\n"; + } + if (!p_input_vars[2].is_empty()) { // color + code += tab + "COLOR.rgb = " + p_input_vars[2] + ";\n"; + } + if (!p_input_vars[3].is_empty()) { // alpha + code += tab + "COLOR.a = " + p_input_vars[3] + ";\n"; + } + + // position + if (shader_type == VisualShader::TYPE_START) { + code += tab + "if (RESTART_POSITION) {\n"; + if (!p_input_vars[4].is_empty()) { + code += tab + "\tTRANSFORM = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(" + p_input_vars[4] + ", 1.0));\n"; + } else { + code += tab + "\tTRANSFORM = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + } + code += tab + "\tif (RESTART_VELOCITY) {\n"; + code += tab + "\t\tVELOCITY = (EMISSION_TRANSFORM * vec4(VELOCITY, 0.0)).xyz;\n"; + code += tab + "\t}\n"; + code += tab + "\tTRANSFORM = EMISSION_TRANSFORM * TRANSFORM;\n"; + code += tab + "}\n"; + } else if (shader_type == VisualShader::TYPE_COLLIDE) { // position + if (!p_input_vars[4].is_empty()) { + code += tab + "TRANSFORM = " + p_input_vars[4] + ";\n"; + } + } + + if (shader_type == VisualShader::TYPE_START || shader_type == VisualShader::TYPE_PROCESS) { + int scale = 5; + int rotation_axis = 6; + int rotation = 7; + if (shader_type == VisualShader::TYPE_PROCESS) { + scale = 4; + rotation_axis = 5; + rotation = 6; + } + String op; + if (shader_type == VisualShader::TYPE_START) { + op = "*="; + } else { + op = "="; + } + + if (!p_input_vars[rotation].is_empty()) { // rotation_axis & angle_in_radians + String axis; + if (p_input_vars[rotation_axis].is_empty()) { + axis = "vec3(0, 1, 0)"; + } else { + axis = p_input_vars[rotation_axis]; + } + code += tab + "TRANSFORM " + op + " __build_rotation_mat4(" + axis + ", " + p_input_vars[rotation] + ");\n"; + } + if (!p_input_vars[scale].is_empty()) { // scale + code += tab + "TRANSFORM " + op + " mat4(vec4(" + p_input_vars[scale] + ", 0, 0, 0), vec4(0, " + p_input_vars[scale] + ", 0, 0), vec4(0, 0, " + p_input_vars[scale] + ", 0), vec4(0, 0, 0, 1));\n"; + } + } + if (!p_input_vars[0].is_empty()) { // active (end) + code += "\t}\n"; + } + } + return code; +} + +VisualShaderNodeParticleOutput::VisualShaderNodeParticleOutput() { +} + +// EmitParticle + +Vector<StringName> VisualShaderNodeParticleEmit::get_editable_properties() const { + Vector<StringName> props; + props.push_back("flags"); + return props; +} + +void VisualShaderNodeParticleEmit::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_flags", "flags"), &VisualShaderNodeParticleEmit::set_flags); + ClassDB::bind_method(D_METHOD("get_flags"), &VisualShaderNodeParticleEmit::get_flags); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Position,RotScale,Velocity,Color,Custom"), "set_flags", "get_flags"); + + BIND_ENUM_CONSTANT(EMIT_FLAG_POSITION); + BIND_ENUM_CONSTANT(EMIT_FLAG_ROT_SCALE); + BIND_ENUM_CONSTANT(EMIT_FLAG_VELOCITY); + BIND_ENUM_CONSTANT(EMIT_FLAG_COLOR); + BIND_ENUM_CONSTANT(EMIT_FLAG_CUSTOM); +} + +String VisualShaderNodeParticleEmit::get_caption() const { + return "EmitParticle"; +} + +int VisualShaderNodeParticleEmit::get_input_port_count() const { + return 7; +} + +VisualShaderNodeParticleEmit::PortType VisualShaderNodeParticleEmit::get_input_port_type(int p_port) const { + switch (p_port) { + case 0: + return PORT_TYPE_BOOLEAN; + case 1: + return PORT_TYPE_TRANSFORM; + case 2: + return PORT_TYPE_VECTOR; + case 3: + return PORT_TYPE_VECTOR; + case 4: + return PORT_TYPE_SCALAR; + case 5: + return PORT_TYPE_VECTOR; + case 6: + return PORT_TYPE_SCALAR; + } + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleEmit::get_input_port_name(int p_port) const { + switch (p_port) { + case 0: + return "condition"; + case 1: + return "transform"; + case 2: + return "velocity"; + case 3: + return "color"; + case 4: + return "alpha"; + case 5: + return "custom"; + case 6: + return "custom_alpha"; + } + return String(); +} + +int VisualShaderNodeParticleEmit::get_output_port_count() const { + return 0; +} + +VisualShaderNodeParticleEmit::PortType VisualShaderNodeParticleEmit::get_output_port_type(int p_port) const { + return PORT_TYPE_SCALAR; +} + +String VisualShaderNodeParticleEmit::get_output_port_name(int p_port) const { + return String(); +} + +void VisualShaderNodeParticleEmit::add_flag(EmitFlags p_flag) { + flags |= p_flag; + emit_changed(); +} + +bool VisualShaderNodeParticleEmit::has_flag(EmitFlags p_flag) const { + return flags & p_flag; +} + +void VisualShaderNodeParticleEmit::set_flags(EmitFlags p_flags) { + flags = (int)p_flags; + emit_changed(); +} + +VisualShaderNodeParticleEmit::EmitFlags VisualShaderNodeParticleEmit::get_flags() const { + return EmitFlags(flags); +} + +bool VisualShaderNodeParticleEmit::is_show_prop_names() const { + return true; +} + +bool VisualShaderNodeParticleEmit::is_generate_input_var(int p_port) const { + if (p_port == 0) { + if (!is_input_port_connected(0)) { + return false; + } + } + return true; +} + +String VisualShaderNodeParticleEmit::get_input_port_default_hint(int p_port) const { + switch (p_port) { + case 1: + return "default"; + case 2: + return "default"; + case 3: + return "default"; + case 4: + return "default"; + case 5: + return "default"; + case 6: + return "default"; + } + return String(); +} + +String VisualShaderNodeParticleEmit::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + String code; + String tab; + bool default_condition = false; + + if (!is_input_port_connected(0)) { + default_condition = true; + if (get_input_port_default_value(0)) { + tab = "\t"; + } else { + return code; + } + } else { + tab = "\t\t"; + } + + String transform; + if (p_input_vars[1].is_empty()) { + transform = "TRANSFORM"; + } else { + transform = p_input_vars[1]; + } + + String velocity; + if (p_input_vars[2].is_empty()) { + velocity = "VELOCITY"; + } else { + velocity = p_input_vars[2]; + } + + String color; + if (p_input_vars[3].is_empty()) { + color = "COLOR.rgb"; + } else { + color = p_input_vars[3]; + } + + String alpha; + if (p_input_vars[4].is_empty()) { + alpha = "COLOR.a"; + } else { + alpha = p_input_vars[4]; + } + + String custom; + if (p_input_vars[5].is_empty()) { + custom = "CUSTOM.rgb"; + } else { + custom = p_input_vars[5]; + } + + String custom_alpha; + if (p_input_vars[6].is_empty()) { + custom_alpha = "CUSTOM.a"; + } else { + custom_alpha = p_input_vars[6]; + } + + List<String> flags_arr; + + if (has_flag(EmitFlags::EMIT_FLAG_POSITION)) { + flags_arr.push_back("FLAG_EMIT_POSITION"); + } + if (has_flag(EmitFlags::EMIT_FLAG_ROT_SCALE)) { + flags_arr.push_back("FLAG_EMIT_ROT_SCALE"); + } + if (has_flag(EmitFlags::EMIT_FLAG_VELOCITY)) { + flags_arr.push_back("FLAG_EMIT_VELOCITY"); + } + if (has_flag(EmitFlags::EMIT_FLAG_COLOR)) { + flags_arr.push_back("FLAG_EMIT_COLOR"); + } + if (has_flag(EmitFlags::EMIT_FLAG_CUSTOM)) { + flags_arr.push_back("FLAG_EMIT_CUSTOM"); + } + + String flags; + + for (int i = 0; i < flags_arr.size(); i++) { + if (i > 0) { + flags += "|"; + } + flags += flags_arr[i]; + } + + if (flags.is_empty()) { + flags = "uint(0)"; + } + + if (!default_condition) { + code += "\tif (" + p_input_vars[0] + ") {\n"; + } + + code += tab + "emit_subparticle(" + transform + ", " + velocity + ", vec4(" + color + ", " + alpha + "), vec4(" + custom + ", " + custom_alpha + "), " + flags + ");\n"; + + if (!default_condition) { + code += "\t}\n"; + } + + return code; +} + +VisualShaderNodeParticleEmit::VisualShaderNodeParticleEmit() { + set_input_port_default_value(0, true); +} diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader_particle_nodes.h new file mode 100644 index 0000000000..ecd187a885 --- /dev/null +++ b/scene/resources/visual_shader_particle_nodes.h @@ -0,0 +1,285 @@ +/*************************************************************************/ +/* visual_shader_particle_nodes.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef VISUAL_SHADER_PARTICLE_NODES_H +#define VISUAL_SHADER_PARTICLE_NODES_H + +#include "scene/resources/visual_shader.h" + +// Emit nodes + +class VisualShaderNodeParticleEmitter : public VisualShaderNode { + GDCLASS(VisualShaderNodeParticleEmitter, VisualShaderNode); + +public: + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + VisualShaderNodeParticleEmitter(); +}; + +class VisualShaderNodeParticleSphereEmitter : public VisualShaderNodeParticleEmitter { + GDCLASS(VisualShaderNodeParticleSphereEmitter, VisualShaderNodeParticleEmitter); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual String generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleSphereEmitter(); +}; + +class VisualShaderNodeParticleBoxEmitter : public VisualShaderNodeParticleEmitter { + GDCLASS(VisualShaderNodeParticleBoxEmitter, VisualShaderNodeParticleEmitter); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual String generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleBoxEmitter(); +}; + +class VisualShaderNodeParticleRingEmitter : public VisualShaderNodeParticleEmitter { + GDCLASS(VisualShaderNodeParticleRingEmitter, VisualShaderNodeParticleEmitter); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual String generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleRingEmitter(); +}; + +class VisualShaderNodeParticleMultiplyByAxisAngle : public VisualShaderNode { + GDCLASS(VisualShaderNodeParticleMultiplyByAxisAngle, VisualShaderNode); + bool degrees_mode = true; + +protected: + static void _bind_methods(); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + virtual bool is_show_prop_names() const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + void set_degrees_mode(bool p_enabled); + bool is_degrees_mode() const; + Vector<StringName> get_editable_properties() const override; + + VisualShaderNodeParticleMultiplyByAxisAngle(); +}; + +class VisualShaderNodeParticleConeVelocity : public VisualShaderNode { + GDCLASS(VisualShaderNodeParticleConeVelocity, VisualShaderNode); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleConeVelocity(); +}; + +class VisualShaderNodeParticleRandomness : public VisualShaderNode { + GDCLASS(VisualShaderNodeParticleRandomness, VisualShaderNode); + +public: + enum OpType { + OP_TYPE_SCALAR, + OP_TYPE_VECTOR, + OP_TYPE_MAX, + }; + +private: + OpType op_type = OP_TYPE_SCALAR; + +protected: + static void _bind_methods(); + +public: + Vector<StringName> get_editable_properties() const override; + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + void set_op_type(OpType p_type); + OpType get_op_type() const; + + VisualShaderNodeParticleRandomness(); +}; + +VARIANT_ENUM_CAST(VisualShaderNodeParticleRandomness::OpType) + +// Process nodes + +class VisualShaderNodeParticleAccelerator : public VisualShaderNodeOutput { + GDCLASS(VisualShaderNodeParticleAccelerator, VisualShaderNodeOutput); + +public: + enum Mode { + MODE_LINEAR, + MODE_RADIAL, + MODE_TANGENTIAL, + MODE_MAX, + }; + +private: + Mode mode = MODE_LINEAR; + +protected: + static void _bind_methods(); + +public: + Vector<StringName> get_editable_properties() const override; + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + void set_mode(Mode p_mode); + Mode get_mode() const; + + VisualShaderNodeParticleAccelerator(); +}; + +VARIANT_ENUM_CAST(VisualShaderNodeParticleAccelerator::Mode) + +// Common nodes + +class VisualShaderNodeParticleOutput : public VisualShaderNodeOutput { + GDCLASS(VisualShaderNodeParticleOutput, VisualShaderNodeOutput); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + virtual bool is_port_separator(int p_index) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleOutput(); +}; + +class VisualShaderNodeParticleEmit : public VisualShaderNode { + GDCLASS(VisualShaderNodeParticleEmit, VisualShaderNode); + +public: + enum EmitFlags { + EMIT_FLAG_POSITION = 1, + EMIT_FLAG_ROT_SCALE = 2, + EMIT_FLAG_VELOCITY = 4, + EMIT_FLAG_COLOR = 8, + EMIT_FLAG_CUSTOM = 16, + }; + +protected: + int flags = EMIT_FLAG_POSITION | EMIT_FLAG_ROT_SCALE | EMIT_FLAG_VELOCITY | EMIT_FLAG_COLOR | EMIT_FLAG_CUSTOM; + static void _bind_methods(); + +public: + Vector<StringName> get_editable_properties() const override; + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + void add_flag(EmitFlags p_flag); + bool has_flag(EmitFlags p_flag) const; + + void set_flags(EmitFlags p_flags); + EmitFlags get_flags() const; + + virtual bool is_show_prop_names() const override; + virtual bool is_generate_input_var(int p_port) const override; + virtual String get_input_port_default_hint(int p_port) const override; + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + VisualShaderNodeParticleEmit(); +}; + +VARIANT_ENUM_CAST(VisualShaderNodeParticleEmit::EmitFlags) + +#endif diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h index 4556db9b93..5d14f03199 100644 --- a/servers/audio/audio_effect.h +++ b/servers/audio/audio_effect.h @@ -34,8 +34,8 @@ #include "core/io/resource.h" #include "core/math/audio_frame.h" -class AudioEffectInstance : public Reference { - GDCLASS(AudioEffectInstance, Reference); +class AudioEffectInstance : public RefCounted { + GDCLASS(AudioEffectInstance, RefCounted); public: virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0; diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h index 93566783be..0d426f99b2 100644 --- a/servers/audio/audio_stream.h +++ b/servers/audio/audio_stream.h @@ -36,8 +36,8 @@ #include "servers/audio/audio_filter_sw.h" #include "servers/audio_server.h" -class AudioStreamPlayback : public Reference { - GDCLASS(AudioStreamPlayback, Reference); +class AudioStreamPlayback : public RefCounted { + GDCLASS(AudioStreamPlayback, RefCounted); public: virtual void start(float p_from_pos = 0.0) = 0; diff --git a/servers/audio/effects/audio_effect_capture.h b/servers/audio/effects/audio_effect_capture.h index 81d4ed6b0f..82686d5b4c 100644 --- a/servers/audio/effects/audio_effect_capture.h +++ b/servers/audio/effects/audio_effect_capture.h @@ -33,7 +33,7 @@ #include "core/config/engine.h" #include "core/math/audio_frame.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/templates/vector.h" #include "servers/audio/audio_effect.h" #include "servers/audio_server.h" diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h index b97ec43946..8f56e227e0 100644 --- a/servers/audio/effects/audio_effect_record.h +++ b/servers/audio/effects/audio_effect_record.h @@ -31,8 +31,8 @@ #ifndef AUDIOEFFECTRECORD_H #define AUDIOEFFECTRECORD_H +#include "core/io/file_access.h" #include "core/io/marshalls.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/os/thread.h" #include "editor/import/resource_importer_wav.h" diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 0e816fd4f8..acfdfa783a 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -32,8 +32,8 @@ #include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" +#include "core/io/file_access.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "scene/resources/audio_stream_sample.h" #include "servers/audio/audio_driver_dummy.h" diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h index eb4ef155bc..fac7ae1b2d 100644 --- a/servers/camera/camera_feed.h +++ b/servers/camera/camera_feed.h @@ -43,8 +43,8 @@ camera feeds that can be used as the background for our environment. **/ -class CameraFeed : public Reference { - GDCLASS(CameraFeed, Reference); +class CameraFeed : public RefCounted { + GDCLASS(CameraFeed, RefCounted); public: enum FeedDataType { diff --git a/servers/camera_server.h b/servers/camera_server.h index 97aa8f74ba..7390129df9 100644 --- a/servers/camera_server.h +++ b/servers/camera_server.h @@ -32,7 +32,7 @@ #define CAMERA_SERVER_H #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/thread_safe.h" #include "core/templates/rid.h" #include "core/variant/variant.h" diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.cpp b/servers/physics_2d/physics_server_2d_wrap_mt.cpp index 790c87cc44..930b19c2cb 100644 --- a/servers/physics_2d/physics_server_2d_wrap_mt.cpp +++ b/servers/physics_2d/physics_server_2d_wrap_mt.cpp @@ -56,7 +56,7 @@ void PhysicsServer2DWrapMT::thread_loop() { step_thread_up.set(); while (!exit.is_set()) { // flush commands one by one, until exit is requested - command_queue.wait_and_flush_one(); + command_queue.wait_and_flush(); } command_queue.flush_all(); // flush all diff --git a/servers/physics_3d/physics_server_3d_wrap_mt.cpp b/servers/physics_3d/physics_server_3d_wrap_mt.cpp index f73f67a756..0a89c1a9c9 100644 --- a/servers/physics_3d/physics_server_3d_wrap_mt.cpp +++ b/servers/physics_3d/physics_server_3d_wrap_mt.cpp @@ -56,7 +56,7 @@ void PhysicsServer3DWrapMT::thread_loop() { step_thread_up = true; while (!exit) { // flush commands one by one, until exit is requested - command_queue.wait_and_flush_one(); + command_queue.wait_and_flush(); } command_queue.flush_all(); // flush all diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp index 4392202084..c1e09c9a22 100644 --- a/servers/physics_3d/space_3d_sw.cpp +++ b/servers/physics_3d/space_3d_sw.cpp @@ -807,6 +807,13 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform3D &p_from, co const CollisionObject3DSW *col_obj = intersection_query_results[i]; int shape_idx = intersection_query_subindex_results[i]; + if (CollisionObject3DSW::TYPE_BODY == col_obj->get_type()) { + const Body3DSW *b = static_cast<const Body3DSW *>(col_obj); + if (p_infinite_inertia && PhysicsServer3D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer3D::BODY_MODE_KINEMATIC != b->get_mode()) { + continue; + } + } + if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, nullptr, p_margin)) { collided = cbk.amount > 0; } @@ -889,6 +896,13 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform3D &p_from, co const CollisionObject3DSW *col_obj = intersection_query_results[i]; int shape_idx = intersection_query_subindex_results[i]; + if (CollisionObject3DSW::TYPE_BODY == col_obj->get_type()) { + const Body3DSW *b = static_cast<const Body3DSW *>(col_obj); + if (p_infinite_inertia && PhysicsServer3D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer3D::BODY_MODE_KINEMATIC != b->get_mode()) { + continue; + } + } + //test initial overlap, does it collide if going all the way? Vector3 point_A, point_B; Vector3 sep_axis = motion_normal; @@ -994,6 +1008,13 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform3D &p_from, co const CollisionObject3DSW *col_obj = intersection_query_results[i]; int shape_idx = intersection_query_subindex_results[i]; + if (CollisionObject3DSW::TYPE_BODY == col_obj->get_type()) { + const Body3DSW *b = static_cast<const Body3DSW *>(col_obj); + if (p_infinite_inertia && PhysicsServer3D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer3D::BODY_MODE_KINEMATIC != b->get_mode()) { + continue; + } + } + rcd.object = col_obj; rcd.shape = shape_idx; bool sc = CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, nullptr, p_margin); diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h index 35430e4a46..df39d6ae50 100644 --- a/servers/physics_server_2d.h +++ b/servers/physics_server_2d.h @@ -33,7 +33,7 @@ #include "core/io/resource.h" #include "core/object/class_db.h" -#include "core/object/reference.h" +#include "core/object/ref_counted.h" class PhysicsDirectSpaceState2D; @@ -95,8 +95,8 @@ public: class PhysicsShapeQueryResult2D; //used for script -class PhysicsShapeQueryParameters2D : public Reference { - GDCLASS(PhysicsShapeQueryParameters2D, Reference); +class PhysicsShapeQueryParameters2D : public RefCounted { + GDCLASS(PhysicsShapeQueryParameters2D, RefCounted); friend class PhysicsDirectSpaceState2D; RES shape_ref; @@ -203,8 +203,8 @@ public: PhysicsDirectSpaceState2D(); }; -class PhysicsShapeQueryResult2D : public Reference { - GDCLASS(PhysicsShapeQueryResult2D, Reference); +class PhysicsShapeQueryResult2D : public RefCounted { + GDCLASS(PhysicsShapeQueryResult2D, RefCounted); Vector<PhysicsDirectSpaceState2D::ShapeResult> result; @@ -597,8 +597,8 @@ public: ~PhysicsServer2D(); }; -class PhysicsTestMotionResult2D : public Reference { - GDCLASS(PhysicsTestMotionResult2D, Reference); +class PhysicsTestMotionResult2D : public RefCounted { + GDCLASS(PhysicsTestMotionResult2D, RefCounted); PhysicsServer2D::MotionResult result; friend class PhysicsServer2D; diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index ec4914641a..d9b805de87 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -96,8 +96,8 @@ public: class PhysicsShapeQueryResult3D; -class PhysicsShapeQueryParameters3D : public Reference { - GDCLASS(PhysicsShapeQueryParameters3D, Reference); +class PhysicsShapeQueryParameters3D : public RefCounted { + GDCLASS(PhysicsShapeQueryParameters3D, RefCounted); friend class PhysicsDirectSpaceState3D; RES shape_ref; @@ -196,8 +196,8 @@ public: PhysicsDirectSpaceState3D(); }; -class PhysicsShapeQueryResult3D : public Reference { - GDCLASS(PhysicsShapeQueryResult3D, Reference); +class PhysicsShapeQueryResult3D : public RefCounted { + GDCLASS(PhysicsShapeQueryResult3D, RefCounted); Vector<PhysicsDirectSpaceState3D::ShapeResult> result; diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp index 1337d36762..f9ac7c8fa3 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp @@ -31,7 +31,7 @@ #include "renderer_compositor_rd.h" #include "core/config/project_settings.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" void RendererCompositorRD::prepare_for_blitting_render_targets() { RD::get_singleton()->prepare_screen_for_drawing(); diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp index 6f29ff42bc..27305cc938 100644 --- a/servers/rendering/renderer_rd/shader_rd.cpp +++ b/servers/rendering/renderer_rd/shader_rd.cpp @@ -31,8 +31,8 @@ #include "shader_rd.h" #include "core/io/compression.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "renderer_compositor_rd.h" #include "servers/rendering/rendering_device.h" #include "thirdparty/misc/smolv.h" diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl index 14bad7dc06..709ea45b88 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl @@ -238,7 +238,11 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, float attenuation, #elif defined(SPECULAR_PHONG) vec3 R = normalize(-reflect(L, N)); +#ifdef USE_SOFT_SHADOWS float cRdotV = clamp(A + dot(R, V), 0.0, 1.0); +#else + float cRdotV = clamp(dot(R, V), 0.0, 1.0); +#endif float shininess = exp2(15.0 * (1.0 - roughness) + 1.0) * 0.25; float phong = pow(cRdotV, shininess); phong *= (shininess + 8.0) * (1.0 / (8.0 * M_PI)); diff --git a/servers/rendering/rendering_device_binds.h b/servers/rendering/rendering_device_binds.h index e43c3669b5..912674e309 100644 --- a/servers/rendering/rendering_device_binds.h +++ b/servers/rendering/rendering_device_binds.h @@ -51,8 +51,8 @@ ClassDB::bind_method(D_METHOD("get_" _MKSTR(m_sub) "_" _MKSTR(m_member)), &m_class::get_##m_sub##_##m_member); \ ADD_PROPERTY(PropertyInfo(m_variant_type, _MKSTR(m_sub) "_" _MKSTR(m_member)), "set_" _MKSTR(m_sub) "_" _MKSTR(m_member), "get_" _MKSTR(m_sub) "_" _MKSTR(m_member)) -class RDTextureFormat : public Reference { - GDCLASS(RDTextureFormat, Reference) +class RDTextureFormat : public RefCounted { + GDCLASS(RDTextureFormat, RefCounted) friend class RenderingDevice; RD::TextureFormat base; @@ -87,8 +87,8 @@ protected: } }; -class RDTextureView : public Reference { - GDCLASS(RDTextureView, Reference) +class RDTextureView : public RefCounted { + GDCLASS(RDTextureView, RefCounted) friend class RenderingDevice; @@ -110,8 +110,8 @@ protected: } }; -class RDAttachmentFormat : public Reference { - GDCLASS(RDAttachmentFormat, Reference) +class RDAttachmentFormat : public RefCounted { + GDCLASS(RDAttachmentFormat, RefCounted) friend class RenderingDevice; RD::AttachmentFormat base; @@ -128,8 +128,8 @@ protected: } }; -class RDSamplerState : public Reference { - GDCLASS(RDSamplerState, Reference) +class RDSamplerState : public RefCounted { + GDCLASS(RDSamplerState, RefCounted) friend class RenderingDevice; RD::SamplerState base; @@ -171,8 +171,8 @@ protected: } }; -class RDVertexAttribute : public Reference { - GDCLASS(RDVertexAttribute, Reference) +class RDVertexAttribute : public RefCounted { + GDCLASS(RDVertexAttribute, RefCounted) friend class RenderingDevice; RD::VertexAttribute base; @@ -192,8 +192,8 @@ protected: RD_BIND(Variant::INT, RDVertexAttribute, frequency); } }; -class RDShaderSource : public Reference { - GDCLASS(RDShaderSource, Reference) +class RDShaderSource : public RefCounted { + GDCLASS(RDShaderSource, RefCounted) String source[RD::SHADER_STAGE_MAX]; RD::ShaderLanguage language = RD::SHADER_LANGUAGE_GLSL; @@ -386,8 +386,8 @@ protected: } }; -class RDUniform : public Reference { - GDCLASS(RDUniform, Reference) +class RDUniform : public RefCounted { + GDCLASS(RDUniform, RefCounted) friend class RenderingDevice; RD::Uniform base; @@ -424,8 +424,8 @@ protected: ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_ids", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "_set_ids", "get_ids"); } }; -class RDPipelineRasterizationState : public Reference { - GDCLASS(RDPipelineRasterizationState, Reference) +class RDPipelineRasterizationState : public RefCounted { + GDCLASS(RDPipelineRasterizationState, RefCounted) friend class RenderingDevice; RD::PipelineRasterizationState base; @@ -459,8 +459,8 @@ protected: } }; -class RDPipelineMultisampleState : public Reference { - GDCLASS(RDPipelineMultisampleState, Reference) +class RDPipelineMultisampleState : public RefCounted { + GDCLASS(RDPipelineMultisampleState, RefCounted) friend class RenderingDevice; RD::PipelineMultisampleState base; @@ -490,8 +490,8 @@ protected: } }; -class RDPipelineDepthStencilState : public Reference { - GDCLASS(RDPipelineDepthStencilState, Reference) +class RDPipelineDepthStencilState : public RefCounted { + GDCLASS(RDPipelineDepthStencilState, RefCounted) friend class RenderingDevice; RD::PipelineDepthStencilState base; @@ -549,8 +549,8 @@ protected: } }; -class RDPipelineColorBlendStateAttachment : public Reference { - GDCLASS(RDPipelineColorBlendStateAttachment, Reference) +class RDPipelineColorBlendStateAttachment : public RefCounted { + GDCLASS(RDPipelineColorBlendStateAttachment, RefCounted) friend class RenderingDevice; RD::PipelineColorBlendState::Attachment base; @@ -594,8 +594,8 @@ protected: } }; -class RDPipelineColorBlendState : public Reference { - GDCLASS(RDPipelineColorBlendState, Reference) +class RDPipelineColorBlendState : public RefCounted { + GDCLASS(RDPipelineColorBlendState, RefCounted) friend class RenderingDevice; RD::PipelineColorBlendState base; diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp index c6fe6a07e0..cd66cd0716 100644 --- a/servers/rendering/rendering_server_default.cpp +++ b/servers/rendering/rendering_server_default.cpp @@ -358,7 +358,7 @@ void RenderingServerDefault::_thread_loop() { draw_thread_up.set(); while (!exit.is_set()) { // flush commands one by one, until exit is requested - command_queue.wait_and_flush_one(); + command_queue.wait_and_flush(); } command_queue.flush_all(); // flush all diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index af66e32e06..4120e04ee1 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -447,7 +447,7 @@ public: virtual DataType get_datatype() const override { return datatype_cache; } virtual String get_datatype_name() const override { return String(struct_name); } - virtual int get_array_size() const override { return array_size; } + virtual int get_array_size() const override { return (index_expression || call_expression) ? 0 : array_size; } virtual bool is_indexed() const override { return index_expression != nullptr; } ArrayNode() : diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 0471990ed7..88ddbd1bce 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -422,7 +422,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint value |= CLAMP(int((src[i * 4 + 0] * 0.5 + 0.5) * 1023.0), 0, 1023); value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10; value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20; - value |= CLAMP(int((src[i * 4 + 3] * 0.5 + 0.5) * 1023.0), 0, 1023) << 30; + if (src[i * 4 + 3] > 0) { + value |= 3 << 30; + } memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4); } @@ -2282,6 +2284,10 @@ RenderingServer::RenderingServer() { GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2", true); GLOBAL_DEF_RST("rendering/textures/vram_compression/import_pvrtc", false); + GLOBAL_DEF("rendering/textures/lossless_compression/force_png", false); + GLOBAL_DEF("rendering/textures/lossless_compression/webp_compression_level", 2); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/lossless_compression/webp_compression_level", PropertyInfo(Variant::INT, "rendering/textures/lossless_compression/webp_compression_level", PROPERTY_HINT_RANGE, "0,9,1")); + GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600); ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/time/time_rollover_secs", PropertyInfo(Variant::FLOAT, "rendering/limits/time/time_rollover_secs", PROPERTY_HINT_RANGE, "0,10000,1,or_greater")); diff --git a/servers/text_server.h b/servers/text_server.h index 7fcfb91151..138ceb9356 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -31,7 +31,7 @@ #ifndef TEXT_SERVER_H #define TEXT_SERVER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/templates/rid.h" #include "core/variant/variant.h" diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h index d1cf13f5e2..bf026ed773 100644 --- a/servers/xr/xr_interface.h +++ b/servers/xr/xr_interface.h @@ -47,8 +47,8 @@ Note that we may make this into a fully instantiable class for GDNative support. */ -class XRInterface : public Reference { - GDCLASS(XRInterface, Reference); +class XRInterface : public RefCounted { + GDCLASS(XRInterface, RefCounted); public: enum Capabilities { /* purely meta data, provides some info about what this interface supports */ diff --git a/servers/xr/xr_positional_tracker.h b/servers/xr/xr_positional_tracker.h index dffa61f369..5577582929 100644 --- a/servers/xr/xr_positional_tracker.h +++ b/servers/xr/xr_positional_tracker.h @@ -43,8 +43,8 @@ This is where potentially additional AR/VR interfaces may be active as there are AR/VR SDKs that solely deal with positional tracking. */ -class XRPositionalTracker : public Reference { - GDCLASS(XRPositionalTracker, Reference); +class XRPositionalTracker : public RefCounted { + GDCLASS(XRPositionalTracker, RefCounted); _THREAD_SAFE_CLASS_ public: diff --git a/servers/xr_server.h b/servers/xr_server.h index a2482b925a..25431844c2 100644 --- a/servers/xr_server.h +++ b/servers/xr_server.h @@ -31,7 +31,7 @@ #ifndef XR_SERVER_H #define XR_SERVER_H -#include "core/object/reference.h" +#include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/os/thread_safe.h" #include "core/templates/rid.h" diff --git a/tests/test_class_db.h b/tests/test_class_db.h index 17f9baab85..fe2ed696c5 100644 --- a/tests/test_class_db.h +++ b/tests/test_class_db.h @@ -97,7 +97,7 @@ struct ExposedClass { bool is_singleton = false; bool is_instantiable = false; - bool is_reference = false; + bool is_ref_counted = false; ClassDB::APIType api_type; @@ -131,7 +131,7 @@ struct ExposedClass { struct NamesCache { StringName variant_type = StaticCString::create("Variant"); StringName object_class = StaticCString::create("Object"); - StringName reference_class = StaticCString::create("Reference"); + StringName ref_counted_class = StaticCString::create("RefCounted"); StringName string_type = StaticCString::create("String"); StringName string_name_type = StaticCString::create("StringName"); StringName node_path_type = StaticCString::create("NodePath"); @@ -516,7 +516,7 @@ void add_exposed_classes(Context &r_context) { exposed_class.api_type = api_type; exposed_class.is_singleton = Engine::get_singleton()->has_singleton(class_name); exposed_class.is_instantiable = class_info->creation_func && !exposed_class.is_singleton; - exposed_class.is_reference = ClassDB::is_parent_class(class_name, "Reference"); + exposed_class.is_ref_counted = ClassDB::is_parent_class(class_name, "RefCounted"); exposed_class.base = ClassDB::get_parent_class(class_name); // Add properties @@ -611,7 +611,7 @@ void add_exposed_classes(Context &r_context) { method.return_type.name = return_info.class_name; bool bad_reference_hint = !method.is_virtual && return_info.hint != PROPERTY_HINT_RESOURCE_TYPE && - ClassDB::is_parent_class(return_info.class_name, r_context.names_cache.reference_class); + ClassDB::is_parent_class(return_info.class_name, r_context.names_cache.ref_counted_class); TEST_COND(bad_reference_hint, "Return type is reference but hint is not '" _STR(PROPERTY_HINT_RESOURCE_TYPE) "'.", " Are you returning a reference type by pointer? Method: '", exposed_class.name, ".", method.name, "'."); } else if (return_info.hint == PROPERTY_HINT_RESOURCE_TYPE) { diff --git a/tests/test_command_queue.h b/tests/test_command_queue.h index 620fb96985..f0d4569942 100644 --- a/tests/test_command_queue.h +++ b/tests/test_command_queue.h @@ -156,7 +156,7 @@ public: command_queue.flush_all(); } for (int i = 0; i < message_count_to_read; i++) { - command_queue.wait_and_flush_one(); + command_queue.wait_and_flush(); } message_count_to_read = 0; @@ -276,50 +276,6 @@ TEST_CASE("[CommandQueue] Test Queue Basics") { ProjectSettings::get_singleton()->property_get_revert(COMMAND_QUEUE_SETTING)); } -TEST_CASE("[CommandQueue] Test Waiting at Queue Full") { - const char *COMMAND_QUEUE_SETTING = "memory/limits/command_queue/multithreading_queue_size_kb"; - ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING, 1); - SharedThreadState sts; - sts.init_threads(); - - int msgs_to_add = 24; // a queue of size 1kB fundamentally cannot fit 24 matrices. - for (int i = 0; i < msgs_to_add; i++) { - sts.add_msg_to_write(SharedThreadState::TEST_MSG_FUNC1_TRANSFORM); - } - sts.writer_threadwork.main_start_work(); - // If we call main_wait_for_done, we will deadlock. So instead... - sts.message_count_to_read = 1; - sts.reader_threadwork.main_start_work(); - sts.reader_threadwork.main_wait_for_done(); - CHECK_MESSAGE(sts.func1_count == 1, - "Reader should have read one message"); - CHECK_MESSAGE(sts.during_writing, - "Writer thread should still be blocked on writing."); - sts.message_count_to_read = msgs_to_add - 3; - sts.reader_threadwork.main_start_work(); - sts.reader_threadwork.main_wait_for_done(); - CHECK_MESSAGE(sts.func1_count >= msgs_to_add - 3, - "Reader should have read most messages"); - sts.writer_threadwork.main_wait_for_done(); - CHECK_MESSAGE(sts.during_writing == false, - "Writer thread should no longer be blocked on writing."); - sts.message_count_to_read = 2; - sts.reader_threadwork.main_start_work(); - sts.reader_threadwork.main_wait_for_done(); - sts.message_count_to_read = -1; - sts.reader_threadwork.main_start_work(); - sts.reader_threadwork.main_wait_for_done(); - CHECK_MESSAGE(sts.func1_count == msgs_to_add, - "Reader should have read all messages"); - - sts.destroy_threads(); - - CHECK_MESSAGE(sts.func1_count == msgs_to_add, - "Reader should have read no additional messages after join"); - ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING, - ProjectSettings::get_singleton()->property_get_revert(COMMAND_QUEUE_SETTING)); -} - TEST_CASE("[CommandQueue] Test Queue Wrapping to same spot.") { const char *COMMAND_QUEUE_SETTING = "memory/limits/command_queue/multithreading_queue_size_kb"; ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING, 1); diff --git a/tests/test_file_access.h b/tests/test_file_access.h index 00a314644c..cb74e08a0d 100644 --- a/tests/test_file_access.h +++ b/tests/test_file_access.h @@ -31,7 +31,7 @@ #ifndef TEST_FILE_ACCESS_H #define TEST_FILE_ACCESS_H -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "test_utils.h" namespace TestFileAccess { diff --git a/tests/test_math.cpp b/tests/test_math.cpp index 7f2097699a..67d9a52539 100644 --- a/tests/test_math.cpp +++ b/tests/test_math.cpp @@ -30,13 +30,13 @@ #include "test_math.h" +#include "core/io/file_access.h" #include "core/math/basis.h" #include "core/math/camera_matrix.h" #include "core/math/delaunay_3d.h" #include "core/math/geometry_2d.h" #include "core/math/math_funcs.h" #include "core/math/transform_3d.h" -#include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/print_string.h" diff --git a/tests/test_object.h b/tests/test_object.h index a12fad51e2..b7eedc2670 100644 --- a/tests/test_object.h +++ b/tests/test_object.h @@ -165,8 +165,8 @@ TEST_CASE("[Object] Construction") { Object object; CHECK_MESSAGE( - !object.is_reference(), - "Object is not a Reference."); + !object.is_ref_counted(), + "Object is not a RefCounted."); Object *p_db = ObjectDB::get_instance(object.get_instance_id()); CHECK_MESSAGE( diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp index 2169350c02..ad763b344e 100644 --- a/tests/test_shader_lang.cpp +++ b/tests/test_shader_lang.cpp @@ -30,7 +30,7 @@ #include "test_shader_lang.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/main_loop.h" #include "core/os/os.h" diff --git a/tests/test_string.h b/tests/test_string.h index 6e214574af..7f404a34e8 100644 --- a/tests/test_string.h +++ b/tests/test_string.h @@ -1130,7 +1130,7 @@ TEST_CASE("[String] Path functions") { CHECK(String(path[i]).get_basename() == base_name[i]); CHECK(String(path[i]).get_extension() == ext[i]); CHECK(String(path[i]).get_file() == file[i]); - CHECK(String(path[i]).is_abs_path() == abs[i]); + CHECK(String(path[i]).is_absolute_path() == abs[i]); CHECK(String(path[i]).is_rel_path() != abs[i]); CHECK(String(path[i]).simplify_path().get_base_dir().plus_file(file[i]) == String(path[i]).simplify_path()); } |