ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits.
This commit is contained in:
parent
4aa31a2851
commit
cf8c679a23
89 changed files with 337 additions and 287 deletions
|
@ -32,7 +32,7 @@
|
|||
|
||||
Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
|
||||
|
||||
if (id == 0) {
|
||||
if (id.is_null()) {
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
return Variant();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::Call
|
|||
|
||||
Variant FuncRef::call_funcv(const Array &p_args) {
|
||||
|
||||
ERR_FAIL_COND_V(id == 0, Variant());
|
||||
ERR_FAIL_COND_V(id.is_null(), Variant());
|
||||
|
||||
Object *obj = ObjectDB::get_instance(id);
|
||||
|
||||
|
@ -69,7 +69,7 @@ void FuncRef::set_function(const StringName &p_func) {
|
|||
}
|
||||
|
||||
bool FuncRef::is_valid() const {
|
||||
if (id == 0)
|
||||
if (id.is_null())
|
||||
return false;
|
||||
|
||||
Object *obj = ObjectDB::get_instance(id);
|
||||
|
@ -95,6 +95,5 @@ void FuncRef::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
|
||||
}
|
||||
|
||||
FuncRef::FuncRef() :
|
||||
id(0) {
|
||||
FuncRef::FuncRef() {
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
#include "core/math/math_defs.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/node_path.h"
|
||||
#include "core/object_id.h"
|
||||
#include "core/string_name.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
/**
|
||||
* Hashing functions
|
||||
*/
|
||||
|
@ -137,6 +137,7 @@ struct HashMapHasherDefault {
|
|||
static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
|
||||
static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
|
||||
static _FORCE_INLINE_ uint32_t hash(const uint64_t p_int) { return hash_one_uint64(p_int); }
|
||||
static _FORCE_INLINE_ uint32_t hash(const ObjectID &p_id) { return hash_one_uint64(p_id); }
|
||||
|
||||
static _FORCE_INLINE_ uint32_t hash(const int64_t p_int) { return hash(uint64_t(p_int)); }
|
||||
static _FORCE_INLINE_ uint32_t hash(const float p_float) { return hash_djb2_one_float(p_float); }
|
||||
|
|
|
@ -53,8 +53,7 @@ ObjectID EncodedObjectAsID::get_object_id() const {
|
|||
return id;
|
||||
}
|
||||
|
||||
EncodedObjectAsID::EncodedObjectAsID() :
|
||||
id(0) {
|
||||
EncodedObjectAsID::EncodedObjectAsID() {
|
||||
}
|
||||
|
||||
#define _S(a) ((int32_t)a)
|
||||
|
@ -386,11 +385,11 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
|
|||
if (type & ENCODE_FLAG_OBJECT_AS_ID) {
|
||||
//this _is_ allowed
|
||||
ERR_FAIL_COND_V(len < 8, ERR_INVALID_DATA);
|
||||
ObjectID val = decode_uint64(buf);
|
||||
ObjectID val = ObjectID(decode_uint64(buf));
|
||||
if (r_len)
|
||||
(*r_len) += 8;
|
||||
|
||||
if (val == 0) {
|
||||
if (val.is_null()) {
|
||||
r_variant = (Object *)NULL;
|
||||
} else {
|
||||
Ref<EncodedObjectAsID> obj_as_id;
|
||||
|
@ -1129,7 +1128,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
|||
if (buf) {
|
||||
|
||||
Object *obj = p_variant;
|
||||
ObjectID id = 0;
|
||||
ObjectID id;
|
||||
if (obj && ObjectDB::instance_validate(obj)) {
|
||||
id = obj->get_instance_id();
|
||||
}
|
||||
|
|
|
@ -446,7 +446,6 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
|
|||
|
||||
PathGetCache::NodeInfo ni;
|
||||
ni.path = path;
|
||||
ni.instance = 0;
|
||||
|
||||
path_get_cache[p_from].nodes[id] = ni;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define METHOD_PTRCALL_H
|
||||
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/object_id.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
|
@ -167,6 +168,21 @@ struct PtrToArg<const T *> {
|
|||
}
|
||||
};
|
||||
|
||||
//this is for ObjectID
|
||||
|
||||
template <>
|
||||
struct PtrToArg<ObjectID> {
|
||||
_FORCE_INLINE_ static const ObjectID convert(const void *p_ptr) {
|
||||
|
||||
return ObjectID(*reinterpret_cast<const uint64_t *>(p_ptr));
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ static void encode(const ObjectID &p_val, void *p_ptr) {
|
||||
|
||||
*((uint64_t *)p_ptr) = p_val;
|
||||
}
|
||||
};
|
||||
|
||||
//this is for the special cases used by Variant
|
||||
|
||||
#define MAKE_VECARG(m_type) \
|
||||
|
|
|
@ -1916,7 +1916,6 @@ Object::Object() {
|
|||
_class_ptr = NULL;
|
||||
_block_signals = false;
|
||||
_predelete_ok = 0;
|
||||
_instance_id = 0;
|
||||
_instance_id = ObjectDB::add_instance(this);
|
||||
_can_translate = true;
|
||||
_is_queued_for_deletion = false;
|
||||
|
@ -1972,7 +1971,7 @@ Object::~Object() {
|
|||
}
|
||||
|
||||
ObjectDB::remove_instance(this);
|
||||
_instance_id = 0;
|
||||
_instance_id = ObjectID();
|
||||
_predelete_ok = 2;
|
||||
|
||||
if (!ScriptServer::are_languages_finished()) {
|
||||
|
@ -1995,14 +1994,14 @@ void postinitialize_handler(Object *p_object) {
|
|||
}
|
||||
|
||||
HashMap<ObjectID, Object *> ObjectDB::instances;
|
||||
ObjectID ObjectDB::instance_counter = 1;
|
||||
uint64_t ObjectDB::instance_counter = 1;
|
||||
HashMap<Object *, ObjectID, ObjectDB::ObjectPtrHash> ObjectDB::instance_checks;
|
||||
ObjectID ObjectDB::add_instance(Object *p_object) {
|
||||
|
||||
ERR_FAIL_COND_V(p_object->get_instance_id() != 0, 0);
|
||||
ERR_FAIL_COND_V(p_object->get_instance_id().is_valid(), ObjectID());
|
||||
|
||||
rw_lock->write_lock();
|
||||
ObjectID instance_id = ++instance_counter;
|
||||
ObjectID instance_id = ObjectID(++instance_counter);
|
||||
instances[instance_id] = p_object;
|
||||
instance_checks[p_object] = instance_id;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/hash_map.h"
|
||||
#include "core/list.h"
|
||||
#include "core/map.h"
|
||||
#include "core/object_id.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/set.h"
|
||||
#include "core/variant.h"
|
||||
|
@ -89,6 +90,7 @@ enum PropertyHint {
|
|||
PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send
|
||||
PROPERTY_HINT_NODE_PATH_VALID_TYPES,
|
||||
PROPERTY_HINT_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog
|
||||
PROPERTY_HINT_INT_IS_OBJECTID,
|
||||
PROPERTY_HINT_MAX,
|
||||
// When updating PropertyHint, also sync the hardcoded list in VisualScriptEditorVariableEdit
|
||||
};
|
||||
|
@ -397,7 +399,6 @@ public: \
|
|||
private:
|
||||
|
||||
class ScriptInstance;
|
||||
typedef uint64_t ObjectID;
|
||||
|
||||
class Object {
|
||||
public:
|
||||
|
@ -452,7 +453,7 @@ private:
|
|||
_id(p_id),
|
||||
method(p_method) {
|
||||
}
|
||||
Target() { _id = 0; }
|
||||
Target() { _id = ObjectID(); }
|
||||
};
|
||||
|
||||
struct Slot {
|
||||
|
@ -775,7 +776,7 @@ class ObjectDB {
|
|||
static HashMap<ObjectID, Object *> instances;
|
||||
static HashMap<Object *, ObjectID, ObjectPtrHash> instance_checks;
|
||||
|
||||
static ObjectID instance_counter;
|
||||
static uint64_t instance_counter;
|
||||
friend class Object;
|
||||
friend void unregister_core_types();
|
||||
|
||||
|
|
32
core/object_id.h
Normal file
32
core/object_id.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef OBJECT_ID_H
|
||||
#define OBJECT_ID_H
|
||||
|
||||
#include "core/typedefs.h"
|
||||
|
||||
// Class to store an object ID (int64)
|
||||
// needs to be compatile with int64 because this is what Variant uses
|
||||
// Also, need to be explicitly only castable to 64 bits integer types
|
||||
// to avoid bugs due to loss of precision
|
||||
|
||||
class ObjectID {
|
||||
uint64_t id = 0;
|
||||
|
||||
public:
|
||||
_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; }
|
||||
_ALWAYS_INLINE_ operator int64_t() const { return id; }
|
||||
|
||||
_ALWAYS_INLINE_ bool operator==(const ObjectID &p_id) const { return id == p_id.id; }
|
||||
_ALWAYS_INLINE_ bool operator!=(const ObjectID &p_id) const { return id != p_id.id; }
|
||||
_ALWAYS_INLINE_ bool operator<(const ObjectID &p_id) const { return id < p_id.id; }
|
||||
|
||||
_ALWAYS_INLINE_ void operator=(int64_t p_int64) { id = p_int64; }
|
||||
_ALWAYS_INLINE_ void operator=(uint64_t p_uint64) { id = p_uint64; }
|
||||
|
||||
_ALWAYS_INLINE_ ObjectID() {}
|
||||
_ALWAYS_INLINE_ explicit ObjectID(const uint64_t p_id) { id = p_id; }
|
||||
_ALWAYS_INLINE_ explicit ObjectID(const int64_t p_id) { id = p_id; }
|
||||
};
|
||||
|
||||
#endif // OBJECT_ID_H
|
|
@ -113,7 +113,7 @@ Reference::~Reference() {
|
|||
|
||||
Variant WeakRef::get_ref() const {
|
||||
|
||||
if (ref == 0)
|
||||
if (ref.is_null())
|
||||
return Variant();
|
||||
|
||||
Object *obj = ObjectDB::get_instance(ref);
|
||||
|
@ -129,16 +129,15 @@ Variant WeakRef::get_ref() const {
|
|||
}
|
||||
|
||||
void WeakRef::set_obj(Object *p_object) {
|
||||
ref = p_object ? p_object->get_instance_id() : 0;
|
||||
ref = p_object ? p_object->get_instance_id() : ObjectID();
|
||||
}
|
||||
|
||||
void WeakRef::set_ref(const REF &p_ref) {
|
||||
|
||||
ref = p_ref.is_valid() ? p_ref->get_instance_id() : 0;
|
||||
ref = p_ref.is_valid() ? p_ref->get_instance_id() : ObjectID();
|
||||
}
|
||||
|
||||
WeakRef::WeakRef() :
|
||||
ref(0) {
|
||||
WeakRef::WeakRef() {
|
||||
}
|
||||
|
||||
void WeakRef::_bind_methods() {
|
||||
|
|
|
@ -187,6 +187,16 @@ struct GetTypeInfo<const RefPtr &> {
|
|||
}
|
||||
};
|
||||
|
||||
//objectID
|
||||
template <>
|
||||
struct GetTypeInfo<ObjectID> {
|
||||
static const Variant::Type VARIANT_TYPE = Variant::INT;
|
||||
static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE;
|
||||
static inline PropertyInfo get_class_info() {
|
||||
return PropertyInfo(Variant::INT, String(), PROPERTY_HINT_INT_IS_OBJECTID);
|
||||
}
|
||||
};
|
||||
|
||||
//for variant
|
||||
template <>
|
||||
struct GetTypeInfo<Variant> {
|
||||
|
|
|
@ -1248,6 +1248,14 @@ Variant::operator uint64_t() const {
|
|||
}
|
||||
}
|
||||
|
||||
Variant::operator ObjectID() const {
|
||||
if (type == INT) {
|
||||
return ObjectID(_data._int);
|
||||
} else {
|
||||
return ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NEED_LONG_INT
|
||||
Variant::operator signed long() const {
|
||||
|
||||
|
@ -2193,6 +2201,11 @@ Variant::Variant(double p_double) {
|
|||
_data._real = p_double;
|
||||
}
|
||||
|
||||
Variant::Variant(const ObjectID &p_id) {
|
||||
type = INT;
|
||||
_data._int = p_id;
|
||||
}
|
||||
|
||||
Variant::Variant(const StringName &p_string) {
|
||||
|
||||
type = STRING;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "core/math/transform_2d.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/node_path.h"
|
||||
#include "core/object_id.h"
|
||||
#include "core/pool_vector.h"
|
||||
#include "core/ref_ptr.h"
|
||||
#include "core/rid.h"
|
||||
|
@ -177,6 +178,8 @@ public:
|
|||
operator unsigned long() const;
|
||||
#endif
|
||||
|
||||
operator ObjectID() const;
|
||||
|
||||
operator CharType() const;
|
||||
operator float() const;
|
||||
operator double() const;
|
||||
|
@ -248,6 +251,7 @@ public:
|
|||
Variant(uint64_t p_int);
|
||||
Variant(float p_float);
|
||||
Variant(double p_double);
|
||||
Variant(const ObjectID &p_id);
|
||||
Variant(const String &p_string);
|
||||
Variant(const StringName &p_string);
|
||||
Variant(const char *const p_cstring);
|
||||
|
|
|
@ -190,5 +190,4 @@ bool DictionaryPropertyEdit::_get(const StringName &p_name, Variant &r_ret) cons
|
|||
}
|
||||
|
||||
DictionaryPropertyEdit::DictionaryPropertyEdit() {
|
||||
obj = 0;
|
||||
}
|
||||
|
|
|
@ -156,8 +156,8 @@ bool EditorHistory::is_history_obj_inspector_only(int p_obj) const {
|
|||
}
|
||||
|
||||
ObjectID EditorHistory::get_history_obj(int p_obj) const {
|
||||
ERR_FAIL_INDEX_V(p_obj, history.size(), 0);
|
||||
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), 0);
|
||||
ERR_FAIL_INDEX_V(p_obj, history.size(), ObjectID());
|
||||
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), ObjectID());
|
||||
return history[p_obj].path[history[p_obj].level].object;
|
||||
}
|
||||
|
||||
|
@ -204,12 +204,12 @@ bool EditorHistory::is_current_inspector_only() const {
|
|||
ObjectID EditorHistory::get_current() {
|
||||
|
||||
if (current < 0 || current >= history.size())
|
||||
return 0;
|
||||
return ObjectID();
|
||||
|
||||
History &h = history.write[current];
|
||||
Object *obj = ObjectDB::get_instance(h.path[h.level].object);
|
||||
if (!obj)
|
||||
return 0;
|
||||
return ObjectID();
|
||||
|
||||
return obj->get_instance_id();
|
||||
}
|
||||
|
@ -226,15 +226,15 @@ int EditorHistory::get_path_size() const {
|
|||
ObjectID EditorHistory::get_path_object(int p_index) const {
|
||||
|
||||
if (current < 0 || current >= history.size())
|
||||
return 0;
|
||||
return ObjectID();
|
||||
|
||||
const History &h = history[current];
|
||||
|
||||
ERR_FAIL_INDEX_V(p_index, h.path.size(), 0);
|
||||
ERR_FAIL_INDEX_V(p_index, h.path.size(), ObjectID());
|
||||
|
||||
Object *obj = ObjectDB::get_instance(h.path[p_index].object);
|
||||
if (!obj)
|
||||
return 0;
|
||||
return ObjectID();
|
||||
|
||||
return obj->get_instance_id();
|
||||
}
|
||||
|
|
|
@ -1558,7 +1558,7 @@ void EditorNode::_dialog_action(String p_file) {
|
|||
save_resource_in_path(saving_resource, p_file);
|
||||
saving_resource = Ref<Resource>();
|
||||
ObjectID current = editor_history.get_current();
|
||||
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
|
||||
ERR_FAIL_COND(!current_obj);
|
||||
current_obj->_change_notify();
|
||||
} break;
|
||||
|
@ -1711,7 +1711,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property, bool p_in
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t id = p_object->get_instance_id();
|
||||
ObjectID id = p_object->get_instance_id();
|
||||
if (id != editor_history.get_current()) {
|
||||
|
||||
if (p_inspector_only) {
|
||||
|
@ -1767,8 +1767,8 @@ static bool overrides_external_editor(Object *p_object) {
|
|||
|
||||
void EditorNode::_edit_current() {
|
||||
|
||||
uint32_t current = editor_history.get_current();
|
||||
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
|
||||
ObjectID current = editor_history.get_current();
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
|
||||
bool inspector_only = editor_history.is_current_inspector_only();
|
||||
|
||||
this->current = current_obj;
|
||||
|
|
|
@ -388,13 +388,13 @@ void EditorPropertyMember::_property_select() {
|
|||
|
||||
} else if (hint == MEMBER_METHOD_OF_INSTANCE) {
|
||||
|
||||
Object *instance = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (instance)
|
||||
selector->select_method_from_instance(instance, current);
|
||||
|
||||
} else if (hint == MEMBER_METHOD_OF_SCRIPT) {
|
||||
|
||||
Object *obj = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (Object::cast_to<Script>(obj)) {
|
||||
selector->select_method_from_script(Object::cast_to<Script>(obj), current);
|
||||
}
|
||||
|
@ -420,13 +420,13 @@ void EditorPropertyMember::_property_select() {
|
|||
|
||||
} else if (hint == MEMBER_PROPERTY_OF_INSTANCE) {
|
||||
|
||||
Object *instance = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (instance)
|
||||
selector->select_property_from_instance(instance, current);
|
||||
|
||||
} else if (hint == MEMBER_PROPERTY_OF_SCRIPT) {
|
||||
|
||||
Object *obj = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (Object::cast_to<Script>(obj)) {
|
||||
selector->select_property_from_script(Object::cast_to<Script>(obj), current);
|
||||
}
|
||||
|
@ -858,7 +858,7 @@ void EditorPropertyObjectID::update_property() {
|
|||
type = "Object";
|
||||
|
||||
ObjectID id = get_edited_object()->get(get_edited_property());
|
||||
if (id != 0) {
|
||||
if (id.is_valid()) {
|
||||
edit->set_text(type + " ID: " + itos(id));
|
||||
edit->set_disabled(false);
|
||||
edit->set_icon(EditorNode::get_singleton()->get_class_icon(type));
|
||||
|
|
|
@ -177,7 +177,7 @@ String SectionedInspector::get_full_item_path(const String &p_item) {
|
|||
void SectionedInspector::edit(Object *p_object) {
|
||||
|
||||
if (!p_object) {
|
||||
obj = 0;
|
||||
obj = ObjectID();
|
||||
sections->clear();
|
||||
|
||||
filter->set_edited(NULL);
|
||||
|
@ -308,7 +308,6 @@ EditorInspector *SectionedInspector::get_inspector() {
|
|||
}
|
||||
|
||||
SectionedInspector::SectionedInspector() :
|
||||
obj(0),
|
||||
sections(memnew(Tree)),
|
||||
filter(memnew(SectionedInspectorFilter)),
|
||||
inspector(memnew(EditorInspector)),
|
||||
|
|
|
@ -166,8 +166,8 @@ void InspectorDock::_resource_file_selected(String p_file) {
|
|||
}
|
||||
|
||||
void InspectorDock::_save_resource(bool save_as) const {
|
||||
uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
|
||||
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
|
||||
|
||||
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
|
||||
|
||||
|
@ -180,8 +180,8 @@ void InspectorDock::_save_resource(bool save_as) const {
|
|||
}
|
||||
|
||||
void InspectorDock::_unref_resource() const {
|
||||
uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
|
||||
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
|
||||
|
||||
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
|
||||
|
||||
|
@ -191,8 +191,8 @@ void InspectorDock::_unref_resource() const {
|
|||
}
|
||||
|
||||
void InspectorDock::_copy_resource() const {
|
||||
uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
|
||||
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
|
||||
|
||||
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void AnimationTreeEditor::edit(AnimationTree *p_tree) {
|
|||
path = tree->get_meta("_tree_edit_path");
|
||||
edit_path(path);
|
||||
} else {
|
||||
current_root = 0;
|
||||
current_root = ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void AnimationTreeEditor::edit_path(const Vector<String> &p_path) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
current_root = 0;
|
||||
current_root = ObjectID();
|
||||
edited_path = button_path;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void AnimationTreeEditor::_about_to_show_root() {
|
|||
|
||||
void AnimationTreeEditor::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
ObjectID root = 0;
|
||||
ObjectID root;
|
||||
if (tree && tree->get_tree_root().is_valid()) {
|
||||
root = tree->get_tree_root()->get_instance_id();
|
||||
}
|
||||
|
@ -242,7 +242,6 @@ AnimationTreeEditor::AnimationTreeEditor() {
|
|||
|
||||
add_child(memnew(HSeparator));
|
||||
|
||||
current_root = 0;
|
||||
singleton = this;
|
||||
editor_base = memnew(PanelContainer);
|
||||
editor_base->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
|
|
@ -3659,7 +3659,7 @@ bool CanvasItemEditor::_build_bones_list(Node *p_node) {
|
|||
// Add a last bone if the Bone2D has no Bone2D child
|
||||
BoneKey bk;
|
||||
bk.from = canvas_item->get_instance_id();
|
||||
bk.to = 0;
|
||||
bk.to = ObjectID();
|
||||
if (!bone_list.has(bk)) {
|
||||
BoneList b;
|
||||
b.length = 0;
|
||||
|
|
|
@ -252,7 +252,7 @@ void SpatialEditorViewport::_clear_selected() {
|
|||
|
||||
void SpatialEditorViewport::_select_clicked(bool p_append, bool p_single, bool p_allow_locked) {
|
||||
|
||||
if (!clicked)
|
||||
if (clicked.is_null())
|
||||
return;
|
||||
|
||||
Node *node = Object::cast_to<Node>(ObjectDB::get_instance(clicked));
|
||||
|
@ -309,7 +309,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
|
|||
Set<Ref<EditorSpatialGizmo> > found_gizmos;
|
||||
|
||||
Node *edited_scene = get_tree()->get_edited_scene_root();
|
||||
ObjectID closest = 0;
|
||||
ObjectID closest;
|
||||
Node *item = NULL;
|
||||
float closest_dist = 1e20;
|
||||
int selected_handle = -1;
|
||||
|
@ -356,7 +356,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
|
|||
}
|
||||
|
||||
if (!item)
|
||||
return 0;
|
||||
return ObjectID();
|
||||
|
||||
if (!editor_selection->is_selected(item) || (r_gizmo_handle && selected_handle >= 0)) {
|
||||
|
||||
|
@ -850,9 +850,9 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
|
|||
clicked = selection_results[0].item->get_instance_id();
|
||||
selection_results.clear();
|
||||
|
||||
if (clicked) {
|
||||
if (clicked.is_valid()) {
|
||||
_select_clicked(clicked_wants_append, true, spatial_editor->get_tool_mode() != SpatialEditor::TOOL_MODE_LIST_SELECT);
|
||||
clicked = 0;
|
||||
clicked = ObjectID();
|
||||
}
|
||||
|
||||
} else if (!selection_results.empty()) {
|
||||
|
@ -1095,7 +1095,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
if (_gizmo_select(_edit.mouse_pos))
|
||||
break;
|
||||
|
||||
clicked = 0;
|
||||
clicked = ObjectID();
|
||||
clicked_includes_current = false;
|
||||
|
||||
if ((spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT && b->get_control()) || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_ROTATE) {
|
||||
|
@ -1139,7 +1139,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
|
||||
clicked_wants_append = b->get_shift();
|
||||
|
||||
if (!clicked) {
|
||||
if (clicked.is_null()) {
|
||||
|
||||
if (!clicked_wants_append)
|
||||
_clear_selected();
|
||||
|
@ -1150,7 +1150,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
cursor.region_end = b->get_position();
|
||||
}
|
||||
|
||||
if (clicked && gizmo_handle >= 0) {
|
||||
if (clicked.is_valid() && gizmo_handle >= 0) {
|
||||
|
||||
Spatial *spa = Object::cast_to<Spatial>(ObjectDB::get_instance(clicked));
|
||||
if (spa) {
|
||||
|
@ -1175,10 +1175,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
_edit.gizmo = Ref<EditorSpatialGizmo>();
|
||||
break;
|
||||
}
|
||||
if (clicked) {
|
||||
if (clicked.is_valid()) {
|
||||
_select_clicked(clicked_wants_append, true);
|
||||
// Processing was deferred.
|
||||
clicked = 0;
|
||||
clicked = ObjectID();
|
||||
}
|
||||
|
||||
if (cursor.region_select) {
|
||||
|
@ -1279,7 +1279,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
} else if (nav_scheme == NAVIGATION_MODO && m->get_alt()) {
|
||||
nav_mode = NAVIGATION_ORBIT;
|
||||
} else {
|
||||
if (clicked) {
|
||||
if (clicked.is_valid()) {
|
||||
|
||||
if (!clicked_includes_current) {
|
||||
|
||||
|
@ -1288,7 +1288,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
_compute_edit(_edit.mouse_pos);
|
||||
clicked = 0;
|
||||
clicked = ObjectID();
|
||||
|
||||
_edit.mode = TRANSFORM_TRANSLATE;
|
||||
}
|
||||
|
@ -2945,9 +2945,9 @@ void SpatialEditorViewport::_selection_result_pressed(int p_result) {
|
|||
|
||||
clicked = selection_results[p_result].item->get_instance_id();
|
||||
|
||||
if (clicked) {
|
||||
if (clicked.is_valid()) {
|
||||
_select_clicked(clicked_wants_append, true, spatial_editor->get_tool_mode() != SpatialEditor::TOOL_MODE_LIST_SELECT);
|
||||
clicked = 0;
|
||||
clicked = ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3581,7 +3581,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
|
|||
editor_data = editor->get_scene_tree_dock()->get_editor_data();
|
||||
editor_selection = editor->get_editor_selection();
|
||||
undo_redo = editor->get_undo_redo();
|
||||
clicked = 0;
|
||||
|
||||
clicked_includes_current = false;
|
||||
orthogonal = false;
|
||||
lock_rotation = false;
|
||||
|
|
|
@ -639,7 +639,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
|
||||
MAKE_PROPSELECT
|
||||
|
||||
Object *instance = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (instance)
|
||||
property_select->select_method_from_instance(instance, v);
|
||||
updating = false;
|
||||
|
@ -648,7 +648,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
} else if (hint == PROPERTY_HINT_METHOD_OF_SCRIPT) {
|
||||
MAKE_PROPSELECT
|
||||
|
||||
Object *obj = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (Object::cast_to<Script>(obj)) {
|
||||
property_select->select_method_from_script(Object::cast_to<Script>(obj), v);
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
|
||||
MAKE_PROPSELECT
|
||||
|
||||
Object *instance = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (instance)
|
||||
property_select->select_property_from_instance(instance, v);
|
||||
|
||||
|
@ -698,7 +698,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
} else if (hint == PROPERTY_HINT_PROPERTY_OF_SCRIPT) {
|
||||
MAKE_PROPSELECT
|
||||
|
||||
Object *obj = ObjectDB::get_instance(hint_text.to_int64());
|
||||
Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64()));
|
||||
if (Object::cast_to<Script>(obj)) {
|
||||
property_select->select_property_from_script(Object::cast_to<Script>(obj), v);
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const
|
|||
base_type = p_base;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
properties = false;
|
||||
instance = NULL;
|
||||
virtuals_only = p_virtuals_only;
|
||||
|
@ -437,7 +437,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const
|
|||
base_type = "";
|
||||
selected = p_current;
|
||||
type = p_type;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
properties = false;
|
||||
instance = NULL;
|
||||
virtuals_only = false;
|
||||
|
@ -453,7 +453,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str
|
|||
base_type = p_instance->get_class();
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
{
|
||||
Ref<Script> scr = p_instance->get_script();
|
||||
if (scr.is_valid())
|
||||
|
@ -474,7 +474,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons
|
|||
base_type = p_base;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
properties = true;
|
||||
instance = NULL;
|
||||
virtuals_only = false;
|
||||
|
@ -509,7 +509,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con
|
|||
base_type = "";
|
||||
selected = p_current;
|
||||
type = p_type;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
properties = true;
|
||||
instance = NULL;
|
||||
virtuals_only = false;
|
||||
|
@ -525,7 +525,7 @@ void PropertySelector::select_property_from_instance(Object *p_instance, const S
|
|||
base_type = "";
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
script = ObjectID();
|
||||
properties = true;
|
||||
instance = p_instance;
|
||||
virtuals_only = false;
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
}
|
||||
|
||||
String get_title() {
|
||||
if (remote_object_id)
|
||||
if (remote_object_id.is_valid())
|
||||
return TTR("Remote ") + String(type_name) + ": " + itos(remote_object_id);
|
||||
else
|
||||
return "<null>";
|
||||
|
@ -197,7 +197,6 @@ public:
|
|||
}
|
||||
|
||||
ScriptEditorDebuggerInspectedObject() {
|
||||
remote_object_id = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -302,7 +301,7 @@ void ScriptEditorDebugger::_scene_tree_selected() {
|
|||
return;
|
||||
}
|
||||
|
||||
inspected_object_id = item->get_metadata(0);
|
||||
inspected_object_id = item->get_metadata(0).operator ObjectID();
|
||||
|
||||
Array msg;
|
||||
msg.push_back("inspect_object");
|
||||
|
@ -434,7 +433,7 @@ int ScriptEditorDebugger::_update_scene_tree(TreeItem *parent, const Array &node
|
|||
TreeItem *item = inspect_scene_tree->create_item(parent);
|
||||
item->set_text(0, item_text);
|
||||
item->set_tooltip(0, TTR("Type:") + " " + item_type);
|
||||
ObjectID id = ObjectID(nodes[current_index + 3]);
|
||||
ObjectID id = nodes[current_index + 3].operator ObjectID();
|
||||
Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(nodes[current_index + 2], "");
|
||||
if (icon.is_valid()) {
|
||||
item->set_icon(0, icon);
|
||||
|
@ -1107,7 +1106,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||
int frame_size = 6;
|
||||
for (int i = 0; i < p_data.size(); i += frame_size) {
|
||||
MultiplayerAPI::ProfilingInfo pi;
|
||||
pi.node = p_data[i + 0];
|
||||
pi.node = p_data[i + 0].operator ObjectID();
|
||||
pi.node_path = p_data[i + 1];
|
||||
pi.incoming_rpc = p_data[i + 2];
|
||||
pi.incoming_rset = p_data[i + 3];
|
||||
|
@ -1253,7 +1252,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||
inspect_edited_object_timeout -= get_process_delta_time();
|
||||
if (inspect_edited_object_timeout < 0) {
|
||||
inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval");
|
||||
if (inspected_object_id) {
|
||||
if (inspected_object_id.is_valid()) {
|
||||
if (ScriptEditorDebuggerInspectedObject *obj = Object::cast_to<ScriptEditorDebuggerInspectedObject>(ObjectDB::get_instance(editor->get_editor_history()->get_current()))) {
|
||||
if (obj->remote_object_id == inspected_object_id) {
|
||||
//take the chance and re-inspect selected object
|
||||
|
@ -2486,7 +2485,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
|
|||
auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false);
|
||||
inspect_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0);
|
||||
inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2);
|
||||
inspected_object_id = 0;
|
||||
inspected_object_id = ObjectID();
|
||||
updating_scene_tree = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer:
|
|||
Object *areaGodoObject = ObjectDB::get_instance(event.event_callback_id);
|
||||
|
||||
if (!areaGodoObject) {
|
||||
event.event_callback_id = 0;
|
||||
event.event_callback_id = ObjectID();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ void AreaBullet::set_event_callback(Type p_callbackObjectType, ObjectID p_id, co
|
|||
ev.event_callback_method = p_method;
|
||||
|
||||
/// Set if monitoring
|
||||
if (eventsCallbacks[0].event_callback_id || eventsCallbacks[1].event_callback_id) {
|
||||
if (eventsCallbacks[0].event_callback_id.is_valid() || eventsCallbacks[1].event_callback_id.is_valid()) {
|
||||
set_godot_object_flags(get_godot_object_flags() | GOF_IS_MONITORING_AREA);
|
||||
} else {
|
||||
set_godot_object_flags(get_godot_object_flags() & (~GOF_IS_MONITORING_AREA));
|
||||
|
@ -287,7 +287,7 @@ void AreaBullet::set_event_callback(Type p_callbackObjectType, ObjectID p_id, co
|
|||
}
|
||||
|
||||
bool AreaBullet::has_event_callback(Type p_callbackObjectType) {
|
||||
return eventsCallbacks[static_cast<int>(p_callbackObjectType)].event_callback_id;
|
||||
return eventsCallbacks[static_cast<int>(p_callbackObjectType)].event_callback_id.is_valid();
|
||||
}
|
||||
|
||||
void AreaBullet::on_enter_area(AreaBullet *p_area) {
|
||||
|
|
|
@ -50,8 +50,7 @@ public:
|
|||
ObjectID event_callback_id;
|
||||
StringName event_callback_method;
|
||||
|
||||
InOutEventCallback() :
|
||||
event_callback_id(0) {}
|
||||
InOutEventCallback() {}
|
||||
};
|
||||
|
||||
enum OverlapState {
|
||||
|
|
|
@ -359,7 +359,7 @@ void BulletPhysicsServer::area_attach_object_instance_id(RID p_area, ObjectID p_
|
|||
|
||||
ObjectID BulletPhysicsServer::area_get_object_instance_id(RID p_area) const {
|
||||
if (space_owner.owns(p_area)) {
|
||||
return 0;
|
||||
return ObjectID();
|
||||
}
|
||||
AreaBullet *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND_V(!area, ObjectID());
|
||||
|
@ -428,14 +428,14 @@ void BulletPhysicsServer::area_set_monitor_callback(RID p_area, Object *p_receiv
|
|||
AreaBullet *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_event_callback(CollisionObjectBullet::TYPE_RIGID_BODY, p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_event_callback(CollisionObjectBullet::TYPE_RIGID_BODY, p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
|
||||
AreaBullet *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_event_callback(CollisionObjectBullet::TYPE_AREA, p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_event_callback(CollisionObjectBullet::TYPE_AREA, p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::area_set_ray_pickable(RID p_area, bool p_enable) {
|
||||
|
@ -569,16 +569,16 @@ void BulletPhysicsServer::body_clear_shapes(RID p_body) {
|
|||
body->remove_all_shapes();
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
|
||||
void BulletPhysicsServer::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
|
||||
CollisionObjectBullet *body = get_collisin_object(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
body->set_instance_id(p_id);
|
||||
}
|
||||
|
||||
uint32_t BulletPhysicsServer::body_get_object_instance_id(RID p_body) const {
|
||||
ObjectID BulletPhysicsServer::body_get_object_instance_id(RID p_body) const {
|
||||
CollisionObjectBullet *body = get_collisin_object(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
ERR_FAIL_COND_V(!body, ObjectID());
|
||||
|
||||
return body->get_instance_id();
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const {
|
|||
void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
|
||||
RigidBodyBullet *body = rigid_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
|
||||
}
|
||||
|
||||
void BulletPhysicsServer::body_set_ray_pickable(RID p_body, bool p_enable) {
|
||||
|
|
|
@ -189,8 +189,8 @@ public:
|
|||
virtual void body_clear_shapes(RID p_body);
|
||||
|
||||
// Used for Rigid and Soft Bodies
|
||||
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
|
||||
virtual uint32_t body_get_object_instance_id(RID p_body) const;
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id);
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const;
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const;
|
||||
|
|
|
@ -90,7 +90,7 @@ void CollisionObjectBullet::ShapeWrapper::claim_bt_shape(const btVector3 &body_s
|
|||
CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
|
||||
RIDBullet(),
|
||||
type(p_type),
|
||||
instance_id(0),
|
||||
instance_id(ObjectID()),
|
||||
collisionLayer(0),
|
||||
collisionMask(0),
|
||||
collisionsEnabled(true),
|
||||
|
|
|
@ -112,7 +112,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
|
|||
result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
|
||||
result.rid = gObj->get_self();
|
||||
result.collider_id = gObj->get_instance_id();
|
||||
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
|
||||
++count;
|
||||
return 1; // not used by bullet
|
||||
|
@ -220,7 +220,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
|
|||
}
|
||||
|
||||
result.collider_id = colObj->get_instance_id();
|
||||
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
result.rid = colObj->get_self();
|
||||
++m_count;
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ void RigidBodyBullet::dispatch_callbacks() {
|
|||
Object *obj = ObjectDB::get_instance(force_integration_callback->id);
|
||||
if (!obj) {
|
||||
// Remove integration callback
|
||||
set_force_integration_callback(0, StringName());
|
||||
set_force_integration_callback(ObjectID(), StringName());
|
||||
} else {
|
||||
const Variant *vp[2] = { &variantBodyDirect, &force_integration_callback->udata };
|
||||
|
||||
|
@ -395,7 +395,7 @@ void RigidBodyBullet::set_force_integration_callback(ObjectID p_id, const String
|
|||
force_integration_callback = NULL;
|
||||
}
|
||||
|
||||
if (p_id != 0) {
|
||||
if (p_id.is_valid()) {
|
||||
force_integration_callback = memnew(ForceIntegrationCallback);
|
||||
force_integration_callback->id = p_id;
|
||||
force_integration_callback->method = p_method;
|
||||
|
|
|
@ -108,7 +108,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
|
|||
r_result.shape = btResult.m_shapeId;
|
||||
r_result.rid = gObj->get_self();
|
||||
r_result.collider_id = gObj->get_instance_id();
|
||||
r_result.collider = 0 == r_result.collider_id ? NULL : ObjectDB::get_instance(r_result.collider_id);
|
||||
r_result.collider = r_result.collider_id.is_null() ? NULL : ObjectDB::get_instance(r_result.collider_id);
|
||||
} else {
|
||||
WARN_PRINT("The raycast performed has hit a collision object that is not part of Godot scene, please check it.");
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ bool GDAPI godot_is_instance_valid(const godot_object *p_object) {
|
|||
}
|
||||
|
||||
godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) {
|
||||
return (godot_object *)ObjectDB::get_instance((ObjectID)p_instance_id);
|
||||
return (godot_object *)ObjectDB::get_instance(ObjectID(p_instance_id));
|
||||
}
|
||||
|
||||
void *godot_get_class_tag(const godot_string_name *p_class) {
|
||||
|
|
|
@ -250,7 +250,12 @@ godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, co
|
|||
keys.write[i] = (*keys_proxy)[i];
|
||||
}
|
||||
|
||||
return self->findmk(keys, p_from, r_key);
|
||||
int key;
|
||||
int ret = self->findmk(keys, p_from, &key);
|
||||
if (r_key) {
|
||||
*r_key = key;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what) {
|
||||
|
|
|
@ -127,7 +127,7 @@ typedef bool godot_bool;
|
|||
|
||||
/////// int
|
||||
|
||||
typedef int godot_int;
|
||||
typedef int64_t godot_int;
|
||||
|
||||
/////// real
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ COMMAND_4(agent_set_callback, RID, p_agent, Object *, p_receiver, StringName, p_
|
|||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
|
||||
agent->set_callback(p_receiver == NULL ? 0 : p_receiver->get_instance_id(), p_method, p_udata);
|
||||
agent->set_callback(p_receiver == NULL ? ObjectID() : p_receiver->get_instance_id(), p_method, p_udata);
|
||||
|
||||
if (agent->get_map()) {
|
||||
if (p_receiver == NULL) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
RvoAgent::RvoAgent() :
|
||||
map(NULL) {
|
||||
callback.id = ObjectID(0);
|
||||
callback.id = ObjectID();
|
||||
}
|
||||
|
||||
void RvoAgent::set_map(NavMap *p_map) {
|
||||
|
@ -62,16 +62,16 @@ void RvoAgent::set_callback(ObjectID p_id, const StringName p_method, const Vari
|
|||
}
|
||||
|
||||
bool RvoAgent::has_callback() const {
|
||||
return callback.id != 0;
|
||||
return callback.id.is_valid();
|
||||
}
|
||||
|
||||
void RvoAgent::dispatch_callback() {
|
||||
if (callback.id == 0) {
|
||||
if (callback.id.is_null()) {
|
||||
return;
|
||||
}
|
||||
Object *obj = ObjectDB::get_instance(callback.id);
|
||||
if (obj == NULL) {
|
||||
callback.id = ObjectID(0);
|
||||
callback.id = ObjectID();
|
||||
}
|
||||
|
||||
Variant::CallError responseCallError;
|
||||
|
|
|
@ -1274,7 +1274,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
gdfs->state.script = Ref<GDScript>(_script);
|
||||
gdfs->state.ip = ip + ipofs;
|
||||
gdfs->state.line = line;
|
||||
gdfs->state.instance_id = (p_instance && p_instance->get_owner()) ? p_instance->get_owner()->get_instance_id() : 0;
|
||||
gdfs->state.instance_id = (p_instance && p_instance->get_owner()) ? p_instance->get_owner()->get_instance_id() : ObjectID();
|
||||
//gdfs->state.result_pos=ip+ipofs-1;
|
||||
gdfs->state.defarg = defarg;
|
||||
gdfs->state.instance = p_instance;
|
||||
|
@ -1829,7 +1829,7 @@ bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
|
|||
|
||||
if (p_extended_check) {
|
||||
//class instance gone?
|
||||
if (state.instance_id && !ObjectDB::get_instance(state.instance_id))
|
||||
if (state.instance_id.is_valid() && !ObjectDB::get_instance(state.instance_id))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
|
|||
Variant GDScriptFunctionState::resume(const Variant &p_arg) {
|
||||
|
||||
ERR_FAIL_COND_V(!function, Variant());
|
||||
if (state.instance_id && !ObjectDB::get_instance(state.instance_id)) {
|
||||
if (state.instance_id.is_valid() && !ObjectDB::get_instance(state.instance_id)) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_V_MSG(Variant(), "Resumed function '" + String(function->get_name()) + "()' after yield, but class instance is gone. At script: " + state.script->get_path() + ":" + itos(state.line));
|
||||
#else
|
||||
|
|
|
@ -1374,7 +1374,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
break;
|
||||
}
|
||||
|
||||
uint32_t id = *p_args[0];
|
||||
ObjectID id = *p_args[0];
|
||||
r_ret = ObjectDB::get_instance(id);
|
||||
|
||||
} break;
|
||||
|
|
|
@ -2414,8 +2414,8 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
ERR_FAIL_COND_V_MSG(instance_id && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
|
||||
ERR_FAIL_COND_V_MSG(script_id && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
|
||||
ERR_FAIL_COND_V_MSG(instance_id.is_valid() && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
|
||||
ERR_FAIL_COND_V_MSG(script_id.is_valid() && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -2476,8 +2476,8 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
|
|||
ERR_FAIL_COND_V(function == StringName(), Variant());
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
ERR_FAIL_COND_V_MSG(instance_id && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
|
||||
ERR_FAIL_COND_V_MSG(script_id && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
|
||||
ERR_FAIL_COND_V_MSG(instance_id.is_valid() && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
|
||||
ERR_FAIL_COND_V_MSG(script_id.is_valid() && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -529,7 +529,6 @@ void VisualScriptPropertySelector::select_method_from_base_type(const String &p_
|
|||
base_type = p_base;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
properties = false;
|
||||
instance = NULL;
|
||||
virtuals_only = p_virtuals_only;
|
||||
|
@ -554,7 +553,6 @@ void VisualScriptPropertySelector::select_from_base_type(const String &p_base, c
|
|||
base_type = p_base;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
properties = true;
|
||||
visual_script_generic = false;
|
||||
instance = NULL;
|
||||
|
@ -601,7 +599,6 @@ void VisualScriptPropertySelector::select_from_basic_type(Variant::Type p_type,
|
|||
base_type = "";
|
||||
selected = p_current;
|
||||
type = p_type;
|
||||
script = 0;
|
||||
properties = true;
|
||||
visual_script_generic = false;
|
||||
instance = NULL;
|
||||
|
@ -623,7 +620,6 @@ void VisualScriptPropertySelector::select_from_action(const String &p_type, cons
|
|||
base_type = p_type;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
properties = false;
|
||||
visual_script_generic = false;
|
||||
instance = NULL;
|
||||
|
@ -645,7 +641,6 @@ void VisualScriptPropertySelector::select_from_instance(Object *p_instance, cons
|
|||
base_type = p_basetype;
|
||||
selected = p_current;
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
properties = true;
|
||||
visual_script_generic = false;
|
||||
instance = p_instance;
|
||||
|
@ -667,7 +662,6 @@ void VisualScriptPropertySelector::select_from_visual_script(const String &p_bas
|
|||
base_type = p_base;
|
||||
selected = "";
|
||||
type = Variant::NIL;
|
||||
script = 0;
|
||||
properties = true;
|
||||
visual_script_generic = true;
|
||||
instance = NULL;
|
||||
|
|
|
@ -148,7 +148,7 @@ void Area2D::_body_exit_tree(ObjectID p_id) {
|
|||
}
|
||||
}
|
||||
|
||||
void Area2D::_body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape) {
|
||||
void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape) {
|
||||
|
||||
bool body_in = p_status == Physics2DServer::AREA_BODY_ADDED;
|
||||
ObjectID objid = p_instance;
|
||||
|
@ -251,7 +251,7 @@ void Area2D::_area_exit_tree(ObjectID p_id) {
|
|||
}
|
||||
}
|
||||
|
||||
void Area2D::_area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape) {
|
||||
void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape) {
|
||||
|
||||
bool area_in = p_status == Physics2DServer::AREA_BODY_ADDED;
|
||||
ObjectID objid = p_instance;
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
bool monitorable;
|
||||
bool locked;
|
||||
|
||||
void _body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape);
|
||||
void _body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape);
|
||||
|
||||
void _body_enter_tree(ObjectID p_id);
|
||||
void _body_exit_tree(ObjectID p_id);
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
|
||||
Map<ObjectID, BodyState> body_map;
|
||||
|
||||
void _area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape);
|
||||
void _area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape);
|
||||
|
||||
void _area_enter_tree(ObjectID p_id);
|
||||
void _area_exit_tree(ObjectID p_id);
|
||||
|
|
|
@ -608,7 +608,7 @@ void Camera2D::set_custom_viewport(Node *p_viewport) {
|
|||
if (custom_viewport) {
|
||||
custom_viewport_id = custom_viewport->get_instance_id();
|
||||
} else {
|
||||
custom_viewport_id = 0;
|
||||
custom_viewport_id = ObjectID();
|
||||
}
|
||||
|
||||
if (is_inside_tree()) {
|
||||
|
@ -795,7 +795,7 @@ Camera2D::Camera2D() {
|
|||
smoothing_enabled = false;
|
||||
limit_smoothing_enabled = false;
|
||||
custom_viewport = NULL;
|
||||
custom_viewport_id = 0;
|
||||
|
||||
process_mode = CAMERA2D_PROCESS_IDLE;
|
||||
|
||||
smoothing = 5.0;
|
||||
|
|
|
@ -997,7 +997,7 @@ ObjectID CanvasItem::get_canvas_layer_instance_id() const {
|
|||
if (canvas_layer) {
|
||||
return canvas_layer->get_instance_id();
|
||||
} else {
|
||||
return 0;
|
||||
return ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ void CollisionObject2D::_notification(int p_what) {
|
|||
case NOTIFICATION_EXIT_CANVAS: {
|
||||
|
||||
if (area)
|
||||
Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, 0);
|
||||
Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, ObjectID());
|
||||
else
|
||||
Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, 0);
|
||||
Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, ObjectID());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1544,7 +1544,7 @@ Object *KinematicCollision2D::get_local_shape() const {
|
|||
|
||||
Object *KinematicCollision2D::get_collider() const {
|
||||
|
||||
if (collision.collider) {
|
||||
if (collision.collider.is_valid()) {
|
||||
return ObjectDB::get_instance(collision.collider);
|
||||
}
|
||||
|
||||
|
@ -1608,7 +1608,7 @@ void KinematicCollision2D::_bind_methods() {
|
|||
}
|
||||
|
||||
KinematicCollision2D::KinematicCollision2D() {
|
||||
collision.collider = 0;
|
||||
|
||||
collision.collider_shape = 0;
|
||||
collision.local_shape = 0;
|
||||
owner = NULL;
|
||||
|
|
|
@ -108,7 +108,7 @@ void Polygon2D::_notification(int p_what) {
|
|||
skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton));
|
||||
}
|
||||
|
||||
ObjectID new_skeleton_id = 0;
|
||||
ObjectID new_skeleton_id;
|
||||
|
||||
if (skeleton_node) {
|
||||
VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton());
|
||||
|
@ -734,7 +734,7 @@ Polygon2D::Polygon2D() {
|
|||
color = Color(1, 1, 1);
|
||||
rect_cache_dirty = true;
|
||||
internal_vertices = 0;
|
||||
current_skeleton_id = 0;
|
||||
|
||||
specular_color = Color(1, 1, 1, 1);
|
||||
shininess = 1.0;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ bool RayCast2D::is_colliding() const {
|
|||
}
|
||||
Object *RayCast2D::get_collider() const {
|
||||
|
||||
if (against == 0)
|
||||
if (against.is_null())
|
||||
return NULL;
|
||||
|
||||
return ObjectDB::get_instance(against);
|
||||
|
@ -225,7 +225,7 @@ void RayCast2D::_update_raycast_state() {
|
|||
against_shape = rr.shape;
|
||||
} else {
|
||||
collided = false;
|
||||
against = 0;
|
||||
against = ObjectID();
|
||||
against_shape = 0;
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ void RayCast2D::_bind_methods() {
|
|||
RayCast2D::RayCast2D() {
|
||||
|
||||
enabled = false;
|
||||
against = 0;
|
||||
|
||||
collided = false;
|
||||
against_shape = 0;
|
||||
collision_mask = 1;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
void RemoteTransform2D::_update_cache() {
|
||||
|
||||
cache = 0;
|
||||
cache = ObjectID();
|
||||
if (has_node(remote_node)) {
|
||||
Node *node = get_node(remote_node);
|
||||
if (!node || this == node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) {
|
||||
|
@ -49,7 +49,7 @@ void RemoteTransform2D::_update_remote() {
|
|||
if (!is_inside_tree())
|
||||
return;
|
||||
|
||||
if (!cache)
|
||||
if (cache.is_null())
|
||||
return;
|
||||
|
||||
Node2D *n = Object::cast_to<Node2D>(ObjectDB::get_instance(cache));
|
||||
|
@ -119,7 +119,7 @@ void RemoteTransform2D::_notification(int p_what) {
|
|||
if (!is_inside_tree())
|
||||
break;
|
||||
|
||||
if (cache) {
|
||||
if (cache.is_valid()) {
|
||||
|
||||
_update_remote();
|
||||
}
|
||||
|
@ -225,6 +225,5 @@ RemoteTransform2D::RemoteTransform2D() {
|
|||
update_remote_rotation = true;
|
||||
update_remote_scale = true;
|
||||
|
||||
cache = 0;
|
||||
set_notify_transform(true);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ void Area::_body_exit_tree(ObjectID p_id) {
|
|||
}
|
||||
}
|
||||
|
||||
void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape) {
|
||||
void Area::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape) {
|
||||
|
||||
bool body_in = p_status == PhysicsServer::AREA_BODY_ADDED;
|
||||
ObjectID objid = p_instance;
|
||||
|
@ -340,7 +340,7 @@ void Area::_area_exit_tree(ObjectID p_id) {
|
|||
}
|
||||
}
|
||||
|
||||
void Area::_area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape) {
|
||||
void Area::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape) {
|
||||
|
||||
bool area_in = p_status == PhysicsServer::AREA_BODY_ADDED;
|
||||
ObjectID objid = p_instance;
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
bool monitorable;
|
||||
bool locked;
|
||||
|
||||
void _body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape);
|
||||
void _body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape);
|
||||
|
||||
void _body_enter_tree(ObjectID p_id);
|
||||
void _body_exit_tree(ObjectID p_id);
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
|
||||
Map<ObjectID, BodyState> body_map;
|
||||
|
||||
void _area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape);
|
||||
void _area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape);
|
||||
|
||||
void _area_enter_tree(ObjectID p_id);
|
||||
void _area_exit_tree(ObjectID p_id);
|
||||
|
|
|
@ -1493,7 +1493,7 @@ Object *KinematicCollision::get_local_shape() const {
|
|||
|
||||
Object *KinematicCollision::get_collider() const {
|
||||
|
||||
if (collision.collider) {
|
||||
if (collision.collider.is_valid()) {
|
||||
return ObjectDB::get_instance(collision.collider);
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ void KinematicCollision::_bind_methods() {
|
|||
}
|
||||
|
||||
KinematicCollision::KinematicCollision() {
|
||||
collision.collider = 0;
|
||||
|
||||
collision.collider_shape = 0;
|
||||
collision.local_shape = 0;
|
||||
owner = NULL;
|
||||
|
|
|
@ -80,7 +80,7 @@ bool RayCast::is_colliding() const {
|
|||
}
|
||||
Object *RayCast::get_collider() const {
|
||||
|
||||
if (against == 0)
|
||||
if (against.is_null())
|
||||
return NULL;
|
||||
|
||||
return ObjectDB::get_instance(against);
|
||||
|
@ -219,7 +219,7 @@ void RayCast::_update_raycast_state() {
|
|||
against_shape = rr.shape;
|
||||
} else {
|
||||
collided = false;
|
||||
against = 0;
|
||||
against = ObjectID();
|
||||
against_shape = 0;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ void RayCast::_clear_debug_shape() {
|
|||
RayCast::RayCast() {
|
||||
|
||||
enabled = false;
|
||||
against = 0;
|
||||
|
||||
collided = false;
|
||||
against_shape = 0;
|
||||
collision_mask = 1;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "remote_transform.h"
|
||||
|
||||
void RemoteTransform::_update_cache() {
|
||||
cache = 0;
|
||||
cache = ObjectID();
|
||||
if (has_node(remote_node)) {
|
||||
Node *node = get_node(remote_node);
|
||||
if (!node || this == node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) {
|
||||
|
@ -47,7 +47,7 @@ void RemoteTransform::_update_remote() {
|
|||
if (!is_inside_tree())
|
||||
return;
|
||||
|
||||
if (!cache)
|
||||
if (cache.is_null())
|
||||
return;
|
||||
|
||||
Spatial *n = Object::cast_to<Spatial>(ObjectDB::get_instance(cache));
|
||||
|
@ -114,7 +114,7 @@ void RemoteTransform::_notification(int p_what) {
|
|||
if (!is_inside_tree())
|
||||
break;
|
||||
|
||||
if (cache) {
|
||||
if (cache.is_valid()) {
|
||||
|
||||
_update_remote();
|
||||
}
|
||||
|
@ -219,6 +219,5 @@ RemoteTransform::RemoteTransform() {
|
|||
update_remote_rotation = true;
|
||||
update_remote_scale = true;
|
||||
|
||||
cache = 0;
|
||||
set_notify_transform(true);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ bool Skeleton::_get(const StringName &p_path, Variant &r_ret) const {
|
|||
else if (what == "bound_children") {
|
||||
Array children;
|
||||
|
||||
for (const List<uint32_t>::Element *E = bones[which].nodes_bound.front(); E; E = E->next()) {
|
||||
for (const List<ObjectID>::Element *E = bones[which].nodes_bound.front(); E; E = E->next()) {
|
||||
|
||||
Object *obj = ObjectDB::get_instance(E->get());
|
||||
ERR_CONTINUE(!obj);
|
||||
|
@ -302,7 +302,7 @@ void Skeleton::_notification(int p_what) {
|
|||
b.global_pose_override_amount = 0.0;
|
||||
}
|
||||
|
||||
for (List<uint32_t>::Element *E = b.nodes_bound.front(); E; E = E->next()) {
|
||||
for (List<ObjectID>::Element *E = b.nodes_bound.front(); E; E = E->next()) {
|
||||
|
||||
Object *obj = ObjectDB::get_instance(E->get());
|
||||
ERR_CONTINUE(!obj);
|
||||
|
@ -505,9 +505,9 @@ void Skeleton::bind_child_node_to_bone(int p_bone, Node *p_node) {
|
|||
ERR_FAIL_NULL(p_node);
|
||||
ERR_FAIL_INDEX(p_bone, bones.size());
|
||||
|
||||
uint32_t id = p_node->get_instance_id();
|
||||
ObjectID id = p_node->get_instance_id();
|
||||
|
||||
for (const List<uint32_t>::Element *E = bones[p_bone].nodes_bound.front(); E; E = E->next()) {
|
||||
for (const List<ObjectID>::Element *E = bones[p_bone].nodes_bound.front(); E; E = E->next()) {
|
||||
|
||||
if (E->get() == id)
|
||||
return; // already here
|
||||
|
@ -520,14 +520,14 @@ void Skeleton::unbind_child_node_from_bone(int p_bone, Node *p_node) {
|
|||
ERR_FAIL_NULL(p_node);
|
||||
ERR_FAIL_INDEX(p_bone, bones.size());
|
||||
|
||||
uint32_t id = p_node->get_instance_id();
|
||||
ObjectID id = p_node->get_instance_id();
|
||||
bones.write[p_bone].nodes_bound.erase(id);
|
||||
}
|
||||
void Skeleton::get_bound_child_nodes_to_bone(int p_bone, List<Node *> *p_bound) const {
|
||||
|
||||
ERR_FAIL_INDEX(p_bone, bones.size());
|
||||
|
||||
for (const List<uint32_t>::Element *E = bones[p_bone].nodes_bound.front(); E; E = E->next()) {
|
||||
for (const List<ObjectID>::Element *E = bones[p_bone].nodes_bound.front(); E; E = E->next()) {
|
||||
|
||||
Object *obj = ObjectDB::get_instance(E->get());
|
||||
ERR_CONTINUE(!obj);
|
||||
|
|
|
@ -99,7 +99,7 @@ private:
|
|||
PhysicalBone *cache_parent_physical_bone;
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
List<uint32_t> nodes_bound;
|
||||
List<ObjectID> nodes_bound;
|
||||
|
||||
Bone() {
|
||||
parent = -1;
|
||||
|
|
|
@ -249,7 +249,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
|
|||
Vector<StringName> leftover_path;
|
||||
Node *child = parent->get_node_and_resource(a->track_get_path(i), resource, leftover_path);
|
||||
ERR_CONTINUE_MSG(!child, "On Animation: '" + p_anim->name + "', couldn't resolve track: '" + String(a->track_get_path(i)) + "'."); // couldn't find the child node
|
||||
uint32_t id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id();
|
||||
ObjectID id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id();
|
||||
int bone_idx = -1;
|
||||
|
||||
if (a->track_get_path(i).get_subname_count() == 1 && Object::cast_to<Skeleton>(child)) {
|
||||
|
|
|
@ -159,17 +159,15 @@ private:
|
|||
|
||||
struct TrackNodeCacheKey {
|
||||
|
||||
uint32_t id;
|
||||
ObjectID id;
|
||||
int bone_idx;
|
||||
|
||||
inline bool operator<(const TrackNodeCacheKey &p_right) const {
|
||||
|
||||
if (id < p_right.id)
|
||||
return true;
|
||||
else if (id > p_right.id)
|
||||
return false;
|
||||
else
|
||||
if (id == p_right.id)
|
||||
return bone_idx < p_right.bone_idx;
|
||||
else
|
||||
return id < p_right.id;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -767,7 +767,7 @@ void AnimationTree::_process_graph(float p_delta) {
|
|||
|
||||
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
|
||||
|
||||
ObjectID current_animation_player = 0;
|
||||
ObjectID current_animation_player;
|
||||
|
||||
if (player) {
|
||||
current_animation_player = player->get_instance_id();
|
||||
|
@ -775,7 +775,7 @@ void AnimationTree::_process_graph(float p_delta) {
|
|||
|
||||
if (last_animation_player != current_animation_player) {
|
||||
|
||||
if (last_animation_player) {
|
||||
if (last_animation_player.is_valid()) {
|
||||
Object *old_player = ObjectDB::get_instance(last_animation_player);
|
||||
if (old_player) {
|
||||
old_player->disconnect("caches_cleared", this, "_clear_caches");
|
||||
|
@ -1296,7 +1296,7 @@ void AnimationTree::_notification(int p_what) {
|
|||
|
||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||
_clear_caches();
|
||||
if (last_animation_player) {
|
||||
if (last_animation_player.is_valid()) {
|
||||
|
||||
Object *player = ObjectDB::get_instance(last_animation_player);
|
||||
if (player) {
|
||||
|
@ -1304,7 +1304,7 @@ void AnimationTree::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
} else if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
if (last_animation_player) {
|
||||
if (last_animation_player.is_valid()) {
|
||||
|
||||
Object *player = ObjectDB::get_instance(last_animation_player);
|
||||
if (player) {
|
||||
|
@ -1584,7 +1584,6 @@ AnimationTree::AnimationTree() {
|
|||
process_pass = 1;
|
||||
started = true;
|
||||
properties_dirty = true;
|
||||
last_animation_player = 0;
|
||||
}
|
||||
|
||||
AnimationTree::~AnimationTree() {
|
||||
|
|
|
@ -187,7 +187,6 @@ private:
|
|||
setup_pass = 0;
|
||||
process_pass = 0;
|
||||
object = NULL;
|
||||
object_id = 0;
|
||||
}
|
||||
virtual ~TrackCache() {}
|
||||
};
|
||||
|
|
|
@ -705,12 +705,12 @@ void Control::set_drag_forwarding(Control *p_target) {
|
|||
if (p_target)
|
||||
data.drag_owner = p_target->get_instance_id();
|
||||
else
|
||||
data.drag_owner = 0;
|
||||
data.drag_owner = ObjectID();
|
||||
}
|
||||
|
||||
Variant Control::get_drag_data(const Point2 &p_point) {
|
||||
|
||||
if (data.drag_owner) {
|
||||
if (data.drag_owner.is_valid()) {
|
||||
Object *obj = ObjectDB::get_instance(data.drag_owner);
|
||||
if (obj) {
|
||||
Control *c = Object::cast_to<Control>(obj);
|
||||
|
@ -732,7 +732,7 @@ Variant Control::get_drag_data(const Point2 &p_point) {
|
|||
|
||||
bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
|
||||
|
||||
if (data.drag_owner) {
|
||||
if (data.drag_owner.is_valid()) {
|
||||
Object *obj = ObjectDB::get_instance(data.drag_owner);
|
||||
if (obj) {
|
||||
Control *c = Object::cast_to<Control>(obj);
|
||||
|
@ -753,7 +753,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const
|
|||
}
|
||||
void Control::drop_data(const Point2 &p_point, const Variant &p_data) {
|
||||
|
||||
if (data.drag_owner) {
|
||||
if (data.drag_owner.is_valid()) {
|
||||
Object *obj = ObjectDB::get_instance(data.drag_owner);
|
||||
if (obj) {
|
||||
Control *c = Object::cast_to<Control>(obj);
|
||||
|
@ -2224,7 +2224,7 @@ void Control::_modal_stack_remove() {
|
|||
|
||||
get_viewport()->_gui_remove_from_modal_stack(element, data.modal_prev_focus_owner);
|
||||
|
||||
data.modal_prev_focus_owner = 0;
|
||||
data.modal_prev_focus_owner = ObjectID();
|
||||
}
|
||||
|
||||
void Control::_propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign) {
|
||||
|
@ -3110,7 +3110,7 @@ Control::Control() {
|
|||
data.rotation = 0;
|
||||
data.parent_canvas_item = NULL;
|
||||
data.scale = Vector2(1, 1);
|
||||
data.drag_owner = 0;
|
||||
|
||||
data.modal_frame = 0;
|
||||
data.block_minimum_size_adjust = false;
|
||||
data.disable_visibility_clip = false;
|
||||
|
@ -3125,7 +3125,6 @@ Control::Control() {
|
|||
data.margin[i] = 0;
|
||||
}
|
||||
data.focus_mode = FOCUS_NONE;
|
||||
data.modal_prev_focus_owner = 0;
|
||||
}
|
||||
|
||||
Control::~Control() {
|
||||
|
|
|
@ -1399,7 +1399,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
|||
} break;
|
||||
case TreeItem::CELL_MODE_CUSTOM: {
|
||||
|
||||
if (p_item->cells[i].custom_draw_obj) {
|
||||
if (p_item->cells[i].custom_draw_obj.is_valid()) {
|
||||
|
||||
Object *cdo = ObjectDB::get_instance(p_item->cells[i].custom_draw_obj);
|
||||
if (cdo)
|
||||
|
|
|
@ -112,7 +112,7 @@ private:
|
|||
|
||||
Cell() {
|
||||
|
||||
custom_draw_obj = 0;
|
||||
custom_draw_obj = ObjectID();
|
||||
custom_button = false;
|
||||
mode = TreeItem::CELL_MODE_STRING;
|
||||
min = 0;
|
||||
|
|
|
@ -200,7 +200,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) {
|
|||
if (custom_viewport) {
|
||||
custom_viewport_id = custom_viewport->get_instance_id();
|
||||
} else {
|
||||
custom_viewport_id = 0;
|
||||
custom_viewport_id = ObjectID();
|
||||
}
|
||||
|
||||
if (is_inside_tree()) {
|
||||
|
@ -327,7 +327,7 @@ CanvasLayer::CanvasLayer() {
|
|||
layer = 1;
|
||||
canvas = VS::get_singleton()->canvas_create();
|
||||
custom_viewport = NULL;
|
||||
custom_viewport_id = 0;
|
||||
|
||||
sort_index = 0;
|
||||
follow_viewport = false;
|
||||
follow_viewport_scale = 1.0;
|
||||
|
|
|
@ -412,7 +412,7 @@ void Viewport::_notification(int p_what) {
|
|||
#ifndef _3D_DISABLED
|
||||
Vector2 last_pos(1e20, 1e20);
|
||||
CollisionObject *last_object = NULL;
|
||||
ObjectID last_id = 0;
|
||||
ObjectID last_id;
|
||||
#endif
|
||||
PhysicsDirectSpaceState::RayResult result;
|
||||
Physics2DDirectSpaceState *ss2d = Physics2DServer::get_singleton()->space_get_direct_state(find_world_2d()->get_space());
|
||||
|
@ -532,7 +532,7 @@ void Viewport::_notification(int p_what) {
|
|||
} else {
|
||||
// This Viewport's builtin canvas
|
||||
canvas_transform = get_canvas_transform();
|
||||
canvas_layer_id = 0;
|
||||
canvas_layer_id = ObjectID();
|
||||
}
|
||||
|
||||
Vector2 point = canvas_transform.affine_inverse().xform(pos);
|
||||
|
@ -540,7 +540,7 @@ void Viewport::_notification(int p_what) {
|
|||
int rc = ss2d->intersect_point_on_canvas(point, canvas_layer_id, res, 64, Set<RID>(), 0xFFFFFFFF, true, true, true);
|
||||
for (int i = 0; i < rc; i++) {
|
||||
|
||||
if (res[i].collider_id && res[i].collider) {
|
||||
if (res[i].collider_id.is_valid() && res[i].collider) {
|
||||
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(res[i].collider);
|
||||
if (co) {
|
||||
bool send_event = true;
|
||||
|
@ -594,18 +594,18 @@ void Viewport::_notification(int p_what) {
|
|||
#ifndef _3D_DISABLED
|
||||
bool captured = false;
|
||||
|
||||
if (physics_object_capture != 0) {
|
||||
if (physics_object_capture.is_valid()) {
|
||||
|
||||
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_capture));
|
||||
if (co && camera) {
|
||||
_collision_object_input_event(co, camera, ev, Vector3(), Vector3(), 0);
|
||||
captured = true;
|
||||
if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
|
||||
physics_object_capture = 0;
|
||||
physics_object_capture = ObjectID();
|
||||
}
|
||||
|
||||
} else {
|
||||
physics_object_capture = 0;
|
||||
physics_object_capture = ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ void Viewport::_notification(int p_what) {
|
|||
//none
|
||||
} else if (pos == last_pos) {
|
||||
|
||||
if (last_id) {
|
||||
if (last_id.is_valid()) {
|
||||
if (ObjectDB::get_instance(last_id) && last_object) {
|
||||
//good, exists
|
||||
_collision_object_input_event(last_object, camera, ev, result.position, result.normal, result.shape);
|
||||
|
@ -633,7 +633,7 @@ void Viewport::_notification(int p_what) {
|
|||
if (space) {
|
||||
|
||||
bool col = space->intersect_ray(from, from + dir * 10000, result, Set<RID>(), 0xFFFFFFFF, true, true, true);
|
||||
ObjectID new_collider = 0;
|
||||
ObjectID new_collider;
|
||||
if (col) {
|
||||
|
||||
CollisionObject *co = Object::cast_to<CollisionObject>(result.collider);
|
||||
|
@ -651,7 +651,7 @@ void Viewport::_notification(int p_what) {
|
|||
|
||||
if (is_mouse && new_collider != physics_object_over) {
|
||||
|
||||
if (physics_object_over) {
|
||||
if (physics_object_over.is_valid()) {
|
||||
|
||||
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_over));
|
||||
if (co) {
|
||||
|
@ -659,7 +659,7 @@ void Viewport::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
if (new_collider) {
|
||||
if (new_collider.is_valid()) {
|
||||
|
||||
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(new_collider));
|
||||
if (co) {
|
||||
|
@ -2504,7 +2504,7 @@ void Viewport::_gui_remove_from_modal_stack(List<Control *>::Element *MI, Object
|
|||
|
||||
gui.modal_stack.erase(MI);
|
||||
|
||||
if (p_prev_focus_owner) {
|
||||
if (p_prev_focus_owner.is_valid()) {
|
||||
|
||||
// for previous window in stack, pass the focus so it feels more
|
||||
// natural
|
||||
|
@ -2701,14 +2701,15 @@ void Viewport::_drop_physics_mouseover() {
|
|||
}
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
if (physics_object_over) {
|
||||
if (physics_object_over.is_valid()) {
|
||||
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_over));
|
||||
if (co) {
|
||||
co->_mouse_exit();
|
||||
}
|
||||
}
|
||||
|
||||
physics_object_over = physics_object_capture = 0;
|
||||
physics_object_over = ObjectID();
|
||||
physics_object_capture = ObjectID();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2718,7 +2719,7 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
|
|||
if (gui.key_focus)
|
||||
p_control->_modal_set_prev_focus_owner(gui.key_focus->get_instance_id());
|
||||
else
|
||||
p_control->_modal_set_prev_focus_owner(0);
|
||||
p_control->_modal_set_prev_focus_owner(ObjectID());
|
||||
|
||||
if (gui.mouse_focus && !p_control->is_a_parent_of(gui.mouse_focus) && !gui.mouse_click_grabber) {
|
||||
|
||||
|
@ -3334,8 +3335,6 @@ Viewport::Viewport() {
|
|||
update_mode = UPDATE_WHEN_VISIBLE;
|
||||
|
||||
physics_object_picking = false;
|
||||
physics_object_capture = 0;
|
||||
physics_object_over = 0;
|
||||
physics_has_last_mousepos = false;
|
||||
physics_last_mousepos = Vector2(Math_INF, Math_INF);
|
||||
|
||||
|
@ -3385,7 +3384,6 @@ Viewport::Viewport() {
|
|||
physics_last_mouse_state.mouse_mask = 0;
|
||||
local_input_handled = false;
|
||||
handle_input_locally = true;
|
||||
physics_last_id = 0; //ensures first time there will be a check
|
||||
|
||||
default_canvas_item_texture_filter = DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
|
||||
default_canvas_item_texture_repeat = DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
|
||||
|
|
|
@ -175,7 +175,7 @@ void AreaSW::set_monitorable(bool p_monitorable) {
|
|||
|
||||
void AreaSW::call_queries() {
|
||||
|
||||
if (monitor_callback_id && !monitored_bodies.empty()) {
|
||||
if (monitor_callback_id.is_valid() && !monitored_bodies.empty()) {
|
||||
|
||||
Variant res[5];
|
||||
Variant *resptr[5];
|
||||
|
@ -185,7 +185,7 @@ void AreaSW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(monitor_callback_id);
|
||||
if (!obj) {
|
||||
monitored_bodies.clear();
|
||||
monitor_callback_id = 0;
|
||||
monitor_callback_id = ObjectID();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void AreaSW::call_queries() {
|
|||
|
||||
monitored_bodies.clear();
|
||||
|
||||
if (area_monitor_callback_id && !monitored_areas.empty()) {
|
||||
if (area_monitor_callback_id.is_valid() && !monitored_areas.empty()) {
|
||||
|
||||
Variant res[5];
|
||||
Variant *resptr[5];
|
||||
|
@ -217,7 +217,7 @@ void AreaSW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(area_monitor_callback_id);
|
||||
if (!obj) {
|
||||
monitored_areas.clear();
|
||||
area_monitor_callback_id = 0;
|
||||
area_monitor_callback_id = ObjectID();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,6 @@ AreaSW::AreaSW() :
|
|||
linear_damp = 0.1;
|
||||
priority = 0;
|
||||
set_ray_pickable(false);
|
||||
monitor_callback_id = 0;
|
||||
area_monitor_callback_id = 0;
|
||||
monitorable = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,10 +111,10 @@ public:
|
|||
//_FORCE_INLINE_ SpaceSW* get_owner() { return owner; }
|
||||
|
||||
void set_monitor_callback(ObjectID p_id, const StringName &p_method);
|
||||
_FORCE_INLINE_ bool has_monitor_callback() const { return monitor_callback_id; }
|
||||
_FORCE_INLINE_ bool has_monitor_callback() const { return monitor_callback_id.is_valid(); }
|
||||
|
||||
void set_area_monitor_callback(ObjectID p_id, const StringName &p_method);
|
||||
_FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id; }
|
||||
_FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id.is_valid(); }
|
||||
|
||||
_FORCE_INLINE_ void add_body_to_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
|
||||
_FORCE_INLINE_ void remove_body_from_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
|
||||
|
|
|
@ -709,7 +709,7 @@ void BodySW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(fi_callback->id);
|
||||
if (!obj) {
|
||||
|
||||
set_force_integration_callback(0, StringName());
|
||||
set_force_integration_callback(ObjectID(), StringName());
|
||||
} else {
|
||||
const Variant *vp[2] = { &v, &fi_callback->udata };
|
||||
|
||||
|
@ -749,7 +749,7 @@ void BodySW::set_force_integration_callback(ObjectID p_id, const StringName &p_m
|
|||
fi_callback = NULL;
|
||||
}
|
||||
|
||||
if (p_id != 0) {
|
||||
if (p_id.is_valid()) {
|
||||
|
||||
fi_callback = memnew(ForceIntegrationCallback);
|
||||
fi_callback->id = p_id;
|
||||
|
|
|
@ -451,7 +451,7 @@ public:
|
|||
return body->contacts[p_contact_idx].collider_pos;
|
||||
}
|
||||
virtual ObjectID get_contact_collider_id(int p_contact_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, 0);
|
||||
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, ObjectID());
|
||||
return body->contacts[p_contact_idx].collider_instance_id;
|
||||
}
|
||||
virtual int get_contact_collider_shape(int p_contact_idx) const {
|
||||
|
|
|
@ -232,7 +232,7 @@ CollisionObjectSW::CollisionObjectSW(Type p_type) :
|
|||
_static = true;
|
||||
type = p_type;
|
||||
space = NULL;
|
||||
instance_id = 0;
|
||||
|
||||
collision_layer = 1;
|
||||
collision_mask = 1;
|
||||
ray_pickable = true;
|
||||
|
|
|
@ -374,7 +374,7 @@ ObjectID PhysicsServerSW::area_get_object_instance_id(RID p_area) const {
|
|||
p_area = space->get_default_area()->get_self();
|
||||
}
|
||||
AreaSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND_V(!area, 0);
|
||||
ERR_FAIL_COND_V(!area, ObjectID());
|
||||
return area->get_instance_id();
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ void PhysicsServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver,
|
|||
AreaSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
void PhysicsServerSW::area_set_ray_pickable(RID p_area, bool p_enable) {
|
||||
|
@ -470,7 +470,7 @@ void PhysicsServerSW::area_set_area_monitor_callback(RID p_area, Object *p_recei
|
|||
AreaSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
/* BODY API */
|
||||
|
@ -665,7 +665,7 @@ uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body) const {
|
|||
return body->get_collision_mask();
|
||||
}
|
||||
|
||||
void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
|
||||
void PhysicsServerSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
|
||||
|
||||
BodySW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
@ -673,10 +673,10 @@ void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id)
|
|||
body->set_instance_id(p_id);
|
||||
};
|
||||
|
||||
uint32_t PhysicsServerSW::body_get_object_instance_id(RID p_body) const {
|
||||
ObjectID PhysicsServerSW::body_get_object_instance_id(RID p_body) const {
|
||||
|
||||
BodySW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
ERR_FAIL_COND_V(!body, ObjectID());
|
||||
|
||||
return body->get_instance_id();
|
||||
};
|
||||
|
@ -934,7 +934,7 @@ void PhysicsServerSW::body_set_force_integration_callback(RID p_body, Object *p_
|
|||
|
||||
BodySW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
|
||||
}
|
||||
|
||||
void PhysicsServerSW::body_set_ray_pickable(RID p_body, bool p_enable) {
|
||||
|
|
|
@ -177,8 +177,8 @@ public:
|
|||
virtual void body_remove_shape(RID p_body, int p_shape_idx);
|
||||
virtual void body_clear_shapes(RID p_body);
|
||||
|
||||
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
|
||||
virtual uint32_t body_get_object_instance_id(RID p_body) const;
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id);
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const;
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const;
|
||||
|
|
|
@ -80,7 +80,7 @@ int PhysicsDirectSpaceStateSW::intersect_point(const Vector3 &p_point, ShapeResu
|
|||
continue;
|
||||
|
||||
r_results[cc].collider_id = col_obj->get_instance_id();
|
||||
if (r_results[cc].collider_id != 0)
|
||||
if (r_results[cc].collider_id.is_valid())
|
||||
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
|
||||
else
|
||||
r_results[cc].collider = NULL;
|
||||
|
@ -159,7 +159,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
|
|||
return false;
|
||||
|
||||
r_result.collider_id = res_obj->get_instance_id();
|
||||
if (r_result.collider_id != 0)
|
||||
if (r_result.collider_id.is_valid())
|
||||
r_result.collider = ObjectDB::get_instance(r_result.collider_id);
|
||||
else
|
||||
r_result.collider = NULL;
|
||||
|
@ -208,7 +208,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
|
|||
|
||||
if (r_results) {
|
||||
r_results[cc].collider_id = col_obj->get_instance_id();
|
||||
if (r_results[cc].collider_id != 0)
|
||||
if (r_results[cc].collider_id.is_valid())
|
||||
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
|
||||
else
|
||||
r_results[cc].collider = NULL;
|
||||
|
@ -705,7 +705,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
|
|||
//but is it right? who knows at this point..
|
||||
|
||||
if (r_result) {
|
||||
r_result->collider_id = 0;
|
||||
r_result->collider_id = ObjectID();
|
||||
r_result->collider_shape = 0;
|
||||
}
|
||||
AABB body_aabb;
|
||||
|
|
|
@ -175,7 +175,7 @@ void Area2DSW::set_monitorable(bool p_monitorable) {
|
|||
|
||||
void Area2DSW::call_queries() {
|
||||
|
||||
if (monitor_callback_id && !monitored_bodies.empty()) {
|
||||
if (monitor_callback_id.is_valid() && !monitored_bodies.empty()) {
|
||||
|
||||
Variant res[5];
|
||||
Variant *resptr[5];
|
||||
|
@ -185,7 +185,7 @@ void Area2DSW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(monitor_callback_id);
|
||||
if (!obj) {
|
||||
monitored_bodies.clear();
|
||||
monitor_callback_id = 0;
|
||||
monitor_callback_id = ObjectID();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void Area2DSW::call_queries() {
|
|||
|
||||
monitored_bodies.clear();
|
||||
|
||||
if (area_monitor_callback_id && !monitored_areas.empty()) {
|
||||
if (area_monitor_callback_id.is_valid() && !monitored_areas.empty()) {
|
||||
|
||||
Variant res[5];
|
||||
Variant *resptr[5];
|
||||
|
@ -217,7 +217,7 @@ void Area2DSW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(area_monitor_callback_id);
|
||||
if (!obj) {
|
||||
monitored_areas.clear();
|
||||
area_monitor_callback_id = 0;
|
||||
area_monitor_callback_id = ObjectID();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -258,8 +258,6 @@ Area2DSW::Area2DSW() :
|
|||
angular_damp = 1.0;
|
||||
linear_damp = 0.1;
|
||||
priority = 0;
|
||||
monitor_callback_id = 0;
|
||||
area_monitor_callback_id = 0;
|
||||
monitorable = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,10 +110,10 @@ public:
|
|||
//_FORCE_INLINE_ SpaceSW* get_owner() { return owner; }
|
||||
|
||||
void set_monitor_callback(ObjectID p_id, const StringName &p_method);
|
||||
_FORCE_INLINE_ bool has_monitor_callback() const { return monitor_callback_id; }
|
||||
_FORCE_INLINE_ bool has_monitor_callback() const { return monitor_callback_id.is_valid(); }
|
||||
|
||||
void set_area_monitor_callback(ObjectID p_id, const StringName &p_method);
|
||||
_FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id; }
|
||||
_FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id.is_valid(); }
|
||||
|
||||
_FORCE_INLINE_ void add_body_to_query(Body2DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
|
||||
_FORCE_INLINE_ void remove_body_from_query(Body2DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
|
||||
|
|
|
@ -610,7 +610,7 @@ void Body2DSW::call_queries() {
|
|||
Object *obj = ObjectDB::get_instance(fi_callback->id);
|
||||
if (!obj) {
|
||||
|
||||
set_force_integration_callback(0, StringName());
|
||||
set_force_integration_callback(ObjectID(), StringName());
|
||||
} else {
|
||||
Variant::CallError ce;
|
||||
if (fi_callback->callback_udata.get_type() != Variant::NIL) {
|
||||
|
@ -653,7 +653,7 @@ void Body2DSW::set_force_integration_callback(ObjectID p_id, const StringName &p
|
|||
fi_callback = NULL;
|
||||
}
|
||||
|
||||
if (p_id != 0) {
|
||||
if (p_id.is_valid()) {
|
||||
|
||||
fi_callback = memnew(ForceIntegrationCallback);
|
||||
fi_callback->id = p_id;
|
||||
|
|
|
@ -400,7 +400,7 @@ public:
|
|||
return body->contacts[p_contact_idx].collider_pos;
|
||||
}
|
||||
virtual ObjectID get_contact_collider_id(int p_contact_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, 0);
|
||||
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, ObjectID());
|
||||
return body->contacts[p_contact_idx].collider_instance_id;
|
||||
}
|
||||
virtual int get_contact_collider_shape(int p_contact_idx) const {
|
||||
|
|
|
@ -267,8 +267,6 @@ CollisionObject2DSW::CollisionObject2DSW(Type p_type) :
|
|||
_static = true;
|
||||
type = p_type;
|
||||
space = NULL;
|
||||
instance_id = 0;
|
||||
canvas_instance_id = 0;
|
||||
collision_mask = 1;
|
||||
collision_layer = 1;
|
||||
pickable = true;
|
||||
|
|
|
@ -470,7 +470,7 @@ ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const {
|
|||
p_area = space->get_default_area()->get_self();
|
||||
}
|
||||
Area2DSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND_V(!area, 0);
|
||||
ERR_FAIL_COND_V(!area, ObjectID());
|
||||
return area->get_instance_id();
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ ObjectID Physics2DServerSW::area_get_canvas_instance_id(RID p_area) const {
|
|||
p_area = space->get_default_area()->get_self();
|
||||
}
|
||||
Area2DSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND_V(!area, 0);
|
||||
ERR_FAIL_COND_V(!area, ObjectID());
|
||||
return area->get_canvas_instance_id();
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ void Physics2DServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver
|
|||
Area2DSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
|
||||
|
@ -578,7 +578,7 @@ void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_rec
|
|||
Area2DSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : 0, p_method);
|
||||
area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
|
||||
}
|
||||
|
||||
/* BODY API */
|
||||
|
@ -756,7 +756,7 @@ Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_dete
|
|||
return body->get_continuous_collision_detection_mode();
|
||||
}
|
||||
|
||||
void Physics2DServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id) {
|
||||
void Physics2DServerSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
|
||||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
@ -764,15 +764,15 @@ void Physics2DServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_id
|
|||
body->set_instance_id(p_id);
|
||||
};
|
||||
|
||||
uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
|
||||
ObjectID Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
|
||||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
ERR_FAIL_COND_V(!body, ObjectID());
|
||||
|
||||
return body->get_instance_id();
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, uint32_t p_id) {
|
||||
void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, ObjectID p_id) {
|
||||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
@ -780,10 +780,10 @@ void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, uint32_t p_id
|
|||
body->set_canvas_instance_id(p_id);
|
||||
};
|
||||
|
||||
uint32_t Physics2DServerSW::body_get_canvas_instance_id(RID p_body) const {
|
||||
ObjectID Physics2DServerSW::body_get_canvas_instance_id(RID p_body) const {
|
||||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
ERR_FAIL_COND_V(!body, ObjectID());
|
||||
|
||||
return body->get_canvas_instance_id();
|
||||
};
|
||||
|
@ -1025,7 +1025,7 @@ void Physics2DServerSW::body_set_force_integration_callback(RID p_body, Object *
|
|||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
|
||||
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
|
||||
}
|
||||
|
||||
bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, Vector2 *r_results, int p_result_max, int &r_result_count) {
|
||||
|
|
|
@ -195,11 +195,11 @@ public:
|
|||
virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled);
|
||||
virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin);
|
||||
|
||||
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id);
|
||||
virtual uint32_t body_get_object_instance_id(RID p_body) const;
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id);
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const;
|
||||
|
||||
virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_id);
|
||||
virtual uint32_t body_get_canvas_instance_id(RID p_body) const;
|
||||
virtual void body_attach_canvas_instance_id(RID p_body, ObjectID p_id);
|
||||
virtual ObjectID body_get_canvas_instance_id(RID p_body) const;
|
||||
|
||||
virtual void body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode);
|
||||
virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const;
|
||||
|
|
|
@ -199,11 +199,11 @@ public:
|
|||
FUNC2(body_remove_shape, RID, int);
|
||||
FUNC1(body_clear_shapes, RID);
|
||||
|
||||
FUNC2(body_attach_object_instance_id, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, body_get_object_instance_id, RID);
|
||||
FUNC2(body_attach_object_instance_id, RID, ObjectID);
|
||||
FUNC1RC(ObjectID, body_get_object_instance_id, RID);
|
||||
|
||||
FUNC2(body_attach_canvas_instance_id, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, body_get_canvas_instance_id, RID);
|
||||
FUNC2(body_attach_canvas_instance_id, RID, ObjectID);
|
||||
FUNC1RC(ObjectID, body_get_canvas_instance_id, RID);
|
||||
|
||||
FUNC2(body_set_continuous_collision_detection_mode, RID, CCDMode);
|
||||
FUNC1RC(CCDMode, body_get_continuous_collision_detection_mode, RID);
|
||||
|
|
|
@ -91,7 +91,7 @@ int Physics2DDirectSpaceStateSW::_intersect_point_impl(const Vector2 &p_point, S
|
|||
continue;
|
||||
|
||||
r_results[cc].collider_id = col_obj->get_instance_id();
|
||||
if (r_results[cc].collider_id != 0)
|
||||
if (r_results[cc].collider_id.is_valid())
|
||||
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
|
||||
r_results[cc].rid = col_obj->get_self();
|
||||
r_results[cc].shape = shape_idx;
|
||||
|
@ -182,7 +182,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vec
|
|||
return false;
|
||||
|
||||
r_result.collider_id = res_obj->get_instance_id();
|
||||
if (r_result.collider_id != 0)
|
||||
if (r_result.collider_id.is_valid())
|
||||
r_result.collider = ObjectDB::get_instance(r_result.collider_id);
|
||||
r_result.normal = res_normal;
|
||||
r_result.metadata = res_obj->get_shape_metadata(res_shape);
|
||||
|
@ -226,7 +226,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
|
|||
continue;
|
||||
|
||||
r_results[cc].collider_id = col_obj->get_instance_id();
|
||||
if (r_results[cc].collider_id != 0)
|
||||
if (r_results[cc].collider_id.is_valid())
|
||||
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
|
||||
r_results[cc].rid = col_obj->get_self();
|
||||
r_results[cc].shape = shape_idx;
|
||||
|
@ -697,7 +697,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
|
|||
//but is it right? who knows at this point..
|
||||
|
||||
if (r_result) {
|
||||
r_result->collider_id = 0;
|
||||
r_result->collider_id = ObjectID();
|
||||
r_result->collider_shape = 0;
|
||||
}
|
||||
Rect2 body_aabb;
|
||||
|
|
|
@ -45,7 +45,7 @@ class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
|
|||
|
||||
GDCLASS(Physics2DDirectSpaceStateSW, Physics2DDirectSpaceState);
|
||||
|
||||
int _intersect_point_impl(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_pick_point, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = 0);
|
||||
int _intersect_point_impl(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_pick_point, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = ObjectID());
|
||||
|
||||
public:
|
||||
Space2DSW *space;
|
||||
|
|
|
@ -523,7 +523,7 @@ void Physics2DTestMotionResult::_bind_methods() {
|
|||
Physics2DTestMotionResult::Physics2DTestMotionResult() {
|
||||
|
||||
colliding = false;
|
||||
result.collider_id = 0;
|
||||
|
||||
result.collider_shape = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class Physics2DDirectSpaceState : public Object {
|
|||
Dictionary _intersect_ray(const Vector2 &p_from, const Vector2 &p_to, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
Array _intersect_point(const Vector2 &p_point, int p_max_results = 32, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
Array _intersect_point_on_canvas(const Vector2 &p_point, ObjectID p_canvas_intance_id, int p_max_results = 32, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
Array _intersect_point_impl(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclud, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = 0);
|
||||
Array _intersect_point_impl(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclud, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = ObjectID());
|
||||
Array _intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results = 32);
|
||||
Array _cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query);
|
||||
Array _collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results = 32);
|
||||
|
@ -404,11 +404,11 @@ public:
|
|||
virtual void body_remove_shape(RID p_body, int p_shape_idx) = 0;
|
||||
virtual void body_clear_shapes(RID p_body) = 0;
|
||||
|
||||
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id) = 0;
|
||||
virtual uint32_t body_get_object_instance_id(RID p_body) const = 0;
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id) = 0;
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const = 0;
|
||||
|
||||
virtual void body_attach_canvas_instance_id(RID p_body, uint32_t p_id) = 0;
|
||||
virtual uint32_t body_get_canvas_instance_id(RID p_body) const = 0;
|
||||
virtual void body_attach_canvas_instance_id(RID p_body, ObjectID p_id) = 0;
|
||||
virtual ObjectID body_get_canvas_instance_id(RID p_body) const = 0;
|
||||
|
||||
enum CCDMode {
|
||||
CCD_MODE_DISABLED,
|
||||
|
@ -509,7 +509,7 @@ public:
|
|||
MotionResult() {
|
||||
collision_local_shape = 0;
|
||||
collider_shape = 0;
|
||||
collider_id = 0;
|
||||
collider_id = ObjectID();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -385,8 +385,8 @@ public:
|
|||
|
||||
virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) = 0;
|
||||
|
||||
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_id) = 0;
|
||||
virtual uint32_t body_get_object_instance_id(RID p_body) const = 0;
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id) = 0;
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const = 0;
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) = 0;
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const = 0;
|
||||
|
@ -495,7 +495,7 @@ public:
|
|||
Variant collider_metadata;
|
||||
MotionResult() {
|
||||
collision_local_shape = 0;
|
||||
collider_id = 0;
|
||||
collider_id = ObjectID();
|
||||
collider_shape = 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -805,7 +805,7 @@ Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID
|
|||
|
||||
Instance *instance = cull[i];
|
||||
ERR_CONTINUE(!instance);
|
||||
if (instance->object_id == 0)
|
||||
if (instance->object_id.is_null())
|
||||
continue;
|
||||
|
||||
instances.push_back(instance->object_id);
|
||||
|
@ -827,7 +827,7 @@ Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3 &p_from, co
|
|||
for (int i = 0; i < culled; i++) {
|
||||
Instance *instance = cull[i];
|
||||
ERR_CONTINUE(!instance);
|
||||
if (instance->object_id == 0)
|
||||
if (instance->object_id.is_null())
|
||||
continue;
|
||||
|
||||
instances.push_back(instance->object_id);
|
||||
|
@ -851,7 +851,7 @@ Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane> &p
|
|||
|
||||
Instance *instance = cull[i];
|
||||
ERR_CONTINUE(!instance);
|
||||
if (instance->object_id == 0)
|
||||
if (instance->object_id.is_null())
|
||||
continue;
|
||||
|
||||
instances.push_back(instance->object_id);
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
AABB *custom_aabb; // <Zylann> would using aabb directly with a bool be better?
|
||||
float extra_margin;
|
||||
uint32_t object_id;
|
||||
ObjectID object_id;
|
||||
|
||||
float lod_begin;
|
||||
float lod_end;
|
||||
|
@ -203,7 +203,6 @@ public:
|
|||
|
||||
extra_margin = 0;
|
||||
|
||||
object_id = 0;
|
||||
visible = true;
|
||||
|
||||
lod_begin = 0;
|
||||
|
|
Loading…
Reference in a new issue