Skip to content

Enums: add missing binds - #117205

Closed
ScatteredComet wants to merge 1 commit into
godotengine:masterfrom
ScatteredComet:bind_enums
Closed

Enums: add missing binds#117205
ScatteredComet wants to merge 1 commit into
godotengine:masterfrom
ScatteredComet:bind_enums

Conversation

@ScatteredComet

@ScatteredComet ScatteredComet commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

@ScatteredComet
ScatteredComet marked this pull request as ready for review March 8, 2026 03:23
@ScatteredComet
ScatteredComet requested review from a team as code owners March 8, 2026 03:24
@ScatteredComet

Copy link
Copy Markdown
Contributor Author

I didn't add ConnectFlags.CONNECT_INHERITED as I'm not sure if it should be exposed.

godot/core/object/object.h

Lines 573 to 580 in 220b0b2

enum ConnectFlags {
CONNECT_DEFERRED = 1,
CONNECT_PERSIST = 2, // Hint for scene to save this connection.
CONNECT_ONE_SHOT = 4,
CONNECT_REFERENCE_COUNTED = 8,
CONNECT_APPEND_SOURCE_OBJECT = 16,
CONNECT_INHERITED = 32, // Used in editor builds.
};

@ScatteredComet ScatteredComet changed the title Enums: add missing members Enums: add missing binds Mar 8, 2026
@ScatteredComet
ScatteredComet marked this pull request as draft March 8, 2026 04:07
@ScatteredComet
ScatteredComet marked this pull request as ready for review March 8, 2026 04:07
@Nintorch Nintorch added this to the 4.x milestone Mar 8, 2026
@Calinou

Calinou commented Mar 16, 2026

Copy link
Copy Markdown
Member

Regarding the shadowmask mode enum, see my comment on the docs issue:

This shadowmask mode was originally planned to be implemented, but was removed before merging as we didn't find a way to get it working with a good level of usability. I guess some leftovers slipped in the merged PR. Removing it now would break compatibility with existing projects, so we should document it as unused.

Comment on lines +202 to +205
<constant name="TRANSITION_TO_TIME_PREVIOUS_POSITION" value="2" enum="TransitionToTime">
</constant>
<constant name="TRANSITION_TO_TIME_MAX" value="3" enum="TransitionToTime">
</constant>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In #114129 I added the binding for TRANSITION_TO_TIME_PREVIOUS_POSITION along with documentation. I did not bind TRANSITION_TO_TIME_MAX. The other enums in this file do not bind that; nor does e.g. AudioStreamRandomizer.PlaybackMode. It's also illegal to pass TRANSITION_TO_TIME_MAX to e.g. add_transition. So I don't think it's correct to bind it.

@ScatteredComet ScatteredComet Mar 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I've got a bit confused; I was told that XML files are all generated using --doc-tools but it seems that ..._MAX enum values are not generated through binding in the cpp file. Sorry! It would be nice in general to have more instructions on how the documentation should be contributed to because I think I'm probably hindering more than helping!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My suggestion (bearing in mind I'm just a guy who occasionally sends 1-line PRs!)

  1. Remove the interactive_music changes from this branch - it's covered in Bind AudioStreamInteractive TRANSITION_TO_TIME_PREVIOUS_POSITION #114129 which I hope will be merged at some point!
  2. Don't bind OPENXR_ACTION_MAX
  3. Write documentation for SHADOWMASK_MODE_ONLY & OPENXR_ACTION_HAPTIC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay cool; I was also confused at why some _MAX enum values are documented and how they are being added to the XML files if they're not bound?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you might be missing where it's bound because they are bound if they are added to the documentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm still a bit confused. e.g. why is <constant name="CLOSE_BUTTON_MAX" value="3" enum="CloseButtonDisplayPolicy"> allowed to be bound, but TRANSITION_TO_TIME_MAX is not allowed to be bound here? I don't understand how to distinguish what should/shouldn't be bound.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By wjt's logic, I would suspect its also not valid to pass CLOSE_BUTTON_MAX (or many other of the _MAX enums found in the docs) to their respective functions, but they are still included in the XML files. Maybe I'm wrong though and there's some MAX enum values which have actual usage beyond just representing the max size?

@AThousandShips AThousandShips Mar 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the explanation:

It's also illegal to pass TRANSITION_TO_TIME_MAX to e.g. add_transition. So I don't think it's correct to bind it.

But I'd say that's up to the person implementing the feature, so doing that without understanding the feature or the logic is not a good idea, so I think this might not be the right task for you

In the cases where they are missing, I'd suggest just going back to the PR that added them, see if there's an explanation, and if not ask somewhere about it, there's usually a good idea behind that, but not always (you can use the "blame" tab on each file in the GitHub web interface to explore the history of any file)

But the enum shouldn't generally be bound unless it's actually useful to binds, a lot of the time it's strictly used internally to do range checking, like ERR_FAIL_INDEX(p_arg, 0, SPECIFIC_ENUM_MAX); (and isn't relevant to iterating over valid values, for example if there's no value for a specific entry between 0 and X_MAX)

@ScatteredComet

Copy link
Copy Markdown
Contributor Author

I'm realising I don't really know what I'm doing wrt the documentation so feel free to close this PR

@AThousandShips AThousandShips removed this from the 4.x milestone Mar 23, 2026
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.

Class reference: missing enum members

5 participants