Rename Reference to RefCounted

This commit is contained in:
Pedro J. Estébanez 2021-06-04 18:03:15 +02:00
parent fbb5a541ef
commit 04688b92ff
270 changed files with 926 additions and 926 deletions

View File

@ -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
}

View File

@ -2074,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 {

View File

@ -353,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;
@ -455,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;
@ -525,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();
@ -537,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();
@ -549,8 +549,8 @@ public:
void post();
};
class _Thread : public Reference {
GDCLASS(_Thread, Reference);
class _Thread : public RefCounted {
GDCLASS(_Thread, RefCounted);
protected:
Variant ret;
@ -666,8 +666,8 @@ public:
class _JSON;
class JSONParseResult : public Reference {
GDCLASS(JSONParseResult, Reference);
class JSONParseResult : public RefCounted {
GDCLASS(JSONParseResult, RefCounted);
friend class _JSON;

View File

@ -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 {

View File

@ -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();

View File

@ -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:

View File

@ -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 {

View File

@ -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;

View File

@ -32,12 +32,12 @@
#define CONFIG_FILE_H
#include "core/io/file_access.h"
#include "core/object/reference.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;

View File

@ -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)();

View File

@ -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 {

View File

@ -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 {
@ -74,8 +74,8 @@ public:
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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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)();

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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 {

View File

@ -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();

View File

@ -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:

View File

@ -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 {

View File

@ -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 {

View File

@ -32,7 +32,7 @@
#define XML_PARSER_H
#include "core/io/file_access.h"
#include "core/object/reference.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

View File

@ -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);

View File

@ -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"

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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--;

View File

@ -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;
};

View File

@ -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; }

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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];

View File

@ -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 {

View File

@ -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>();

View File

@ -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 {

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -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();
}

View File

@ -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"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

Some files were not shown because too many files have changed in this diff Show More