Open slvmnd opened 1 year ago
One thing that needs to be considered is what to do about default values which this pull request does not currently handle, so for example:
const PxReal inflation = 0.0f,
bool doubleSided = false,
PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT
Here this code will pick up the default values for inflation and doubleSided, but not for queryFlags.
Generating "PxGeometryQueryFlag::eDEFAULT" or something similar from the AST seems fairly complicated and fragile, so the best alternative for complex values is probably to read the value from the C++ source code, but that would be a fairly large change to how the generator is currently architected.
Hi, this is a simple fix for https://github.com/EmbarkStudios/physx-rs/issues/188
It generates comments for literal default values (ints, floats, ..) like this:
A totally different way of solving this would be to not care about the kind of AST node and use the range begin/end offset to read the source expression from the source code instead. But if almost all default values are simple values then this approach might be good enough.
Not really expecting you to merge this as is without changes, but at least it can serve as a starting point.
I haven't really written much rust before so let me know if there is something un-idiomatic.