Cleanup: rename Mesh.edit_btmesh -> edit_mesh
When bmesh was in a branch we had both edit_mesh and edit_btmesh, now there is no reason to use this odd name.
This commit is contained in:
parent
203b964ff4
commit
e0e6229176
|
@ -1909,11 +1909,11 @@ static void editbmesh_calc_modifiers(
|
|||
* check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential
|
||||
* but quiets annoying error messages since tessfaces wont be created. */
|
||||
if (dataMask & CD_MASK_MFACE) {
|
||||
if ((*r_final)->edit_btmesh == NULL) {
|
||||
if ((*r_final)->edit_mesh == NULL) {
|
||||
BKE_mesh_tessface_ensure(*r_final);
|
||||
}
|
||||
if (r_cage && *r_cage) {
|
||||
if ((*r_cage)->edit_btmesh == NULL) {
|
||||
if ((*r_cage)->edit_mesh == NULL) {
|
||||
if (*r_cage != *r_final) {
|
||||
BKE_mesh_tessface_ensure(*r_cage);
|
||||
}
|
||||
|
@ -1971,7 +1971,7 @@ static void mesh_finalize_eval(Object *object)
|
|||
/* Make evaluated mesh to share same edit mesh pointer as original
|
||||
* and copied meshes.
|
||||
*/
|
||||
mesh_eval->edit_btmesh = mesh->edit_btmesh;
|
||||
mesh_eval->edit_mesh = mesh->edit_mesh;
|
||||
/* Copy autosmooth settings from original mesh.
|
||||
* This is not done by BKE_mesh_new_nomain_from_template(), so need to take
|
||||
* extra care here.
|
||||
|
|
|
@ -99,18 +99,18 @@ float (*BKE_crazyspace_get_mapped_editverts(
|
|||
Mesh *me = obedit->data;
|
||||
Mesh *me_eval;
|
||||
float (*vertexcos)[3];
|
||||
int nverts = me->edit_btmesh->bm->totvert;
|
||||
int nverts = me->edit_mesh->bm->totvert;
|
||||
|
||||
/* disable subsurf temporal, get mapped cos, and enable it */
|
||||
if (modifiers_disable_subsurf_temporary(obedit)) {
|
||||
/* need to make new derivemesh */
|
||||
makeDerivedMesh(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, false);
|
||||
makeDerivedMesh(depsgraph, scene, obedit, me->edit_mesh, CD_MASK_BAREMESH, false);
|
||||
}
|
||||
|
||||
/* now get the cage */
|
||||
vertexcos = MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map");
|
||||
|
||||
me_eval = editbmesh_get_eval_cage_from_orig(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
|
||||
me_eval = editbmesh_get_eval_cage_from_orig(depsgraph, scene, obedit, me->edit_mesh, CD_MASK_BAREMESH);
|
||||
|
||||
mesh_get_mapped_verts_coords(me_eval, vertexcos, nverts);
|
||||
|
||||
|
|
|
@ -83,12 +83,12 @@ BMEditMesh *BKE_editmesh_from_object(Object *ob)
|
|||
/* sanity check */
|
||||
#if 0 /* disable in mutlti-object edit. */
|
||||
#ifndef NDEBUG
|
||||
if (((Mesh *)ob->data)->edit_btmesh) {
|
||||
BLI_assert(((Mesh *)ob->data)->edit_btmesh->ob == ob);
|
||||
if (((Mesh *)ob->data)->edit_mesh) {
|
||||
BLI_assert(((Mesh *)ob->data)->edit_mesh->ob == ob);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return ((Mesh *)ob->data)->edit_btmesh;
|
||||
return ((Mesh *)ob->data)->edit_mesh;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -514,11 +514,11 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
|
|||
|
||||
me = (Mesh *)key->from;
|
||||
|
||||
if (me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) {
|
||||
if (me->edit_mesh && me->edit_mesh->bm->totvert == kb->totelem) {
|
||||
a = 0;
|
||||
co = MEM_mallocN(sizeof(float) * 3 * me->edit_btmesh->bm->totvert, "key_block_get_data");
|
||||
co = MEM_mallocN(sizeof(float) * 3 * me->edit_mesh->bm->totvert, "key_block_get_data");
|
||||
|
||||
BM_ITER_MESH (eve, &iter, me->edit_btmesh->bm, BM_VERTS_OF_MESH) {
|
||||
BM_ITER_MESH (eve, &iter, me->edit_mesh->bm, BM_VERTS_OF_MESH) {
|
||||
copy_v3_v3(co[a], eve->co);
|
||||
a++;
|
||||
}
|
||||
|
@ -1052,8 +1052,8 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac
|
|||
dvert = me->dvert;
|
||||
totvert = me->totvert;
|
||||
|
||||
if (me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
|
||||
em = me->edit_btmesh;
|
||||
if (me->edit_mesh && me->edit_mesh->bm->totvert == totvert)
|
||||
em = me->edit_mesh;
|
||||
}
|
||||
else if (ob->type == OB_LATTICE) {
|
||||
Lattice *lt = ob->data;
|
||||
|
|
|
@ -96,7 +96,7 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)
|
|||
{
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
if (em != NULL) {
|
||||
if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) {
|
||||
return true;
|
||||
|
@ -110,7 +110,7 @@ bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_dat
|
|||
{
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
if (em != NULL) {
|
||||
if (em->bm->totedge != 0) {
|
||||
return true;
|
||||
|
|
|
@ -330,7 +330,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
|
|||
|
||||
void BKE_mesh_ensure_skin_customdata(Mesh *me)
|
||||
{
|
||||
BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
|
||||
BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
|
||||
MVertSkin *vs;
|
||||
|
||||
if (bm) {
|
||||
|
@ -369,7 +369,7 @@ void BKE_mesh_ensure_skin_customdata(Mesh *me)
|
|||
|
||||
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
|
||||
{
|
||||
BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
|
||||
BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
|
||||
bool changed = false;
|
||||
if (bm) {
|
||||
if (!CustomData_has_layer(&bm->pdata, CD_FACEMAP)) {
|
||||
|
@ -393,7 +393,7 @@ bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
|
|||
|
||||
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me)
|
||||
{
|
||||
BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
|
||||
BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
|
||||
bool changed = false;
|
||||
if (bm) {
|
||||
if (CustomData_has_layer(&bm->pdata, CD_FACEMAP)) {
|
||||
|
@ -447,8 +447,8 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd)
|
|||
|
||||
bool BKE_mesh_has_custom_loop_normals(Mesh *me)
|
||||
{
|
||||
if (me->edit_btmesh) {
|
||||
return CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
if (me->edit_mesh) {
|
||||
return CustomData_has_layer(&me->edit_mesh->bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
}
|
||||
else {
|
||||
return CustomData_has_layer(&me->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
|
@ -471,7 +471,7 @@ void BKE_mesh_free(Mesh *me)
|
|||
MEM_SAFE_FREE(me->mat);
|
||||
MEM_SAFE_FREE(me->bb);
|
||||
MEM_SAFE_FREE(me->mselect);
|
||||
MEM_SAFE_FREE(me->edit_btmesh);
|
||||
MEM_SAFE_FREE(me->edit_mesh);
|
||||
}
|
||||
|
||||
static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
|
||||
|
@ -557,7 +557,7 @@ void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int
|
|||
|
||||
BKE_mesh_update_customdata_pointers(me_dst, do_tessface);
|
||||
|
||||
me_dst->edit_btmesh = NULL;
|
||||
me_dst->edit_mesh = NULL;
|
||||
|
||||
me_dst->mselect = MEM_dupallocN(me_dst->mselect);
|
||||
me_dst->bb = MEM_dupallocN(me_dst->bb);
|
||||
|
@ -772,8 +772,8 @@ bool BKE_mesh_uv_cdlayer_rename_index(
|
|||
CustomData *ldata, *fdata;
|
||||
CustomDataLayer *cdlu, *cdlf;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
ldata = &me->edit_btmesh->bm->ldata;
|
||||
if (me->edit_mesh) {
|
||||
ldata = &me->edit_mesh->bm->ldata;
|
||||
fdata = NULL; /* No tessellated data in BMesh! */
|
||||
}
|
||||
else {
|
||||
|
@ -805,8 +805,8 @@ bool BKE_mesh_uv_cdlayer_rename_index(
|
|||
bool BKE_mesh_uv_cdlayer_rename(Mesh *me, const char *old_name, const char *new_name, bool do_tessface)
|
||||
{
|
||||
CustomData *ldata, *fdata;
|
||||
if (me->edit_btmesh) {
|
||||
ldata = &me->edit_btmesh->bm->ldata;
|
||||
if (me->edit_mesh) {
|
||||
ldata = &me->edit_mesh->bm->ldata;
|
||||
/* No tessellated data in BMesh! */
|
||||
fdata = NULL;
|
||||
do_tessface = false;
|
||||
|
@ -1145,8 +1145,8 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r
|
|||
n = remap[n]; \
|
||||
} ((void)0)
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMIter iter;
|
||||
BMFace *efa;
|
||||
|
||||
|
@ -1547,8 +1547,8 @@ void BKE_mesh_mselect_active_set(Mesh *me, int index, int type)
|
|||
void BKE_mesh_count_selected_items(const Mesh *mesh, int r_count[3])
|
||||
{
|
||||
r_count[0] = r_count[1] = r_count[2] = 0;
|
||||
if (mesh->edit_btmesh) {
|
||||
BMesh *bm = mesh->edit_btmesh->bm;
|
||||
if (mesh->edit_mesh) {
|
||||
BMesh *bm = mesh->edit_mesh->bm;
|
||||
r_count[0] = bm->totvertsel;
|
||||
r_count[1] = bm->totedgesel;
|
||||
r_count[2] = bm->totfacesel;
|
||||
|
|
|
@ -79,8 +79,8 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
|
|||
|
||||
void multires_customdata_delete(Mesh *me)
|
||||
{
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
/* CustomData_external_remove is used here only to mark layer
|
||||
* as non-external for further free-ing, so zero element count
|
||||
* looks safer than em->totface */
|
||||
|
@ -469,8 +469,8 @@ void multiresModifier_set_levels_from_disps(MultiresModifierData *mmd, Object *o
|
|||
Mesh *me = ob->data;
|
||||
MDisps *mdisp;
|
||||
|
||||
if (me->edit_btmesh)
|
||||
mdisp = CustomData_get_layer(&me->edit_btmesh->bm->ldata, CD_MDISPS);
|
||||
if (me->edit_mesh)
|
||||
mdisp = CustomData_get_layer(&me->edit_mesh->bm->ldata, CD_MDISPS);
|
||||
else
|
||||
mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
|
||||
|
||||
|
|
|
@ -465,7 +465,7 @@ void BKE_object_free_derived_caches(Object *ob)
|
|||
ob->data = ob->runtime.mesh_orig;
|
||||
}
|
||||
/* Evaluated mesh points to edit mesh, but does not own it. */
|
||||
mesh_eval->edit_btmesh = NULL;
|
||||
mesh_eval->edit_mesh = NULL;
|
||||
BKE_mesh_free(mesh_eval);
|
||||
BKE_libblock_free_data(&mesh_eval->id, false);
|
||||
MEM_freeN(mesh_eval);
|
||||
|
@ -613,7 +613,7 @@ bool BKE_object_is_in_editmode(const Object *ob)
|
|||
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
return ((Mesh *)ob->data)->edit_btmesh != NULL;
|
||||
return ((Mesh *)ob->data)->edit_mesh != NULL;
|
||||
case OB_ARMATURE:
|
||||
return ((bArmature *)ob->data)->edbo != NULL;
|
||||
case OB_FONT:
|
||||
|
@ -642,7 +642,7 @@ bool BKE_object_data_is_in_editmode(const ID *id)
|
|||
BLI_assert(OB_DATA_SUPPORT_EDITMODE(type));
|
||||
switch (type) {
|
||||
case ID_ME:
|
||||
return ((const Mesh *)id)->edit_btmesh != NULL;
|
||||
return ((const Mesh *)id)->edit_mesh != NULL;
|
||||
case ID_CU:
|
||||
return (
|
||||
(((const Curve *)id)->editnurb != NULL) ||
|
||||
|
@ -665,7 +665,7 @@ bool BKE_object_is_in_wpaint_select_vert(const Object *ob)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
return ((ob->mode & OB_MODE_WEIGHT_PAINT) &&
|
||||
(me->edit_btmesh == NULL) &&
|
||||
(me->edit_mesh == NULL) &&
|
||||
(ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX));
|
||||
}
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
|
||||
if (par->type == OB_MESH) {
|
||||
Mesh *me = par->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
Mesh *me_eval = (em) ? em->mesh_eval_final : par->runtime.mesh_eval;
|
||||
|
||||
if (me_eval) {
|
||||
|
|
|
@ -173,8 +173,8 @@ bool BKE_object_defgroup_clear(Object *ob, bDeformGroup *dg, const bool use_sele
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
|
||||
|
||||
if (cd_dvert_offset != -1) {
|
||||
|
@ -353,7 +353,7 @@ static void object_defgroup_remove_edit_mode(Object *ob, bDeformGroup *dg)
|
|||
/* Else, make sure that any groups with higher indices are adjusted accordingly */
|
||||
else if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
|
||||
|
||||
BMIter iter;
|
||||
|
|
|
@ -305,7 +305,7 @@ static const DupliGenerator gen_dupli_collection = {
|
|||
/* OB_DUPLIVERTS */
|
||||
typedef struct VertexDupliData {
|
||||
Mesh *me_eval;
|
||||
BMEditMesh *edit_btmesh;
|
||||
BMEditMesh *edit_mesh;
|
||||
int totvert;
|
||||
float (*orco)[3];
|
||||
bool use_rotation;
|
||||
|
@ -396,14 +396,14 @@ static void make_duplis_verts(const DupliContext *ctx)
|
|||
|
||||
/* gather mesh info */
|
||||
{
|
||||
vdd.edit_btmesh = BKE_editmesh_from_object(parent);
|
||||
vdd.edit_mesh = BKE_editmesh_from_object(parent);
|
||||
|
||||
/* We do not need any render-specific handling anymore, depsgraph takes care of that. */
|
||||
/* NOTE: Do direct access to the evaluated mesh: this function is used
|
||||
* during meta balls evaluation. But even without those all the objects
|
||||
* which are needed for correct instancing are already evaluated. */
|
||||
if (vdd.edit_btmesh != NULL) {
|
||||
vdd.me_eval = vdd.edit_btmesh->mesh_eval_cage;
|
||||
if (vdd.edit_mesh != NULL) {
|
||||
vdd.me_eval = vdd.edit_mesh->mesh_eval_cage;
|
||||
}
|
||||
else {
|
||||
vdd.me_eval = parent->runtime.mesh_eval;
|
||||
|
|
|
@ -132,8 +132,8 @@ static void object_fmap_remove_edit_mode(Object *ob, bFaceMap *fmap, bool do_sel
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_fmap_offset = CustomData_get_offset(&em->bm->pdata, CD_FACEMAP);
|
||||
|
||||
if (cd_fmap_offset != -1) {
|
||||
|
|
|
@ -162,7 +162,7 @@ void BKE_object_handle_data_update(
|
|||
#if 0
|
||||
BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? BKE_editmesh_from_object(ob) : NULL;
|
||||
#else
|
||||
BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? ((Mesh *)ob->data)->edit_btmesh : NULL;
|
||||
BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? ((Mesh *)ob->data)->edit_mesh : NULL;
|
||||
if (em && em->ob != ob) {
|
||||
em = NULL;
|
||||
}
|
||||
|
|
|
@ -1453,7 +1453,7 @@ static void prepare_mesh_for_viewport_render(
|
|||
(mesh->id.recalc & ID_RECALC_ALL)))
|
||||
{
|
||||
if (check_rendered_viewport_visible(bmain)) {
|
||||
BMesh *bm = mesh->edit_btmesh->bm;
|
||||
BMesh *bm = mesh->edit_mesh->bm;
|
||||
BM_mesh_bm_to_me(
|
||||
bmain, bm, mesh,
|
||||
(&(struct BMeshToMeshParams){
|
||||
|
|
|
@ -4717,7 +4717,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
|||
direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
|
||||
|
||||
mesh->bb = NULL;
|
||||
mesh->edit_btmesh = NULL;
|
||||
mesh->edit_mesh = NULL;
|
||||
BKE_mesh_runtime_reset(mesh);
|
||||
|
||||
/* happens with old files */
|
||||
|
|
|
@ -520,22 +520,22 @@ void update_lattice_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
|
|||
void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph,
|
||||
const ID *id_orig, ID *id_cow)
|
||||
{
|
||||
/* For meshes we need to update edit_btmesh to make it to point
|
||||
/* For meshes we need to update edit_mesh to make it to point
|
||||
* to the CoW version of object.
|
||||
*
|
||||
* This is kind of confusing, because actual bmesh is not owned by
|
||||
* the CoW object, so need to be accurate about using link from
|
||||
* edit_btmesh to object. */
|
||||
* edit_mesh to object. */
|
||||
const Mesh *mesh_orig = (const Mesh *)id_orig;
|
||||
Mesh *mesh_cow = (Mesh *)id_cow;
|
||||
if (mesh_orig->edit_btmesh == NULL) {
|
||||
if (mesh_orig->edit_mesh == NULL) {
|
||||
return;
|
||||
}
|
||||
mesh_cow->edit_btmesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_btmesh);
|
||||
mesh_cow->edit_btmesh->ob =
|
||||
(Object *)depsgraph->get_cow_id(&mesh_orig->edit_btmesh->ob->id);
|
||||
mesh_cow->edit_btmesh->mesh_eval_cage = NULL;
|
||||
mesh_cow->edit_btmesh->mesh_eval_final = NULL;
|
||||
mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh);
|
||||
mesh_cow->edit_mesh->ob =
|
||||
(Object *)depsgraph->get_cow_id(&mesh_orig->edit_mesh->ob->id);
|
||||
mesh_cow->edit_mesh->mesh_eval_cage = NULL;
|
||||
mesh_cow->edit_mesh->mesh_eval_final = NULL;
|
||||
}
|
||||
|
||||
/* Edit data is stored and owned by original datablocks, copied ones
|
||||
|
@ -850,10 +850,10 @@ static void deg_restore_object_runtime(
|
|||
/* Do same thing as object update: override actual object data
|
||||
* pointer with evaluated datablock. */
|
||||
object->data = mesh_eval;
|
||||
/* Evaluated mesh simply copied edit_btmesh pointer from
|
||||
/* Evaluated mesh simply copied edit_mesh pointer from
|
||||
* original mesh during update, need to make sure no dead
|
||||
* pointers are left behind. */
|
||||
mesh_eval->edit_btmesh = mesh_orig->edit_btmesh;
|
||||
mesh_eval->edit_mesh = mesh_orig->edit_mesh;
|
||||
}
|
||||
}
|
||||
object->base_flag = object_runtime_backup->base_flag;
|
||||
|
@ -992,12 +992,12 @@ void discard_lattice_edit_mode_pointers(ID *id_cow)
|
|||
void discard_mesh_edit_mode_pointers(ID *id_cow)
|
||||
{
|
||||
Mesh *mesh_cow = (Mesh *)id_cow;
|
||||
if (mesh_cow->edit_btmesh == NULL) {
|
||||
if (mesh_cow->edit_mesh == NULL) {
|
||||
return;
|
||||
}
|
||||
BKE_editmesh_free_derivedmesh(mesh_cow->edit_btmesh);
|
||||
MEM_freeN(mesh_cow->edit_btmesh);
|
||||
mesh_cow->edit_btmesh = NULL;
|
||||
BKE_editmesh_free_derivedmesh(mesh_cow->edit_mesh);
|
||||
MEM_freeN(mesh_cow->edit_mesh);
|
||||
mesh_cow->edit_mesh = NULL;
|
||||
}
|
||||
|
||||
void discard_scene_pointers(ID *id_cow)
|
||||
|
|
|
@ -88,22 +88,22 @@ enum {
|
|||
|
||||
static int mesh_render_verts_len_get(Mesh *me)
|
||||
{
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totvert : me->totvert;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totvert : me->totvert;
|
||||
}
|
||||
|
||||
static int mesh_render_edges_len_get(Mesh *me)
|
||||
{
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totedge : me->totedge;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totedge : me->totedge;
|
||||
}
|
||||
|
||||
static int mesh_render_looptri_len_get(Mesh *me)
|
||||
{
|
||||
return me->edit_btmesh ? me->edit_btmesh->tottri : poly_to_tri_count(me->totpoly, me->totloop);
|
||||
return me->edit_mesh ? me->edit_mesh->tottri : poly_to_tri_count(me->totpoly, me->totloop);
|
||||
}
|
||||
|
||||
static int mesh_render_polys_len_get(Mesh *me)
|
||||
{
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totface : me->totpoly;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totface : me->totpoly;
|
||||
}
|
||||
|
||||
static int mesh_render_mat_len_get(Mesh *me)
|
||||
|
@ -113,7 +113,7 @@ static int mesh_render_mat_len_get(Mesh *me)
|
|||
|
||||
static int UNUSED_FUNCTION(mesh_render_loops_len_get)(Mesh *me)
|
||||
{
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totloop : me->totloop;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totloop : me->totloop;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -345,7 +345,7 @@ static void mesh_cd_layers_type_merge(
|
|||
static void mesh_cd_calc_active_uv_layer(
|
||||
const Mesh *me, ushort cd_lused[CD_NUMTYPES])
|
||||
{
|
||||
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
|
||||
const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
||||
|
||||
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
|
||||
if (layer != -1) {
|
||||
|
@ -356,7 +356,7 @@ static void mesh_cd_calc_active_uv_layer(
|
|||
static void mesh_cd_calc_active_vcol_layer(
|
||||
const Mesh *me, ushort cd_lused[CD_NUMTYPES])
|
||||
{
|
||||
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
|
||||
const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
||||
|
||||
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL);
|
||||
if (layer != -1) {
|
||||
|
@ -368,7 +368,7 @@ static void mesh_cd_calc_used_gpu_layers(
|
|||
const Mesh *me, uchar cd_vused[CD_NUMTYPES], ushort cd_lused[CD_NUMTYPES],
|
||||
struct GPUMaterial **gpumat_array, int gpumat_array_len)
|
||||
{
|
||||
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
|
||||
const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
||||
|
||||
/* See: DM_vertex_attributes_from_gpu for similar logic */
|
||||
GPUVertAttrLayers gpu_attrs = {{{0}}};
|
||||
|
@ -499,7 +499,7 @@ static void mesh_cd_extract_auto_layers_names_and_srgb(
|
|||
Mesh *me, const ushort cd_lused[CD_NUMTYPES],
|
||||
char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len)
|
||||
{
|
||||
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
|
||||
const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
||||
|
||||
int uv_len_used = count_bits_i(cd_lused[CD_MLOOPUV]);
|
||||
int vcol_len_used = count_bits_i(cd_lused[CD_MLOOPCOL]);
|
||||
|
@ -563,8 +563,8 @@ static MeshRenderData *mesh_render_data_create_ex(
|
|||
const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0;
|
||||
const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *embm = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
BMesh *bm = embm->bm;
|
||||
|
||||
rdata->edit_bmesh = embm;
|
||||
|
@ -792,8 +792,8 @@ static MeshRenderData *mesh_render_data_create_ex(
|
|||
|
||||
BLI_assert(cd_vused != NULL && cd_lused != NULL);
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
if (me->edit_mesh) {
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
cd_vdata = &bm->vdata;
|
||||
cd_ldata = &bm->ldata;
|
||||
}
|
||||
|
@ -823,8 +823,8 @@ static MeshRenderData *mesh_render_data_create_ex(
|
|||
/* If orco is not available compute it ourselves */
|
||||
if (!rdata->orco) {
|
||||
rdata->is_orco_allocated = true;
|
||||
if (me->edit_btmesh) {
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
if (me->edit_mesh) {
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
rdata->orco = MEM_mallocN(sizeof(*rdata->orco) * rdata->vert_len, "orco mesh");
|
||||
BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
|
||||
for (int i = 0; i < bm->totvert; i++) {
|
||||
|
@ -1070,12 +1070,12 @@ static MeshRenderData *mesh_render_data_create_ex(
|
|||
#define MBC_GET_FINAL_MESH(me) \
|
||||
/* Hack to show the final result. */ \
|
||||
const bool _use_em_final = ( \
|
||||
(me)->edit_btmesh && \
|
||||
(me)->edit_btmesh->mesh_eval_final && \
|
||||
((me)->edit_btmesh->mesh_eval_final->runtime.is_original == false)); \
|
||||
(me)->edit_mesh && \
|
||||
(me)->edit_mesh->mesh_eval_final && \
|
||||
((me)->edit_mesh->mesh_eval_final->runtime.is_original == false)); \
|
||||
Mesh _me_fake; \
|
||||
if (_use_em_final) { \
|
||||
_me_fake = *(me)->edit_btmesh->mesh_eval_final; \
|
||||
_me_fake = *(me)->edit_mesh->mesh_eval_final; \
|
||||
_me_fake.mat = (me)->mat; \
|
||||
_me_fake.totcol = (me)->totcol; \
|
||||
(me) = &_me_fake; \
|
||||
|
@ -1884,7 +1884,7 @@ static bool mesh_batch_cache_valid(Mesh *me)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (cache->is_editmode != (me->edit_btmesh != NULL)) {
|
||||
if (cache->is_editmode != (me->edit_mesh != NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ static void mesh_batch_cache_init(Mesh *me)
|
|||
memset(cache, 0, sizeof(*cache));
|
||||
}
|
||||
|
||||
cache->is_editmode = me->edit_btmesh != NULL;
|
||||
cache->is_editmode = me->edit_mesh != NULL;
|
||||
|
||||
if (cache->is_editmode == false) {
|
||||
cache->edge_len = mesh_render_edges_len_get(me);
|
||||
|
|
|
@ -545,7 +545,7 @@ static void edit_mesh_add_ob_to_pass(
|
|||
bool has_edit_mesh_cage = false;
|
||||
/* TODO: Should be its own function. */
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
BMEditMesh *embm = me->edit_btmesh;
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
if (embm) {
|
||||
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
|
|||
struct DRWTextStore *dt = DRW_text_cache_ensure();
|
||||
const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | (unit->system ? 0 : DRW_TEXT_CACHE_ASCII);
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
|
||||
char numstr[32]; /* Stores the measurement display text here */
|
||||
size_t numstr_len;
|
||||
|
|
|
@ -2961,7 +2961,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
bool has_edit_mesh_cage = false;
|
||||
/* TODO: Should be its own function. */
|
||||
if (is_edit_mode) {
|
||||
BMEditMesh *embm = me->edit_btmesh;
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
|
||||
}
|
||||
if (!is_edit_mode ||
|
||||
|
|
|
@ -253,7 +253,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
|
|||
if (ob->type == OB_MESH) {
|
||||
/* TODO: Should be its own function. */
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
BMEditMesh *embm = me->edit_btmesh;
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
if (embm) {
|
||||
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
|
|||
|
||||
static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
|
||||
{
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
|
||||
switch (edge_mode) {
|
||||
case EDGE_MODE_TAG_CREASE:
|
||||
|
|
|
@ -3067,7 +3067,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
|
|||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
Object *obedit = objects[ob_index];
|
||||
Mesh *me = obedit->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
|
||||
if (em->bm->totvertsel == 0) {
|
||||
continue;
|
||||
|
@ -3128,7 +3128,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
|
|||
Mesh *me_ref = obedit_ref->data;
|
||||
Key *key_ref = me_ref->key;
|
||||
KeyBlock *kb_ref = NULL;
|
||||
BMEditMesh *em_ref = me_ref->edit_btmesh;
|
||||
BMEditMesh *em_ref = me_ref->edit_mesh;
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
@ -3164,7 +3164,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
|
|||
Mesh *me = obedit->data;
|
||||
Key *key = me->key;
|
||||
KeyBlock *kb = NULL;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
int shape;
|
||||
|
||||
if (em->bm->totvertsel == 0) {
|
||||
|
@ -3742,7 +3742,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
|
|||
BM_mesh_bm_to_me(bmain, bm_new, base_new->object->data, (&(struct BMeshToMeshParams){0}));
|
||||
|
||||
BM_mesh_free(bm_new);
|
||||
((Mesh *)base_new->object->data)->edit_btmesh = NULL;
|
||||
((Mesh *)base_new->object->data)->edit_mesh = NULL;
|
||||
|
||||
return base_new;
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ static Object *editmesh_object_from_context(bContext *C)
|
|||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit && obedit->type == OB_MESH) {
|
||||
Mesh *me = obedit->data;
|
||||
if (me->edit_btmesh != NULL) {
|
||||
if (me->edit_mesh != NULL) {
|
||||
return obedit;
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ static bool mesh_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bma
|
|||
|
||||
elem->obedit_ref.ptr = ob;
|
||||
Mesh *me = elem->obedit_ref.ptr->data;
|
||||
undomesh_from_editmesh(&elem->data, me->edit_btmesh, me->key);
|
||||
undomesh_from_editmesh(&elem->data, me->edit_mesh, me->key);
|
||||
us->step.data_size += elem->data.undo_size;
|
||||
}
|
||||
MEM_freeN(objects);
|
||||
|
@ -733,13 +733,13 @@ static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bma
|
|||
MeshUndoStep_Elem *elem = &us->elems[i];
|
||||
Object *obedit = elem->obedit_ref.ptr;
|
||||
Mesh *me = obedit->data;
|
||||
if (me->edit_btmesh == NULL) {
|
||||
if (me->edit_mesh == NULL) {
|
||||
/* Should never fail, may not crash but can give odd behavior. */
|
||||
CLOG_ERROR(&LOG, "name='%s', failed to enter edit-mode for object '%s', undo state invalid",
|
||||
us_p->name, obedit->id.name);
|
||||
continue;
|
||||
}
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
undomesh_to_editmesh(&elem->data, em, obedit->data);
|
||||
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
|
|
|
@ -296,26 +296,26 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
|
|||
me, ob, add_key_index,
|
||||
&((struct BMeshCreateParams){.use_toolflags = true,}));
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
if (me->edit_mesh) {
|
||||
/* this happens when switching shape keys */
|
||||
EDBM_mesh_free(me->edit_btmesh);
|
||||
MEM_freeN(me->edit_btmesh);
|
||||
EDBM_mesh_free(me->edit_mesh);
|
||||
MEM_freeN(me->edit_mesh);
|
||||
}
|
||||
|
||||
/* currently executing operators re-tessellates, so we can avoid doing here
|
||||
* but at some point it may need to be added back. */
|
||||
#if 0
|
||||
me->edit_btmesh = BKE_editmesh_create(bm, true);
|
||||
me->edit_mesh = BKE_editmesh_create(bm, true);
|
||||
#else
|
||||
me->edit_btmesh = BKE_editmesh_create(bm, false);
|
||||
me->edit_mesh = BKE_editmesh_create(bm, false);
|
||||
#endif
|
||||
|
||||
me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = select_mode;
|
||||
me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
|
||||
me->edit_btmesh->ob = ob;
|
||||
me->edit_mesh->selectmode = me->edit_mesh->bm->selectmode = select_mode;
|
||||
me->edit_mesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
|
||||
me->edit_mesh->ob = ob;
|
||||
|
||||
/* we need to flush selection because the mode may have changed from when last in editmode */
|
||||
EDBM_selectmode_flush(me->edit_btmesh);
|
||||
EDBM_selectmode_flush(me->edit_mesh);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,7 +325,7 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
|
|||
void EDBM_mesh_load(Main *bmain, Object *ob)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
|
||||
/* Workaround for T42360, 'ob->shapenr' should be 1 in this case.
|
||||
* however this isn't synchronized between objects at the moment. */
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_tot)
|
||||
{
|
||||
CustomData *data;
|
||||
BMesh *bm = (me->edit_btmesh) ? me->edit_btmesh->bm : NULL;
|
||||
BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : NULL;
|
||||
int tot;
|
||||
|
||||
/* this */
|
||||
|
@ -113,7 +113,7 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
|
|||
return data;
|
||||
}
|
||||
|
||||
#define GET_CD_DATA(me, data) ((me)->edit_btmesh ? &(me)->edit_btmesh->bm->data : &(me)->data)
|
||||
#define GET_CD_DATA(me, data) ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)
|
||||
static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
|
||||
{
|
||||
const int type = layer->type;
|
||||
|
@ -125,8 +125,8 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
|
|||
n = (layer - &data->layers[layer_index]);
|
||||
BLI_assert(n >= 0 && (n + layer_index) < data->totlayer);
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
|
||||
if (me->edit_mesh) {
|
||||
BM_data_layer_free_n(me->edit_mesh->bm, data, type, n);
|
||||
}
|
||||
else {
|
||||
CustomData_free_layer(data, type, tot, layer_index + n);
|
||||
|
@ -204,7 +204,7 @@ static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv)
|
|||
/* without bContext, called in uvedit */
|
||||
void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
|
||||
{
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
|
||||
if (em) {
|
||||
/* Collect BMesh UVs */
|
||||
|
@ -256,8 +256,8 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
|
|||
|
||||
bool is_init = false;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
em = me->edit_mesh;
|
||||
|
||||
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
|
||||
if (layernum_dst >= MAX_MTFACE)
|
||||
|
@ -315,8 +315,8 @@ void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
|
|||
BMEditMesh *em;
|
||||
int layernum_dst;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
em = me->edit_mesh;
|
||||
|
||||
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
|
||||
if (layernum_dst == 0)
|
||||
|
@ -381,8 +381,8 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
|
|||
BMEditMesh *em;
|
||||
int layernum;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
em = me->edit_mesh;
|
||||
|
||||
layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
|
||||
if (layernum >= MAX_MCOL) {
|
||||
|
@ -431,7 +431,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
|
|||
|
||||
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
|
||||
{
|
||||
BLI_assert(me->edit_btmesh == NULL);
|
||||
BLI_assert(me->edit_mesh == NULL);
|
||||
|
||||
if (!me->mloopcol && me->totloop) {
|
||||
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
|
||||
|
@ -625,8 +625,8 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
|
|||
BLI_assert(CustomData_layertype_is_singleton(type) == true);
|
||||
|
||||
if (CustomData_has_layer(data, type)) {
|
||||
if (me->edit_btmesh) {
|
||||
BM_data_layer_free(me->edit_btmesh->bm, data, type);
|
||||
if (me->edit_mesh) {
|
||||
BM_data_layer_free(me->edit_mesh->bm, data, type);
|
||||
}
|
||||
else {
|
||||
CustomData_free_layers(data, type, tot);
|
||||
|
@ -783,13 +783,13 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
|
|||
if (!BKE_mesh_has_custom_loop_normals(me)) {
|
||||
CustomData *data = GET_CD_DATA(me, ldata);
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
if (me->edit_mesh) {
|
||||
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
|
||||
if (me->flag & ME_AUTOSMOOTH) {
|
||||
BM_edges_sharp_from_angle_set(me->edit_btmesh->bm, me->smoothresh);
|
||||
BM_edges_sharp_from_angle_set(me->edit_mesh->bm, me->smoothresh);
|
||||
}
|
||||
|
||||
BM_data_layer_add(me->edit_btmesh->bm, data, CD_CUSTOMLOOPNORMAL);
|
||||
BM_data_layer_add(me->edit_mesh->bm, data, CD_CUSTOMLOOPNORMAL);
|
||||
}
|
||||
else {
|
||||
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
|
||||
|
@ -1088,7 +1088,7 @@ static void mesh_remove_faces(Mesh *mesh, int len)
|
|||
#if 0
|
||||
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add geometry in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
|
|||
|
||||
void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add tessfaces in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add edges in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add vertices in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot remove faces in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1181,7 +1181,7 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add loops in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1191,7 +1191,7 @@ void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot add polygons in edit mode");
|
||||
return;
|
||||
}
|
||||
|
@ -1201,8 +1201,8 @@ void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
|
|||
|
||||
void ED_mesh_calc_tessface(Mesh *mesh, bool free_mpoly)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
BKE_editmesh_tessface_calc(mesh->edit_btmesh);
|
||||
if (mesh->edit_mesh) {
|
||||
BKE_editmesh_tessface_calc(mesh->edit_mesh);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_tessface_calc(mesh);
|
||||
|
|
|
@ -63,7 +63,7 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, Mesh *me_eval, cons
|
|||
}
|
||||
else if (mode == 's') { /* start table */
|
||||
Mesh *me = ob->data;
|
||||
const bool use_em = (!me_eval && em && me->edit_btmesh == em);
|
||||
const bool use_em = (!me_eval && em && me->edit_mesh == em);
|
||||
const int totvert = use_em ? em->bm->totvert : me_eval ? me_eval->totvert : me->totvert;
|
||||
|
||||
if (MirrKdStore.tree) /* happens when entering this call without ending it */
|
||||
|
@ -136,7 +136,7 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
|
|||
|
||||
bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store)
|
||||
{
|
||||
const bool is_editmode = (me->edit_btmesh != NULL);
|
||||
const bool is_editmode = (me->edit_mesh != NULL);
|
||||
int totvert;
|
||||
int totedge;
|
||||
|
||||
|
@ -144,9 +144,9 @@ bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mes
|
|||
totvert = me_eval->totvert;
|
||||
totedge = me_eval->totedge;
|
||||
}
|
||||
else if (me->edit_btmesh) {
|
||||
totvert = me->edit_btmesh->bm->totvert;
|
||||
totedge = me->edit_btmesh->bm->totedge;
|
||||
else if (me->edit_mesh) {
|
||||
totvert = me->edit_mesh->bm->totvert;
|
||||
totedge = me->edit_mesh->bm->totedge;
|
||||
}
|
||||
else {
|
||||
totvert = me->totvert;
|
||||
|
@ -170,9 +170,9 @@ void ED_mesh_mirrtopo_init(
|
|||
Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store,
|
||||
const bool skip_em_vert_array_init)
|
||||
{
|
||||
const bool is_editmode = (me->edit_btmesh != NULL);
|
||||
const bool is_editmode = (me->edit_mesh != NULL);
|
||||
MEdge *medge = NULL, *med;
|
||||
BMEditMesh *em = me_eval ? NULL : me->edit_btmesh;
|
||||
BMEditMesh *em = me_eval ? NULL : me->edit_mesh;
|
||||
|
||||
/* editmode*/
|
||||
BMEdge *eed;
|
||||
|
@ -208,7 +208,7 @@ void ED_mesh_mirrtopo_init(
|
|||
|
||||
/* Initialize the vert-edge-user counts used to detect unique topology */
|
||||
if (em) {
|
||||
totedge = me->edit_btmesh->bm->totedge;
|
||||
totedge = me->edit_mesh->bm->totedge;
|
||||
|
||||
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
|
||||
const int i1 = BM_elem_index_get(eed->v1), i2 = BM_elem_index_get(eed->v2);
|
||||
|
|
|
@ -822,7 +822,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *e
|
|||
int ED_mesh_mirror_get_vert(Object *ob, int index)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
|
||||
int index_mirr;
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
|
|||
{
|
||||
if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) {
|
||||
Mesh *me = ob->data;
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
BMesh *bm = me->edit_mesh->bm;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
|
||||
|
||||
if (cd_dvert_offset != -1) {
|
||||
|
|
|
@ -407,11 +407,11 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
|
|||
|
||||
if (obedit->type == OB_MESH) {
|
||||
Mesh *me = obedit->data;
|
||||
if (me->edit_btmesh == NULL) {
|
||||
if (me->edit_mesh == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
|
||||
if (me->edit_mesh->bm->totvert > MESH_MAX_VERTS) {
|
||||
error("Too many vertices");
|
||||
return false;
|
||||
}
|
||||
|
@ -419,9 +419,9 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
|
|||
EDBM_mesh_load(bmain, obedit);
|
||||
|
||||
if (freedata) {
|
||||
EDBM_mesh_free(me->edit_btmesh);
|
||||
MEM_freeN(me->edit_btmesh);
|
||||
me->edit_btmesh = NULL;
|
||||
EDBM_mesh_free(me->edit_mesh);
|
||||
MEM_freeN(me->edit_mesh);
|
||||
me->edit_mesh = NULL;
|
||||
}
|
||||
/* will be recalculated as needed. */
|
||||
{
|
||||
|
|
|
@ -99,8 +99,8 @@ static void object_fmap_swap_edit_mode(Object *ob, int num1, int num2)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_fmap_offset = CustomData_get_offset(&em->bm->pdata, CD_FACEMAP);
|
||||
|
||||
if (cd_fmap_offset != -1) {
|
||||
|
@ -238,7 +238,7 @@ static int face_map_assign_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
if (fmap) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMFace *efa;
|
||||
BMIter iter;
|
||||
int *map;
|
||||
|
@ -286,7 +286,7 @@ static int face_map_remove_from_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
if (fmap) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMFace *efa;
|
||||
BMIter iter;
|
||||
int *map;
|
||||
|
@ -331,7 +331,7 @@ void OBJECT_OT_face_map_remove_from(struct wmOperatorType *ot)
|
|||
static void fmap_select(Object *ob, bool select)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMFace *efa;
|
||||
BMIter iter;
|
||||
int *map;
|
||||
|
|
|
@ -136,7 +136,7 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
|
|||
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
int index = 0, nr = 0;
|
||||
|
@ -316,7 +316,7 @@ static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit,
|
|||
|
||||
DEG_id_tag_update(obedit->data, 0);
|
||||
|
||||
em = me->edit_btmesh;
|
||||
em = me->edit_mesh;
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
BKE_editmesh_tessface_calc(em);
|
||||
|
|
|
@ -1485,7 +1485,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
|
|||
static void modifier_skin_customdata_delete(Object *ob)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
|
||||
if (em)
|
||||
BM_data_layer_free(em->bm, &em->bm->vdata, CD_MVERT_SKIN);
|
||||
|
|
|
@ -144,7 +144,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
|
|||
|
||||
DEG_id_tag_update(obedit->data, 0);
|
||||
|
||||
em = me->edit_btmesh;
|
||||
em = me->edit_mesh;
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
BKE_editmesh_tessface_calc(em);
|
||||
|
|
|
@ -842,7 +842,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
if (obedit) {
|
||||
if (obedit->type == OB_MESH) {
|
||||
Mesh *me = obedit->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, co
|
|||
{
|
||||
Mesh *me = (Mesh *)id;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
|
||||
BMIter iter;
|
||||
|
@ -506,7 +506,7 @@ static void ED_mesh_defvert_mirror_update_em(
|
|||
const int cd_dvert_offset)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMVert *eve_mirr;
|
||||
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
|
||||
|
||||
|
@ -543,7 +543,7 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx)
|
|||
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
MDeformVert *dvert_act;
|
||||
|
||||
if (me->editflag & ME_EDIT_MIRROR_X) {
|
||||
|
@ -580,7 +580,7 @@ static void vgroup_remove_weight(Object *ob, const int def_nr)
|
|||
static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMVert *eve_act;
|
||||
int v_act;
|
||||
MDeformVert *dvert_act;
|
||||
|
@ -619,7 +619,7 @@ static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type
|
|||
static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
MDeformVert *dvert_act;
|
||||
int i, vgroup_tot, subset_count;
|
||||
const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count);
|
||||
|
@ -895,8 +895,8 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
|
||||
/* warning, this lookup is _not_ fast */
|
||||
|
||||
|
@ -972,8 +972,8 @@ static void vgroup_select_verts(Object *ob, int select)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
|
||||
|
||||
if (cd_dvert_offset != -1) {
|
||||
|
@ -2210,7 +2210,7 @@ void ED_vgroup_mirror(
|
|||
/* only the active group */
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
|
||||
if (em) {
|
||||
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
|
||||
|
@ -2387,8 +2387,8 @@ static void vgroup_assign_verts(Object *ob, const float weight)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh) {
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
if (me->edit_mesh) {
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
int cd_dvert_offset;
|
||||
|
||||
BMIter iter;
|
||||
|
@ -3740,7 +3740,7 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
|
|||
MDeformVert *dvert_act;
|
||||
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
float weight_act;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ void draw_object_backbufsel(
|
|||
case OB_MESH:
|
||||
if (ob->mode & OB_MODE_EDIT) {
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
const bool draw_facedot = check_ob_drawface_dot(scene, v3d, ob->dt);
|
||||
const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0;
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
|||
if (ob->type == OB_MESH) {
|
||||
TransformMedian_Mesh *median = &median_basis.mesh;
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
BMVert *eve;
|
||||
BMEdge *eed;
|
||||
|
@ -557,7 +557,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
|||
{
|
||||
const TransformMedian_Mesh *median = &median_basis.mesh, *ve_median = &ve_median_basis.mesh;
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
BMIter iter;
|
||||
BMVert *eve;
|
||||
|
|
|
@ -561,7 +561,7 @@ static bool raycastEditMesh(
|
|||
BMEditMesh *em_orig;
|
||||
int looptri_num_active = -1;
|
||||
|
||||
/* Get original version of the edit_btmesh. */
|
||||
/* Get original version of the edit_mesh. */
|
||||
em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
|
||||
|
||||
if (sctx->callbacks.edit_mesh.test_face_fn) {
|
||||
|
@ -640,7 +640,7 @@ static bool raycastEditMesh(
|
|||
retval = true;
|
||||
|
||||
if (r_index) {
|
||||
/* Get original version of the edit_btmesh. */
|
||||
/* Get original version of the edit_mesh. */
|
||||
BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
|
||||
|
||||
*r_index = BM_elem_index_get(em_orig->looptris[hit.index][0]->f);
|
||||
|
|
|
@ -208,10 +208,10 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
|
|||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
if (me->edit_btmesh) {
|
||||
EDBM_mesh_free(me->edit_btmesh);
|
||||
MEM_freeN(me->edit_btmesh);
|
||||
me->edit_btmesh = NULL;
|
||||
if (me->edit_mesh) {
|
||||
EDBM_mesh_free(me->edit_mesh);
|
||||
MEM_freeN(me->edit_mesh);
|
||||
me->edit_mesh = NULL;
|
||||
}
|
||||
}
|
||||
else if (ob->type == OB_ARMATURE) {
|
||||
|
|
|
@ -268,7 +268,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
|
|||
if (sima->flag & SI_DRAWSHADOW) {
|
||||
bool is_cage_like_final_meshes = false;
|
||||
Mesh *me = (Mesh *)eval_ob->data;
|
||||
BMEditMesh *embm = me->edit_btmesh;
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
is_cage_like_final_meshes = embm &&
|
||||
embm->mesh_eval_final &&
|
||||
embm->mesh_eval_final->runtime.is_original;
|
||||
|
|
|
@ -4431,7 +4431,7 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
|
|||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
Object *ob = objects[ob_index];
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
UvVertMap *vmap;
|
||||
|
@ -4578,7 +4578,7 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
|
|||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
Object *ob = objects[ob_index];
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
if (synced_selection && (bm->totedgesel == 0)) {
|
||||
|
|
|
@ -148,7 +148,7 @@ typedef struct Mesh {
|
|||
|
||||
/* When the object is available, the preferred access method is: BKE_editmesh_from_object(ob) */
|
||||
/** Not saved in file!. */
|
||||
struct BMEditMesh *edit_btmesh;
|
||||
struct BMEditMesh *edit_mesh;
|
||||
|
||||
struct CustomData vdata, edata, fdata;
|
||||
|
||||
|
|
|
@ -86,27 +86,27 @@ static Mesh *rna_mesh(PointerRNA *ptr)
|
|||
|
||||
static CustomData *rna_mesh_vdata_helper(Mesh *me)
|
||||
{
|
||||
return (me->edit_btmesh) ? &me->edit_btmesh->bm->vdata : &me->vdata;
|
||||
return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_edata_helper(Mesh *me)
|
||||
{
|
||||
return (me->edit_btmesh) ? &me->edit_btmesh->bm->edata : &me->edata;
|
||||
return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_pdata_helper(Mesh *me)
|
||||
{
|
||||
return (me->edit_btmesh) ? &me->edit_btmesh->bm->pdata : &me->pdata;
|
||||
return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_ldata_helper(Mesh *me)
|
||||
{
|
||||
return (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
|
||||
return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_fdata_helper(Mesh *me)
|
||||
{
|
||||
return (me->edit_btmesh) ? NULL : &me->fdata;
|
||||
return (me->edit_mesh) ? NULL : &me->fdata;
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_vdata(PointerRNA *ptr)
|
||||
|
@ -670,13 +670,13 @@ static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, Poi
|
|||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
||||
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
|
||||
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
|
||||
}
|
||||
|
||||
static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return (me->edit_btmesh) ? 0 : me->totloop;
|
||||
return (me->edit_mesh) ? 0 : me->totloop;
|
||||
}
|
||||
|
||||
static bool rna_MeshUVLoopLayer_active_render_get(PointerRNA *ptr)
|
||||
|
@ -719,13 +719,13 @@ static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter,
|
|||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
||||
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
|
||||
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
|
||||
}
|
||||
|
||||
static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return (me->edit_btmesh) ? 0 : me->totloop;
|
||||
return (me->edit_mesh) ? 0 : me->totloop;
|
||||
}
|
||||
|
||||
static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
|
||||
|
@ -1101,7 +1101,7 @@ static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collectio
|
|||
CustomDataLayer *cdl;
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
CustomData *vdata = rna_mesh_vdata(ptr);
|
||||
int a, b, totvert = (me->edit_btmesh) ? 0 : me->totvert;
|
||||
int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
|
||||
|
||||
for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
|
||||
if (cdl->type == type) {
|
||||
|
@ -1122,7 +1122,7 @@ static char *rna_PolyCustomData_data_path(PointerRNA *ptr, const char *collectio
|
|||
CustomDataLayer *cdl;
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
CustomData *pdata = rna_mesh_pdata(ptr);
|
||||
int a, b, totpoly = (me->edit_btmesh) ? 0 : me->totpoly;
|
||||
int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
|
||||
|
||||
for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
|
||||
if (cdl->type == type) {
|
||||
|
@ -1143,7 +1143,7 @@ static char *rna_LoopCustomData_data_path(PointerRNA *ptr, const char *collectio
|
|||
CustomDataLayer *cdl;
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
CustomData *ldata = rna_mesh_ldata(ptr);
|
||||
int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
|
||||
int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
|
||||
|
||||
for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
|
||||
if (cdl->type == type) {
|
||||
|
@ -1354,17 +1354,17 @@ static char *rna_MeshFaceMap_path(PointerRNA *ptr)
|
|||
static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totvertsel : 0;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
|
||||
}
|
||||
static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totedgesel : 0;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
|
||||
}
|
||||
static int rna_Mesh_tot_face_get(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
|
||||
return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
|
||||
}
|
||||
|
||||
static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name)
|
||||
|
@ -1440,7 +1440,7 @@ static void rna_Mesh_uv_layers_remove(struct Mesh *me, ReportList *reports, Cust
|
|||
static bool rna_Mesh_is_editmode_get(PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
return (me->edit_btmesh != NULL);
|
||||
return (me->edit_mesh != NULL);
|
||||
}
|
||||
|
||||
/* only to quiet warnings */
|
||||
|
|
|
@ -347,8 +347,8 @@ static void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr)
|
|||
|
||||
DEG_id_tag_update(ob->data, 0);
|
||||
|
||||
EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh);
|
||||
BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh);
|
||||
EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_mesh);
|
||||
BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_mesh);
|
||||
break;
|
||||
case OB_CURVE:
|
||||
case OB_SURF:
|
||||
|
@ -789,8 +789,8 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
|
|||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (me->edit_btmesh)
|
||||
me->edit_btmesh->mat_nr = value;
|
||||
if (me->edit_mesh)
|
||||
me->edit_mesh->mat_nr = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1484,9 +1484,9 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *valu
|
|||
|
||||
if (view_layer && view_layer->basact) {
|
||||
Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
|
||||
if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
|
||||
me->edit_btmesh->selectmode = flag;
|
||||
EDBM_selectmode_set(me->edit_btmesh);
|
||||
if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
|
||||
me->edit_mesh->selectmode = flag;
|
||||
EDBM_selectmode_set(me->edit_mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1500,7 +1500,7 @@ static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSE
|
|||
|
||||
if (view_layer->basact) {
|
||||
me = BKE_mesh_from_object(view_layer->basact->object);
|
||||
if (me && me->edit_btmesh == NULL)
|
||||
if (me && me->edit_mesh == NULL)
|
||||
me = NULL;
|
||||
}
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
|
|||
|
||||
if (view_layer->basact) {
|
||||
me = BKE_mesh_from_object(view_layer->basact->object);
|
||||
if (me && me->edit_btmesh == NULL)
|
||||
if (me && me->edit_mesh == NULL)
|
||||
me = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,11 +150,11 @@ static void deformVerts(
|
|||
Mesh *mesh_original = NULL;
|
||||
|
||||
if (ctx->object->type == OB_MESH) {
|
||||
BMEditMesh *edit_btmesh = BKE_editmesh_from_object(ctx->object);
|
||||
BMEditMesh *em = BKE_editmesh_from_object(ctx->object);
|
||||
|
||||
if (edit_btmesh) {
|
||||
if (em) {
|
||||
/* In edit mode get directly from the edit mesh. */
|
||||
psmd->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(edit_btmesh->bm, 0);
|
||||
psmd->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
|
||||
}
|
||||
else {
|
||||
/* Otherwise get regular mesh. */
|
||||
|
|
|
@ -94,13 +94,13 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (me->edit_btmesh == NULL) {
|
||||
if (me->edit_mesh == NULL) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"The mesh must be in editmode");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bm = me->edit_btmesh->bm;
|
||||
bm = me->edit_mesh->bm;
|
||||
|
||||
return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_IS_WRAPPED);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (me->edit_btmesh == NULL) {
|
||||
if (me->edit_mesh == NULL) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"The mesh must be in editmode");
|
||||
return NULL;
|
||||
|
@ -150,7 +150,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
|
|||
{
|
||||
extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive);
|
||||
|
||||
EDBM_update_generic(me->edit_btmesh, do_loop_triangles, is_destructive);
|
||||
EDBM_update_generic(me->edit_mesh, do_loop_triangles, is_destructive);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
|
|
@ -890,7 +890,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
|
|||
}
|
||||
|
||||
/* we could allow this but its almost certainly _not_ what script authors want */
|
||||
if (me->edit_btmesh) {
|
||||
if (me->edit_mesh) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue