Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_component_mesh.cc
| Show First 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) { | ||||
| if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) { | if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) { | ||||
| BKE_mesh_calc_normals(const_cast<Mesh *>(mesh)); | BKE_mesh_calc_normals(const_cast<Mesh *>(mesh)); | ||||
| } | } | ||||
| BLI_mutex_unlock(mesh_eval_mutex); | BLI_mutex_unlock(mesh_eval_mutex); | ||||
| } | } | ||||
| } | } | ||||
| static bool get_shade_smooth(const MPoly &mpoly) | |||||
| { | |||||
| return mpoly.flag & ME_SMOOTH; | |||||
| } | |||||
| static void set_shade_smooth(MPoly &mpoly, const bool &value) | |||||
| { | |||||
| SET_FLAG_FROM_TEST(mpoly.flag, value, ME_SMOOTH); | |||||
| } | |||||
| 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)); | |||||
| } | |||||
| 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)); | |||||
| } | |||||
| static float2 get_loop_uv(const MLoopUV &uv) | static float2 get_loop_uv(const MLoopUV &uv) | ||||
| { | { | ||||
| return float2(uv.uv); | return float2(uv.uv); | ||||
| } | } | ||||
| static void set_loop_uv(MLoopUV &uv, const float2 &co) | static void set_loop_uv(MLoopUV &uv, const float2 &co) | ||||
| { | { | ||||
| copy_v2_v2(uv.uv, co); | copy_v2_v2(uv.uv, co); | ||||
| ▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | static BuiltinCustomDataLayerProvider material_index("material_index", | ||||
| BuiltinAttributeProvider::Writable, | BuiltinAttributeProvider::Writable, | ||||
| BuiltinAttributeProvider::NonDeletable, | BuiltinAttributeProvider::NonDeletable, | ||||
| polygon_access, | polygon_access, | ||||
| make_material_index_read_attribute, | make_material_index_read_attribute, | ||||
| make_material_index_write_attribute, | make_material_index_write_attribute, | ||||
| nullptr, | nullptr, | ||||
| nullptr); | nullptr); | ||||
| static BuiltinCustomDataLayerProvider shade_smooth("shade_smooth", | |||||
| ATTR_DOMAIN_POLYGON, | |||||
| CD_PROP_BOOL, | |||||
| CD_MPOLY, | |||||
| BuiltinAttributeProvider::NonCreatable, | |||||
| BuiltinAttributeProvider::Writable, | |||||
| BuiltinAttributeProvider::NonDeletable, | |||||
| polygon_access, | |||||
| make_shade_smooth_read_attribute, | |||||
| make_shade_smooth_write_attribute, | |||||
| nullptr, | |||||
| nullptr); | |||||
| static BuiltinCustomDataLayerProvider vertex_normal("vertex_normal", | static BuiltinCustomDataLayerProvider vertex_normal("vertex_normal", | ||||
| ATTR_DOMAIN_POINT, | ATTR_DOMAIN_POINT, | ||||
| CD_PROP_FLOAT3, | CD_PROP_FLOAT3, | ||||
| CD_MVERT, | CD_MVERT, | ||||
| BuiltinAttributeProvider::NonCreatable, | BuiltinAttributeProvider::NonCreatable, | ||||
| BuiltinAttributeProvider::Readonly, | BuiltinAttributeProvider::Readonly, | ||||
| BuiltinAttributeProvider::NonDeletable, | BuiltinAttributeProvider::NonDeletable, | ||||
| point_access, | point_access, | ||||
| Show All 17 Lines | static NamedLegacyCustomDataProvider vertex_colors(ATTR_DOMAIN_CORNER, | ||||
| make_vertex_color_write_attribute); | make_vertex_color_write_attribute); | ||||
| static VertexGroupsAttributeProvider vertex_groups; | static VertexGroupsAttributeProvider vertex_groups; | ||||
| static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access); | static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access); | ||||
| static CustomDataAttributeProvider point_custom_data(ATTR_DOMAIN_POINT, point_access); | static CustomDataAttributeProvider point_custom_data(ATTR_DOMAIN_POINT, point_access); | ||||
| static CustomDataAttributeProvider edge_custom_data(ATTR_DOMAIN_EDGE, edge_access); | static CustomDataAttributeProvider edge_custom_data(ATTR_DOMAIN_EDGE, edge_access); | ||||
| static CustomDataAttributeProvider polygon_custom_data(ATTR_DOMAIN_POLYGON, polygon_access); | static CustomDataAttributeProvider polygon_custom_data(ATTR_DOMAIN_POLYGON, polygon_access); | ||||
| return ComponentAttributeProviders({&position, &material_index, &vertex_normal}, | return ComponentAttributeProviders({&position, &material_index, &vertex_normal, &shade_smooth}, | ||||
| {&uvs, | {&uvs, | ||||
| &vertex_colors, | &vertex_colors, | ||||
| &corner_custom_data, | &corner_custom_data, | ||||
| &vertex_groups, | &vertex_groups, | ||||
| &point_custom_data, | &point_custom_data, | ||||
| &edge_custom_data, | &edge_custom_data, | ||||
| &polygon_custom_data}); | &polygon_custom_data}); | ||||
| } | } | ||||
| Show All 11 Lines | |||||