Add further details on properties returning Packed*Array

This commit is contained in:
A Thousand Ships 2024-01-23 16:39:26 +01:00
parent 980e4d7955
commit 23782b898b
No known key found for this signature in database
GPG key ID: 2033189A662F8BD7
16 changed files with 47 additions and 8 deletions

View file

@ -96,6 +96,18 @@ const Vector<String> classes_with_csharp_differences = {
};
#endif
const Vector<String> packed_array_types = {
"PackedByteArray",
"PackedColorArray",
"PackedFloat32Array",
"PackedFloat64Array",
"PackedInt32Array",
"PackedInt64Array",
"PackedStringArray",
"PackedVector2Array",
"PackedVector3Array",
};
// TODO: this is sometimes used directly as doc->something, other times as EditorHelp::get_doc_data(), which is thread-safe.
// Might this be a problem?
DocTools *EditorHelp::doc = nullptr;
@ -2193,6 +2205,12 @@ void EditorHelp::_update_doc() {
}
has_prev_text = true;
_add_text(descr);
// Add copy note to built-in properties returning Packed*Array.
if (!cd.is_script_doc && packed_array_types.has(prop.type)) {
class_desc->add_newline();
class_desc->add_newline();
_add_text(vformat(TTR("[b]Note:[/b] The returned array is [i]copied[/i] and any changes to it will not update the original property value. See [%s] for more details."), prop.type));
}
} else if (!has_prev_text) {
class_desc->add_image(get_editor_theme_icon(SNAME("Error")));
class_desc->add_text(" ");