This removes `AnonymousAttributeID` which was "attached" to every anonymous attribute before. It adds more complexity than is justified for its functionality. It was originally introduced to keep the reference count of the anonymous attribute so that it can be deleted automatically when the attribute is not referenced anymore. For quite some time we have had deterministic attribute life-times though which don't rely on the reference count anymore. Anonymous attributes are sometimes shown in the UI as "friendly looking" string like `"UV Map" from Cube`. Some information necessary for this was also stored in `AnonymousAttributeID`. However, this can also be solved differently. Specifically, this functionality has now been added directly to `AttributeFieldInput`. This refactor also allows removing `AttributeIDRef` which was mainly introduced because we had to keep the `AnonymousAttributeID` attached with the attribute name. Just using simple string types to identify attributes can reduce the mental overhead quite significantly. This will be done as a separate refactor though. Pull Request: https://projects.blender.org/blender/blender/pulls/127081
65 lines
2.9 KiB
C++
65 lines
2.9 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "FN_field.hh"
|
|
|
|
#include "BKE_attribute.hh"
|
|
#include "BKE_curves.hh"
|
|
|
|
namespace blender::geometry {
|
|
|
|
using bke::CurvesGeometry;
|
|
|
|
struct ResampleCurvesOutputAttributeIDs {
|
|
std::optional<std::string> tangent_id;
|
|
std::optional<std::string> normal_id;
|
|
};
|
|
|
|
/**
|
|
* Create new curves where the selected curves have been resampled with a number of uniform-length
|
|
* samples defined by the count field. Interpolate attributes to the result, with an accuracy that
|
|
* depends on the curve's resolution parameter.
|
|
*
|
|
* \note The values provided by the #count_field are clamped to 1 or greater.
|
|
*/
|
|
CurvesGeometry resample_to_count(const CurvesGeometry &src_curves,
|
|
const IndexMask &selection,
|
|
const VArray<int> &counts,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
CurvesGeometry resample_to_count(const CurvesGeometry &src_curves,
|
|
const fn::FieldContext &field_context,
|
|
const fn::Field<bool> &selection_field,
|
|
const fn::Field<int> &count_field,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
|
|
/**
|
|
* Create new curves resampled to make each segment have the length specified by the
|
|
* #segment_length field input, rounded to make the length of each segment the same.
|
|
* The accuracy will depend on the curve's resolution parameter.
|
|
*/
|
|
CurvesGeometry resample_to_length(const CurvesGeometry &src_curves,
|
|
const IndexMask &selection,
|
|
const VArray<float> &sample_lengths,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
CurvesGeometry resample_to_length(const CurvesGeometry &src_curves,
|
|
const fn::FieldContext &field_context,
|
|
const fn::Field<bool> &selection_field,
|
|
const fn::Field<float> &segment_length_field,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
|
|
/**
|
|
* Evaluate each selected curve to its implicit evaluated points.
|
|
*/
|
|
CurvesGeometry resample_to_evaluated(const CurvesGeometry &src_curves,
|
|
const IndexMask &selection,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
CurvesGeometry resample_to_evaluated(const CurvesGeometry &src_curves,
|
|
const fn::FieldContext &field_context,
|
|
const fn::Field<bool> &selection_field,
|
|
const ResampleCurvesOutputAttributeIDs &output_ids = {});
|
|
|
|
} // namespace blender::geometry
|