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

@ -87,6 +87,7 @@ BASE_STRINGS = [
"This method may be changed or removed in future versions.",
"This operator may be changed or removed in future versions.",
"This theme property may be changed or removed in future versions.",
"[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.",
]
strings_l10n: Dict[str, str] = {}
@ -145,6 +146,18 @@ CLASSES_WITH_CSHARP_DIFFERENCES: List[str] = [
"Variant",
]
PACKED_ARRAY_TYPES: List[str] = [
"PackedByteArray",
"PackedColorArray",
"PackedFloat32Array",
"Packedfloat64Array",
"PackedInt32Array",
"PackedInt64Array",
"PackedStringArray",
"PackedVector2Array",
"PackedVector3Array",
]
class State:
def __init__(self) -> None:
@ -1277,6 +1290,9 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
if property_def.text is not None and property_def.text.strip() != "":
f.write(f"{format_text_block(property_def.text.strip(), property_def, state)}\n\n")
if property_def.type_name.type_name in PACKED_ARRAY_TYPES:
tmp = f"[b]Note:[/b] The returned array is [i]copied[/i] and any changes to it will not update the original property value. See [{property_def.type_name.type_name}] for more details."
f.write(f"{format_text_block(tmp, property_def, state)}\n\n")
elif property_def.deprecated is None and property_def.experimental is None:
f.write(".. container:: contribute\n\n\t")
f.write(