mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
GDScript: Fix subscript resolution for constant non-metatypes
This commit is contained in:
parent
571cd0eb79
commit
c35cb51d74
5 changed files with 193 additions and 17 deletions
|
|
@ -4095,25 +4095,29 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
|
|||
}
|
||||
} break;
|
||||
case GDScriptParser::DataType::ENUM: {
|
||||
variable->export_info.type = Variant::INT;
|
||||
variable->export_info.hint = PROPERTY_HINT_ENUM;
|
||||
if (export_type.is_meta_type) {
|
||||
variable->export_info.type = Variant::DICTIONARY;
|
||||
} else {
|
||||
variable->export_info.type = Variant::INT;
|
||||
variable->export_info.hint = PROPERTY_HINT_ENUM;
|
||||
|
||||
String enum_hint_string;
|
||||
bool first = true;
|
||||
for (const KeyValue<StringName, int64_t> &E : export_type.enum_values) {
|
||||
if (!first) {
|
||||
enum_hint_string += ",";
|
||||
} else {
|
||||
first = false;
|
||||
String enum_hint_string;
|
||||
bool first = true;
|
||||
for (const KeyValue<StringName, int64_t> &E : export_type.enum_values) {
|
||||
if (!first) {
|
||||
enum_hint_string += ",";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
enum_hint_string += E.key.operator String().capitalize().xml_escape();
|
||||
enum_hint_string += ":";
|
||||
enum_hint_string += String::num_int64(E.value).xml_escape();
|
||||
}
|
||||
enum_hint_string += E.key.operator String().capitalize().xml_escape();
|
||||
enum_hint_string += ":";
|
||||
enum_hint_string += String::num_int64(E.value).xml_escape();
|
||||
}
|
||||
|
||||
variable->export_info.hint_string = enum_hint_string;
|
||||
variable->export_info.usage |= PROPERTY_USAGE_CLASS_IS_ENUM;
|
||||
variable->export_info.class_name = String(export_type.native_type).replace("::", ".");
|
||||
variable->export_info.hint_string = enum_hint_string;
|
||||
variable->export_info.usage |= PROPERTY_USAGE_CLASS_IS_ENUM;
|
||||
variable->export_info.class_name = String(export_type.native_type).replace("::", ".");
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
push_error(R"(Export type can only be built-in, a resource, a node, or an enum.)", variable);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue