Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/mesh_data.c
| Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv) | ||||
| for (int i = 0; i < mp->totloop; i++) { | for (int i = 0; i < mp->totloop; i++) { | ||||
| fuv[i] = mloopuv[mp->loopstart + i].uv; | fuv[i] = mloopuv[mp->loopstart + i].uv; | ||||
| } | } | ||||
| mesh_uv_reset_array(fuv, mp->totloop); | mesh_uv_reset_array(fuv, mp->totloop); | ||||
| } | } | ||||
| /* without bContext, called in uvedit */ | |||||
| void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum) | void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum) | ||||
| { | { | ||||
| BMEditMesh *em = me->edit_mesh; | BMEditMesh *em = me->edit_mesh; | ||||
| if (em) { | if (em) { | ||||
| /* Collect BMesh UVs */ | /* Collect BMesh UVs */ | ||||
| const int cd_loop_uv_offset = CustomData_get_n_offset(&em->bm->ldata, CD_MLOOPUV, layernum); | const int cd_loop_uv_offset = CustomData_get_n_offset(&em->bm->ldata, CD_MLOOPUV, layernum); | ||||
| Show All 28 Lines | void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me) | ||||
| /* could be ldata or pdata */ | /* could be ldata or pdata */ | ||||
| CustomData *ldata = GET_CD_DATA(me, ldata); | CustomData *ldata = GET_CD_DATA(me, ldata); | ||||
| const int layernum = CustomData_get_active_layer(ldata, CD_MLOOPUV); | const int layernum = CustomData_get_active_layer(ldata, CD_MLOOPUV); | ||||
| ED_mesh_uv_loop_reset_ex(me, layernum); | ED_mesh_uv_loop_reset_ex(me, layernum); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); | ||||
| } | } | ||||
| /* NOTE: keep in sync with #ED_mesh_color_add. */ | |||||
| int ED_mesh_uv_texture_add( | int ED_mesh_uv_texture_add( | ||||
| Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | ||||
| { | { | ||||
| /* NOTE: keep in sync with #ED_mesh_color_add. */ | |||||
| BMEditMesh *em; | BMEditMesh *em; | ||||
| int layernum_dst; | int layernum_dst; | ||||
| bool is_init = false; | bool is_init = false; | ||||
| if (me->edit_mesh) { | if (me->edit_mesh) { | ||||
| em = me->edit_mesh; | em = me->edit_mesh; | ||||
| ▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name) | ||||
| CustomData *ldata = GET_CD_DATA(me, ldata); | CustomData *ldata = GET_CD_DATA(me, ldata); | ||||
| const int n = CustomData_get_named_layer(ldata, CD_MLOOPUV, name); | const int n = CustomData_get_named_layer(ldata, CD_MLOOPUV, name); | ||||
| if (n != -1) { | if (n != -1) { | ||||
| return ED_mesh_uv_texture_remove_index(me, n); | return ED_mesh_uv_texture_remove_index(me, n); | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ | |||||
| int ED_mesh_color_add( | int ED_mesh_color_add( | ||||
| Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | ||||
| { | { | ||||
| /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ | |||||
| BMEditMesh *em; | BMEditMesh *em; | ||||
| int layernum; | int layernum; | ||||
| if (me->edit_mesh) { | if (me->edit_mesh) { | ||||
| em = me->edit_mesh; | em = me->edit_mesh; | ||||
| layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL); | layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL); | ||||
| if (layernum >= MAX_MCOL) { | if (layernum >= MAX_MCOL) { | ||||
| ▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | static bool sculpt_vertex_color_remove_poll(bContext *C) | ||||
| const int active = CustomData_get_active_layer(vdata, CD_PROP_COLOR); | const int active = CustomData_get_active_layer(vdata, CD_PROP_COLOR); | ||||
| if (active != -1) { | if (active != -1) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ | |||||
| int ED_mesh_sculpt_color_add( | int ED_mesh_sculpt_color_add( | ||||
| Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) | ||||
| { | { | ||||
| /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ | |||||
| BMEditMesh *em; | BMEditMesh *em; | ||||
| int layernum; | int layernum; | ||||
| if (me->edit_mesh) { | if (me->edit_mesh) { | ||||
| em = me->edit_mesh; | em = me->edit_mesh; | ||||
| layernum = CustomData_number_of_layers(&em->bm->vdata, CD_PROP_COLOR); | layernum = CustomData_number_of_layers(&em->bm->vdata, CD_PROP_COLOR); | ||||
| if (layernum >= MAX_MCOL) { | if (layernum >= MAX_MCOL) { | ||||
| ▲ Show 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | static int mesh_customdata_mask_clear_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| if (ret_a == OPERATOR_FINISHED || ret_b == OPERATOR_FINISHED) { | if (ret_a == OPERATOR_FINISHED || ret_b == OPERATOR_FINISHED) { | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| void MESH_OT_customdata_mask_clear(wmOperatorType *ot) | void MESH_OT_customdata_mask_clear(wmOperatorType *ot) | ||||
| { | { | ||||
| /* NOTE: no create_mask yet */ | |||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Clear Sculpt Mask Data"; | ot->name = "Clear Sculpt Mask Data"; | ||||
| ot->idname = "MESH_OT_customdata_mask_clear"; | ot->idname = "MESH_OT_customdata_mask_clear"; | ||||
| ot->description = "Clear vertex sculpt masking data from the mesh"; | ot->description = "Clear vertex sculpt masking data from the mesh"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = mesh_customdata_mask_clear_exec; | ot->exec = mesh_customdata_mask_clear_exec; | ||||
| ▲ Show 20 Lines • Show All 520 Lines • Show Last 20 Lines | |||||