summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/script_language.cpp19
-rw-r--r--core/script_language.h11
2 files changed, 12 insertions, 18 deletions
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 496521486e..120a87d078 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -376,7 +376,7 @@ ScriptDebugger::ScriptDebugger() {
bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) {
- if (build_failed)
+ if (script->is_placeholder_fallback_enabled())
return false;
if (values.has(p_name)) {
@@ -407,7 +407,7 @@ bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) co
return true;
}
- if (!build_failed) {
+ if (!script->is_placeholder_fallback_enabled()) {
Variant defval;
if (script->get_property_default_value(p_name, defval)) {
r_ret = defval;
@@ -420,7 +420,7 @@ bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) co
void PlaceHolderScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const {
- if (build_failed) {
+ if (script->is_placeholder_fallback_enabled()) {
for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
p_properties->push_back(E->get());
}
@@ -450,7 +450,7 @@ Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName &p_n
void PlaceHolderScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
- if (build_failed)
+ if (script->is_placeholder_fallback_enabled())
return;
if (script.is_valid()) {
@@ -459,7 +459,7 @@ void PlaceHolderScriptInstance::get_method_list(List<MethodInfo> *p_list) const
}
bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
- if (build_failed)
+ if (script->is_placeholder_fallback_enabled())
return false;
if (script.is_valid()) {
@@ -470,8 +470,6 @@ bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values) {
- build_failed = false;
-
Set<StringName> new_values;
for (const List<PropertyInfo>::Element *E = p_properties.front(); E; E = E->next()) {
@@ -517,7 +515,7 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
- if (build_failed) {
+ if (script->is_placeholder_fallback_enabled()) {
Map<StringName, Variant>::Element *E = values.find(p_name);
if (E) {
@@ -544,7 +542,7 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name,
Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_name, bool *r_valid) {
- if (build_failed) {
+ if (script->is_placeholder_fallback_enabled()) {
const Map<StringName, Variant>::Element *E = values.find(p_name);
if (E) {
@@ -563,8 +561,7 @@ Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_nam
PlaceHolderScriptInstance::PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner) :
owner(p_owner),
language(p_language),
- script(p_script),
- build_failed(false) {
+ script(p_script) {
}
PlaceHolderScriptInstance::~PlaceHolderScriptInstance() {
diff --git a/core/script_language.h b/core/script_language.h
index 654d1d4265..8543ed08b5 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -146,6 +146,8 @@ public:
virtual void get_constants(Map<StringName, Variant> *p_constants) {}
virtual void get_members(Set<StringName> *p_constants) {}
+ virtual bool is_placeholder_fallback_enabled() const { return false; }
+
Script() {}
};
@@ -334,8 +336,6 @@ class PlaceHolderScriptInstance : public ScriptInstance {
ScriptLanguage *language;
Ref<Script> script;
- bool build_failed;
-
public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
@@ -361,13 +361,10 @@ public:
void update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values); //likely changed in editor
- void set_build_failed(bool p_build_failed) { build_failed = p_build_failed; }
- bool get_build_failed() const { return build_failed; }
-
virtual bool is_placeholder() const { return true; }
- virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid);
- virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid);
+ virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid = NULL);
+ virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid = NULL);
virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const { return MultiplayerAPI::RPC_MODE_DISABLED; }
virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const { return MultiplayerAPI::RPC_MODE_DISABLED; }