Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose all existing PropertyHint global enums #67360

Merged
Merged
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion core/global_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,23 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS);

BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_ID);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_TYPE_STRING);

BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_METHOD_OF_VARIANT_TYPE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_METHOD_OF_BASE_TYPE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_METHOD_OF_INSTANCE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_METHOD_OF_SCRIPT);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_PROPERTY_OF_BASE_TYPE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_PROPERTY_OF_INSTANCE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_PROPERTY_OF_SCRIPT);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_TOO_BIG);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_VALID_TYPES);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_SAVE_FILE);
Copy link
Member

Choose a reason for hiding this comment

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

Missing PROPERTY_HINT_ENUM_SUGGESTION.

Copy link
Member

Choose a reason for hiding this comment

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

And the docs check will likely still fail as PROPERTY_HINT_MAX is bound but not documented.
The best is to run --doctool to generate the template from your compiled binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing PROPERTY_HINT_ENUM_SUGGESTION.

Not missed it's just included in a different place from @YuriSizov.
image
image

If you like I can move this around in @GlobalScope.xml to re-organize, or just leave it as is.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see. I guess it was put there because ENUM and ENUM_SUGGESTION are linked, but were not made consecutive in the enum to avoid breaking compat. Can probably be kept as is.

BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LOCALE_ID);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_MAX);

BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_STORAGE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR);
Expand Down
38 changes: 38 additions & 0 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,47 @@
<constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="24" enum="PropertyHint">
Hints that an image is compressed using lossless compression.
</constant>
<constant name="PROPERTY_HINT_OBJECT_ID" value="25" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_TYPE_STRING" value="26" enum="PropertyHint">
Hint that a property represents a particular type. If a property is [constant TYPE_STRING], allows to set a type from the create dialog. If you need to create an [Array] to contain elements of a specific type, the [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code] for specifying [Resource] types. For instance:
[codeblock]
hint_string = "%s:" % [TYPE_INT] # Array of inteters.
hint_string = "%s:%s:" % [TYPE_ARRAY, TYPE_REAL] # Two-dimensional array of floats.
hint_string = "%s/%s:Resource" % [TYPE_OBJECT, TYPE_OBJECT] # Array of resources.
hint_string = "%s:%s/%s:Resource" % [TYPE_ARRAY, TYPE_OBJECT, TYPE_OBJECT] # Two-dimensional array of resources.
[/codeblock]
[b]Note:[/b] The final colon is required to specify for properly detecting built-in types.
</constant>
<constant name="PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE" value="27" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_METHOD_OF_VARIANT_TYPE" value="28" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_METHOD_OF_BASE_TYPE" value="29" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_METHOD_OF_INSTANCE" value="30" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_METHOD_OF_SCRIPT" value="31" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE" value="32" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_PROPERTY_OF_BASE_TYPE" value="33" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_PROPERTY_OF_INSTANCE" value="34" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_PROPERTY_OF_SCRIPT" value="35" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_OBJECT_TOO_BIG" value="36" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_NODE_PATH_VALID_TYPES" value="37" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_SAVE_FILE" value="38" enum="PropertyHint">
</constant>
<constant name="PROPERTY_HINT_LOCALE_ID" value="40" enum="PropertyHint">
Hints that a string property is a locale code. Editing it will show a locale dialog for picking language and country.
</constant>
<constant name="PROPERTY_HINT_MAX" value="41" enum="PropertyHint">
</constant>
<constant name="PROPERTY_USAGE_STORAGE" value="1" enum="PropertyUsageFlags">
The property is serialized and saved in the scene file (default).
</constant>
Expand Down