Fix: Grease Pencil: Debug build error when armature is parent

Error is about accessing value of nullopt optional `vert_coords_prev`.
This occurs when armature is parented to grease pencil object.

Pull Request: https://projects.blender.org/blender/blender/pulls/134016
This commit is contained in:
Pratik Borhade
2025-02-04 11:12:40 +01:00
committed by Pratik Borhade
parent d486c8f655
commit ac27bd16db

View File

@@ -621,8 +621,11 @@ void BKE_armature_deform_coords_with_curves(
* used for Grease Pencil layers as well. */
BLI_assert(dverts.size() == vert_coords.size());
/* const_cast for old positions for the C API, these are not actually written. */
blender::float3 *vert_coords_prev_data = const_cast<blender::float3 *>(vert_coords_prev->data());
blender::float3 *vert_coords_prev_data = nullptr;
if (vert_coords_prev.has_value()) {
/* const_cast for old positions for the C API, these are not actually written. */
vert_coords_prev_data = const_cast<blender::float3 *>(vert_coords_prev->data());
}
armature_deform_coords_impl(
&ob_arm,
@@ -632,7 +635,7 @@ void BKE_armature_deform_coords_with_curves(
vert_deform_mats ? reinterpret_cast<float(*)[3][3]>(vert_deform_mats->data()) : nullptr,
vert_coords.size(),
deformflag,
vert_coords_prev ? reinterpret_cast<float(*)[3]>(vert_coords_prev_data) : nullptr,
reinterpret_cast<float(*)[3]>(vert_coords_prev_data),
defgrp_name.c_str(),
dverts,
nullptr,