Rename instance()->instantiate() when it's a verb
This commit is contained in:
parent
60dcc4f39c
commit
e28fd07b2b
371 changed files with 1318 additions and 1318 deletions
|
|
@ -516,7 +516,7 @@ void ClassDB::instance_get_native_extension_data(ObjectNativeExtension **r_exten
|
|||
}
|
||||
}
|
||||
|
||||
Object *ClassDB::instance(const StringName &p_class) {
|
||||
Object *ClassDB::instantiate(const StringName &p_class) {
|
||||
ClassInfo *ti;
|
||||
{
|
||||
OBJTYPE_RLOCK;
|
||||
|
|
@ -544,7 +544,7 @@ Object *ClassDB::instance(const StringName &p_class) {
|
|||
return ti->creation_func();
|
||||
}
|
||||
|
||||
bool ClassDB::can_instance(const StringName &p_class) {
|
||||
bool ClassDB::can_instantiate(const StringName &p_class) {
|
||||
OBJTYPE_RLOCK;
|
||||
|
||||
ClassInfo *ti = classes.getptr(p_class);
|
||||
|
|
@ -1522,8 +1522,8 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
|
|||
if (Engine::get_singleton()->has_singleton(p_class)) {
|
||||
c = Engine::get_singleton()->get_singleton_object(p_class);
|
||||
cleanup_c = false;
|
||||
} else if (ClassDB::can_instance(p_class)) {
|
||||
c = ClassDB::instance(p_class);
|
||||
} else if (ClassDB::can_instantiate(p_class)) {
|
||||
c = ClassDB::instantiate(p_class);
|
||||
cleanup_c = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ public:
|
|||
static StringName get_compatibility_remapped_class(const StringName &p_class);
|
||||
static bool class_exists(const StringName &p_class);
|
||||
static bool is_parent_class(const StringName &p_class, const StringName &p_inherits);
|
||||
static bool can_instance(const StringName &p_class);
|
||||
static Object *instance(const StringName &p_class);
|
||||
static bool can_instantiate(const StringName &p_class);
|
||||
static Object *instantiate(const StringName &p_class);
|
||||
static void instance_get_native_extension_data(ObjectNativeExtension **r_extension, void **r_extension_instance);
|
||||
static APIType get_api_type(const StringName &p_class);
|
||||
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@ void Object::set_script(const Variant &p_script) {
|
|||
Ref<Script> s = script;
|
||||
|
||||
if (!s.is_null()) {
|
||||
if (s->can_instance()) {
|
||||
if (s->can_instantiate()) {
|
||||
OBJ_DEBUG_LOCK
|
||||
script_instance = s->instance_create(this);
|
||||
} else if (Engine::get_singleton()->is_editor_hint()) {
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ public:
|
|||
inline bool is_null() const { return reference == nullptr; }
|
||||
|
||||
void unref() {
|
||||
//TODO this should be moved to mutexes, since this engine does not really
|
||||
// TODO: this should be moved to mutexes, since this engine does not really
|
||||
// do a lot of referencing on references and stuff
|
||||
// mutexes will avoid more crashes?
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ public:
|
|||
reference = nullptr;
|
||||
}
|
||||
|
||||
void instance() {
|
||||
void instantiate() {
|
||||
ref(memnew(T));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ Dictionary Script::_get_script_constant_map() {
|
|||
}
|
||||
|
||||
void Script::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("can_instance"), &Script::can_instance);
|
||||
ClassDB::bind_method(D_METHOD("can_instantiate"), &Script::can_instantiate);
|
||||
//ClassDB::bind_method(D_METHOD("instance_create","base_object"),&Script::instance_create);
|
||||
ClassDB::bind_method(D_METHOD("instance_has", "base_object"), &Script::instance_has);
|
||||
ClassDB::bind_method(D_METHOD("has_source_code"), &Script::has_source_code);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ protected:
|
|||
Dictionary _get_script_constant_map();
|
||||
|
||||
public:
|
||||
virtual bool can_instance() const = 0;
|
||||
virtual bool can_instantiate() const = 0;
|
||||
|
||||
virtual Ref<Script> get_base_script() const = 0; //for script inheritance
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue