WIP: uv-simple-select #1

Closed
Chris Blackbourn wants to merge 182 commits from uv-simple-select into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
10 changed files with 6 additions and 65 deletions
Showing only changes of commit b9ed92c828 - Show all commits

View File

@ -604,7 +604,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
colliding_names = [] colliding_names = []
for collection in ( for collection in (
# Built-in names. # Built-in names.
{"shade_smooth": None, "normal": None, "crease": None}, {"shade_smooth": None, "crease": None},
mesh.attributes, mesh.attributes,
None if ob is None else ob.vertex_groups, None if ob is None else ob.vertex_groups,
): ):

View File

@ -316,9 +316,6 @@ GVArray BuiltinCustomDataLayerProvider::try_get_for_read(const void *owner) cons
GAttributeWriter BuiltinCustomDataLayerProvider::try_get_for_write(void *owner) const GAttributeWriter BuiltinCustomDataLayerProvider::try_get_for_write(void *owner) const
{ {
if (writable_ != Writable) {
return {};
}
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 {}; return {};
@ -905,10 +902,8 @@ Vector<AttributeTransferData> retrieve_attributes_for_transfer(
BLI_assert(src); BLI_assert(src);
bke::GSpanAttributeWriter dst = dst_attributes.lookup_or_add_for_write_only_span( bke::GSpanAttributeWriter dst = dst_attributes.lookup_or_add_for_write_only_span(
id, meta_data.domain, meta_data.data_type); id, meta_data.domain, meta_data.data_type);
if (dst) { BLI_assert(dst);
/* Writing the the legacy "normal" attribute will fail. */ attributes.append({std::move(src), meta_data, std::move(dst)});
attributes.append({std::move(src), meta_data, std::move(dst)});
}
return true; return true;
}); });

View File

@ -37,10 +37,6 @@ class BuiltinAttributeProvider {
Creatable, Creatable,
NonCreatable, NonCreatable,
}; };
enum WritableEnum {
Writable,
Readonly,
};
enum DeletableEnum { enum DeletableEnum {
Deletable, Deletable,
NonDeletable, NonDeletable,
@ -51,7 +47,6 @@ class BuiltinAttributeProvider {
const eAttrDomain domain_; const eAttrDomain domain_;
const eCustomDataType data_type_; const eCustomDataType data_type_;
const CreatableEnum createable_; const CreatableEnum createable_;
const WritableEnum writable_;
const DeletableEnum deletable_; const DeletableEnum deletable_;
const AttributeValidator validator_; const AttributeValidator validator_;
@ -60,14 +55,12 @@ class BuiltinAttributeProvider {
const eAttrDomain domain, const eAttrDomain domain,
const eCustomDataType data_type, const eCustomDataType data_type,
const CreatableEnum createable, const CreatableEnum createable,
const WritableEnum writable,
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), createable_(createable),
writable_(writable),
deletable_(deletable), deletable_(deletable),
validator_(validator) validator_(validator)
{ {
@ -205,20 +198,14 @@ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider {
const eCustomDataType attribute_type, const eCustomDataType attribute_type,
const eCustomDataType stored_type, const eCustomDataType stored_type,
const CreatableEnum creatable, const CreatableEnum creatable,
const WritableEnum writable,
const DeletableEnum deletable, const DeletableEnum deletable,
const CustomDataAccessInfo custom_data_access, const CustomDataAccessInfo custom_data_access,
const AsReadAttribute as_read_attribute, const AsReadAttribute as_read_attribute,
const AsWriteAttribute as_write_attribute, const AsWriteAttribute as_write_attribute,
const UpdateOnChange update_on_write, const UpdateOnChange update_on_write,
const AttributeValidator validator = {}) const AttributeValidator validator = {})
: BuiltinAttributeProvider(std::move(attribute_name), : BuiltinAttributeProvider(
domain, std::move(attribute_name), domain, attribute_type, creatable, deletable, validator),
attribute_type,
creatable,
writable,
deletable,
validator),
stored_type_(stored_type), stored_type_(stored_type),
custom_data_access_(custom_data_access), custom_data_access_(custom_data_access),
as_read_attribute_(as_read_attribute), as_read_attribute_(as_read_attribute),

View File

@ -375,7 +375,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::NonCreatable, BuiltinAttributeProvider::NonCreatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
make_array_read_attribute<float3>, make_array_read_attribute<float3>,
@ -387,7 +386,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT, CD_PROP_FLOAT,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float>, make_array_read_attribute<float>,
@ -399,7 +397,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,
@ -411,7 +408,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT, CD_PROP_FLOAT,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float>, make_array_read_attribute<float>,
@ -423,7 +419,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float3>, make_array_read_attribute<float3>,
@ -435,7 +430,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float3>, make_array_read_attribute<float3>,
@ -453,7 +447,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -466,7 +459,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -479,7 +471,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_FLOAT, CD_PROP_FLOAT,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float>, make_array_read_attribute<float>,
@ -495,7 +486,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -514,7 +504,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -533,7 +522,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -552,7 +540,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT8, CD_PROP_INT8,
CD_PROP_INT8, CD_PROP_INT8,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<int8_t>, make_array_read_attribute<int8_t>,
@ -569,7 +556,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,
@ -582,7 +568,6 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
CD_PROP_BOOL, CD_PROP_BOOL,
CD_PROP_BOOL, CD_PROP_BOOL,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
curve_access, curve_access,
make_array_read_attribute<bool>, make_array_read_attribute<bool>,

View File

@ -129,7 +129,7 @@ class InstancePositionAttributeProvider final : public BuiltinAttributeProvider
public: public:
InstancePositionAttributeProvider() InstancePositionAttributeProvider()
: BuiltinAttributeProvider( : BuiltinAttributeProvider(
"position", ATTR_DOMAIN_INSTANCE, CD_PROP_FLOAT3, NonCreatable, Writable, NonDeletable) "position", ATTR_DOMAIN_INSTANCE, CD_PROP_FLOAT3, NonCreatable, NonDeletable)
{ {
} }
@ -200,7 +200,6 @@ static ComponentAttributeProviders create_attribute_providers_for_instances()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
instance_custom_data_access, instance_custom_data_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,

View File

@ -1180,7 +1180,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::NonCreatable, BuiltinAttributeProvider::NonCreatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
make_array_read_attribute<float3>, make_array_read_attribute<float3>,
@ -1192,7 +1191,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,
@ -1211,7 +1209,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
face_access, face_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,
@ -1225,7 +1222,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_BOOL, CD_PROP_BOOL,
CD_MPOLY, CD_MPOLY,
BuiltinAttributeProvider::NonCreatable, BuiltinAttributeProvider::NonCreatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
face_access, face_access,
make_derived_read_attribute<MPoly, bool, get_shade_smooth>, make_derived_read_attribute<MPoly, bool, get_shade_smooth>,
@ -1237,7 +1233,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_BOOL, CD_PROP_BOOL,
CD_PROP_BOOL, CD_PROP_BOOL,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
edge_access, edge_access,
make_array_read_attribute<bool>, make_array_read_attribute<bool>,
@ -1250,7 +1245,6 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_FLOAT, CD_PROP_FLOAT,
CD_CREASE, CD_CREASE,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
edge_access, edge_access,
make_array_read_attribute<float>, make_array_read_attribute<float>,

View File

@ -142,7 +142,6 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud()
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
CD_PROP_FLOAT3, CD_PROP_FLOAT3,
BuiltinAttributeProvider::NonCreatable, BuiltinAttributeProvider::NonCreatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::NonDeletable, BuiltinAttributeProvider::NonDeletable,
point_access, point_access,
make_array_read_attribute<float3>, make_array_read_attribute<float3>,
@ -153,7 +152,6 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud()
CD_PROP_FLOAT, CD_PROP_FLOAT,
CD_PROP_FLOAT, CD_PROP_FLOAT,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<float>, make_array_read_attribute<float>,
@ -164,7 +162,6 @@ static ComponentAttributeProviders create_attribute_providers_for_point_cloud()
CD_PROP_INT32, CD_PROP_INT32,
CD_PROP_INT32, CD_PROP_INT32,
BuiltinAttributeProvider::Creatable, BuiltinAttributeProvider::Creatable,
BuiltinAttributeProvider::Writable,
BuiltinAttributeProvider::Deletable, BuiltinAttributeProvider::Deletable,
point_access, point_access,
make_array_read_attribute<int>, make_array_read_attribute<int>,

View File

@ -92,15 +92,9 @@ void attribute_search_add_items(StringRefNull str,
StringSearch *search = BLI_string_search_new(); StringSearch *search = BLI_string_search_new();
for (const GeometryAttributeInfo *item : infos) { for (const GeometryAttributeInfo *item : infos) {
/* Don't show the legacy "normal" attribute. */
if (item->name == "normal" && item->domain == ATTR_DOMAIN_FACE) {
continue;
}
if (!bke::allow_procedural_attribute_access(item->name)) { if (!bke::allow_procedural_attribute_access(item->name)) {
continue; continue;
} }
BLI_string_search_add(search, item->name.c_str(), (void *)item, 0); BLI_string_search_add(search, item->name.c_str(), (void *)item, 0);
} }

View File

@ -839,7 +839,6 @@ static OrderedAttributes gather_generic_mesh_attributes_to_propagate(
options.propagation_info, options.propagation_info,
attributes_to_propagate); attributes_to_propagate);
attributes_to_propagate.remove("position"); attributes_to_propagate.remove("position");
attributes_to_propagate.remove("normal");
attributes_to_propagate.remove("shade_smooth"); attributes_to_propagate.remove("shade_smooth");
r_create_id = attributes_to_propagate.pop_try("id").has_value(); r_create_id = attributes_to_propagate.pop_try("id").has_value();
r_create_material_index = attributes_to_propagate.pop_try("material_index").has_value(); r_create_material_index = attributes_to_propagate.pop_try("material_index").has_value();

View File

@ -471,9 +471,6 @@ static void extrude_mesh_edges(Mesh &mesh,
} }
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span( GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
id, meta_data.domain, meta_data.data_type); id, meta_data.domain, meta_data.data_type);
if (!attribute) {
return true; /* Impossible to write the "normal" attribute. */
}
attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) { attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) {
using T = decltype(dummy); using T = decltype(dummy);
@ -867,9 +864,6 @@ static void extrude_mesh_face_regions(Mesh &mesh,
} }
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span( GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
id, meta_data.domain, meta_data.data_type); id, meta_data.domain, meta_data.data_type);
if (!attribute) {
return true; /* Impossible to write the "normal" attribute. */
}
attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) { attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) {
using T = decltype(dummy); using T = decltype(dummy);
@ -1158,9 +1152,6 @@ static void extrude_individual_mesh_faces(Mesh &mesh,
} }
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span( GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
id, meta_data.domain, meta_data.data_type); id, meta_data.domain, meta_data.data_type);
if (!attribute) {
return true; /* Impossible to write the "normal" attribute. */
}
attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) { attribute_math::convert_to_static_type(meta_data.data_type, [&](auto dummy) {
using T = decltype(dummy); using T = decltype(dummy);