summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-07-22 16:57:56 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-07-22 16:57:56 -0300
commit3b2dfae5af9759da31516de25fcae12001092bb0 (patch)
treec4a5784211be0a44844387c8d385d9b76714b462
parent0ad1a8f3d00f1927765f7ad687a470f96373729a (diff)
function to add script and instance at once, as needed by neikeq
-rw-r--r--core/object.cpp11
-rw-r--r--core/object.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 000cefcac7..316c624268 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -993,6 +993,17 @@ void Object::cancel_delete() {
_predelete_ok = true;
}
+void Object::set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_instance) {
+
+ //this function is not meant to be used in any of these ways
+ ERR_FAIL_COND(p_script.is_null());
+ ERR_FAIL_COND(!p_instance);
+ ERR_FAIL_COND(script_instance != NULL || !script.is_null());
+
+ script = p_script;
+ script_instance = p_instance;
+}
+
void Object::set_script(const RefPtr &p_script) {
if (script == p_script)
diff --git a/core/object.h b/core/object.h
index 556f3f1586..148a73fbc4 100644
--- a/core/object.h
+++ b/core/object.h
@@ -651,6 +651,8 @@ public:
void set_script_instance(ScriptInstance *p_instance);
_FORCE_INLINE_ ScriptInstance *get_script_instance() const { return script_instance; }
+ void set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_instance); //some script languages can't control instance creation, so this function eases the process
+
void add_user_signal(const MethodInfo &p_signal);
void emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
void emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount);