28#include "RNA_prototypes.hh"
138 float fac = 0.0f, dfac = 1.0f / float(
len);
140 dfac *= float(
M_PI) * 2.0f;
142 for (
int i = 0; i <
len; i++) {
143 fuv[i][0] = 0.5f *
sinf(fac) + 0.5f;
144 fuv[i][1] = 0.5f *
cosf(fac) + 0.5f;
169 for (
int i = 0; i < face.
size(); i++) {
170 fuv[i] = mloopuv[face[i]];
234 bool is_init =
false;
246 if (layernum_dst && do_init) {
252 if (active_set || layernum_dst == 0) {
279 if (active_set || layernum_dst == 0) {
285 if (!is_init && do_init) {
298 return static_cast<const bool *
>(
370 if (layernum_dst == 0) {
376 if (layernum_dst == 0) {
435 bke::AttrDomain::Corner,
455 ID *
data = (ob) ?
static_cast<ID *
>(ob->
data) :
nullptr;
502 ot->
idname =
"MESH_OT_uv_texture_add";
539 ot->
name =
"Remove UV Map";
541 ot->
idname =
"MESH_OT_uv_texture_remove";
623 ot->
name =
"Clear Sculpt Mask Data";
624 ot->
idname =
"MESH_OT_customdata_mask_clear";
625 ot->
description =
"Clear vertex sculpt masking data from the mesh";
674 ot->
name =
"Add Skin Data";
675 ot->
idname =
"MESH_OT_customdata_skin_add";
699 ot->
name =
"Clear Skin Data";
700 ot->
idname =
"MESH_OT_customdata_skin_clear";
726 if (!
mesh->attributes_for_write().add<
short2>(
742 ot->
name =
"Add Custom Split Normals Data";
743 ot->
idname =
"MESH_OT_customdata_custom_splitnormals_add";
744 ot->
description =
"Add a custom split normals layer, if none exists yet";
770 if (!
mesh->attributes_for_write().remove(
"custom_normal")) {
775 mesh->tag_custom_normals_changed();
785 ot->
name =
"Clear Custom Split Normals Data";
786 ot->
idname =
"MESH_OT_customdata_custom_splitnormals_clear";
787 ot->
description =
"Remove the custom split normals layer, if it exists";
823 ".select_vert", bke::AttrDomain::Point);
824 select_vert.
span.take_back(
len).fill(
true);
859 ".select_edge", bke::AttrDomain::Edge);
860 select_edge.
span.take_back(
len).fill(
true);
935 ".select_poly", bke::AttrDomain::Face);
936 select_poly.
span.take_back(
len).fill(
true);
1098 const char *elem_type;
1101 elem_type =
"vertices";
1104 elem_type =
"edges";
1107 elem_type =
"faces";
1134 if (
mesh !=
nullptr) {
1139 if (ob ==
nullptr) {
1154 const OffsetIndices polys =
mesh->faces();
1158 "sharp_edge", bke::AttrDomain::Edge,
false);
1160 bke::AttrDomain::Face);
1165 threading::parallel_for(polys.index_range(), 1024, [&](
const IndexRange range) {
1166 for (const int face_i : range) {
1167 if (!sharp_faces.is_empty() && sharp_faces[face_i]) {
1168 for (const int edge : corner_edges.slice(polys[face_i])) {
1169 sharp_edges[edge] = true;
1175 IndexMaskMemory memory;
1176 const IndexMask split_mask = IndexMask::from_bools(sharp_edges, memory);
1177 if (split_mask.is_empty()) {
1181 geometry::split_edges(*
mesh, split_mask, {});
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< blender::StringRef > name)
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, blender::StringRef name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
blender::StringRef BKE_uv_map_pin_name_get(blender::StringRef uv_map_name, char *buffer)
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner, blender::StringRef name)
bool BKE_attribute_remove(AttributeOwner &owner, blender::StringRef name, struct ReportList *reports)
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
blender::StringRef BKE_uv_map_edge_select_name_get(blender::StringRef uv_map_name, char *buffer)
bool BKE_color_attribute_supported(const struct Mesh &mesh, blender::StringRef name)
blender::StringRef BKE_uv_map_vert_select_name_get(blender::StringRef uv_map_name, char *buffer)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Scene * CTX_data_scene(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, blender::StringRef name, int totelem)
int CustomData_get_named_layer(const CustomData *data, eCustomDataType type, blender::StringRef name)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_n_offset(const CustomData *data, eCustomDataType type, int n)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_add_layer_named(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, blender::StringRef name)
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
const char * CustomData_get_layer_name(const CustomData *data, eCustomDataType type, int n)
void CustomData_free(CustomData *data)
void CustomData_free_layers(CustomData *data, eCustomDataType type)
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
int CustomData_get_active_layer(const CustomData *data, eCustomDataType type)
void CustomData_free_elem(CustomData *data, int index, int count)
void CustomData_copy_data(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
size_t CustomData_get_elem_size(const CustomDataLayer *layer)
void CustomData_ensure_layers_are_mutable(CustomData *data, int totelem)
bool CustomData_layertype_is_singleton(eCustomDataType type)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
const void * CustomData_add_layer_named_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, blender::StringRef name, const blender::ImplicitSharingInfo *sharing_info)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
void CustomData_set_layer_active(CustomData *data, eCustomDataType type, int n)
void * CustomData_get_layer_n_for_write(CustomData *data, eCustomDataType type, int n, int totelem)
const CustomData_MeshMasks CD_MASK_MESH
KeyBlock * BKE_keyblock_find_by_index(Key *key, int index)
void BKE_mesh_tessface_clear(Mesh *mesh)
void BKE_mesh_ensure_skin_customdata(Mesh *mesh)
bool BKE_mesh_has_custom_loop_normals(Mesh *mesh)
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_runtime_clear_cache(Mesh *mesh)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void DEG_id_tag_update(ID *id, unsigned int flags)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define MAX_CUSTOMDATA_LAYER_NAME
Object is a sort of wrapper for general info.
bool ED_paint_proj_mesh_data_check(Scene &scene, Object &ob, bool *r_has_uvs, bool *r_has_mat, bool *r_has_tex, bool *r_has_stencil)
bool ED_operator_editable_mesh(bContext *C)
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
bool BM_data_layer_free_named(BMesh *bm, CustomData *data, StringRef name)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_uv_map_attr_select_and_pin_ensure(BMesh *bm)
void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
void BM_data_layer_ensure_named(BMesh *bm, CustomData *data, int type, const StringRef name)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static AttributeOwner from_id(ID *id)
constexpr int64_t size() const
void materialize(MutableSpan< T > r_span) const
GAttributeReader lookup(const StringRef attribute_id) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
IndexRange index_range() const
void * MEM_dupallocN(const void *vmemh)
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
void ED_mesh_uv_ensure(Mesh *mesh, const char *name)
bool * ED_mesh_uv_map_vert_select_layer_ensure(Mesh *mesh, const int uv_index)
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
static bool layers_poll(bContext *C)
const bool * ED_mesh_uv_map_edge_select_layer_get(const Mesh *mesh, const int uv_index)
static void mesh_uv_reset_bmface(BMFace *f, const int cd_loop_uv_offset)
static void mesh_remove_loops(Mesh *mesh, int len)
void ED_mesh_report_mirror_ex(wmOperator *op, int totmirr, int totfail, char selectmode)
bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
void MESH_OT_customdata_skin_add(wmOperatorType *ot)
const bool * ED_mesh_uv_map_vert_select_layer_get(const Mesh *mesh, const int uv_index)
static wmOperatorStatus mesh_customdata_mask_clear_exec(bContext *C, wmOperator *op)
static wmOperatorStatus mesh_uv_texture_add_exec(bContext *C, wmOperator *op)
static const bool * mesh_loop_boolean_custom_data_get_by_name(const Mesh &mesh, const StringRef name)
static wmOperatorStatus mesh_customdata_skin_clear_exec(bContext *C, wmOperator *)
bool * ED_mesh_uv_map_edge_select_layer_ensure(Mesh *mesh, const int uv_index)
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
static bool uv_texture_remove_poll(bContext *C)
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
static bool * ensure_corner_boolean_attribute(Mesh &mesh, const StringRef name)
void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
void ED_mesh_verts_add(Mesh *mesh, ReportList *reports, int count)
void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
static void mesh_remove_faces(Mesh *mesh, int len)
void ED_mesh_geometry_clear(Mesh *mesh)
static void mesh_add_edges(Mesh *mesh, int len)
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
int ED_mesh_uv_add(Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
static bool mesh_customdata_skin_add_poll(bContext *C)
static wmOperatorStatus mesh_customdata_skin_add_exec(bContext *C, wmOperator *)
static CustomData * mesh_customdata_get_type(Mesh *mesh, const char htype, int *r_tot)
static void mesh_uv_reset_mface(const blender::IndexRange face, float2 *mloopuv)
void ED_mesh_loops_remove(Mesh *mesh, ReportList *reports, int count)
static wmOperatorStatus mesh_uv_texture_remove_exec(bContext *C, wmOperator *op)
static void mesh_add_faces(Mesh *mesh, int len)
void ED_mesh_uv_loop_reset_ex(Mesh *mesh, const int layernum)
bool * ED_mesh_uv_map_pin_layer_ensure(Mesh *mesh, const int uv_index)
void ED_mesh_uv_loop_reset(bContext *C, Mesh *mesh)
static int mesh_customdata_skin_state(bContext *C)
static wmOperatorStatus mesh_customdata_clear_exec__internal(bContext *C, char htype, const eCustomDataType type)
int ED_mesh_color_add(Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
void ED_mesh_split_faces(Mesh *mesh)
static void mesh_remove_verts(Mesh *mesh, int len)
static void mesh_add_verts(Mesh *mesh, int len)
void MESH_OT_uv_texture_add(wmOperatorType *ot)
static void mesh_add_loops(Mesh *mesh, int len)
static bool mesh_customdata_mask_clear_poll(bContext *C)
static wmOperatorStatus mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperator *)
static void mesh_remove_edges(Mesh *mesh, int len)
KeyBlock * ED_mesh_get_edit_shape_key(const Mesh *me)
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
static bool mesh_customdata_skin_clear_poll(bContext *C)
void ED_mesh_verts_remove(Mesh *mesh, ReportList *reports, int count)
static void mesh_uv_reset_array(float **fuv, const int len)
const bool * ED_mesh_uv_map_pin_layer_get(const Mesh *mesh, const int uv_index)
static wmOperatorStatus mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator *)
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
Mesh * ED_mesh_context(bContext *C)
Object * context_object(const bContext *C)
Object * context_active_object(const bContext *C)
static void unique_name(bNode *node)
struct MLoopNorSpaceArray * lnor_spacearr
MeshRuntimeHandle * runtime
int * face_offset_indices
char * active_color_attribute
MutableVArraySpan< T > span
wmOperatorStatus(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)