This commit moves Curves and Grease Pencil to use `AttributeStorage` instead of `CustomData`, except for vertex groups. This PR mostly involves extending the changes from the above commit for point clouds to generalize to other geometry types. This is mostly straightforward, though a couple non-trivial places of note are the joining of Grease Pencil objects (`merge_attributes`), the "default render fallback" UV for curves objects which was previously unused at the UI level and just ended up being the first attribute, and the `update_curve_types()` call in the curves versioning function. Similar to: -fa03c53d4a-f74e304b00Part of #122398. Pull Request: https://projects.blender.org/blender/blender/pulls/140936
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
/* SPDX-FileCopyrightText: 2025 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "DNA_attribute_types.h"
|
|
|
|
#include "BKE_attribute.hh"
|
|
#include "BKE_attribute_storage.hh"
|
|
|
|
struct CustomData;
|
|
namespace blender::bke {
|
|
class CurvesGeometry;
|
|
}
|
|
struct PointCloud;
|
|
struct GreasePencil;
|
|
struct Mesh;
|
|
|
|
namespace blender::bke {
|
|
|
|
/**
|
|
* Convert a custom data type to an attribute type. May return `std::nullopt` if the custom data
|
|
* type isn't used at runtime, is not a generic type that can be stored as an attribute, or is only
|
|
* used for #BMesh.
|
|
*/
|
|
std::optional<AttrType> custom_data_type_to_attr_type(eCustomDataType data_type);
|
|
|
|
/**
|
|
* Convert an attribute type to a legacy custom data type.
|
|
*/
|
|
std::optional<eCustomDataType> attr_type_to_custom_data_type(AttrType attr_type);
|
|
|
|
/**
|
|
* Move attributes from the #AttributeStorage to the mesh's #CustomData structs. Used for forward
|
|
* compatibility: converting newer files written with #AttributeStorage while #CustomData is still
|
|
* used at runtime.
|
|
*/
|
|
void mesh_convert_storage_to_customdata(Mesh &mesh);
|
|
|
|
/**
|
|
* Move generic attributes from #CustomData to #AttributeStorage (not including non-generic layer
|
|
* types). Use for versioning old files when the newer #AttributeStorage format is used at runtime.
|
|
*/
|
|
void mesh_convert_customdata_to_storage(Mesh &mesh);
|
|
|
|
/** See #mesh_convert_customdata_to_storage. */
|
|
void curves_convert_customdata_to_storage(CurvesGeometry &curves);
|
|
|
|
/** See #mesh_convert_customdata_to_storage. */
|
|
void pointcloud_convert_customdata_to_storage(PointCloud &pointcloud);
|
|
|
|
/** See #mesh_convert_customdata_to_storage. */
|
|
void grease_pencil_convert_customdata_to_storage(GreasePencil &grease_pencil);
|
|
|
|
} // namespace blender::bke
|