Cleanup: Move three mesh editors files to C++
Simplifies refactoring in D14685, allows use of better data structures.
This commit is contained in:
parent
7b091fbb94
commit
1c70402c62
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include "BLI_sys_types.h" /* for bool and uint */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegion;
|
||||
struct Base;
|
||||
struct Depsgraph;
|
||||
|
@ -133,3 +137,7 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
|
|||
uint id_max,
|
||||
uint *dist);
|
||||
void DRW_select_buffer_context_create(struct Base **bases, uint bases_len, short select_mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -384,7 +384,7 @@ void ED_operatormacros_mesh(void);
|
|||
*/
|
||||
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
|
||||
|
||||
/* editface.c */
|
||||
/* editface.cc */
|
||||
|
||||
/**
|
||||
* Copy the face flags, most importantly selection from the mesh to the final derived mesh,
|
||||
|
@ -520,7 +520,7 @@ float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vert
|
|||
*/
|
||||
void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr);
|
||||
|
||||
/* mesh_data.c */
|
||||
/* mesh_data.cc */
|
||||
|
||||
void ED_mesh_verts_add(struct Mesh *mesh, struct ReportList *reports, int count);
|
||||
void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
|
||||
|
@ -591,7 +591,7 @@ void EDBM_redo_state_restore_and_free(struct BMBackup *backup,
|
|||
bool recalc_looptri) ATTR_NONNULL(1, 2);
|
||||
void EDBM_redo_state_free(struct BMBackup *backup) ATTR_NONNULL(1);
|
||||
|
||||
/* *** meshtools.c *** */
|
||||
/* *** meshtools.cc *** */
|
||||
|
||||
int ED_mesh_join_objects_exec(struct bContext *C, struct wmOperator *op);
|
||||
int ED_mesh_shapes_join_objects_exec(struct bContext *C, struct wmOperator *op);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -256,6 +258,7 @@ typedef enum {
|
|||
*/
|
||||
V3D_PROJ_TEST_CLIP_CONTENT = (1 << 5),
|
||||
} eV3DProjTest;
|
||||
ENUM_OPERATORS(eV3DProjTest, V3D_PROJ_TEST_CLIP_CONTENT);
|
||||
|
||||
#define V3D_PROJ_TEST_CLIP_DEFAULT \
|
||||
(V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR)
|
||||
|
|
|
@ -24,7 +24,7 @@ set(INC
|
|||
)
|
||||
|
||||
set(SRC
|
||||
editface.c
|
||||
editface.cc
|
||||
editmesh_add.c
|
||||
editmesh_add_gizmo.c
|
||||
editmesh_automerge.c
|
||||
|
@ -51,10 +51,10 @@ set(SRC
|
|||
editmesh_tools.c
|
||||
editmesh_undo.c
|
||||
editmesh_utils.c
|
||||
mesh_data.c
|
||||
mesh_data.cc
|
||||
mesh_mirror.c
|
||||
mesh_ops.c
|
||||
meshtools.c
|
||||
meshtools.cc
|
||||
|
||||
mesh_intern.h
|
||||
)
|
||||
|
|
|
@ -36,16 +36,16 @@
|
|||
|
||||
/* own include */
|
||||
|
||||
void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
||||
void paintface_flush_flags(bContext *C, Object *ob, short flag)
|
||||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
MPoly *polys, *mp_orig;
|
||||
const int *index_array = NULL;
|
||||
const int *index_array = nullptr;
|
||||
int totpoly;
|
||||
|
||||
BLI_assert((flag & ~(SELECT | ME_HIDE)) == 0);
|
||||
|
||||
if (me == NULL) {
|
||||
if (me == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
|||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
|
||||
if (ob_eval == NULL) {
|
||||
if (ob_eval == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
|||
Mesh *me_eval = (Mesh *)ob_eval->runtime.data_eval;
|
||||
bool updated = false;
|
||||
|
||||
if (me_orig != NULL && me_eval != NULL && me_orig->totpoly == me->totpoly) {
|
||||
if (me_orig != nullptr && me_eval != nullptr && me_orig->totpoly == me->totpoly) {
|
||||
/* Update the COW copy of the mesh. */
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
me_orig->mpoly[i].flag = me->mpoly[i].flag;
|
||||
|
@ -79,7 +79,7 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
|||
updated = true;
|
||||
}
|
||||
/* Mesh polys => Final derived polys */
|
||||
else if ((index_array = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) {
|
||||
else if ((index_array = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) {
|
||||
polys = me_eval->mpoly;
|
||||
totpoly = me_eval->totpoly;
|
||||
|
||||
|
@ -104,10 +104,10 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
|||
BKE_mesh_batch_cache_dirty_tag(me_eval, BKE_MESH_BATCH_DIRTY_SELECT_PAINT);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(ob->data, ID_RECALC_SELECT);
|
||||
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_SELECT);
|
||||
}
|
||||
else {
|
||||
DEG_id_tag_update(ob->data, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
|
||||
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
|
||||
|
@ -116,7 +116,7 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
|
|||
void paintface_hide(bContext *C, Object *ob, const bool unselected)
|
||||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL || me->totpoly == 0) {
|
||||
if (me == nullptr || me->totpoly == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ void paintface_hide(bContext *C, Object *ob, const bool unselected)
|
|||
void paintface_reveal(bContext *C, Object *ob, const bool select)
|
||||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL || me->totpoly == 0) {
|
||||
if (me == nullptr || me->totpoly == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b
|
|||
uint index = (uint)-1;
|
||||
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL || me->totpoly == 0) {
|
||||
if (me == nullptr || me->totpoly == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b
|
|||
bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool flush_flags)
|
||||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL) {
|
||||
if (me == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -337,12 +337,12 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool paintface_mouse_select(struct bContext *C,
|
||||
bool paintface_mouse_select(bContext *C,
|
||||
const int mval[2],
|
||||
const struct SelectPick_Params *params,
|
||||
const SelectPick_Params *params,
|
||||
Object *ob)
|
||||
{
|
||||
MPoly *mpoly_sel = NULL;
|
||||
MPoly *mpoly_sel = nullptr;
|
||||
uint index;
|
||||
bool changed = false;
|
||||
bool found = false;
|
||||
|
@ -414,11 +414,11 @@ void paintvert_flush_flags(Object *ob)
|
|||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
|
||||
MVert *mvert_eval, *mv;
|
||||
const int *index_array = NULL;
|
||||
const int *index_array = nullptr;
|
||||
int totvert;
|
||||
int i;
|
||||
|
||||
if (me == NULL) {
|
||||
if (me == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -426,11 +426,11 @@ void paintvert_flush_flags(Object *ob)
|
|||
* since this could become slow for realtime updates (circle-select for eg) */
|
||||
BKE_mesh_flush_select_from_verts(me);
|
||||
|
||||
if (me_eval == NULL) {
|
||||
if (me_eval == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
index_array = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
|
||||
index_array = (const int *)CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
|
||||
|
||||
mvert_eval = me_eval->mvert;
|
||||
totvert = me_eval->totvert;
|
||||
|
@ -455,16 +455,16 @@ void paintvert_flush_flags(Object *ob)
|
|||
BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
|
||||
}
|
||||
|
||||
void paintvert_tag_select_update(struct bContext *C, struct Object *ob)
|
||||
void paintvert_tag_select_update(bContext *C, Object *ob)
|
||||
{
|
||||
DEG_id_tag_update(ob->data, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
|
||||
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
|
||||
}
|
||||
|
||||
bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
|
||||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL) {
|
||||
if (me == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
|
|||
{
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
|
||||
if (me == NULL || me->dvert == NULL) {
|
||||
if (me == nullptr || me->dvert == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
|
|||
MVert *mv = &me->mvert[i];
|
||||
MDeformVert *dv = &me->dvert[i];
|
||||
if ((mv->flag & ME_HIDE) == 0) {
|
||||
if (dv->dw == NULL) {
|
||||
if (dv->dw == nullptr) {
|
||||
/* if null weight then not grouped */
|
||||
mv->flag |= SELECT;
|
||||
}
|
|
@ -46,7 +46,7 @@
|
|||
static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_tot)
|
||||
{
|
||||
CustomData *data;
|
||||
BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : NULL;
|
||||
BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : nullptr;
|
||||
int tot;
|
||||
|
||||
switch (htype) {
|
||||
|
@ -93,7 +93,7 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
|
|||
default:
|
||||
BLI_assert(0);
|
||||
tot = 0;
|
||||
data = NULL;
|
||||
data = nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv)
|
|||
mesh_uv_reset_array(fuv, mp->totloop);
|
||||
}
|
||||
|
||||
void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
|
||||
void ED_mesh_uv_loop_reset_ex(Mesh *me, const int layernum)
|
||||
{
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
|
||||
|
@ -219,7 +219,7 @@ void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
|
|||
else {
|
||||
/* Collect Mesh UVs */
|
||||
BLI_assert(CustomData_has_layer(&me->ldata, CD_MLOOPUV));
|
||||
MLoopUV *mloopuv = CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, layernum);
|
||||
MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, layernum);
|
||||
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
mesh_uv_reset_mface(&me->mpoly[i], mloopuv);
|
||||
|
@ -229,7 +229,7 @@ void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
|
|||
DEG_id_tag_update(&me->id, 0);
|
||||
}
|
||||
|
||||
void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
|
||||
void ED_mesh_uv_loop_reset(bContext *C, Mesh *me)
|
||||
{
|
||||
/* could be ldata or pdata */
|
||||
CustomData *ldata = GET_CD_DATA(me, ldata);
|
||||
|
@ -284,7 +284,7 @@ int ED_mesh_uv_texture_add(
|
|||
is_init = true;
|
||||
}
|
||||
else {
|
||||
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name);
|
||||
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, nullptr, me->totloop, name);
|
||||
}
|
||||
|
||||
if (active_set || layernum_dst == 0) {
|
||||
|
@ -305,7 +305,7 @@ int ED_mesh_uv_texture_add(
|
|||
return layernum_dst;
|
||||
}
|
||||
|
||||
void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
|
||||
void ED_mesh_uv_texture_ensure(Mesh *me, const char *name)
|
||||
{
|
||||
BMEditMesh *em;
|
||||
int layernum_dst;
|
||||
|
@ -315,13 +315,13 @@ void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
|
|||
|
||||
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
|
||||
if (layernum_dst == 0) {
|
||||
ED_mesh_uv_texture_add(me, name, true, true, NULL);
|
||||
ED_mesh_uv_texture_add(me, name, true, true, nullptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
layernum_dst = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV);
|
||||
if (layernum_dst == 0) {
|
||||
ED_mesh_uv_texture_add(me, name, true, true, NULL);
|
||||
ED_mesh_uv_texture_add(me, name, true, true, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ bool ED_mesh_uv_texture_remove_index(Mesh *me, const int n)
|
|||
int index;
|
||||
|
||||
index = CustomData_get_layer_index_n(ldata, CD_MLOOPUV, n);
|
||||
cdlu = (index == -1) ? NULL : &ldata->layers[index];
|
||||
cdlu = (index == -1) ? nullptr : &ldata->layers[index];
|
||||
|
||||
if (!cdlu) {
|
||||
return false;
|
||||
|
@ -409,7 +409,7 @@ int ED_mesh_color_add(
|
|||
}
|
||||
else {
|
||||
CustomData_add_layer_named(
|
||||
&me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, NULL, me->totloop, name);
|
||||
&me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, nullptr, me->totloop, name);
|
||||
}
|
||||
|
||||
if (active_set || layernum == 0) {
|
||||
|
@ -425,14 +425,14 @@ int ED_mesh_color_add(
|
|||
return layernum;
|
||||
}
|
||||
|
||||
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
|
||||
bool ED_mesh_color_ensure(Mesh *me, const char *name)
|
||||
{
|
||||
BLI_assert(me->edit_mesh == NULL);
|
||||
BLI_assert(me->edit_mesh == nullptr);
|
||||
CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id);
|
||||
|
||||
if (!layer) {
|
||||
CustomData_add_layer_named(
|
||||
&me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, NULL, me->totloop, name);
|
||||
&me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, nullptr, me->totloop, name);
|
||||
layer = me->ldata.layers + CustomData_get_layer_index(&me->ldata, CD_PROP_BYTE_COLOR);
|
||||
|
||||
BKE_id_attributes_active_color_set(&me->id, layer);
|
||||
|
@ -441,7 +441,7 @@ bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
|
|||
|
||||
DEG_id_tag_update(&me->id, 0);
|
||||
|
||||
return (layer != NULL);
|
||||
return (layer != nullptr);
|
||||
}
|
||||
|
||||
bool ED_mesh_color_remove_index(Mesh *me, const int n)
|
||||
|
@ -451,7 +451,7 @@ bool ED_mesh_color_remove_index(Mesh *me, const int n)
|
|||
int index;
|
||||
|
||||
index = CustomData_get_layer_index_n(ldata, CD_PROP_BYTE_COLOR, n);
|
||||
cdl = (index == -1) ? NULL : &ldata->layers[index];
|
||||
cdl = (index == -1) ? nullptr : &ldata->layers[index];
|
||||
|
||||
if (!cdl) {
|
||||
return false;
|
||||
|
@ -487,7 +487,7 @@ bool ED_mesh_color_remove_named(Mesh *me, const char *name)
|
|||
static bool layers_poll(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
ID *data = (ob) ? ob->data : NULL;
|
||||
ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
|
||||
return (ob && !ID_IS_LINKED(ob) && !ID_IS_OVERRIDE_LIBRARY(ob) && ob->type == OB_MESH && data &&
|
||||
!ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data));
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ static bool sculpt_vertex_color_remove_poll(bContext *C)
|
|||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
CustomData *vdata = GET_CD_DATA(me, vdata);
|
||||
const int active = CustomData_get_active_layer(vdata, CD_PROP_COLOR);
|
||||
if (active != -1) {
|
||||
|
@ -549,12 +549,14 @@ int ED_mesh_sculpt_color_add(
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(&me->vdata, CD_PROP_COLOR) && do_init) {
|
||||
const MPropCol *color_data = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const MPropCol *color_data = (const MPropCol *)CustomData_get_layer(&me->vdata,
|
||||
CD_PROP_COLOR);
|
||||
CustomData_add_layer_named(
|
||||
&me->vdata, CD_PROP_COLOR, CD_DUPLICATE, (MPropCol *)color_data, me->totvert, name);
|
||||
}
|
||||
else {
|
||||
CustomData_add_layer_named(&me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, me->totvert, name);
|
||||
CustomData_add_layer_named(
|
||||
&me->vdata, CD_PROP_COLOR, CD_DEFAULT, nullptr, me->totvert, name);
|
||||
}
|
||||
|
||||
if (active_set || layernum == 0) {
|
||||
|
@ -570,18 +572,18 @@ int ED_mesh_sculpt_color_add(
|
|||
return layernum;
|
||||
}
|
||||
|
||||
bool ED_mesh_sculpt_color_ensure(struct Mesh *me, const char *name)
|
||||
bool ED_mesh_sculpt_color_ensure(Mesh *me, const char *name)
|
||||
{
|
||||
BLI_assert(me->edit_mesh == NULL);
|
||||
BLI_assert(me->edit_mesh == nullptr);
|
||||
|
||||
if (me->totvert && !CustomData_has_layer(&me->vdata, CD_PROP_COLOR)) {
|
||||
CustomData_add_layer_named(&me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, me->totvert, name);
|
||||
CustomData_add_layer_named(&me->vdata, CD_PROP_COLOR, CD_DEFAULT, nullptr, me->totvert, name);
|
||||
BKE_mesh_update_customdata_pointers(me, true);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&me->id, 0);
|
||||
|
||||
return (me->mloopcol != NULL);
|
||||
return (me->mloopcol != nullptr);
|
||||
}
|
||||
|
||||
bool ED_mesh_sculpt_color_remove_index(Mesh *me, const int n)
|
||||
|
@ -591,7 +593,7 @@ bool ED_mesh_sculpt_color_remove_index(Mesh *me, const int n)
|
|||
int index;
|
||||
|
||||
index = CustomData_get_layer_index_n(vdata, CD_PROP_COLOR, n);
|
||||
cdl = (index == -1) ? NULL : &vdata->layers[index];
|
||||
cdl = (index == -1) ? nullptr : &vdata->layers[index];
|
||||
|
||||
if (!cdl) {
|
||||
return false;
|
||||
|
@ -631,7 +633,7 @@ static bool uv_texture_remove_poll(bContext *C)
|
|||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
CustomData *ldata = GET_CD_DATA(me, ldata);
|
||||
const int active = CustomData_get_active_layer(ldata, CD_MLOOPUV);
|
||||
if (active != -1) {
|
||||
|
@ -644,16 +646,16 @@ static bool uv_texture_remove_poll(bContext *C)
|
|||
static int mesh_uv_texture_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (ED_mesh_uv_texture_add(me, NULL, true, true, op->reports) == -1) {
|
||||
if (ED_mesh_uv_texture_add(me, nullptr, true, true, op->reports) == -1) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, nullptr, nullptr, nullptr, nullptr);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -677,7 +679,7 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot)
|
|||
static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (!ED_mesh_uv_texture_remove_active(me)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -685,8 +687,8 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, nullptr, nullptr, nullptr, nullptr);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -716,7 +718,7 @@ static bool vertex_color_remove_poll(bContext *C)
|
|||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
CustomData *ldata = GET_CD_DATA(me, ldata);
|
||||
const int active = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR);
|
||||
if (active != -1) {
|
||||
|
@ -729,9 +731,9 @@ static bool vertex_color_remove_poll(bContext *C)
|
|||
static int mesh_vertex_color_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (ED_mesh_color_add(me, NULL, true, true, op->reports) == -1) {
|
||||
if (ED_mesh_color_add(me, nullptr, true, true, op->reports) == -1) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -756,7 +758,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
|
|||
static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (!ED_mesh_color_remove_active(me)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -785,9 +787,9 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
|
|||
static int mesh_sculpt_vertex_color_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (ED_mesh_sculpt_color_add(me, NULL, true, true, op->reports) == -1) {
|
||||
if (ED_mesh_sculpt_color_add(me, nullptr, true, true, op->reports) == -1) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -812,7 +814,7 @@ void MESH_OT_sculpt_vertex_color_add(wmOperatorType *ot)
|
|||
static int mesh_sculpt_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (!ED_mesh_sculpt_color_remove_active(me)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -868,7 +870,7 @@ static bool mesh_customdata_mask_clear_poll(bContext *C)
|
|||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
if (ob && ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
/* special case - can't run this if we're in sculpt mode */
|
||||
if (ob->mode & OB_MODE_SCULPT) {
|
||||
|
@ -925,7 +927,7 @@ static int mesh_customdata_skin_state(bContext *C)
|
|||
Object *ob = ED_object_context(C);
|
||||
|
||||
if (ob && ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
if (!ID_IS_LINKED(me) && !ID_IS_OVERRIDE_LIBRARY(me)) {
|
||||
CustomData *data = GET_CD_DATA(me, vdata);
|
||||
return CustomData_has_layer(data, CD_MVERT_SKIN);
|
||||
|
@ -942,7 +944,7 @@ static bool mesh_customdata_skin_add_poll(bContext *C)
|
|||
static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BKE_mesh_ensure_skin_customdata(me);
|
||||
|
||||
|
@ -1025,7 +1027,7 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
|
|||
me->smoothresh);
|
||||
}
|
||||
|
||||
CustomData_add_layer(data, CD_CUSTOMLOOPNORMAL, CD_DEFAULT, NULL, me->totloop);
|
||||
CustomData_add_layer(data, CD_CUSTOMLOOPNORMAL, CD_DEFAULT, nullptr, me->totloop);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&me->id, 0);
|
||||
|
@ -1057,7 +1059,7 @@ static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperato
|
|||
|
||||
if (BKE_mesh_has_custom_loop_normals(me)) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
if (em != NULL && em->bm->lnor_spacearr != NULL) {
|
||||
if (em != nullptr && em->bm->lnor_spacearr != nullptr) {
|
||||
BKE_lnor_spacearr_clear(em->bm->lnor_spacearr);
|
||||
}
|
||||
return mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_CUSTOMLOOPNORMAL);
|
||||
|
@ -1114,7 +1116,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
|
|||
CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert);
|
||||
|
||||
if (!CustomData_has_layer(&vdata, CD_MVERT)) {
|
||||
CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
|
||||
CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, nullptr, totvert);
|
||||
}
|
||||
|
||||
CustomData_free(&mesh->vdata, mesh->totvert);
|
||||
|
@ -1152,7 +1154,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
|
|||
CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
|
||||
|
||||
if (!CustomData_has_layer(&edata, CD_MEDGE)) {
|
||||
CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
|
||||
CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, nullptr, totedge);
|
||||
}
|
||||
|
||||
CustomData_free(&mesh->edata, mesh->totedge);
|
||||
|
@ -1186,7 +1188,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
|
|||
CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop);
|
||||
|
||||
if (!CustomData_has_layer(&ldata, CD_MLOOP)) {
|
||||
CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
|
||||
CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, nullptr, totloop);
|
||||
}
|
||||
|
||||
BKE_mesh_runtime_clear_cache(mesh);
|
||||
|
@ -1215,7 +1217,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
|
|||
CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly);
|
||||
|
||||
if (!CustomData_has_layer(&pdata, CD_MPOLY)) {
|
||||
CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
|
||||
CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, nullptr, totpoly);
|
||||
}
|
||||
|
||||
CustomData_free(&mesh->pdata, mesh->totpoly);
|
||||
|
@ -1413,21 +1415,21 @@ void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
|
|||
ED_mesh_report_mirror_ex(op, totmirr, totfail, SCE_SELECT_VERTEX);
|
||||
}
|
||||
|
||||
Mesh *ED_mesh_context(struct bContext *C)
|
||||
Mesh *ED_mesh_context(bContext *C)
|
||||
{
|
||||
Mesh *mesh = CTX_data_pointer_get_type(C, "mesh", &RNA_Mesh).data;
|
||||
if (mesh != NULL) {
|
||||
Mesh *mesh = static_cast<Mesh *>(CTX_data_pointer_get_type(C, "mesh", &RNA_Mesh).data);
|
||||
if (mesh != nullptr) {
|
||||
return mesh;
|
||||
}
|
||||
|
||||
Object *ob = ED_object_active_context(C);
|
||||
if (ob == NULL) {
|
||||
return NULL;
|
||||
if (ob == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ID *data = (ID *)ob->data;
|
||||
if (data == NULL || GS(data->name) != ID_ME) {
|
||||
return NULL;
|
||||
if (data == nullptr || GS(data->name) != ID_ME) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (Mesh *)data;
|
|
@ -9,6 +9,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct BMEditMesh;
|
||||
struct BMElem;
|
||||
struct BMOperator;
|
||||
|
@ -301,7 +305,7 @@ void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot);
|
|||
void MESH_OT_mark_freestyle_face(struct wmOperatorType *ot);
|
||||
#endif
|
||||
|
||||
/* *** mesh_data.c *** */
|
||||
/* *** mesh_data.cc *** */
|
||||
|
||||
void MESH_OT_uv_texture_add(struct wmOperatorType *ot);
|
||||
void MESH_OT_uv_texture_remove(struct wmOperatorType *ot);
|
||||
|
@ -314,3 +318,7 @@ void MESH_OT_customdata_skin_add(struct wmOperatorType *ot);
|
|||
void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot);
|
||||
void MESH_OT_customdata_custom_splitnormals_add(struct wmOperatorType *ot);
|
||||
void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -21,9 +21,6 @@
|
|||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
|
@ -92,7 +89,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
{
|
||||
int a, b;
|
||||
|
||||
Mesh *me = ob_src->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob_src->data);
|
||||
MVert *mvert = *mvert_pp;
|
||||
MEdge *medge = *medge_pp;
|
||||
MLoop *mloop = *mloop_pp;
|
||||
|
@ -107,12 +104,13 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
CustomData_copy_data_named(&me->vdata, vdata, 0, *vertofs, me->totvert);
|
||||
|
||||
/* vertex groups */
|
||||
MDeformVert *dvert = CustomData_get(vdata, *vertofs, CD_MDEFORMVERT);
|
||||
const MDeformVert *dvert_src = CustomData_get(&me->vdata, 0, CD_MDEFORMVERT);
|
||||
MDeformVert *dvert = (MDeformVert *)CustomData_get(vdata, *vertofs, CD_MDEFORMVERT);
|
||||
const MDeformVert *dvert_src = (const MDeformVert *)CustomData_get(
|
||||
&me->vdata, 0, CD_MDEFORMVERT);
|
||||
|
||||
/* Remap to correct new vgroup indices, if needed. */
|
||||
if (dvert_src) {
|
||||
BLI_assert(dvert != NULL);
|
||||
BLI_assert(dvert != nullptr);
|
||||
|
||||
/* Build src to merged mapping of vgroup indices. */
|
||||
int *vgroup_index_map;
|
||||
|
@ -121,7 +119,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
ob_src, ob_dst, &vgroup_index_map_len);
|
||||
BKE_object_defgroup_index_map_apply(
|
||||
dvert, me->totvert, vgroup_index_map, vgroup_index_map_len);
|
||||
if (vgroup_index_map != NULL) {
|
||||
if (vgroup_index_map != nullptr) {
|
||||
MEM_freeN(vgroup_index_map);
|
||||
}
|
||||
}
|
||||
|
@ -151,11 +149,11 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
float(*cos)[3] = ((float(*)[3])kb->data) + *vertofs;
|
||||
|
||||
/* Check if this mesh has such a shape-key. */
|
||||
KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : NULL;
|
||||
KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : nullptr;
|
||||
if (okb) {
|
||||
/* copy this mesh's shape-key to the destination shape-key
|
||||
* (need to transform first) */
|
||||
float(*ocos)[3] = okb->data;
|
||||
float(*ocos)[3] = static_cast<float(*)[3]>(okb->data);
|
||||
for (a = 0; a < me->totvert; a++, cos++, ocos++) {
|
||||
copy_v3_v3(*cos, *ocos);
|
||||
mul_m4_v3(cmat, *cos);
|
||||
|
@ -181,10 +179,10 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
float(*cos)[3] = ((float(*)[3])kb->data) + *vertofs;
|
||||
|
||||
/* Check if this was one of the original shape-keys. */
|
||||
KeyBlock *okb = nkey ? BKE_keyblock_find_name(nkey, kb->name) : NULL;
|
||||
KeyBlock *okb = nkey ? BKE_keyblock_find_name(nkey, kb->name) : nullptr;
|
||||
if (okb) {
|
||||
/* copy this mesh's shape-key to the destination shape-key */
|
||||
float(*ocos)[3] = okb->data;
|
||||
float(*ocos)[3] = static_cast<float(*)[3]>(okb->data);
|
||||
for (a = 0; a < me->totvert; a++, cos++, ocos++) {
|
||||
copy_v3_v3(*cos, *ocos);
|
||||
}
|
||||
|
@ -255,17 +253,17 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
/* Face maps. */
|
||||
int *fmap = CustomData_get(pdata, *polyofs, CD_FACEMAP);
|
||||
const int *fmap_src = CustomData_get(&me->pdata, 0, CD_FACEMAP);
|
||||
int *fmap = (int *)CustomData_get(pdata, *polyofs, CD_FACEMAP);
|
||||
const int *fmap_src = (const int *)CustomData_get(&me->pdata, 0, CD_FACEMAP);
|
||||
|
||||
/* Remap to correct new face-map indices, if needed. */
|
||||
if (fmap_src) {
|
||||
BLI_assert(fmap != NULL);
|
||||
BLI_assert(fmap != nullptr);
|
||||
int *fmap_index_map;
|
||||
int fmap_index_map_len;
|
||||
fmap_index_map = BKE_object_facemap_index_map_create(ob_src, ob_dst, &fmap_index_map_len);
|
||||
BKE_object_facemap_index_map_apply(fmap, me->totpoly, fmap_index_map, fmap_index_map_len);
|
||||
if (fmap_index_map != NULL) {
|
||||
if (fmap_index_map != nullptr) {
|
||||
MEM_freeN(fmap_index_map);
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +289,7 @@ static void mesh_join_offset_face_sets_ID(const Mesh *mesh, int *face_set_offset
|
|||
return;
|
||||
}
|
||||
|
||||
int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
|
||||
int *face_sets = (int *)CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
|
||||
if (!face_sets) {
|
||||
return;
|
||||
}
|
||||
|
@ -318,20 +316,18 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Material **matar = NULL, *ma;
|
||||
Material **matar = nullptr, *ma;
|
||||
Mesh *me;
|
||||
MVert *mvert = NULL;
|
||||
MEdge *medge = NULL;
|
||||
MPoly *mpoly = NULL;
|
||||
MLoop *mloop = NULL;
|
||||
Key *key, *nkey = NULL;
|
||||
KeyBlock *kb, *kbn;
|
||||
MVert *mvert = nullptr;
|
||||
MEdge *medge = nullptr;
|
||||
MPoly *mpoly = nullptr;
|
||||
MLoop *mloop = nullptr;
|
||||
Key *key, *nkey = nullptr;
|
||||
float imat[4][4];
|
||||
int a, b, totcol, totmat = 0, totedge = 0, totvert = 0;
|
||||
int totloop = 0, totpoly = 0, vertofs, *matmap = NULL;
|
||||
int totloop = 0, totpoly = 0, vertofs, *matmap = nullptr;
|
||||
int i, haskey = 0, edgeofs, loopofs, polyofs;
|
||||
bool ok = false, join_parent = false;
|
||||
bDeformGroup *dg, *odg;
|
||||
CustomData vdata, edata, fdata, ldata, pdata;
|
||||
|
||||
if (ob->mode & OB_MODE_EDIT) {
|
||||
|
@ -350,7 +346,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
/* count & check */
|
||||
CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
|
||||
if (ob_iter->type == OB_MESH) {
|
||||
me = ob_iter->data;
|
||||
me = static_cast<Mesh *>(ob_iter->data);
|
||||
|
||||
totvert += me->totvert;
|
||||
totedge += me->totedge;
|
||||
|
@ -362,7 +358,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
ok = true;
|
||||
}
|
||||
|
||||
if ((ob->parent != NULL) && (ob_iter == ob->parent)) {
|
||||
if ((ob->parent != nullptr) && (ob_iter == ob->parent)) {
|
||||
join_parent = true;
|
||||
}
|
||||
|
||||
|
@ -377,7 +373,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
/* Apply parent transform if the active object's parent was joined to it.
|
||||
* NOTE: This doesn't apply recursive parenting. */
|
||||
if (join_parent) {
|
||||
ob->parent = NULL;
|
||||
ob->parent = nullptr;
|
||||
BKE_object_apply_mat4_ex(ob, ob->obmat, ob->parent, ob->parentinv, false);
|
||||
}
|
||||
|
||||
|
@ -417,8 +413,8 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* new material indices and material array */
|
||||
if (totmat) {
|
||||
matar = MEM_callocN(sizeof(*matar) * totmat, "join_mesh matar");
|
||||
matmap = MEM_callocN(sizeof(*matmap) * totmat, "join_mesh matmap");
|
||||
matar = static_cast<Material **>(MEM_callocN(sizeof(*matar) * totmat, __func__));
|
||||
matmap = static_cast<int *>(MEM_callocN(sizeof(*matmap) * totmat, __func__));
|
||||
}
|
||||
totcol = ob->totcol;
|
||||
|
||||
|
@ -439,7 +435,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
nkey = (Key *)BKE_id_copy(bmain, &key->id);
|
||||
|
||||
/* for all keys in old block, clear data-arrays */
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
LISTBASE_FOREACH (KeyBlock *, kb, &key->block) {
|
||||
if (kb->data) {
|
||||
MEM_freeN(kb->data);
|
||||
}
|
||||
|
@ -463,13 +459,14 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
|
||||
/* only act if a mesh, and not the one we're joining to */
|
||||
if ((ob != ob_iter) && (ob_iter->type == OB_MESH)) {
|
||||
me = ob_iter->data;
|
||||
me = static_cast<Mesh *>(ob_iter->data);
|
||||
|
||||
/* Join this object's vertex groups to the base one's */
|
||||
for (dg = me->vertex_group_names.first; dg; dg = dg->next) {
|
||||
LISTBASE_FOREACH (bDeformGroup *, dg, &me->vertex_group_names) {
|
||||
/* See if this group exists in the object (if it doesn't, add it to the end) */
|
||||
if (!BKE_object_defgroup_find_name(ob, dg->name)) {
|
||||
odg = MEM_mallocN(sizeof(bDeformGroup), "join deformGroup");
|
||||
bDeformGroup *odg = static_cast<bDeformGroup *>(
|
||||
MEM_mallocN(sizeof(bDeformGroup), __func__));
|
||||
memcpy(odg, dg, sizeof(bDeformGroup));
|
||||
BLI_addtail(&mesh_active->vertex_group_names, odg);
|
||||
}
|
||||
|
@ -482,8 +479,8 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
/* Join this object's face maps to the base one's. */
|
||||
LISTBASE_FOREACH (bFaceMap *, fmap, &ob_iter->fmaps) {
|
||||
/* See if this group exists in the object (if it doesn't, add it to the end) */
|
||||
if (BKE_object_facemap_find_name(ob, fmap->name) == NULL) {
|
||||
bFaceMap *fmap_new = MEM_mallocN(sizeof(bFaceMap), "join faceMap");
|
||||
if (BKE_object_facemap_find_name(ob, fmap->name) == nullptr) {
|
||||
bFaceMap *fmap_new = static_cast<bFaceMap *>(MEM_mallocN(sizeof(bFaceMap), __func__));
|
||||
memcpy(fmap_new, fmap, sizeof(bFaceMap));
|
||||
BLI_addtail(&ob->fmaps, fmap_new);
|
||||
}
|
||||
|
@ -523,13 +520,15 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
* check if destination mesh already has matching entries too. */
|
||||
if (me->key && key) {
|
||||
/* for remapping KeyBlock.relative */
|
||||
int *index_map = MEM_mallocN(sizeof(int) * me->key->totkey, __func__);
|
||||
KeyBlock **kb_map = MEM_mallocN(sizeof(KeyBlock *) * me->key->totkey, __func__);
|
||||
int *index_map = static_cast<int *>(
|
||||
MEM_mallocN(sizeof(int) * me->key->totkey, __func__));
|
||||
KeyBlock **kb_map = static_cast<KeyBlock **>(
|
||||
MEM_mallocN(sizeof(KeyBlock *) * me->key->totkey, __func__));
|
||||
|
||||
for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) {
|
||||
LISTBASE_FOREACH_INDEX (KeyBlock *, kb, &me->key->block, i) {
|
||||
BLI_assert(i < me->key->totkey);
|
||||
|
||||
kbn = BKE_keyblock_find_name(key, kb->name);
|
||||
KeyBlock *kbn = BKE_keyblock_find_name(key, kb->name);
|
||||
/* if key doesn't exist in destination mesh, add it */
|
||||
if (kbn) {
|
||||
index_map[i] = BLI_findindex(&key->block, kbn);
|
||||
|
@ -550,7 +549,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* remap relative index values */
|
||||
for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) {
|
||||
LISTBASE_FOREACH_INDEX (KeyBlock *, kb, &me->key->block, i) {
|
||||
/* sanity check, should always be true */
|
||||
if (LIKELY(kb->relative < me->key->totkey)) {
|
||||
kb_map[i]->relative = index_map[kb->relative];
|
||||
|
@ -572,10 +571,10 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
CustomData_reset(&ldata);
|
||||
CustomData_reset(&pdata);
|
||||
|
||||
mvert = CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
|
||||
medge = CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
|
||||
mloop = CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
|
||||
mpoly = CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
|
||||
mvert = (MVert *)CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, nullptr, totvert);
|
||||
medge = (MEdge *)CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, nullptr, totedge);
|
||||
mloop = (MLoop *)CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, nullptr, totloop);
|
||||
mpoly = (MPoly *)CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, nullptr, totpoly);
|
||||
|
||||
vertofs = 0;
|
||||
edgeofs = 0;
|
||||
|
@ -662,7 +661,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
CTX_DATA_END;
|
||||
|
||||
/* return to mesh we're merging to */
|
||||
me = ob->data;
|
||||
me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
CustomData_free(&me->vdata, me->totvert);
|
||||
CustomData_free(&me->edata, me->totedge);
|
||||
|
@ -704,8 +703,8 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (totcol) {
|
||||
me->mat = matar;
|
||||
ob->mat = MEM_callocN(sizeof(*ob->mat) * totcol, "join obmatar");
|
||||
ob->matbits = MEM_callocN(sizeof(*ob->matbits) * totcol, "join obmatbits");
|
||||
ob->mat = static_cast<Material **>(MEM_callocN(sizeof(*ob->mat) * totcol, __func__));
|
||||
ob->matbits = static_cast<char *>(MEM_callocN(sizeof(*ob->matbits) * totcol, __func__));
|
||||
MEM_freeN(matmap);
|
||||
}
|
||||
|
||||
|
@ -752,8 +751,8 @@ int ED_mesh_shapes_join_objects_exec(bContext *C, wmOperator *op)
|
|||
Object *ob_active = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Mesh *me = (Mesh *)ob_active->data;
|
||||
Mesh *selme = NULL;
|
||||
Mesh *me_deformed = NULL;
|
||||
Mesh *selme = nullptr;
|
||||
Mesh *me_deformed = nullptr;
|
||||
Key *key = me->key;
|
||||
KeyBlock *kb;
|
||||
bool ok = false, nonequal_verts = false;
|
||||
|
@ -770,7 +769,7 @@ int ED_mesh_shapes_join_objects_exec(bContext *C, wmOperator *op)
|
|||
ok = true;
|
||||
}
|
||||
else {
|
||||
nonequal_verts = 1;
|
||||
nonequal_verts = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -788,12 +787,12 @@ int ED_mesh_shapes_join_objects_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (key == NULL) {
|
||||
if (key == nullptr) {
|
||||
key = me->key = BKE_key_add(bmain, (ID *)me);
|
||||
key->type = KEY_RELATIVE;
|
||||
|
||||
/* first key added, so it was the basis. initialize it with the existing mesh */
|
||||
kb = BKE_keyblock_add(key, NULL);
|
||||
kb = BKE_keyblock_add(key, nullptr);
|
||||
BKE_keyblock_convert_from_mesh(me, key, kb);
|
||||
}
|
||||
|
||||
|
@ -836,21 +835,21 @@ int ED_mesh_shapes_join_objects_exec(bContext *C, wmOperator *op)
|
|||
/** \name Mesh Topology Mirror API
|
||||
* \{ */
|
||||
|
||||
static MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
|
||||
static MirrTopoStore_t mesh_topo_store = {nullptr, -1, -1, false};
|
||||
|
||||
BLI_INLINE void mesh_mirror_topo_table_get_meshes(Object *ob,
|
||||
Mesh *me_eval,
|
||||
Mesh **r_me_mirror,
|
||||
BMEditMesh **r_em_mirror)
|
||||
{
|
||||
Mesh *me_mirror = NULL;
|
||||
BMEditMesh *em_mirror = NULL;
|
||||
Mesh *me_mirror = nullptr;
|
||||
BMEditMesh *em_mirror = nullptr;
|
||||
|
||||
Mesh *me = ob->data;
|
||||
if (me_eval != NULL) {
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
if (me_eval != nullptr) {
|
||||
me_mirror = me_eval;
|
||||
}
|
||||
else if (me->edit_mesh != NULL) {
|
||||
else if (me->edit_mesh != nullptr) {
|
||||
em_mirror = me->edit_mesh;
|
||||
}
|
||||
else {
|
||||
|
@ -893,7 +892,7 @@ static bool ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval)
|
|||
|
||||
static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *me_eval, int index)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
MVert *mvert = me_eval ? me_eval->mvert : me->mvert;
|
||||
float vec[3];
|
||||
|
||||
|
@ -902,7 +901,7 @@ static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *me_eval, int index)
|
|||
vec[1] = mvert->co[1];
|
||||
vec[2] = mvert->co[2];
|
||||
|
||||
return ED_mesh_mirror_spatial_table_lookup(ob, NULL, me_eval, vec);
|
||||
return ED_mesh_mirror_spatial_table_lookup(ob, nullptr, me_eval, vec);
|
||||
}
|
||||
|
||||
static int mesh_get_x_mirror_vert_topo(Object *ob, Mesh *mesh, int index)
|
||||
|
@ -929,28 +928,25 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c
|
|||
|
||||
/* ignore nan verts */
|
||||
if ((isfinite(co[0]) == false) || (isfinite(co[1]) == false) || (isfinite(co[2]) == false)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vec[0] = -co[0];
|
||||
vec[1] = co[1];
|
||||
vec[2] = co[2];
|
||||
|
||||
i = ED_mesh_mirror_spatial_table_lookup(ob, em, NULL, vec);
|
||||
i = ED_mesh_mirror_spatial_table_lookup(ob, em, nullptr, vec);
|
||||
if (i != -1) {
|
||||
return BM_vert_at_index(em->bm, i);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob,
|
||||
struct BMEditMesh *em,
|
||||
BMVert *eve,
|
||||
int index)
|
||||
static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, BMEditMesh *em, BMVert *eve, int index)
|
||||
{
|
||||
intptr_t poinval;
|
||||
if (!ed_mesh_mirror_topo_table_update(ob, NULL)) {
|
||||
return NULL;
|
||||
if (!ed_mesh_mirror_topo_table_update(ob, nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
|
@ -966,7 +962,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob,
|
|||
}
|
||||
|
||||
if (index == em->bm->totvert) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -975,15 +971,11 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob,
|
|||
if (poinval != -1) {
|
||||
return (BMVert *)(poinval);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BMVert *editbmesh_get_x_mirror_vert(Object *ob,
|
||||
struct BMEditMesh *em,
|
||||
BMVert *eve,
|
||||
const float co[3],
|
||||
int index,
|
||||
const bool use_topology)
|
||||
BMVert *editbmesh_get_x_mirror_vert(
|
||||
Object *ob, BMEditMesh *em, BMVert *eve, const float co[3], int index, const bool use_topology)
|
||||
{
|
||||
if (use_topology) {
|
||||
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
|
||||
|
@ -993,7 +985,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob,
|
|||
|
||||
int ED_mesh_mirror_get_vert(Object *ob, int index)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
|
||||
int index_mirr;
|
||||
|
@ -1005,7 +997,7 @@ int ED_mesh_mirror_get_vert(Object *ob, int index)
|
|||
index_mirr = eve_mirr ? BM_elem_index_get(eve_mirr) : -1;
|
||||
}
|
||||
else {
|
||||
index_mirr = mesh_get_x_mirror_vert(ob, NULL, index, use_topology);
|
||||
index_mirr = mesh_get_x_mirror_vert(ob, nullptr, index, use_topology);
|
||||
}
|
||||
|
||||
return index_mirr;
|
||||
|
@ -1022,7 +1014,7 @@ static float *editmesh_get_mirror_uv(
|
|||
|
||||
/* ignore nan verts */
|
||||
if (isnan(uv[0]) || !isfinite(uv[0]) || isnan(uv[1]) || !isfinite(uv[1])) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (axis) {
|
||||
|
@ -1062,14 +1054,14 @@ static float *editmesh_get_mirror_uv(
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static uint mirror_facehash(const void *ptr)
|
||||
{
|
||||
const MFace *mf = ptr;
|
||||
const MFace *mf = static_cast<const MFace *>(ptr);
|
||||
uint v0, v1;
|
||||
|
||||
if (mf->v4) {
|
||||
|
@ -1122,21 +1114,21 @@ static bool mirror_facecmp(const void *a, const void *b)
|
|||
|
||||
int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
MVert *mv, *mvert;
|
||||
MFace mirrormf, *mf, *hashmf, *mface;
|
||||
GHash *fhash;
|
||||
int *mirrorverts, *mirrorfaces;
|
||||
|
||||
BLI_assert(em == NULL); /* Does not work otherwise, currently... */
|
||||
BLI_assert(em == nullptr); /* Does not work otherwise, currently... */
|
||||
|
||||
const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
|
||||
const int totvert = me_eval ? me_eval->totvert : me->totvert;
|
||||
const int totface = me_eval ? me_eval->totface : me->totface;
|
||||
int a;
|
||||
|
||||
mirrorverts = MEM_callocN(sizeof(int) * totvert, "MirrorVerts");
|
||||
mirrorfaces = MEM_callocN(sizeof(int[2]) * totface, "MirrorFaces");
|
||||
mirrorverts = static_cast<int *>(MEM_callocN(sizeof(int) * totvert, "MirrorVerts"));
|
||||
mirrorfaces = static_cast<int *>(MEM_callocN(sizeof(int[2]) * totface, "MirrorFaces"));
|
||||
|
||||
mvert = me_eval ? me_eval->mvert : me->mvert;
|
||||
mface = me_eval ? me_eval->mface : me->mface;
|
||||
|
@ -1166,7 +1158,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
|
|||
SWAP(uint, mirrormf.v2, mirrormf.v4);
|
||||
}
|
||||
|
||||
hashmf = BLI_ghash_lookup(fhash, &mirrormf);
|
||||
hashmf = static_cast<MFace *>(BLI_ghash_lookup(fhash, &mirrormf));
|
||||
if (hashmf) {
|
||||
mirrorfaces[a * 2] = hashmf - mface;
|
||||
mirrorfaces[a * 2 + 1] = mirror_facerotation(&mirrormf, hashmf);
|
||||
|
@ -1176,7 +1168,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
|
|||
}
|
||||
}
|
||||
|
||||
BLI_ghash_free(fhash, NULL, NULL);
|
||||
BLI_ghash_free(fhash, nullptr, nullptr);
|
||||
MEM_freeN(mirrorverts);
|
||||
|
||||
return mirrorfaces;
|
||||
|
@ -1187,7 +1179,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
|
|||
bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index)
|
||||
{
|
||||
ViewContext vc;
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BLI_assert(me && GS(me->id.name) == ID_ME);
|
||||
|
||||
|
@ -1221,7 +1213,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px,
|
|||
|
||||
static void ed_mesh_pick_face_vert__mpoly_find(
|
||||
/* context */
|
||||
struct ARegion *region,
|
||||
ARegion *region,
|
||||
const float mval[2],
|
||||
/* mesh data (evaluated) */
|
||||
const MPoly *mp,
|
||||
|
@ -1251,14 +1243,14 @@ bool ED_mesh_pick_face_vert(
|
|||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
uint poly_index;
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BLI_assert(me && GS(me->id.name) == ID_ME);
|
||||
|
||||
if (ED_mesh_pick_face(C, ob, mval, dist_px, &poly_index)) {
|
||||
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
struct ARegion *region = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
/* derived mesh to find deformed locations */
|
||||
Mesh *me_eval = mesh_get_eval_final(
|
||||
|
@ -1267,7 +1259,7 @@ bool ED_mesh_pick_face_vert(
|
|||
int v_idx_best = ORIGINDEX_NONE;
|
||||
|
||||
/* find the vert closest to 'mval' */
|
||||
const float mval_f[2] = {UNPACK2(mval)};
|
||||
const float mval_f[2] = {(float)mval[0], (float)mval[1]};
|
||||
float len_best = FLT_MAX;
|
||||
|
||||
MPoly *me_eval_mpoly;
|
||||
|
@ -1281,7 +1273,7 @@ bool ED_mesh_pick_face_vert(
|
|||
|
||||
me_eval_mpoly_len = me_eval->totpoly;
|
||||
|
||||
const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
|
||||
const int *index_mp_to_orig = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
|
||||
|
||||
/* tag all verts using this face */
|
||||
if (index_mp_to_orig) {
|
||||
|
@ -1313,7 +1305,8 @@ bool ED_mesh_pick_face_vert(
|
|||
|
||||
/* map 'dm -> me' r_index if possible */
|
||||
if (v_idx_best != ORIGINDEX_NONE) {
|
||||
const int *index_mv_to_orig = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
|
||||
const int *index_mv_to_orig = (const int *)CustomData_get_layer(&me_eval->vdata,
|
||||
CD_ORIGINDEX);
|
||||
if (index_mv_to_orig) {
|
||||
v_idx_best = index_mv_to_orig[v_idx_best];
|
||||
}
|
||||
|
@ -1334,7 +1327,7 @@ bool ED_mesh_pick_face_vert(
|
|||
*
|
||||
* \return boolean true == Found
|
||||
*/
|
||||
typedef struct VertPickData {
|
||||
struct VertPickData {
|
||||
const MVert *mvert;
|
||||
const float *mval_f; /* [2] */
|
||||
ARegion *region;
|
||||
|
@ -1342,14 +1335,14 @@ typedef struct VertPickData {
|
|||
/* runtime */
|
||||
float len_best;
|
||||
int v_idx_best;
|
||||
} VertPickData;
|
||||
};
|
||||
|
||||
static void ed_mesh_pick_vert__mapFunc(void *userData,
|
||||
int index,
|
||||
const float co[3],
|
||||
const float UNUSED(no[3]))
|
||||
{
|
||||
VertPickData *data = userData;
|
||||
VertPickData *data = static_cast<VertPickData *>(userData);
|
||||
if ((data->mvert[index].flag & ME_HIDE) == 0) {
|
||||
float sco[2];
|
||||
|
||||
|
@ -1367,7 +1360,7 @@ bool ED_mesh_pick_vert(
|
|||
bContext *C, Object *ob, const int mval[2], uint dist_px, bool use_zbuf, uint *r_index)
|
||||
{
|
||||
ViewContext vc;
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BLI_assert(me && GS(me->id.name) == ID_ME);
|
||||
|
||||
|
@ -1404,16 +1397,16 @@ bool ED_mesh_pick_vert(
|
|||
/* derived mesh to find deformed locations */
|
||||
Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
|
||||
ARegion *region = vc.region;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
|
||||
/* find the vert closest to 'mval' */
|
||||
const float mval_f[2] = {(float)mval[0], (float)mval[1]};
|
||||
|
||||
VertPickData data = {NULL};
|
||||
VertPickData data = {nullptr};
|
||||
|
||||
ED_view3d_init_mats_rv3d(ob, rv3d);
|
||||
|
||||
if (me_eval == NULL) {
|
||||
if (me_eval == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1439,7 +1432,7 @@ bool ED_mesh_pick_vert(
|
|||
MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
|
||||
{
|
||||
if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
if (!BLI_listbase_is_empty(&me->vertex_group_names)) {
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
|
||||
|
@ -1451,27 +1444,27 @@ MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
|
|||
if (r_eve) {
|
||||
*r_eve = eve;
|
||||
}
|
||||
return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset);
|
||||
return static_cast<MDeformVert *>(BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r_eve) {
|
||||
*r_eve = NULL;
|
||||
*r_eve = nullptr;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
int index = BKE_mesh_mselect_active_get(me, ME_VSEL);
|
||||
if (r_index) {
|
||||
*r_index = index;
|
||||
}
|
||||
if (index == -1 || me->dvert == NULL) {
|
||||
return NULL;
|
||||
if (index == -1 || me->dvert == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return me->dvert + index;
|
||||
}
|
||||
|
@ -1480,14 +1473,14 @@ MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
|
|||
{
|
||||
if (ob->type == OB_MESH) {
|
||||
if (ob->mode & OB_MODE_EDIT) {
|
||||
return ED_mesh_active_dvert_get_em(ob, NULL);
|
||||
return ED_mesh_active_dvert_get_em(ob, nullptr);
|
||||
}
|
||||
return ED_mesh_active_dvert_get_ob(ob, NULL);
|
||||
return ED_mesh_active_dvert_get_ob(ob, nullptr);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EDBM_mesh_stats_multi(struct Object **objects,
|
||||
void EDBM_mesh_stats_multi(Object **objects,
|
||||
const uint objects_len,
|
||||
int totelem[3],
|
||||
int totelem_sel[3])
|
Loading…
Reference in New Issue