You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Fix enums coming from other classes without preload
Fix #19704, fix #26001
This commit is contained in:
@@ -409,6 +409,11 @@ bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (constants.has(p_name)) {
|
||||
r_ret = constants[p_name];
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!script->is_placeholder_fallback_enabled()) {
|
||||
Variant defval;
|
||||
if (script->get_property_default_value(p_name, defval)) {
|
||||
@@ -444,6 +449,13 @@ Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName &p_n
|
||||
*r_is_valid = true;
|
||||
return values[p_name].get_type();
|
||||
}
|
||||
|
||||
if (constants.has(p_name)) {
|
||||
if (r_is_valid)
|
||||
*r_is_valid = true;
|
||||
return constants[p_name].get_type();
|
||||
}
|
||||
|
||||
if (r_is_valid)
|
||||
*r_is_valid = false;
|
||||
|
||||
@@ -513,6 +525,9 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
|
||||
owner->_change_notify();
|
||||
}
|
||||
//change notify
|
||||
|
||||
constants.clear();
|
||||
script->get_constants(&constants);
|
||||
}
|
||||
|
||||
void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
|
||||
@@ -552,6 +567,13 @@ Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_nam
|
||||
*r_valid = true;
|
||||
return E->value();
|
||||
}
|
||||
|
||||
E = constants.find(p_name);
|
||||
if (E) {
|
||||
if (r_valid)
|
||||
*r_valid = true;
|
||||
return E->value();
|
||||
}
|
||||
}
|
||||
|
||||
if (r_valid)
|
||||
|
||||
Reference in New Issue
Block a user