From e28fd07b2bbe78db0f286604a6eb469d8a0664be Mon Sep 17 00:00:00 2001 From: Lightning_A Date: Thu, 17 Jun 2021 16:03:09 -0600 Subject: Rename `instance()`->`instantiate()` when it's a verb --- modules/gdscript/doc_classes/@GDScript.xml | 2 +- modules/gdscript/editor/gdscript_highlighter.cpp | 2 +- modules/gdscript/gdscript.cpp | 16 ++++++++-------- modules/gdscript/gdscript.h | 8 ++++---- modules/gdscript/gdscript_analyzer.cpp | 2 +- modules/gdscript/gdscript_cache.cpp | 4 ++-- modules/gdscript/gdscript_compiler.cpp | 2 +- modules/gdscript/gdscript_editor.cpp | 4 ++-- .../language_server/gdscript_language_protocol.cpp | 6 +++--- modules/gdscript/language_server/gdscript_workspace.cpp | 2 +- modules/gdscript/register_types.cpp | 10 +++++----- modules/gdscript/tests/gdscript_test_runner.cpp | 8 ++++---- modules/gdscript/tests/test_gdscript.cpp | 2 +- 13 files changed, 34 insertions(+), 34 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 58620f2b3e..839aa6b3c6 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -177,7 +177,7 @@ [b]Note:[/b] Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script. [codeblock] # Instance a scene. - var diamond = preload("res://diamond.tscn").instance() + var diamond = preload("res://diamond.tscn").instantiate() [/codeblock] diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index b867b03903..79ec9eb65f 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -622,6 +622,6 @@ void GDScriptSyntaxHighlighter::add_color_region(const String &p_start_key, cons Ref GDScriptSyntaxHighlighter::_create() const { Ref syntax_highlighter; - syntax_highlighter.instance(); + syntax_highlighter.instantiate(); return syntax_highlighter; } diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 1567576009..397776ba1a 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -72,7 +72,7 @@ void GDScriptNativeClass::_bind_methods() { } Variant GDScriptNativeClass::_new() { - Object *o = instance(); + Object *o = instantiate(); ERR_FAIL_COND_V_MSG(!o, Variant(), "Class type: '" + String(name) + "' is not instantiable."); RefCounted *rc = Object::cast_to(o); @@ -83,8 +83,8 @@ Variant GDScriptNativeClass::_new() { } } -Object *GDScriptNativeClass::instance() { - return ClassDB::instance(name); +Object *GDScriptNativeClass::instantiate() { + return ClassDB::instantiate(name); } void GDScript::_super_implicit_constructor(GDScript *p_script, GDScriptInstance *p_instance, Callable::CallError &r_error) { @@ -170,7 +170,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant()); if (_baseptr->native.ptr()) { - owner = _baseptr->native->instance(); + owner = _baseptr->native->instantiate(); } else { owner = memnew(RefCounted); //by default, no base means use reference } @@ -196,7 +196,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr } } -bool GDScript::can_instance() const { +bool GDScript::can_instantiate() const { #ifdef TOOLS_ENABLED return valid && (tool || ScriptServer::is_scripting_enabled()); #else @@ -346,9 +346,9 @@ ScriptInstance *GDScript::instance_create(Object *p_this) { if (top->native.is_valid()) { if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) { if (EngineDebugger::is_active()) { - GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'"); + GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instantiated in object of type: '" + p_this->get_class() + "'"); } - ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + "."); + ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instantiated in object of type '" + p_this->get_class() + "'" + "."); } } @@ -2256,7 +2256,7 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori if (script.is_null()) { // Don't fail loading because of parsing error. - script.instance(); + script.instantiate(); } if (r_error) { diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 42019ae501..078b7a2fd0 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -51,7 +51,7 @@ protected: public: _FORCE_INLINE_ const StringName &get_name() const { return name; } Variant _new(); - Object *instance(); + Object *instantiate(); GDScriptNativeClass(const StringName &p_name); }; @@ -80,10 +80,10 @@ class GDScript : public Script { GDScript *_base = nullptr; //fast pointer access GDScript *_owner = nullptr; //for subclasses - Set members; //members are just indices to the instanced script. + Set members; //members are just indices to the instantiated script. Map constants; Map member_functions; - Map member_indices; //members are just indices to the instanced script. + Map member_indices; //members are just indices to the instantiated script. Map> subclasses; Map> _signals; Vector rpc_functions; @@ -196,7 +196,7 @@ public: StringName debug_get_member_by_index(int p_idx) const; Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); - virtual bool can_instance() const override; + virtual bool can_instantiate() const override; virtual Ref