Fix #124297: GPv3: Build modifier natural drawing speed fix #124350

Merged
Falk David merged 6 commits from ChengduLittleA/blender:fix-124297 into main 2024-07-16 10:26:50 +02:00
2 changed files with 2 additions and 6 deletions
Showing only changes of commit f70605778b - Show all commits

View File

@ -766,7 +766,6 @@ static Drawing legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gp
/* Curve Attributes. */
SpanAttributeWriter<bool> stroke_cyclic = attributes.lookup_or_add_for_write_span<bool>(
"cyclic", AttrDomain::Curve);
/* TODO: This should be a `double` attribute. */
SpanAttributeWriter<float> stroke_init_times = attributes.lookup_or_add_for_write_span<float>(
"init_time", AttrDomain::Curve);
SpanAttributeWriter<int8_t> stroke_start_caps = attributes.lookup_or_add_for_write_span<int8_t>(
@ -795,10 +794,8 @@ static Drawing legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gp
}
stroke_cyclic.span[stroke_i] = (gps->flag & GP_STROKE_CYCLIC) != 0;
/* TODO: This should be a `double` attribute. */
/* Truncating time in ms to uint32 then we don't lose precision in lower bits. */
stroke_init_times.span[stroke_i] = float(uint32_t(uint64_t(gps->inittime * (double)1e3))) /
float(1e3);
stroke_init_times.span[stroke_i] = float(uint32_t(gps->inittime * double(1e3))) / float(1e3);
ChengduLittleA marked this conversation as resolved Outdated

We can remove this TODO I think

We can remove this TODO I think
stroke_start_caps.span[stroke_i] = int8_t(gps->caps[0]);
stroke_end_caps.span[stroke_i] = int8_t(gps->caps[1]);
ChengduLittleA marked this conversation as resolved Outdated

Use double(1e3).
No need to cast to uint64_t before casting to uint32_t.

Use `double(1e3)`. No need to cast to `uint64_t` before casting to `uint32_t`.
stroke_softness.span[stroke_i] = 1.0f - gps->hardness;

View File

@ -591,8 +591,7 @@ struct PaintOperationExecutor {
bke::SpanAttributeWriter<float> init_times = attributes.lookup_or_add_for_write_span<float>(
"init_time", bke::AttrDomain::Curve);
/* Truncating time in ms to uint32 then we don't lose precision in lower bits. */
init_times.span[active_curve] = float(uint32_t(uint64_t(self.start_time_ * double(1e3)))) /
float(1e3);
init_times.span[active_curve] = float(uint64_t(self.start_time_ * double(1e3))) / float(1e3);
ChengduLittleA marked this conversation as resolved Outdated

Same as above, no need to cast to uint64_t before casting to uint32_t.

Same as above, no need to cast to `uint64_t` before casting to `uint32_t`.
curve_attributes_to_skip.add("init_time");
init_times.finish();