Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-02-19 17:46:42 +11:00
commit 264691e563
9 changed files with 32 additions and 16 deletions

View File

@ -1396,7 +1396,11 @@ static void prepare_mesh_for_viewport_render(Main *bmain, const EvaluationContex
{
if (check_rendered_viewport_visible(bmain)) {
BMesh *bm = mesh->edit_btmesh->bm;
BM_mesh_bm_to_me(bm, mesh, (&(struct BMeshToMeshParams){0}));
BM_mesh_bm_to_me(
bm, mesh,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
}));
DEG_id_tag_update(&mesh->id, 0);
}
}

View File

@ -708,7 +708,7 @@ void BM_mesh_bm_to_me(
}
/* patch hook indices and vertex parents */
if (ototvert > 0) {
if (params->calc_object_remap && (ototvert > 0)) {
Object *ob;
ModifierData *md;
BMVert **vertMap = NULL;
@ -765,11 +765,7 @@ void BM_mesh_bm_to_me(
if (vertMap) MEM_freeN(vertMap);
}
if (params->calc_tessface) {
BKE_mesh_tessface_calc(me);
}
BKE_mesh_update_customdata_pointers(me, params->calc_tessface);
BKE_mesh_update_customdata_pointers(me, false);
{
BMEditSelection *selected;

View File

@ -55,7 +55,8 @@ void BM_mesh_bm_from_me(
ATTR_NONNULL(1, 3);
struct BMeshToMeshParams {
uint calc_tessface : 1;
/** Update object hook indices & vertex parents. */
uint calc_object_remap : 1;
int64_t cd_mask_extra;
};
void BM_mesh_bm_to_me(

View File

@ -843,7 +843,6 @@ static BMOpDefine bmo_bmesh_to_mesh_def = {
{"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}},
/* pointer to an object structure */
{"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
{"skip_tessface", BMO_OP_SLOT_BOOL}, /* don't calculate mfaces */
{{'\0'}},
},
{{{'\0'}}}, /* no output */

View File

@ -62,15 +62,18 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
Mesh *me = ob->data;
BMO_op_callf(bm, op->flag,
"bmesh_to_mesh mesh=%p object=%p skip_tessface=%b",
me, ob, true);
"bmesh_to_mesh mesh=%p object=%p",
me, ob);
}
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
{
Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
/* Object *ob = BMO_slot_ptr_get(op, "object"); */
const bool dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){ .calc_tessface = dotess, }));
BM_mesh_bm_to_me(
bm, me,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
}));
}

View File

@ -3374,7 +3374,11 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
}
if (retval_iter) {
BM_mesh_bm_to_me(bm_old, me, (&(struct BMeshToMeshParams){0}));
BM_mesh_bm_to_me(
bm_old, me,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
}));
DEG_id_tag_update(&me->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);

View File

@ -496,6 +496,8 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
BM_mesh_bm_to_me(
em->bm, &um->me, (&(struct BMeshToMeshParams){
/* Undo code should not be manipulating 'G.main->object' hooks/vertex-parent. */
.calc_object_remap = false,
.cd_mask_extra = CD_MASK_SHAPE_KEYINDEX,
}));

View File

@ -381,7 +381,10 @@ void EDBM_mesh_load(Object *ob)
bm->shapenr = 1;
}
BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){0}));
BM_mesh_bm_to_me(
bm, me, (&(struct BMeshToMeshParams){
.calc_object_remap = true,
}));
#ifdef USE_TESSFACE_DEFAULT
BKE_mesh_tessface_calc(me);

View File

@ -902,7 +902,11 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
bm = self->bm;
BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){0}));
BM_mesh_bm_to_me(
bm, me,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
}));
/* we could have the user do this but if they forget blender can easy crash
* since the references arrays for the objects derived meshes are now invalid */