Refactor CDData masks, to have one mask per mesh elem type.

We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.

Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!

As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).

Reviewers: brecht, campbellbarton, sergey

Differential Revision: https://developer.blender.org/D4407
This commit is contained in:
2019-03-07 11:13:40 +01:00
parent cee53160d2
commit ab0bc65c24
128 changed files with 1064 additions and 793 deletions

View File

@@ -941,7 +941,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
bool use_deform = true;
bool use_cage = false;
bool use_fnorm = true;
const int mask = CD_MASK_BMESH;
CustomData_MeshMasks data_masks = CD_MASK_BMESH;
BPY_BM_CHECK_OBJ(self);
@@ -976,15 +976,15 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
return NULL;
}
else {
me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, mask);
me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, &data_masks);
}
}
else {
if (use_cage) {
me_eval = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, mask);
me_eval = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &data_masks);
}
else {
me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, mask);
me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &data_masks);
}
}
}
@@ -996,10 +996,10 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
return NULL;
}
else if (use_render) {
me_eval = mesh_create_eval_no_deform_render(depsgraph, scene_eval, ob, NULL, mask);
me_eval = mesh_create_eval_no_deform_render(depsgraph, scene_eval, ob, NULL, &data_masks);
}
else {
me_eval = mesh_create_eval_no_deform(depsgraph, scene_eval, ob, NULL, mask);
me_eval = mesh_create_eval_no_deform(depsgraph, scene_eval, ob, NULL, &data_masks);
}
}