diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-07 13:13:40 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-07 13:29:50 +0300 |
commit | ab0bc65c24bdf68c356adb2566f3669153c931ea (patch) | |
tree | 23909478874a13d84e504a905809eb211e62a9e2 /source/blender/depsgraph/intern/depsgraph_query.cc | |
parent | cee53160d2bd9067a3d43cc862ce61e36ff70454 (diff) |
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
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index a366b9b6568..3b7f19e9916 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -29,6 +29,7 @@ extern "C" { #include <string.h> // XXX: memcpy #include "BLI_utildefines.h" +#include "BKE_customdata.h" #include "BKE_idcode.h" #include "BKE_main.h" #include "BLI_listbase.h" @@ -114,7 +115,7 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id) return id_node->eval_flags; } -uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob) +void DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob, CustomData_MeshMasks *r_mask) { if (graph == NULL) { /* Happens when converting objects to mesh from a python script @@ -122,17 +123,21 @@ uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob) * * Currently harmless because it's only called for temporary * objects which are out of the DAG anyway. */ - return 0; + return; } const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id)); if (id_node == NULL) { /* TODO(sergey): Does it mean we need to check set scene? */ - return 0; + return; } - return id_node->customdata_mask; + r_mask->vmask |= id_node->customdata_masks.vert_mask; + r_mask->emask |= id_node->customdata_masks.edge_mask; + r_mask->fmask |= id_node->customdata_masks.face_mask; + r_mask->lmask |= id_node->customdata_masks.loop_mask; + r_mask->pmask |= id_node->customdata_masks.poly_mask; } Scene *DEG_get_evaluated_scene(const Depsgraph *graph) |