Fix: Grease Pencil: Points with zero aspect ratio not displayed

A aspect ratio less than or equal to zero will cause point to not be
displayed.
This behavior problematic because use strokes create by Geometry Nodes
(or bugs) can cause the `aspect_ratio` to default to zero.
And as there is currently no operator to set `aspect_ratio` this
invisible geometry can not be fixed by most users.

This PR fixes this by returning `1.0f` when the `aspect_ratio` is
invalided.

Pull Request: https://projects.blender.org/blender/blender/pulls/146279
This commit is contained in:
Casey Bianco-Davis
2025-09-15 18:51:33 +02:00
committed by casey-bianco-davis
parent 4fb784b97f
commit ce2005318a

View File

@@ -228,6 +228,10 @@ BLI_INLINE int32_t pack_rotation_aspect_hardness(float rot, float asp, float sof
int32_t packed = 0;
/* Aspect uses 9 bits */
float asp_normalized = (asp > 1.0f) ? (1.0f / asp) : asp;
/* Use the default aspect ratio of 1 when the value is outside of the valid range. */
if (asp_normalized <= 0.0f) {
asp_normalized = 1.0f;
}
packed |= int32_t(unit_float_to_uchar_clamp(asp_normalized));
/* Store if inverted in the 9th bit. */
if (asp > 1.0f) {