Skip to content

PropertyInfo: Only include 'usage' in Dictionary conversion when explicitly set#2005

Open
TheAenema wants to merge 1 commit into
godotengine:masterfrom
Selciner-Games:master
Open

PropertyInfo: Only include 'usage' in Dictionary conversion when explicitly set#2005
TheAenema wants to merge 1 commit into
godotengine:masterfrom
Selciner-Games:master

Conversation

@TheAenema

Copy link
Copy Markdown

The implicit conversion from PropertyInfo to Dictionary currently includes the usage field unconditionally.

In recent Godot versions, support for the usage field has been removed from add_property_info() for both EditorSettings and ProjectSettings triggering the following warning whenever PropertyInfo is used:

WARNING: "usage" is not supported in add_property_info().

This causes unnecessary warning spam in the editor console when registering custom settings from GDExtension using PropertyInfo.

Fix is quite simple, We add a check in PropertyInfo::operator Dictionary() that assigns the usage field only when it's set to a value other than PROPERTY_USAGE_NONE.

operator Dictionary() const {
	Dictionary dict;
	dict["name"] = name;
	dict["class_name"] = class_name;
	dict["type"] = type;
	dict["hint"] = hint;
	dict["hint_string"] = hint_string;
	if (usage != PROPERTY_USAGE_NONE) {
		dict["usage"] = usage;
	}
	return dict;
}

@TheAenema TheAenema requested a review from a team as a code owner June 23, 2026 14:28

@dsnopek dsnopek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! That makes sense to me :-)

@dsnopek dsnopek added bug This has been identified as a bug cherrypick:4.5 labels Jun 23, 2026
@dsnopek dsnopek added this to the 10.x milestone Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug cherrypick:4.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants