Skip to content

Commit 0b20ae2

Browse files
committed
Add missing warning about copying packed arrays to EditorHelpBit
1 parent 8327dfa commit 0b20ae2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

doc/tools/make_rst.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"This method may be changed or removed in future versions.",
8888
"This operator may be changed or removed in future versions.",
8989
"This theme property may be changed or removed in future versions.",
90+
# See also `make_rst_class()` and `editor/doc/editor_help.cpp`.
9091
"[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.",
9192
]
9293
strings_l10n: Dict[str, str] = {}
@@ -1303,6 +1304,7 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
13031304

13041305
# Add copy note to built-in properties returning `Packed*Array`.
13051306
if property_def.type_name.type_name in PACKED_ARRAY_TYPES:
1307+
# See also `BASE_STRINGS` and `editor/doc/editor_help.cpp`.
13061308
copy_note = 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."
13071309
f.write(f"{format_text_block(copy_note, property_def, state)}\n\n")
13081310

editor/doc/editor_help.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,7 @@ void EditorHelp::_update_doc() {
23252325
if (!cd.is_script_doc && packed_array_types.has(prop.type)) {
23262326
class_desc->add_newline();
23272327
class_desc->add_newline();
2328+
// See also `EditorHelpBit::parse_symbol()` and `doc/tools/make_rst.py`.
23282329
_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));
23292330
}
23302331

@@ -4368,6 +4369,16 @@ void EditorHelpBit::parse_symbol(const String &p_symbol, const String &p_prologu
43684369
symbol_hint = SYMBOL_HINT_ASSIGNABLE;
43694370
}
43704371
help_data = _get_property_help_data(class_name, item_name);
4372+
4373+
// Add copy note to built-in properties returning `Packed*Array`.
4374+
const DocData::ClassDoc *cd = EditorHelp::get_doc(class_name);
4375+
if (cd && !cd->is_script_doc && packed_array_types.has(help_data.doc_type.type)) {
4376+
if (!help_data.description.is_empty()) {
4377+
help_data.description += "\n";
4378+
}
4379+
// See also `EditorHelp::_update_doc()` and `doc/tools/make_rst.py`.
4380+
help_data.description += 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."), help_data.doc_type.type);
4381+
}
43714382
} else if (item_type == "internal_property") {
43724383
symbol_type = TTR("Internal Property");
43734384
help_data.description = "[color=<EditorHelpBitCommentColor>][i]" + TTR("This property can only be set in the Inspector.") + "[/i][/color]";

0 commit comments

Comments
 (0)