2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2013 Blender Foundation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-01-31 12:56:40 +01:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup depsgraph
|
2019-01-31 12:56:40 +01:00
|
|
|
*
|
|
|
|
* Datatypes for internal use in the Depsgraph
|
|
|
|
*
|
|
|
|
* All of these datatypes are only really used within the "core" depsgraph.
|
|
|
|
* In particular, node types declared here form the structure of operations
|
|
|
|
* in the graph.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
|
|
|
|
* to avoid any possible overhead caused by string (re)allocation/formatting. */
|
|
|
|
#include <algorithm>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <deque>
|
2019-03-18 15:56:16 +01:00
|
|
|
#include <map>
|
2019-04-29 12:37:21 +02:00
|
|
|
#include <set>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-01-31 12:56:40 +01:00
|
|
|
|
2020-04-24 11:34:04 +02:00
|
|
|
#include "BLI_map.hh"
|
2020-04-24 10:48:25 +02:00
|
|
|
#include "BLI_set.hh"
|
2020-04-28 15:56:53 +02:00
|
|
|
#include "BLI_string_ref.hh"
|
|
|
|
#include "BLI_vector.hh"
|
2020-04-29 11:37:19 +02:00
|
|
|
#include "BLI_vector_set.hh"
|
2020-04-24 10:48:25 +02:00
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
struct Depsgraph;
|
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
struct CustomData_MeshMasks;
|
|
|
|
|
2022-07-19 14:44:07 +02:00
|
|
|
namespace blender::deg {
|
2019-01-31 12:56:40 +01:00
|
|
|
|
|
|
|
/* Commonly used types. */
|
2020-03-05 17:31:40 +01:00
|
|
|
using std::deque;
|
2020-06-29 14:29:05 +02:00
|
|
|
using std::optional;
|
2019-03-18 15:56:16 +01:00
|
|
|
using std::pair;
|
2019-01-31 12:56:40 +01:00
|
|
|
using std::string;
|
2020-04-28 11:37:44 +02:00
|
|
|
using std::unique_ptr;
|
2019-01-31 12:56:40 +01:00
|
|
|
|
|
|
|
/* Commonly used functions. */
|
2019-03-18 15:56:16 +01:00
|
|
|
using std::make_pair;
|
2019-01-31 12:56:40 +01:00
|
|
|
using std::max;
|
|
|
|
using std::to_string;
|
|
|
|
|
|
|
|
/* Function bindings. */
|
|
|
|
using std::function;
|
|
|
|
using namespace std::placeholders;
|
|
|
|
#define function_bind std::bind
|
|
|
|
|
|
|
|
/* Source of the dependency graph node update tag.
|
|
|
|
*
|
|
|
|
* NOTE: This is a bit mask, so accumulation of sources is possible.
|
|
|
|
*
|
|
|
|
* TODO(sergey): Find a better place for this. */
|
|
|
|
enum eUpdateSource {
|
|
|
|
/* Update is caused by a time change. */
|
|
|
|
DEG_UPDATE_SOURCE_TIME = (1 << 0),
|
|
|
|
/* Update caused by user directly or indirectly influencing the node. */
|
|
|
|
DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1),
|
|
|
|
/* Update is happening as a special response for the relations update. */
|
|
|
|
DEG_UPDATE_SOURCE_RELATIONS = (1 << 2),
|
|
|
|
/* Update is happening due to visibility change. */
|
|
|
|
DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
|
|
|
|
};
|
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
/* C++ wrapper around DNA's CustomData_MeshMasks struct. */
|
|
|
|
struct DEGCustomDataMeshMasks {
|
|
|
|
uint64_t vert_mask;
|
|
|
|
uint64_t edge_mask;
|
|
|
|
uint64_t face_mask;
|
|
|
|
uint64_t loop_mask;
|
|
|
|
uint64_t poly_mask;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
DEGCustomDataMeshMasks() : vert_mask(0), edge_mask(0), face_mask(0), loop_mask(0), poly_mask(0)
|
|
|
|
{
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
explicit DEGCustomDataMeshMasks(const CustomData_MeshMasks *other);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
DEGCustomDataMeshMasks &operator|=(const DEGCustomDataMeshMasks &other)
|
|
|
|
{
|
|
|
|
this->vert_mask |= other.vert_mask;
|
|
|
|
this->edge_mask |= other.edge_mask;
|
|
|
|
this->face_mask |= other.face_mask;
|
|
|
|
this->loop_mask |= other.loop_mask;
|
|
|
|
this->poly_mask |= other.poly_mask;
|
|
|
|
return *this;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
DEGCustomDataMeshMasks operator|(const DEGCustomDataMeshMasks &other) const
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.vert_mask = this->vert_mask | other.vert_mask;
|
|
|
|
result.edge_mask = this->edge_mask | other.edge_mask;
|
|
|
|
result.face_mask = this->face_mask | other.face_mask;
|
|
|
|
result.loop_mask = this->loop_mask | other.loop_mask;
|
|
|
|
result.poly_mask = this->poly_mask | other.poly_mask;
|
|
|
|
return result;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
bool operator==(const DEGCustomDataMeshMasks &other) const
|
|
|
|
{
|
|
|
|
return (this->vert_mask == other.vert_mask && this->edge_mask == other.edge_mask &&
|
|
|
|
this->face_mask == other.face_mask && this->loop_mask == other.loop_mask &&
|
|
|
|
this->poly_mask == other.poly_mask);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
bool operator!=(const DEGCustomDataMeshMasks &other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
static DEGCustomDataMeshMasks MaskVert(const uint64_t vert_mask)
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.vert_mask = vert_mask;
|
|
|
|
return result;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
static DEGCustomDataMeshMasks MaskEdge(const uint64_t edge_mask)
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.edge_mask = edge_mask;
|
|
|
|
return result;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
static DEGCustomDataMeshMasks MaskFace(const uint64_t face_mask)
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.face_mask = face_mask;
|
|
|
|
return result;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
static DEGCustomDataMeshMasks MaskLoop(const uint64_t loop_mask)
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.loop_mask = loop_mask;
|
|
|
|
return result;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
2019-03-07 11:13:40 +01:00
|
|
|
static DEGCustomDataMeshMasks MaskPoly(const uint64_t poly_mask)
|
|
|
|
{
|
|
|
|
DEGCustomDataMeshMasks result;
|
|
|
|
result.poly_mask = poly_mask;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-07-19 14:44:07 +02:00
|
|
|
} // namespace blender::deg
|