Improve display of non-exported members in Remote Tree Inspector
This commit is contained in:
@@ -2860,9 +2860,11 @@ Error GDScriptCompiler::_prepare_compilation(GDScript *p_script, const GDScriptP
|
||||
}
|
||||
break;
|
||||
}
|
||||
minfo.data_type = _gdtype_from_datatype(variable->get_datatype(), p_script);
|
||||
|
||||
PropertyInfo prop_info = variable->get_datatype().to_property_info(name);
|
||||
const GDScriptParser::DataType variable_type = variable->get_datatype();
|
||||
minfo.data_type = _gdtype_from_datatype(variable_type, p_script);
|
||||
|
||||
PropertyInfo prop_info = variable_type.to_property_info(name);
|
||||
PropertyInfo export_info = variable->export_info;
|
||||
|
||||
if (variable->exported) {
|
||||
@@ -2873,6 +2875,28 @@ Error GDScriptCompiler::_prepare_compilation(GDScript *p_script, const GDScriptP
|
||||
prop_info.hint = export_info.hint;
|
||||
prop_info.hint_string = export_info.hint_string;
|
||||
prop_info.usage = export_info.usage;
|
||||
} else {
|
||||
// Enum hint doesn't really belong to the data type information, so we don't want to add it to
|
||||
// `GDScriptParser::DataType::to_property_info()`. However, we still want to add this metadata
|
||||
// for unexported properties so they display nicely in the Remote Tree Inspector.
|
||||
if (variable_type.kind == GDScriptParser::DataType::ENUM && !variable_type.is_meta_type) {
|
||||
prop_info.hint = PROPERTY_HINT_ENUM;
|
||||
|
||||
String enum_hint_string;
|
||||
bool first = true;
|
||||
for (const KeyValue<StringName, int64_t> &E : variable_type.enum_values) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
enum_hint_string += ",";
|
||||
}
|
||||
enum_hint_string += E.key.operator String().capitalize().xml_escape();
|
||||
enum_hint_string += ":";
|
||||
enum_hint_string += String::num_int64(E.value).xml_escape();
|
||||
}
|
||||
|
||||
prop_info.hint_string = enum_hint_string;
|
||||
}
|
||||
}
|
||||
prop_info.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
|
||||
minfo.property_info = prop_info;
|
||||
|
||||
Reference in New Issue
Block a user