Skip to content

Fix missing Infinity/NaN handling in bindings generator - #2030

Open
aaronfranke wants to merge 1 commit into
godotengine:masterfrom
aaronfranke:bind-gen-inf-nan
Open

Fix missing Infinity/NaN handling in bindings generator#2030
aaronfranke wants to merge 1 commit into
godotengine:masterfrom
aaronfranke:bind-gen-inf-nan

Conversation

@aaronfranke

Copy link
Copy Markdown
Member

The bindings_generator.py script in godot-cpp fails to handle default values of Infinity or NaN:

Screenshot 2026-07-25 143024

Apparently Godot doesn't have either of these as default values in the normal engine, so the problem didn't occur before.

This PR adds a remapping to Math::INF and Math::NaN, which requires including the math_defs.hpp header: https://github.com/godotengine/godot-cpp/blob/master/include/godot_cpp/core/math_defs.hpp

@aaronfranke
aaronfranke requested a review from a team as a code owner July 25, 2026 21:41
Comment thread binding_generator.py

result.append("")
result.append("#include <godot_cpp/core/defs.hpp>")
result.append("#include <godot_cpp/core/math_defs.hpp>")

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.

I'm a little unsure about including this in every header for builtin classes.

Although, I guess we are already including it pretty widely, given that it's included in math.hpp which is included in some variant type headers (ex vector2.hpp) which are included all over.

If it weren't a big mess (which it probably would be), it'd be nice to be more targeted about this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What would the alternative be? Directly using <limits>?

@dsnopek dsnopek added the enhancement This is an enhancement on the current functionality label Jul 26, 2026
@dsnopek dsnopek added this to the 10.x milestone Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This is an enhancement on the current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants