Skip to content

Conversation

@timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Nov 2, 2025

The problems:

  • StringName was not documented as a valid type for PROPERTY_HINT_ENUM or PROPERTY_HINT_ENUM_SUGGESTION, but it actually is.
  • Improve editor language selector #110492 added a way to specify explicit values for String enum properties:
    • It was not documented.
    • It was not added to StringName, but I see no reason not to do it :P

So this PR basically adds missing documentations and adds the special hint string syntax processing for StringName.

I can't test the documentation in the editor as opening the class reference crashes editor recently.

@timothyqiu timothyqiu requested review from a team as code owners November 2, 2025 09:19
@Mickeon
Copy link
Member

Mickeon commented Nov 2, 2025

Why were / and ; chosen instead of : and ,? Where's the consensus; is it for compatibility? It's so unnatural, it almost looks undocumented on purpose. The original PR was to improve the language selector, and this behavior happens to be an undiscussed side effect of it.
Let's please rethink about this before making it public (and potentially spreading it to other properties/settings where it would make sense)

@AThousandShips
Copy link
Member

I think changing this existing code now would be messy unless there's a strong reason against it

@KoBeWi
Copy link
Member

KoBeWi commented Nov 2, 2025

It's so unnatural, it almost looks undocumented on purpose.

Because it is. It was only needed for language selector, so the implementation is rather hacky. If we want to support it "officially", it needs to be done properly.

<constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint">
Hints that an [int] or [String] property is an enumerated value to pick in a list specified via a hint string.
The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name. For integer properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"Zero,One,Three:3,Four,Six:6"[/code].
Hints that an [int], [String], or [StringName] property is an enumerated value to pick in a list specified via a hint string. The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Hints that an [int], [String], or [StringName] property is an enumerated value to pick in a list specified via a hint string. The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name.
Hints that an [int], [String], or [StringName] property is an enumerated value to pick in a list specified via a hint string. The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespace is [b]not[/b] removed from either end of a name.

While we're here

Copy link
Member

Choose a reason for hiding this comment

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

See #112318 where this PR may be leaning towards.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I also fix this for the description of PROPERTY_HINT_FLAGS ?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants