Fix: LineArt: Fix potential out of range original index after chaining

Due to the existence of intersection and lines from different objects
can be chained together, there could be index that's out of range from
_current_ object reference from a chain, which is normal and was handled
before !148840, that logic was mistakenly lost, now it's fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/149455
This commit is contained in:
YimingWu 2025-11-06 14:26:23 +01:00
parent 0574c4b6f9
commit a445f6be96

View file

@ -5444,7 +5444,7 @@ void MOD_lineart_gpencil_generate_v3(const LineartCache *cache,
auto transfer_to_matching_groups = [&](const int64_t source_index, const int target_index) {
for (const int from_group : src_to_dst_defgroup.index_range()) {
if (from_group < 0) {
if (from_group < 0 || UNLIKELY(source_index >= src_dvert.size())) {
continue;
}
const MDeformWeight *mdw_from = BKE_defvert_find_index(&src_dvert[source_index],
@ -5459,7 +5459,7 @@ void MOD_lineart_gpencil_generate_v3(const LineartCache *cache,
auto transfer_to_singular_group = [&](const int64_t source_index, const int target_index) {
float highest_weight = 0.0f;
for (const int from_group : src_to_dst_defgroup.index_range()) {
if (from_group < 0) {
if (from_group < 0 || UNLIKELY(source_index >= src_dvert.size())) {
continue;
}
const MDeformWeight *mdw_from = BKE_defvert_find_index(&src_dvert[source_index],