forked from blender/blender
realize-depth #5
@ -425,9 +425,6 @@ bool BuiltinCustomDataLayerProvider::try_delete(void *owner) const
|
||||
bool BuiltinCustomDataLayerProvider::try_create(void *owner,
|
||||
const AttributeInit &initializer) const
|
||||
{
|
||||
if (createable_ != Creatable) {
|
||||
return false;
|
||||
}
|
||||
CustomData *custom_data = custom_data_access_.get_custom_data(owner);
|
||||
if (custom_data == nullptr) {
|
||||
return false;
|
||||
|
@ -31,14 +31,10 @@ struct CustomDataAccessInfo {
|
||||
* 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
|
||||
* 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 {
|
||||
public:
|
||||
/* Some utility enums to avoid hard to read booleans in function calls. */
|
||||
enum CreatableEnum {
|
||||
Creatable,
|
||||
NonCreatable,
|
||||
};
|
||||
enum DeletableEnum {
|
||||
Deletable,
|
||||
NonDeletable,
|
||||
@ -48,7 +44,6 @@ class BuiltinAttributeProvider {
|
||||
const std::string name_;
|
||||
const AttrDomain domain_;
|
||||
const eCustomDataType data_type_;
|
||||
const CreatableEnum createable_;
|
||||
const DeletableEnum deletable_;
|
||||
const AttributeValidator validator_;
|
||||
|
||||
@ -56,13 +51,11 @@ class BuiltinAttributeProvider {
|
||||
BuiltinAttributeProvider(std::string name,
|
||||
const AttrDomain domain,
|
||||
const eCustomDataType data_type,
|
||||
const CreatableEnum createable,
|
||||
const DeletableEnum deletable,
|
||||
AttributeValidator validator = {})
|
||||
: name_(std::move(name)),
|
||||
domain_(domain),
|
||||
data_type_(data_type),
|
||||
createable_(createable),
|
||||
deletable_(deletable),
|
||||
validator_(validator)
|
||||
{
|
||||
@ -181,13 +174,12 @@ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider {
|
||||
BuiltinCustomDataLayerProvider(std::string attribute_name,
|
||||
const AttrDomain domain,
|
||||
const eCustomDataType data_type,
|
||||
const CreatableEnum creatable,
|
||||
const DeletableEnum deletable,
|
||||
const CustomDataAccessInfo custom_data_access,
|
||||
const UpdateOnChange update_on_change,
|
||||
const AttributeValidator validator = {})
|
||||
: 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),
|
||||
update_on_change_(update_on_change)
|
||||
{
|
||||
|
@ -476,7 +476,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider position("position",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
@ -484,7 +483,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider radius("radius",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_radii_changed);
|
||||
@ -492,7 +490,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider id("id",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
nullptr);
|
||||
@ -500,7 +497,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider tilt("tilt",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_normals_changed);
|
||||
@ -508,7 +504,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider handle_right("handle_right",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
@ -516,7 +511,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider handle_left("handle_left",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
@ -530,7 +524,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider handle_type_right("handle_type_right",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_topology_changed,
|
||||
@ -539,7 +532,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider handle_type_left("handle_type_left",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_topology_changed,
|
||||
@ -548,7 +540,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider nurbs_weight("nurbs_weight",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
@ -560,7 +551,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_topology_changed,
|
||||
@ -575,7 +565,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider normal_mode("normal_mode",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_normals_changed,
|
||||
@ -584,7 +573,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider custom_normal("custom_normal",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_normals_changed);
|
||||
@ -598,7 +586,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider nurbs_knots_mode("knots_mode",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_topology_changed,
|
||||
@ -613,7 +600,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider curve_type("curve_type",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_INT8,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_curve_types_changed,
|
||||
@ -626,7 +612,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider resolution("resolution",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_topology_changed,
|
||||
@ -635,7 +620,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
|
||||
static BuiltinCustomDataLayerProvider cyclic("cyclic",
|
||||
AttrDomain::Curve,
|
||||
CD_PROP_BOOL,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
curve_access,
|
||||
tag_component_topology_changed);
|
||||
|
@ -133,7 +133,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
|
||||
static BuiltinCustomDataLayerProvider id("id",
|
||||
AttrDomain::Instance,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
instance_custom_data_access,
|
||||
nullptr);
|
||||
@ -141,7 +140,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
|
||||
static BuiltinCustomDataLayerProvider instance_transform("instance_transform",
|
||||
AttrDomain::Instance,
|
||||
CD_PROP_FLOAT4X4,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
instance_custom_data_access,
|
||||
nullptr);
|
||||
@ -150,7 +148,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
|
||||
static BuiltinCustomDataLayerProvider reference_index(".reference_index",
|
||||
AttrDomain::Instance,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
instance_custom_data_access,
|
||||
tag_component_reference_index_changed);
|
||||
|
@ -1010,7 +1010,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider position("position",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
@ -1018,7 +1017,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider id("id",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
nullptr);
|
||||
@ -1033,7 +1031,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider material_index("material_index",
|
||||
AttrDomain::Face,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
face_access,
|
||||
nullptr,
|
||||
@ -1046,7 +1043,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider edge_verts(".edge_verts",
|
||||
AttrDomain::Edge,
|
||||
CD_PROP_INT32_2D,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
edge_access,
|
||||
nullptr,
|
||||
@ -1061,7 +1057,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider corner_vert(".corner_vert",
|
||||
AttrDomain::Corner,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
corner_access,
|
||||
nullptr,
|
||||
@ -1069,7 +1064,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider corner_edge(".corner_edge",
|
||||
AttrDomain::Corner,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
corner_access,
|
||||
nullptr,
|
||||
@ -1078,7 +1072,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider sharp_face("sharp_face",
|
||||
AttrDomain::Face,
|
||||
CD_PROP_BOOL,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
face_access,
|
||||
tag_component_sharpness_changed);
|
||||
@ -1086,7 +1079,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static BuiltinCustomDataLayerProvider sharp_edge("sharp_edge",
|
||||
AttrDomain::Edge,
|
||||
CD_PROP_BOOL,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
edge_access,
|
||||
tag_component_sharpness_changed);
|
||||
|
@ -147,21 +147,18 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud()
|
||||
static BuiltinCustomDataLayerProvider position("position",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT3,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
point_access,
|
||||
tag_component_positions_changed);
|
||||
static BuiltinCustomDataLayerProvider radius("radius",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_FLOAT,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
tag_component_radius_changed);
|
||||
static BuiltinCustomDataLayerProvider id("id",
|
||||
AttrDomain::Point,
|
||||
CD_PROP_INT32,
|
||||
BuiltinAttributeProvider::Creatable,
|
||||
BuiltinAttributeProvider::Deletable,
|
||||
point_access,
|
||||
nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user