Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/godot_cpp/core/property_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ struct PropertyInfo {
dict["type"] = type;
dict["hint"] = hint;
dict["hint_string"] = hint_string;
dict["usage"] = usage;
if (usage != PROPERTY_USAGE_NONE) {
dict["usage"] = usage;
}
Comment on lines +83 to +85
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Potential roundtrip inconsistency with from_dict().

When usage == PROPERTY_USAGE_NONE, the "usage" key is now omitted from the dictionary. However, from_dict() (lines 106-108) leaves usage at the struct default PROPERTY_USAGE_DEFAULT when the key is missing. This means:

  • PropertyInfo with usage = PROPERTY_USAGE_NONEDictionaryfrom_dict()usage = PROPERTY_USAGE_DEFAULT

If roundtrip fidelity is needed, consider updating from_dict() to default to PROPERTY_USAGE_NONE when the "usage" key is absent:

Proposed fix to align from_dict() behavior
 	static PropertyInfo from_dict(const Dictionary &p_dict) {
 		PropertyInfo pi;
+		pi.usage = PROPERTY_USAGE_NONE; // Match to_dict() behavior when key is missing
 		if (p_dict.has("type")) {
 			pi.type = Variant::Type(int(p_dict["type"]));
 		}
🤖 Prompt for AI Agents
In `@include/godot_cpp/core/property_info.hpp` around lines 83 - 85, The
serialization omits the "usage" key when PropertyInfo::usage ==
PROPERTY_USAGE_NONE, but PropertyInfo::from_dict() currently falls back to
PROPERTY_USAGE_DEFAULT when the key is absent, breaking roundtrip fidelity;
update PropertyInfo::from_dict() to set usage to PROPERTY_USAGE_NONE when the
"usage" key is missing (e.g., check dict.has("usage") or equivalent) so that
missing key restores PROPERTY_USAGE_NONE instead of PROPERTY_USAGE_DEFAULT,
referencing the PropertyInfo struct and its usage field and the constants
PROPERTY_USAGE_NONE / PROPERTY_USAGE_DEFAULT to locate the change.

return dict;
}

Expand Down