32 #include "RNA_prototypes.h"
106 #define GET_CD_DATA(me, data) ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)
111 int layer_index, tot, n;
123 n = (layer - &
data->layers[layer_index]);
162 float fac = 0.0f, dfac = 1.0f / (
float)
len;
166 for (
int i = 0; i <
len; i++) {
167 fuv[i][0] = 0.5f *
sinf(fac) + 0.5f;
168 fuv[i][1] = 0.5f *
cosf(fac) + 0.5f;
193 for (
int i = 0; i < mp->
totloop; i++) {
226 for (
int i = 0; i < me->
totpoly; i++) {
245 Mesh *me,
const char *name,
const bool active_set,
const bool do_init,
ReportList *reports)
252 bool is_init =
false;
266 if (layernum_dst && do_init) {
272 if (active_set || layernum_dst == 0) {
292 if (active_set || layernum_dst == 0) {
300 if (!is_init && do_init) {
319 if (layernum_dst == 0) {
325 if (layernum_dst == 0) {
338 cdlu = (index == -1) ?
nullptr : &ldata->
layers[index];
373 const bool active_set,
390 if (layernum && do_init) {
394 if (active_set || layernum == 0) {
410 if (active_set || layernum == 0) {
439 return (layer !=
nullptr);
449 cdl = (index == -1) ?
nullptr : &ldata->
layers[index];
485 ID *
data = (ob) ?
static_cast<ID *
>(ob->
data) :
nullptr;
511 const bool active_set,
528 if (layernum && do_init) {
532 if (active_set || layernum == 0) {
550 if (active_set || layernum == 0) {
584 cdl = (index == -1) ?
nullptr : &vdata->
layers[index];
657 ot->
idname =
"MESH_OT_uv_texture_add";
688 ot->
name =
"Remove UV Map";
690 ot->
idname =
"MESH_OT_uv_texture_remove";
734 ot->
name =
"Add Vertex Color";
736 ot->
idname =
"MESH_OT_vertex_color_add";
761 ot->
name =
"Remove Vertex Color";
763 ot->
idname =
"MESH_OT_vertex_color_remove";
790 ot->
name =
"Add Sculpt Vertex Color";
792 ot->
idname =
"MESH_OT_sculpt_vertex_color_add";
817 ot->
name =
"Remove Sculpt Vertex Color";
819 ot->
idname =
"MESH_OT_sculpt_vertex_color_remove";
897 ot->
name =
"Clear Sculpt Mask Data";
898 ot->
idname =
"MESH_OT_customdata_mask_clear";
899 ot->
description =
"Clear vertex sculpt masking data from the mesh";
948 ot->
name =
"Add Skin Data";
949 ot->
idname =
"MESH_OT_customdata_skin_add";
973 ot->
name =
"Clear Skin Data";
974 ot->
idname =
"MESH_OT_customdata_skin_clear";
1032 ot->
name =
"Add Custom Split Normals Data";
1033 ot->
idname =
"MESH_OT_customdata_custom_splitnormals_add";
1034 ot->
description =
"Add a custom split normals layer, if none exists yet";
1061 ot->
name =
"Clear Custom Split Normals Data";
1062 ot->
idname =
"MESH_OT_customdata_custom_splitnormals_clear";
1063 ot->
description =
"Remove the custom split normals layer, if it exists";
1120 for (
int i = 0; i <
len; i++, mvert++) {
1156 for (i = 0; i <
len; i++, medge++) {
1219 for (i = 0; i <
len; i++, mpoly++) {
1380 const char *elem_type;
1383 elem_type =
"vertices";
1386 elem_type =
"edges";
1389 elem_type =
"faces";
1409 if (
mesh !=
nullptr) {
1414 if (ob ==
nullptr) {
typedef float(TangentPoint)[2]
Generic geometry attributes built on CustomData.
void BKE_id_attributes_active_color_set(struct ID *id, struct CustomDataLayer *active_layer)
struct CustomDataLayer * BKE_id_attributes_active_color_get(const struct ID *id)
struct Scene * CTX_data_scene(const bContext *C)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free(struct CustomData *data, int totelem)
int CustomData_number_of_layers(const struct CustomData *data, int type)
bool CustomData_free_layer(struct CustomData *data, int type, int totelem, int index)
void CustomData_set_layer_active(struct CustomData *data, int type, int n)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_free_layers(struct CustomData *data, int type, int totelem)
bool CustomData_has_layer(const struct CustomData *data, int type)
bool CustomData_layertype_is_singleton(int type)
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
int CustomData_get_active_layer(const struct CustomData *data, int type)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
int CustomData_get_layer_index(const struct CustomData *data, int type)
void * CustomData_get_layer(const struct CustomData *data, int type)
int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
int CustomData_get_n_offset(const struct CustomData *data, int type, int n)
void CustomData_free_elem(struct CustomData *data, int index, int count)
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
const CustomData_MeshMasks CD_MASK_MESH
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
void BKE_mesh_tessface_clear(struct Mesh *mesh)
bool BKE_mesh_has_custom_loop_normals(struct Mesh *me)
void BKE_mesh_ensure_skin_customdata(struct Mesh *me)
void BKE_mesh_calc_edges_loose(struct Mesh *mesh)
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd)
void BKE_mesh_normals_tag_dirty(struct Mesh *mesh)
void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges)
void BKE_edges_sharp_from_angle_set(const struct MVert *mverts, int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, float split_angle)
void BKE_mesh_runtime_clear_cache(struct Mesh *mesh)
This function clears runtime cache of the given 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(struct ID *id, int flag)
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object is a sort of wrapper for general info.
#define SCE_SELECT_VERTEX
struct Object * ED_object_context(const struct bContext *C)
struct Object * ED_object_active_context(const struct bContext *C)
bool ED_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
bool ED_operator_editable_mesh(struct bContext *C)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_edges_sharp_from_angle_set(BMesh *bm, const float split_angle)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
void ED_mesh_update(Mesh *mesh, bContext *C, bool calc_edges, bool calc_edges_loose)
bool ED_mesh_sculpt_color_remove_active(Mesh *me)
int ED_mesh_sculpt_color_add(Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *UNUSED(reports))
static bool sculpt_vertex_color_remove_poll(bContext *C)
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
static bool layers_poll(bContext *C)
int ED_mesh_uv_add(Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports)
static void mesh_uv_reset_bmface(BMFace *f, const int cd_loop_uv_offset)
static void mesh_remove_loops(Mesh *mesh, int len)
bool ED_mesh_color_remove_index(Mesh *me, const int n)
void ED_mesh_report_mirror_ex(wmOperator *op, int totmirr, int totfail, char selectmode)
bool ED_mesh_color_ensure(Mesh *me, const char *name)
static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_customdata_skin_add(wmOperatorType *ot)
bool ED_mesh_sculpt_color_remove_named(Mesh *me, const char *name)
bool ED_mesh_sculpt_color_remove_index(Mesh *me, const int n)
static int mesh_sculpt_vertex_color_add_exec(bContext *C, wmOperator *op)
static int mesh_uv_texture_add_exec(bContext *C, wmOperator *op)
void MESH_OT_vertex_color_add(wmOperatorType *ot)
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
bool ED_mesh_uv_remove_named(Mesh *me, const char *name)
static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv)
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
static bool uv_texture_remove_poll(bContext *C)
static void mesh_add_polys(Mesh *mesh, int len)
void ED_mesh_uv_loop_reset(bContext *C, Mesh *me)
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperator *UNUSED(op))
int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *UNUSED(reports))
void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
#define GET_CD_DATA(me, data)
void ED_mesh_verts_add(Mesh *mesh, ReportList *reports, int count)
void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
static bool vertex_color_remove_poll(bContext *C)
void ED_mesh_geometry_clear(Mesh *mesh)
static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
Mesh * ED_mesh_context(bContext *C)
static void mesh_add_edges(Mesh *mesh, int len)
void ED_mesh_uv_ensure(Mesh *me, const char *name)
void ED_mesh_polys_remove(Mesh *mesh, ReportList *reports, int count)
static bool mesh_customdata_skin_add_poll(bContext *C)
static CustomData * mesh_customdata_get_type(Mesh *me, const char htype, int *r_tot)
void ED_mesh_loops_remove(Mesh *mesh, ReportList *reports, int count)
void MESH_OT_vertex_color_remove(wmOperatorType *ot)
void MESH_OT_sculpt_vertex_color_remove(wmOperatorType *ot)
static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *UNUSED(op))
bool ED_mesh_uv_remove_active(Mesh *me)
static int mesh_customdata_skin_state(bContext *C)
static int mesh_vertex_color_add_exec(bContext *C, wmOperator *op)
bool ED_mesh_color_remove_named(Mesh *me, const char *name)
static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator *UNUSED(op))
bool ED_mesh_uv_remove_index(Mesh *me, const int n)
void MESH_OT_sculpt_vertex_color_add(wmOperatorType *ot)
static void mesh_remove_verts(Mesh *mesh, int len)
bool ED_mesh_sculpt_color_ensure(Mesh *me, const char *name)
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)
bool ED_mesh_color_remove_active(Mesh *me)
static void mesh_remove_edges(Mesh *mesh, int len)
void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
static bool mesh_customdata_skin_clear_poll(bContext *C)
static void mesh_remove_polys(Mesh *mesh, int len)
static int mesh_sculpt_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
void ED_mesh_verts_remove(Mesh *mesh, ReportList *reports, int count)
static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int type)
static void mesh_uv_reset_array(float **fuv, const int len)
void ED_mesh_uv_loop_reset_ex(Mesh *me, const int layernum)
static int mesh_customdata_mask_clear_exec(bContext *C, wmOperator *UNUSED(op))
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
static int mesh_customdata_skin_clear_exec(bContext *C, wmOperator *UNUSED(op))
bool active
all scheduled work for the GPU.
struct MLoopNorSpaceArray * lnor_spacearr
struct BMEditMesh * edit_mesh
struct MLoopCol * mloopcol
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)