RNA: generate valid infinite float property default values
In `makesrna`, generate valid default values for float properties, when those defaults are positive/negative infinity. Blender would currently generate the strings `inff` and `-inff`, which are not valid C++. This PR changes that to `std::numeric_limits<float>::infinity()` and `-std::numeric_limits<float>::infinity()`. Context: the layered animation system (see #113594) will have animation layers with strips on them. It will have the concept of "infinite strips", where from a user's perspective there aren't even any strips at all, and the layer seems to directly contain the keys themselves. This is purely a UI distinction though, where we simply won't draw the outline of infinite strips. Being able to work with ±∞ as floating point values has clear advantages, as then the `strip.frame_start` and `strip.frame_end` properties will always "tell the truth". This particular change is necessary to allow these values as defaults. It is not intended that users will have property sliders for these properties when their value is "infinite" (but rather a button 'make finite' or something along those lines), so interaction with the UI code will likely be minimal. Pull Request: https://projects.blender.org/blender/blender/pulls/113854
This commit is contained in:
parent
0488117548
commit
395ac4c41f
|
@ -646,6 +646,12 @@ static void rna_float_print(FILE *f, float num)
|
|||
else if ((fabsf(num) < float(INT64_MAX)) && (int64_t(num) == num)) {
|
||||
fprintf(f, "%.1ff", num);
|
||||
}
|
||||
else if (num == std::numeric_limits<float>::infinity()) {
|
||||
fprintf(f, "std::numeric_limits<float>::infinity()");
|
||||
}
|
||||
else if (num == -std::numeric_limits<float>::infinity()) {
|
||||
fprintf(f, "-std::numeric_limits<float>::infinity()");
|
||||
}
|
||||
else {
|
||||
fprintf(f, "%.10ff", num);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue