mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #20583 from neikeq/issue-15371
Fix case where exported properties value is lost
This commit is contained in:
commit
b4f579b5ba
7 changed files with 253 additions and 57 deletions
|
@ -181,7 +181,11 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Variant::CallErro
|
|||
|
||||
bool GDScript::can_instance() const {
|
||||
|
||||
return valid || (!tool && !ScriptServer::is_scripting_enabled());
|
||||
#ifdef TOOLS_ENABLED
|
||||
return valid && (tool || ScriptServer::is_scripting_enabled());
|
||||
#else
|
||||
return valid;
|
||||
#endif
|
||||
}
|
||||
|
||||
Ref<Script> GDScript::get_base_script() const {
|
||||
|
@ -310,27 +314,6 @@ bool GDScript::get_property_default_value(const StringName &p_property, Variant
|
|||
|
||||
ScriptInstance *GDScript::instance_create(Object *p_this) {
|
||||
|
||||
if (!tool && !ScriptServer::is_scripting_enabled()) {
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
//instance a fake script for editing the values
|
||||
//plist.invert();
|
||||
|
||||
/*print_line("CREATING PLACEHOLDER");
|
||||
for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) {
|
||||
print_line(E->get().name);
|
||||
}*/
|
||||
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this));
|
||||
placeholders.insert(si);
|
||||
//_update_placeholder(si);
|
||||
_update_exports();
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
GDScript *top = this;
|
||||
while (top->_base)
|
||||
top = top->_base;
|
||||
|
@ -349,6 +332,27 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
|
|||
Variant::CallError unchecked_error;
|
||||
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this), unchecked_error);
|
||||
}
|
||||
|
||||
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
//instance a fake script for editing the values
|
||||
//plist.invert();
|
||||
|
||||
/*print_line("CREATING PLACEHOLDER");
|
||||
for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) {
|
||||
print_line(E->get().name);
|
||||
}*/
|
||||
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this));
|
||||
placeholders.insert(si);
|
||||
//_update_placeholder(si);
|
||||
_update_exports();
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GDScript::instance_has(const Object *p_this) const {
|
||||
|
||||
#ifndef NO_THREADS
|
||||
|
@ -480,6 +484,10 @@ bool GDScript::_update_exports() {
|
|||
for (int i = 0; i < c->_signals.size(); i++) {
|
||||
_signals[c->_signals[i].name] = c->_signals[i].arguments;
|
||||
}
|
||||
} else {
|
||||
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
|
||||
E->get()->set_build_failed(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//print_line("unchanged is "+get_path());
|
||||
|
@ -501,7 +509,7 @@ bool GDScript::_update_exports() {
|
|||
_update_exports_values(values, propnames);
|
||||
|
||||
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
|
||||
|
||||
E->get()->set_build_failed(false);
|
||||
E->get()->update(propnames, values);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue