Fix T103747: crash when using rotation output of Curve to Points node

This commit is contained in:
Jacques Lucke 2023-01-09 14:31:36 +01:00
parent 589cbbf0e3
commit 29a41ed6c2
Notes: blender-bot 2023-02-13 22:37:44 +01:00
Referenced by issue #103747, Regression: Crash when using Rotation Output of Curve To Points node (node_geo_curve_to_points.cc)
2 changed files with 7 additions and 6 deletions

View File

@ -283,9 +283,9 @@ class GeoNodeExecParams {
* attribute is not needed.
*/
AutoAnonymousAttributeID get_output_anonymous_attribute_id_if_needed(
const StringRef output_identifier)
const StringRef output_identifier, const bool force_create = false)
{
if (!this->anonymous_attribute_output_is_required(output_identifier)) {
if (!this->anonymous_attribute_output_is_required(output_identifier) && !force_create) {
return {};
}
const GeoNodesLFUserData &user_data = *this->user_data();

View File

@ -111,12 +111,13 @@ static void node_geo_exec(GeoNodeExecParams params)
GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set);
AutoAnonymousAttributeID tangent_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Tangent");
AutoAnonymousAttributeID normal_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Normal");
AutoAnonymousAttributeID rotation_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Rotation");
const bool need_tangent_and_normal = bool(rotation_anonymous_id);
AutoAnonymousAttributeID tangent_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Tangent", need_tangent_and_normal);
AutoAnonymousAttributeID normal_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Normal", need_tangent_and_normal);
geometry::ResampleCurvesOutputAttributeIDs resample_attributes;
resample_attributes.tangent_id = tangent_anonymous_id.get();