Closed raulsntos closed 2 months ago
Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1569
Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1570
Cherry-picked for 4.1 in PR https://github.com/godotengine/godot-cpp/pull/1572
The engine uses the names
int
andfloat
to refer to the 64-bit types, so in the bindings generator we have a hardcoded conversion for those types.But this type conversion should not be used for metadata. Even though the underlying type should still be 64-bit for interop, metadata is meant to specify the correct type to expose. So if metadata says
float
it means the type is really meant to be a 32-bitfloat
and notdouble
. Other hardcoded type conversions (int
andNil
) won't ever be metadata.This change corrects the
float
type, to use the right type in the generated C++ code. Before we were always usingdouble
due to this type conversion.For example, the
InputEventMouseButton::get_factor
API changes with this PR to returnfloat
which matches the method signature in the engine:https://github.com/godotengine/godot/blob/826de7976a6add282c7b14d4be2a7e6d775821d8/core/input/input_event.h#L245