forked from bartvdbraak/blender
Geometry Nodes: rename attribute domains
This patch renames two domains: * `Polygon` -> `Face` * `Corner` -> `Face Corner` For the change from `polygon` to `face` I did a "deep rename" where I updated all (most?) cases where we refere to the attribute domain in code as well. The change from `corner` to `face corner` is only a ui change. I did not see a real need to update all code the code for that. It does not seem to improve the code, more on the contrary. Ref T86818. Differential Revision: https://developer.blender.org/D10803
This commit is contained in:
parent
150e0553da
commit
28cf851a5c
@ -375,7 +375,7 @@ static void attr_create_generic(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool
|
||||
case BL::Attribute::domain_POINT:
|
||||
element = ATTR_ELEMENT_VERTEX;
|
||||
break;
|
||||
case BL::Attribute::domain_POLYGON:
|
||||
case BL::Attribute::domain_FACE:
|
||||
element = ATTR_ELEMENT_FACE;
|
||||
break;
|
||||
default:
|
||||
|
@ -39,12 +39,12 @@ struct ReportList;
|
||||
|
||||
/* Attribute.domain */
|
||||
typedef enum AttributeDomain {
|
||||
ATTR_DOMAIN_AUTO = -1, /* Use for nodes to choose automatically based on other data. */
|
||||
ATTR_DOMAIN_POINT = 0, /* Mesh, Hair or PointCloud Point */
|
||||
ATTR_DOMAIN_EDGE = 1, /* Mesh Edge */
|
||||
ATTR_DOMAIN_CORNER = 2, /* Mesh Corner */
|
||||
ATTR_DOMAIN_POLYGON = 3, /* Mesh Polygon */
|
||||
ATTR_DOMAIN_CURVE = 4, /* Hair Curve */
|
||||
ATTR_DOMAIN_AUTO = -1, /* Use for nodes to choose automatically based on other data. */
|
||||
ATTR_DOMAIN_POINT = 0, /* Mesh, Hair or PointCloud Point */
|
||||
ATTR_DOMAIN_EDGE = 1, /* Mesh Edge */
|
||||
ATTR_DOMAIN_CORNER = 2, /* Mesh Corner */
|
||||
ATTR_DOMAIN_FACE = 3, /* Mesh Face */
|
||||
ATTR_DOMAIN_CURVE = 4, /* Hair Curve */
|
||||
|
||||
ATTR_DOMAIN_NUM
|
||||
} AttributeDomain;
|
||||
|
@ -69,8 +69,8 @@ static void get_domains(ID *id, DomainInfo info[ATTR_DOMAIN_NUM])
|
||||
info[ATTR_DOMAIN_EDGE].length = mesh->totedge;
|
||||
info[ATTR_DOMAIN_CORNER].customdata = &mesh->ldata;
|
||||
info[ATTR_DOMAIN_CORNER].length = mesh->totloop;
|
||||
info[ATTR_DOMAIN_POLYGON].customdata = &mesh->pdata;
|
||||
info[ATTR_DOMAIN_POLYGON].length = mesh->totpoly;
|
||||
info[ATTR_DOMAIN_FACE].customdata = &mesh->pdata;
|
||||
info[ATTR_DOMAIN_FACE].length = mesh->totpoly;
|
||||
break;
|
||||
}
|
||||
case ID_HA: {
|
||||
|
@ -331,7 +331,7 @@ static int attribute_domain_priority(const AttributeDomain domain)
|
||||
case ATTR_DOMAIN_CURVE:
|
||||
return 0;
|
||||
#endif
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return 1;
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
return 2;
|
||||
|
@ -175,7 +175,7 @@ int MeshComponent::attribute_domain_size(const AttributeDomain domain) const
|
||||
return mesh_->totvert;
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
return mesh_->totedge;
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return mesh_->totpoly;
|
||||
default:
|
||||
break;
|
||||
@ -259,9 +259,9 @@ static ReadAttributePtr adapt_mesh_domain_point_to_corner(const Mesh &mesh,
|
||||
* only some values are required.
|
||||
*/
|
||||
template<typename T>
|
||||
static void adapt_mesh_domain_corner_to_polygon_impl(const Mesh &mesh,
|
||||
Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
static void adapt_mesh_domain_corner_to_face_impl(const Mesh &mesh,
|
||||
Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totpoly);
|
||||
attribute_math::DefaultMixer<T> mixer(r_values);
|
||||
@ -277,8 +277,8 @@ static void adapt_mesh_domain_corner_to_polygon_impl(const Mesh &mesh,
|
||||
mixer.finalize();
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_corner_to_polygon(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_corner_to_face(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -286,7 +286,7 @@ static ReadAttributePtr adapt_mesh_domain_corner_to_polygon(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totpoly);
|
||||
adapt_mesh_domain_corner_to_polygon_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_corner_to_face_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -336,9 +336,9 @@ static ReadAttributePtr adapt_mesh_domain_corner_to_edge(const Mesh &mesh,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void adapt_mesh_domain_polygon_to_point_impl(const Mesh &mesh,
|
||||
Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
void adapt_mesh_domain_face_to_point_impl(const Mesh &mesh,
|
||||
Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totvert);
|
||||
attribute_math::DefaultMixer<T> mixer(r_values);
|
||||
@ -356,8 +356,8 @@ void adapt_mesh_domain_polygon_to_point_impl(const Mesh &mesh,
|
||||
mixer.finalize();
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_face_to_point(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -365,7 +365,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totvert);
|
||||
adapt_mesh_domain_polygon_to_point_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_face_to_point_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -374,9 +374,9 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void adapt_mesh_domain_polygon_to_corner_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
void adapt_mesh_domain_face_to_corner_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totloop);
|
||||
|
||||
@ -387,8 +387,8 @@ void adapt_mesh_domain_polygon_to_corner_impl(const Mesh &mesh,
|
||||
}
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_face_to_corner(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -396,7 +396,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totloop);
|
||||
adapt_mesh_domain_polygon_to_corner_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_face_to_corner_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -405,9 +405,9 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void adapt_mesh_domain_polygon_to_edge_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
void adapt_mesh_domain_face_to_edge_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totedge);
|
||||
attribute_math::DefaultMixer<T> mixer(r_values);
|
||||
@ -423,8 +423,8 @@ void adapt_mesh_domain_polygon_to_edge_impl(const Mesh &mesh,
|
||||
mixer.finalize();
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_polygon_to_edge(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_face_to_edge(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -432,7 +432,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_edge(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totedge);
|
||||
adapt_mesh_domain_polygon_to_edge_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_face_to_edge_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -446,9 +446,9 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_edge(const Mesh &mesh,
|
||||
* only some values are required.
|
||||
*/
|
||||
template<typename T>
|
||||
static void adapt_mesh_domain_point_to_polygon_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
static void adapt_mesh_domain_point_to_face_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totpoly);
|
||||
attribute_math::DefaultMixer<T> mixer(r_values);
|
||||
@ -464,8 +464,8 @@ static void adapt_mesh_domain_point_to_polygon_impl(const Mesh &mesh,
|
||||
mixer.finalize();
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_point_to_polygon(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_point_to_face(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -473,7 +473,7 @@ static ReadAttributePtr adapt_mesh_domain_point_to_polygon(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totpoly);
|
||||
adapt_mesh_domain_point_to_polygon_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_point_to_face_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -531,7 +531,7 @@ void adapt_mesh_domain_edge_to_corner_impl(const Mesh &mesh,
|
||||
for (const int poly_index : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly = mesh.mpoly[poly_index];
|
||||
|
||||
/* For every corner, mix the values from the adjacent edges on the polygon. */
|
||||
/* For every corner, mix the values from the adjacent edges on the face. */
|
||||
for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
|
||||
const int loop_index_prev = (loop_index - 1) % poly.totloop;
|
||||
const MLoop &loop = mesh.mloop[loop_index];
|
||||
@ -602,9 +602,9 @@ static ReadAttributePtr adapt_mesh_domain_edge_to_point(const Mesh &mesh,
|
||||
* only some values are required.
|
||||
*/
|
||||
template<typename T>
|
||||
static void adapt_mesh_domain_edge_to_polygon_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
static void adapt_mesh_domain_edge_to_face_impl(const Mesh &mesh,
|
||||
const Span<T> old_values,
|
||||
MutableSpan<T> r_values)
|
||||
{
|
||||
BLI_assert(r_values.size() == mesh.totpoly);
|
||||
attribute_math::DefaultMixer<T> mixer(r_values);
|
||||
@ -620,8 +620,8 @@ static void adapt_mesh_domain_edge_to_polygon_impl(const Mesh &mesh,
|
||||
mixer.finalize();
|
||||
}
|
||||
|
||||
static ReadAttributePtr adapt_mesh_domain_edge_to_polygon(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
static ReadAttributePtr adapt_mesh_domain_edge_to_face(const Mesh &mesh,
|
||||
ReadAttributePtr attribute)
|
||||
{
|
||||
ReadAttributePtr new_attribute;
|
||||
const CustomDataType data_type = attribute->custom_data_type();
|
||||
@ -629,7 +629,7 @@ static ReadAttributePtr adapt_mesh_domain_edge_to_polygon(const Mesh &mesh,
|
||||
using T = decltype(dummy);
|
||||
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
|
||||
Array<T> values(mesh.totpoly);
|
||||
adapt_mesh_domain_edge_to_polygon_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
adapt_mesh_domain_edge_to_face_impl<T>(mesh, attribute->get_span<T>(), values);
|
||||
new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
|
||||
std::move(values));
|
||||
}
|
||||
@ -658,8 +658,8 @@ ReadAttributePtr MeshComponent::attribute_try_adapt_domain(ReadAttributePtr attr
|
||||
switch (new_domain) {
|
||||
case ATTR_DOMAIN_POINT:
|
||||
return blender::bke::adapt_mesh_domain_corner_to_point(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
return blender::bke::adapt_mesh_domain_corner_to_polygon(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return blender::bke::adapt_mesh_domain_corner_to_face(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
return blender::bke::adapt_mesh_domain_corner_to_edge(*mesh_, std::move(attribute));
|
||||
default:
|
||||
@ -671,8 +671,8 @@ ReadAttributePtr MeshComponent::attribute_try_adapt_domain(ReadAttributePtr attr
|
||||
switch (new_domain) {
|
||||
case ATTR_DOMAIN_CORNER:
|
||||
return blender::bke::adapt_mesh_domain_point_to_corner(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
return blender::bke::adapt_mesh_domain_point_to_polygon(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return blender::bke::adapt_mesh_domain_point_to_face(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
return blender::bke::adapt_mesh_domain_point_to_edge(*mesh_, std::move(attribute));
|
||||
default:
|
||||
@ -680,14 +680,14 @@ ReadAttributePtr MeshComponent::attribute_try_adapt_domain(ReadAttributePtr attr
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ATTR_DOMAIN_POLYGON: {
|
||||
case ATTR_DOMAIN_FACE: {
|
||||
switch (new_domain) {
|
||||
case ATTR_DOMAIN_POINT:
|
||||
return blender::bke::adapt_mesh_domain_polygon_to_point(*mesh_, std::move(attribute));
|
||||
return blender::bke::adapt_mesh_domain_face_to_point(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_CORNER:
|
||||
return blender::bke::adapt_mesh_domain_polygon_to_corner(*mesh_, std::move(attribute));
|
||||
return blender::bke::adapt_mesh_domain_face_to_corner(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
return blender::bke::adapt_mesh_domain_polygon_to_edge(*mesh_, std::move(attribute));
|
||||
return blender::bke::adapt_mesh_domain_face_to_edge(*mesh_, std::move(attribute));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -699,8 +699,8 @@ ReadAttributePtr MeshComponent::attribute_try_adapt_domain(ReadAttributePtr attr
|
||||
return blender::bke::adapt_mesh_domain_edge_to_corner(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_POINT:
|
||||
return blender::bke::adapt_mesh_domain_edge_to_point(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
return blender::bke::adapt_mesh_domain_edge_to_polygon(*mesh_, std::move(attribute));
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return blender::bke::adapt_mesh_domain_edge_to_face(*mesh_, std::move(attribute));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -774,14 +774,14 @@ static void set_material_index(MPoly &mpoly, const int &index)
|
||||
static ReadAttributePtr make_material_index_read_attribute(const void *data, const int domain_size)
|
||||
{
|
||||
return std::make_unique<DerivedArrayReadAttribute<MPoly, int, get_material_index>>(
|
||||
ATTR_DOMAIN_POLYGON, Span<MPoly>((const MPoly *)data, domain_size));
|
||||
ATTR_DOMAIN_FACE, Span<MPoly>((const MPoly *)data, domain_size));
|
||||
}
|
||||
|
||||
static WriteAttributePtr make_material_index_write_attribute(void *data, const int domain_size)
|
||||
{
|
||||
return std::make_unique<
|
||||
DerivedArrayWriteAttribute<MPoly, int, get_material_index, set_material_index>>(
|
||||
ATTR_DOMAIN_POLYGON, MutableSpan<MPoly>((MPoly *)data, domain_size));
|
||||
ATTR_DOMAIN_FACE, MutableSpan<MPoly>((MPoly *)data, domain_size));
|
||||
}
|
||||
|
||||
static bool get_shade_smooth(const MPoly &mpoly)
|
||||
@ -797,14 +797,14 @@ static void set_shade_smooth(MPoly &mpoly, const bool &value)
|
||||
static ReadAttributePtr make_shade_smooth_read_attribute(const void *data, const int domain_size)
|
||||
{
|
||||
return std::make_unique<DerivedArrayReadAttribute<MPoly, bool, get_shade_smooth>>(
|
||||
ATTR_DOMAIN_POLYGON, Span<MPoly>((const MPoly *)data, domain_size));
|
||||
ATTR_DOMAIN_FACE, Span<MPoly>((const MPoly *)data, domain_size));
|
||||
}
|
||||
|
||||
static WriteAttributePtr make_shade_smooth_write_attribute(void *data, const int domain_size)
|
||||
{
|
||||
return std::make_unique<
|
||||
DerivedArrayWriteAttribute<MPoly, bool, get_shade_smooth, set_shade_smooth>>(
|
||||
ATTR_DOMAIN_POLYGON, MutableSpan<MPoly>((MPoly *)data, domain_size));
|
||||
ATTR_DOMAIN_FACE, MutableSpan<MPoly>((MPoly *)data, domain_size));
|
||||
}
|
||||
|
||||
static float2 get_loop_uv(const MLoopUV &uv)
|
||||
@ -1045,7 +1045,7 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider {
|
||||
public:
|
||||
NormalAttributeProvider()
|
||||
: BuiltinAttributeProvider(
|
||||
"normal", ATTR_DOMAIN_POLYGON, CD_PROP_FLOAT3, NonCreatable, Readonly, NonDeletable)
|
||||
"normal", ATTR_DOMAIN_FACE, CD_PROP_FLOAT3, NonCreatable, Readonly, NonDeletable)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1063,7 +1063,7 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider {
|
||||
const void *data = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
|
||||
|
||||
return std::make_unique<ArrayReadAttribute<float3>>(
|
||||
ATTR_DOMAIN_POLYGON, Span<float3>((const float3 *)data, mesh->totpoly));
|
||||
ATTR_DOMAIN_FACE, Span<float3>((const float3 *)data, mesh->totpoly));
|
||||
}
|
||||
|
||||
Array<float3> normals(mesh->totpoly);
|
||||
@ -1072,8 +1072,7 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider {
|
||||
BKE_mesh_calc_poly_normal(poly, &mesh->mloop[poly->loopstart], mesh->mvert, normals[i]);
|
||||
}
|
||||
|
||||
return std::make_unique<OwnedArrayReadAttribute<float3>>(ATTR_DOMAIN_POLYGON,
|
||||
std::move(normals));
|
||||
return std::make_unique<OwnedArrayReadAttribute<float3>>(ATTR_DOMAIN_FACE, std::move(normals));
|
||||
}
|
||||
|
||||
WriteAttributePtr try_get_for_write(GeometryComponent &UNUSED(component)) const final
|
||||
@ -1093,7 +1092,7 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider {
|
||||
|
||||
bool exists(const GeometryComponent &component) const final
|
||||
{
|
||||
return component.attribute_domain_size(ATTR_DOMAIN_POLYGON) != 0;
|
||||
return component.attribute_domain_size(ATTR_DOMAIN_FACE) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1130,9 +1129,9 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static CustomDataAccessInfo edge_access = {MAKE_MUTABLE_CUSTOM_DATA_GETTER(edata),
|
||||
MAKE_CONST_CUSTOM_DATA_GETTER(edata),
|
||||
update_custom_data_pointers};
|
||||
static CustomDataAccessInfo polygon_access = {MAKE_MUTABLE_CUSTOM_DATA_GETTER(pdata),
|
||||
MAKE_CONST_CUSTOM_DATA_GETTER(pdata),
|
||||
update_custom_data_pointers};
|
||||
static CustomDataAccessInfo face_access = {MAKE_MUTABLE_CUSTOM_DATA_GETTER(pdata),
|
||||
MAKE_CONST_CUSTOM_DATA_GETTER(pdata),
|
||||
update_custom_data_pointers};
|
||||
|
||||
#undef MAKE_CONST_CUSTOM_DATA_GETTER
|
||||
#undef MAKE_MUTABLE_CUSTOM_DATA_GETTER
|
||||
@ -1152,25 +1151,25 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static NormalAttributeProvider normal;
|
||||
|
||||
static BuiltinCustomDataLayerProvider material_index("material_index",
|
||||
ATTR_DOMAIN_POLYGON,
|
||||
ATTR_DOMAIN_FACE,
|
||||
CD_PROP_INT32,
|
||||
CD_MPOLY,
|
||||
BuiltinAttributeProvider::NonCreatable,
|
||||
BuiltinAttributeProvider::Writable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
polygon_access,
|
||||
face_access,
|
||||
make_material_index_read_attribute,
|
||||
make_material_index_write_attribute,
|
||||
nullptr);
|
||||
|
||||
static BuiltinCustomDataLayerProvider shade_smooth("shade_smooth",
|
||||
ATTR_DOMAIN_POLYGON,
|
||||
ATTR_DOMAIN_FACE,
|
||||
CD_PROP_BOOL,
|
||||
CD_MPOLY,
|
||||
BuiltinAttributeProvider::NonCreatable,
|
||||
BuiltinAttributeProvider::Writable,
|
||||
BuiltinAttributeProvider::NonDeletable,
|
||||
polygon_access,
|
||||
face_access,
|
||||
make_shade_smooth_read_attribute,
|
||||
make_shade_smooth_write_attribute,
|
||||
nullptr);
|
||||
@ -1205,7 +1204,7 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access);
|
||||
static CustomDataAttributeProvider point_custom_data(ATTR_DOMAIN_POINT, point_access);
|
||||
static CustomDataAttributeProvider edge_custom_data(ATTR_DOMAIN_EDGE, edge_access);
|
||||
static CustomDataAttributeProvider polygon_custom_data(ATTR_DOMAIN_POLYGON, polygon_access);
|
||||
static CustomDataAttributeProvider face_custom_data(ATTR_DOMAIN_FACE, face_access);
|
||||
|
||||
return ComponentAttributeProviders({&position, &material_index, &shade_smooth, &normal, &crease},
|
||||
{&uvs,
|
||||
@ -1214,7 +1213,7 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
|
||||
&vertex_groups,
|
||||
&point_custom_data,
|
||||
&edge_custom_data,
|
||||
&polygon_custom_data});
|
||||
&face_custom_data});
|
||||
}
|
||||
|
||||
} // namespace blender::bke
|
||||
|
@ -275,9 +275,9 @@ static void get_selected_corner_indices(const Mesh &mesh,
|
||||
}
|
||||
}
|
||||
|
||||
static void get_selected_polygon_indices(const Mesh &mesh,
|
||||
const IsVertexSelectedFn is_vertex_selected_fn,
|
||||
Vector<int64_t> &r_polygon_indices)
|
||||
static void get_selected_face_indices(const Mesh &mesh,
|
||||
const IsVertexSelectedFn is_vertex_selected_fn,
|
||||
Vector<int64_t> &r_face_indices)
|
||||
{
|
||||
for (const int poly_index : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly = mesh.mpoly[poly_index];
|
||||
@ -290,7 +290,7 @@ static void get_selected_polygon_indices(const Mesh &mesh,
|
||||
}
|
||||
}
|
||||
if (is_selected) {
|
||||
r_polygon_indices.append(poly_index);
|
||||
r_face_indices.append(poly_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,8 +315,8 @@ static void get_selected_indices_on_domain(const Mesh &mesh,
|
||||
switch (domain) {
|
||||
case ATTR_DOMAIN_POINT:
|
||||
return get_selected_vertex_indices(mesh, is_vertex_selected_fn, r_indices);
|
||||
case ATTR_DOMAIN_POLYGON:
|
||||
return get_selected_polygon_indices(mesh, is_vertex_selected_fn, r_indices);
|
||||
case ATTR_DOMAIN_FACE:
|
||||
return get_selected_face_indices(mesh, is_vertex_selected_fn, r_indices);
|
||||
case ATTR_DOMAIN_CORNER:
|
||||
return get_selected_corner_indices(mesh, is_vertex_selected_fn, r_indices);
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
|
@ -54,8 +54,8 @@ const EnumPropertyItem rna_enum_attribute_domain_items[] = {
|
||||
// {ATTR_DOMAIN_GEOMETRY, "GEOMETRY", 0, "Geometry", "Attribute on (whole) geometry"},
|
||||
{ATTR_DOMAIN_POINT, "POINT", 0, "Point", "Attribute on point"},
|
||||
{ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"},
|
||||
{ATTR_DOMAIN_CORNER, "CORNER", 0, "Corner", "Attribute on mesh polygon corner"},
|
||||
{ATTR_DOMAIN_POLYGON, "POLYGON", 0, "Polygon", "Attribute on mesh polygons"},
|
||||
{ATTR_DOMAIN_CORNER, "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
|
||||
{ATTR_DOMAIN_FACE, "FACE", 0, "Face", "Attribute on mesh faces"},
|
||||
/* Not implement yet */
|
||||
// {ATTR_DOMAIN_GRIDS, "GRIDS", 0, "Grids", "Attribute on mesh multires grids"},
|
||||
{ATTR_DOMAIN_CURVE, "CURVE", 0, "Curve", "Attribute on hair curve"},
|
||||
@ -66,8 +66,8 @@ const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[] = {
|
||||
{ATTR_DOMAIN_AUTO, "AUTO", 0, "Auto", ""},
|
||||
{ATTR_DOMAIN_POINT, "POINT", 0, "Point", "Attribute on point"},
|
||||
{ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"},
|
||||
{ATTR_DOMAIN_CORNER, "CORNER", 0, "Corner", "Attribute on mesh polygon corner"},
|
||||
{ATTR_DOMAIN_POLYGON, "POLYGON", 0, "Polygon", "Attribute on mesh polygons"},
|
||||
{ATTR_DOMAIN_CORNER, "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
|
||||
{ATTR_DOMAIN_FACE, "FACE", 0, "Face", "Attribute on mesh faces"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -3080,7 +3080,7 @@ const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *C,
|
||||
ATTR_DOMAIN_CORNER,
|
||||
ATTR_DOMAIN_EDGE,
|
||||
ATTR_DOMAIN_POINT,
|
||||
ATTR_DOMAIN_POLYGON)) {
|
||||
ATTR_DOMAIN_FACE)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -7319,7 +7319,7 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna)
|
||||
"MESH",
|
||||
ICON_MESH_DATA,
|
||||
"Mesh",
|
||||
"Mesh component containing point, corner, edge and polygon data"},
|
||||
"Mesh component containing point, corner, edge and face data"},
|
||||
{GEO_COMPONENT_TYPE_POINT_CLOUD,
|
||||
"POINTCLOUD",
|
||||
ICON_POINTCLOUD_DATA,
|
||||
|
@ -310,10 +310,10 @@ BLI_NOINLINE static void interpolate_attribute_corner(const Mesh &mesh,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
BLI_NOINLINE static void interpolate_attribute_polygon(const Mesh &mesh,
|
||||
const Span<int> looptri_indices,
|
||||
const Span<T> data_in,
|
||||
MutableSpan<T> data_out)
|
||||
BLI_NOINLINE static void interpolate_attribute_face(const Mesh &mesh,
|
||||
const Span<int> looptri_indices,
|
||||
const Span<T> data_in,
|
||||
MutableSpan<T> data_out)
|
||||
{
|
||||
BLI_assert(data_in.size() == mesh.totpoly);
|
||||
Span<MLoopTri> looptris = get_mesh_looptris(mesh);
|
||||
@ -344,8 +344,8 @@ BLI_NOINLINE static void interpolate_attribute(const Mesh &mesh,
|
||||
mesh, bary_coords, looptri_indices, source_span, output_span);
|
||||
break;
|
||||
}
|
||||
case ATTR_DOMAIN_POLYGON: {
|
||||
interpolate_attribute_polygon<T>(mesh, looptri_indices, source_span, output_span);
|
||||
case ATTR_DOMAIN_FACE: {
|
||||
interpolate_attribute_face<T>(mesh, looptri_indices, source_span, output_span);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
Loading…
Reference in New Issue
Block a user