realize-depth #5

Merged
Arye Ramaty merged 43 commits from David-Haver/blender:realize-depth into WIP-realize-depth 2024-03-31 17:22:49 +02:00
6 changed files with 3 additions and 44 deletions
Showing only changes of commit ef22826a3c - Show all commits

View File

@ -425,9 +425,6 @@ bool BuiltinCustomDataLayerProvider::try_delete(void *owner) const
bool BuiltinCustomDataLayerProvider::try_create(void *owner, bool BuiltinCustomDataLayerProvider::try_create(void *owner,
const AttributeInit &initializer) const const AttributeInit &initializer) const
{ {
if (createable_ != Creatable) {
return false;
}
CustomData *custom_data = custom_data_access_.get_custom_data(owner); CustomData *custom_data = custom_data_access_.get_custom_data(owner);
if (custom_data == nullptr) { if (custom_data == nullptr) {
return false; return false;

View File

@ -31,14 +31,10 @@ struct CustomDataAccessInfo {
* A #BuiltinAttributeProvider is responsible for exactly one attribute on a geometry component. * A #BuiltinAttributeProvider is responsible for exactly one attribute on a geometry component.
* The attribute is identified by its name and has a fixed domain and type. Builtin attributes do * The attribute is identified by its name and has a fixed domain and type. Builtin attributes do
* not follow the same loose rules as other attributes, because they are mapped to internal * not follow the same loose rules as other attributes, because they are mapped to internal
* "legacy" data structures. For example, some builtin attributes cannot be deleted. */ * "legacy" data structures. For example, some builtin attributes cannot be deleted.
*/
class BuiltinAttributeProvider { class BuiltinAttributeProvider {
public: public:
/* Some utility enums to avoid hard to read booleans in function calls. */
enum CreatableEnum {
Creatable,
NonCreatable,
};
enum DeletableEnum { enum DeletableEnum {
Deletable, Deletable,
NonDeletable, NonDeletable,
@ -48,7 +44,6 @@ class BuiltinAttributeProvider {
const std::string name_; const std::string name_;
const AttrDomain domain_; const AttrDomain domain_;
const eCustomDataType data_type_; const eCustomDataType data_type_;
const CreatableEnum createable_;
const DeletableEnum deletable_; const DeletableEnum deletable_;
const AttributeValidator validator_; const AttributeValidator validator_;
@ -56,13 +51,11 @@ class BuiltinAttributeProvider {
BuiltinAttributeProvider(std::string name, BuiltinAttributeProvider(std::string name,
const AttrDomain domain, const AttrDomain domain,
const eCustomDataType data_type, const eCustomDataType data_type,
const CreatableEnum createable,
const DeletableEnum deletable, const DeletableEnum deletable,
AttributeValidator validator = {}) AttributeValidator validator = {})
: name_(std::move(name)), : name_(std::move(name)),
domain_(domain), domain_(domain),
data_type_(data_type), data_type_(data_type),
createable_(createable),
deletable_(deletable), deletable_(deletable),
validator_(validator) validator_(validator)
{ {
@ -181,13 +174,12 @@ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider {
BuiltinCustomDataLayerProvider(std::string attribute_name, BuiltinCustomDataLayerProvider(std::string attribute_name,
const AttrDomain domain, const AttrDomain domain,
const eCustomDataType data_type, const eCustomDataType data_type,
const CreatableEnum creatable,
const DeletableEnum deletable, const DeletableEnum deletable,
const CustomDataAccessInfo custom_data_access, const CustomDataAccessInfo custom_data_access,
const UpdateOnChange update_on_change, const UpdateOnChange update_on_change,
const AttributeValidator validator = {}) const AttributeValidator validator = {})
: BuiltinAttributeProvider( : BuiltinAttributeProvider(
std::move(attribute_name), domain, data_type, creatable, deletable, validator), std::move(attribute_name), domain, data_type, deletable, validator),
custom_data_access_(custom_data_access), custom_data_access_(custom_data_access),
update_on_change_(update_on_change) update_on_change_(update_on_change)
{ {

View File

@ -476,7 +476,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider position("position", static BuiltinCustomDataLayerProvider position("position",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
@ -484,7 +483,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider radius("radius", static BuiltinCustomDataLayerProvider radius("radius",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_radii_changed); tag_component_radii_changed);
@ -492,7 +490,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider id("id", static BuiltinCustomDataLayerProvider id("id",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
nullptr); nullptr);
@ -500,7 +497,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider tilt("tilt", static BuiltinCustomDataLayerProvider tilt("tilt",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_normals_changed); tag_component_normals_changed);
@ -508,7 +504,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider handle_right("handle_right", static BuiltinCustomDataLayerProvider handle_right("handle_right",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
@ -516,7 +511,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider handle_left("handle_left", static BuiltinCustomDataLayerProvider handle_left("handle_left",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
@ -530,7 +524,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider handle_type_right("handle_type_right", static BuiltinCustomDataLayerProvider handle_type_right("handle_type_right",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_topology_changed, tag_component_topology_changed,
@ -539,7 +532,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider handle_type_left("handle_type_left", static BuiltinCustomDataLayerProvider handle_type_left("handle_type_left",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_topology_changed, tag_component_topology_changed,
@ -548,7 +540,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider nurbs_weight("nurbs_weight", static BuiltinCustomDataLayerProvider nurbs_weight("nurbs_weight",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
@ -560,7 +551,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order", static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_topology_changed, tag_component_topology_changed,
@ -575,7 +565,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider normal_mode("normal_mode", static BuiltinCustomDataLayerProvider normal_mode("normal_mode",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_normals_changed, tag_component_normals_changed,
@ -584,7 +573,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider custom_normal("custom_normal", static BuiltinCustomDataLayerProvider custom_normal("custom_normal",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_normals_changed); tag_component_normals_changed);
@ -598,7 +586,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider nurbs_knots_mode("knots_mode", static BuiltinCustomDataLayerProvider nurbs_knots_mode("knots_mode",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_topology_changed, tag_component_topology_changed,
@ -613,7 +600,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider curve_type("curve_type", static BuiltinCustomDataLayerProvider curve_type("curve_type",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_curve_types_changed, tag_component_curve_types_changed,
@ -626,7 +612,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider resolution("resolution", static BuiltinCustomDataLayerProvider resolution("resolution",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_topology_changed, tag_component_topology_changed,
@ -635,7 +620,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static BuiltinCustomDataLayerProvider cyclic("cyclic", static BuiltinCustomDataLayerProvider cyclic("cyclic",
AttrDomain::Curve, AttrDomain::Curve,
CD_PROP_BOOL, CD_PROP_BOOL,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
tag_component_topology_changed); tag_component_topology_changed);

View File

@ -133,7 +133,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
static BuiltinCustomDataLayerProvider id("id", static BuiltinCustomDataLayerProvider id("id",
AttrDomain::Instance, AttrDomain::Instance,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
instance_custom_data_access, instance_custom_data_access,
nullptr); nullptr);
@ -141,7 +140,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
static BuiltinCustomDataLayerProvider instance_transform("instance_transform", static BuiltinCustomDataLayerProvider instance_transform("instance_transform",
AttrDomain::Instance, AttrDomain::Instance,
CD_PROP_FLOAT4X4, CD_PROP_FLOAT4X4,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
instance_custom_data_access, instance_custom_data_access,
nullptr); nullptr);
@ -150,7 +148,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
static BuiltinCustomDataLayerProvider reference_index(".reference_index", static BuiltinCustomDataLayerProvider reference_index(".reference_index",
AttrDomain::Instance, AttrDomain::Instance,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
instance_custom_data_access, instance_custom_data_access,
tag_component_reference_index_changed); tag_component_reference_index_changed);

View File

@ -1010,7 +1010,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider position("position", static BuiltinCustomDataLayerProvider position("position",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
@ -1018,7 +1017,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider id("id", static BuiltinCustomDataLayerProvider id("id",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
nullptr); nullptr);
@ -1033,7 +1031,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider material_index("material_index", static BuiltinCustomDataLayerProvider material_index("material_index",
AttrDomain::Face, AttrDomain::Face,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
face_access, face_access,
nullptr, nullptr,
@ -1046,7 +1043,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider edge_verts(".edge_verts", static BuiltinCustomDataLayerProvider edge_verts(".edge_verts",
AttrDomain::Edge, AttrDomain::Edge,
CD_PROP_INT32_2D, CD_PROP_INT32_2D,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
edge_access, edge_access,
nullptr, nullptr,
@ -1061,7 +1057,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider corner_vert(".corner_vert", static BuiltinCustomDataLayerProvider corner_vert(".corner_vert",
AttrDomain::Corner, AttrDomain::Corner,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
corner_access, corner_access,
nullptr, nullptr,
@ -1069,7 +1064,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider corner_edge(".corner_edge", static BuiltinCustomDataLayerProvider corner_edge(".corner_edge",
AttrDomain::Corner, AttrDomain::Corner,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
corner_access, corner_access,
nullptr, nullptr,
@ -1078,7 +1072,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider sharp_face("sharp_face", static BuiltinCustomDataLayerProvider sharp_face("sharp_face",
AttrDomain::Face, AttrDomain::Face,
CD_PROP_BOOL, CD_PROP_BOOL,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
face_access, face_access,
tag_component_sharpness_changed); tag_component_sharpness_changed);
@ -1086,7 +1079,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
static BuiltinCustomDataLayerProvider sharp_edge("sharp_edge", static BuiltinCustomDataLayerProvider sharp_edge("sharp_edge",
AttrDomain::Edge, AttrDomain::Edge,
CD_PROP_BOOL, CD_PROP_BOOL,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
edge_access, edge_access,
tag_component_sharpness_changed); tag_component_sharpness_changed);

View File

@ -147,21 +147,18 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud()
static BuiltinCustomDataLayerProvider position("position", static BuiltinCustomDataLayerProvider position("position",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
tag_component_positions_changed); tag_component_positions_changed);
static BuiltinCustomDataLayerProvider radius("radius", static BuiltinCustomDataLayerProvider radius("radius",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
tag_component_radius_changed); tag_component_radius_changed);
static BuiltinCustomDataLayerProvider id("id", static BuiltinCustomDataLayerProvider id("id",
AttrDomain::Point, AttrDomain::Point,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
nullptr); nullptr);