Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2016 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup depsgraph
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "intern/builder/deg_builder.h"
|
|
|
|
|
|
2019-02-27 15:15:26 +01:00
|
|
|
#include <cstring>
|
|
|
|
|
|
2018-06-13 09:49:14 +02:00
|
|
|
#include "DNA_anim_types.h"
|
2019-02-27 11:17:36 +01:00
|
|
|
#include "DNA_layer_types.h"
|
2016-11-11 16:15:34 +01:00
|
|
|
#include "DNA_ID.h"
|
2019-02-27 11:17:36 +01:00
|
|
|
#include "DNA_object_types.h"
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2018-09-19 15:21:51 +02:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
#include "BLI_ghash.h"
|
2018-08-23 16:17:06 +02:00
|
|
|
#include "BLI_stack.h"
|
|
|
|
|
|
2018-06-13 09:49:14 +02:00
|
|
|
extern "C" {
|
|
|
|
|
#include "BKE_animsys.h"
|
|
|
|
|
}
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
#include "intern/depsgraph.h"
|
2019-01-31 12:56:40 +01:00
|
|
|
#include "intern/depsgraph_tag.h"
|
|
|
|
|
#include "intern/depsgraph_type.h"
|
2018-05-31 16:44:34 +02:00
|
|
|
#include "intern/eval/deg_eval_copy_on_write.h"
|
2019-01-31 12:56:40 +01:00
|
|
|
#include "intern/node/deg_node.h"
|
|
|
|
|
#include "intern/node/deg_node_id.h"
|
|
|
|
|
#include "intern/node/deg_node_component.h"
|
|
|
|
|
#include "intern/node/deg_node_operation.h"
|
2017-11-08 14:48:25 +01:00
|
|
|
|
2017-07-18 16:42:24 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
namespace DEG {
|
|
|
|
|
|
2019-02-27 11:17:36 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
|
* Base class for builders.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-27 15:15:26 +01:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
struct VisibilityCheckData {
|
|
|
|
|
eEvaluationMode eval_mode;
|
|
|
|
|
bool is_visibility_animated;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void visibility_animated_check_cb(ID * /*id*/, FCurve *fcu, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
VisibilityCheckData *data =
|
|
|
|
|
reinterpret_cast<VisibilityCheckData *>(user_data);
|
|
|
|
|
if (data->is_visibility_animated) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (data->eval_mode == DAG_EVAL_VIEWPORT) {
|
|
|
|
|
if (STREQ(fcu->rna_path, "hide_viewport")) {
|
|
|
|
|
data->is_visibility_animated = true;
|
|
|
|
|
}
|
2019-03-04 22:09:55 +11:00
|
|
|
}
|
|
|
|
|
else if (data->eval_mode == DAG_EVAL_RENDER) {
|
2019-02-27 15:15:26 +01:00
|
|
|
if (STREQ(fcu->rna_path, "hide_render")) {
|
|
|
|
|
data->is_visibility_animated = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-28 18:47:07 +01:00
|
|
|
bool is_object_visibility_animated(const Depsgraph *graph, Object *object)
|
2019-02-27 15:15:26 +01:00
|
|
|
{
|
2019-03-06 10:51:11 +11:00
|
|
|
AnimData *anim_data = BKE_animdata_from_id(&object->id);
|
2019-02-27 15:15:26 +01:00
|
|
|
if (anim_data == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
VisibilityCheckData data;
|
|
|
|
|
data.eval_mode = graph->mode;
|
|
|
|
|
data.is_visibility_animated = false;
|
|
|
|
|
BKE_fcurves_id_cb(&object->id, visibility_animated_check_cb, &data);
|
|
|
|
|
return data.is_visibility_animated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2019-02-28 18:47:07 +01:00
|
|
|
bool deg_check_base_available_for_build(const Depsgraph *graph, Base *base)
|
2019-02-28 12:15:42 +11:00
|
|
|
{
|
2019-02-28 18:47:07 +01:00
|
|
|
const int base_flag = (graph->mode == DAG_EVAL_VIEWPORT) ?
|
2019-02-27 11:17:36 +01:00
|
|
|
BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
|
|
|
|
|
if (base->flag & base_flag) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-02-28 18:47:07 +01:00
|
|
|
if (is_object_visibility_animated(graph, base->object)) {
|
2019-02-27 15:15:26 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2019-02-27 11:17:36 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-28 18:47:07 +01:00
|
|
|
DepsgraphBuilder::DepsgraphBuilder(Main *bmain, Depsgraph *graph)
|
|
|
|
|
: bmain_(bmain),
|
|
|
|
|
graph_(graph) {
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-01 16:35:11 +01:00
|
|
|
bool DepsgraphBuilder::need_pull_base_into_graph(Base *base)
|
2019-02-28 18:47:07 +01:00
|
|
|
{
|
|
|
|
|
return deg_check_base_available_for_build(graph_, base);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-27 11:17:36 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
|
* Builder finalizer.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-08-23 16:17:06 +02:00
|
|
|
namespace {
|
|
|
|
|
|
2018-09-03 12:55:26 +02:00
|
|
|
void deg_graph_build_flush_visibility(Depsgraph *graph)
|
2018-08-23 16:17:06 +02:00
|
|
|
{
|
2018-09-03 14:35:42 +02:00
|
|
|
enum {
|
|
|
|
|
DEG_NODE_VISITED = (1 << 0),
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
BLI_Stack *stack = BLI_stack_new(sizeof(OperationNode *),
|
2018-08-23 16:17:06 +02:00
|
|
|
"DEG flush layers stack");
|
2019-01-31 12:56:40 +01:00
|
|
|
for (IDNode *id_node : graph->id_nodes) {
|
|
|
|
|
GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
|
2018-09-19 15:21:51 +02:00
|
|
|
{
|
2018-09-24 15:41:00 +02:00
|
|
|
comp_node->affects_directly_visible |= id_node->is_directly_visible;
|
2018-09-19 15:21:51 +02:00
|
|
|
}
|
|
|
|
|
GHASH_FOREACH_END();
|
|
|
|
|
}
|
2019-01-31 12:56:40 +01:00
|
|
|
for (OperationNode *op_node : graph->operations) {
|
2018-09-03 14:35:42 +02:00
|
|
|
op_node->custom_flags = 0;
|
2018-08-23 16:17:06 +02:00
|
|
|
op_node->num_links_pending = 0;
|
2019-01-31 12:56:40 +01:00
|
|
|
for (Relation *rel : op_node->outlinks) {
|
|
|
|
|
if ((rel->from->type == NodeType::OPERATION) &&
|
|
|
|
|
(rel->flag & RELATION_FLAG_CYCLIC) == 0)
|
2018-08-23 16:17:06 +02:00
|
|
|
{
|
|
|
|
|
++op_node->num_links_pending;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (op_node->num_links_pending == 0) {
|
|
|
|
|
BLI_stack_push(stack, &op_node);
|
2018-09-03 14:35:42 +02:00
|
|
|
op_node->custom_flags |= DEG_NODE_VISITED;
|
2018-08-23 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (!BLI_stack_is_empty(stack)) {
|
2019-01-31 12:56:40 +01:00
|
|
|
OperationNode *op_node;
|
2018-08-23 16:17:06 +02:00
|
|
|
BLI_stack_pop(stack, &op_node);
|
|
|
|
|
/* Flush layers to parents. */
|
2019-01-31 12:56:40 +01:00
|
|
|
for (Relation *rel : op_node->inlinks) {
|
|
|
|
|
if (rel->from->type == NodeType::OPERATION) {
|
|
|
|
|
OperationNode *op_from = (OperationNode *)rel->from;
|
2018-09-19 15:21:51 +02:00
|
|
|
op_from->owner->affects_directly_visible |=
|
|
|
|
|
op_node->owner->affects_directly_visible;
|
2018-08-23 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Schedule parent nodes. */
|
2019-01-31 12:56:40 +01:00
|
|
|
for (Relation *rel : op_node->inlinks) {
|
|
|
|
|
if (rel->from->type == NodeType::OPERATION) {
|
|
|
|
|
OperationNode *op_from = (OperationNode *)rel->from;
|
|
|
|
|
if ((rel->flag & RELATION_FLAG_CYCLIC) == 0) {
|
2018-08-23 16:17:06 +02:00
|
|
|
BLI_assert(op_from->num_links_pending > 0);
|
|
|
|
|
--op_from->num_links_pending;
|
|
|
|
|
}
|
2018-09-03 14:35:42 +02:00
|
|
|
if ((op_from->num_links_pending == 0) &&
|
|
|
|
|
(op_from->custom_flags & DEG_NODE_VISITED) == 0)
|
|
|
|
|
{
|
2018-08-23 16:17:06 +02:00
|
|
|
BLI_stack_push(stack, &op_from);
|
2018-09-03 14:35:42 +02:00
|
|
|
op_from->custom_flags |= DEG_NODE_VISITED;
|
2018-08-23 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BLI_stack_free(stack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2017-10-25 13:27:13 +02:00
|
|
|
void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
2017-03-30 14:38:25 +02:00
|
|
|
{
|
2018-09-03 15:22:02 +02:00
|
|
|
/* Make sure dependencies of visible ID datablocks are visible. */
|
2018-09-03 12:55:26 +02:00
|
|
|
deg_graph_build_flush_visibility(graph);
|
2017-04-05 11:11:44 +02:00
|
|
|
/* Re-tag IDs for update if it was tagged before the relations
|
2019-01-31 12:56:40 +01:00
|
|
|
* update tag. */
|
|
|
|
|
for (IDNode *id_node : graph->id_nodes) {
|
2017-11-24 16:44:54 +01:00
|
|
|
ID *id = id_node->id_orig;
|
Depsgraph: Initial groundwork for copy-on-write support
< Dependency graph Copy-on-Write >
--------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
This is an initial commit of Copy-on-write support added to dependency graph.
Main priority for now: get playback (Alt-A) and all operators (selection,
transform etc) to work with the new concept of clear separation between
evaluated data coming from dependency graph and original data coming from
.blend file (and stored in bmain).
= How does this work? =
The idea is to support Copy-on-Write on the ID level. This means, we duplicate
the whole ID before we cann it's evaluaiton function. This is currently done
in the following way:
- At the depsgraph construction time we create "shallow" copy of the ID
datablock, just so we know it's pointer in memory and can use for function
bindings.
- At the evaluaiton time, the copy of ID get's "expanded" (needs a better
name internally, so it does not conflict with expanding datablocks during
library linking), which means the content of the datablock is being
copied over and all IDs are getting remapped to the copied ones.
Currently we do the whole copy, in the future we will support some tricks
here to prevent duplicating geometry arrays (verts, edges, loops, faces
and polys) when we don't need that.
- Evaluation functions are operating on copied datablocks and never touching
original datablock.
- There are some cases when we need to know non-ID pointers for function
bindings. This mainly applies to scene collections and armatures. The
idea of dealing with this is to "expand" copy-on-write datablock at
the dependency graph build time. This might introduce some slowdown to the
dependency graph construction time, but allows us to have minimal changes
in the code and avoid any hash look-up from evaluation function (one of
the ideas to avoid using pointers as function bindings is to pass name
of layer or a bone to the evaluation function and look up actual data based
on that name).
Currently there is a special function in depsgraph which does such a
synchronization, in the future we might want to make it more generic.
At some point we need to synchronize copy-on-write version of datablock with
the original version. This happens, i.e., when we change active object or
change selection. We don't want any actual evaluation of update flush happening
for such thins, so now we have a special update tag:
DEG_id_tag_update((id, DEG_TAG_COPY_ON_WRITE)
- For the render engines we now have special call for the dependency graph to
give evaluated datablock for the given original one. This isn't fully ideal
but allows to have Cycles viewport render.
This is definitely a subject for further investigation / improvement.
This call will tag copy-on-write component tagged for update without causing
updates to be flushed to any other objects, causing chain reaction of updates.
This tag is handy when selection in the scene changes.
This basically summarizes ideas underneath this commit. The code should be
reasonably documented.
Here is a demo of dependency graph with all copy-on-write stuff in it:
https://developer.blender.org/F635468
= What to expect to (not) work? =
- Only meshes are properly-ish aware of copy-on-write currently, Non-mesh
geometry will probably crash or will not work at all.
- Armatures will need similar depsgraph built-time expansion of the copied
datablock.
- There are some extra tags / relations added, to keep things demo-able but
which are slowing things down for evaluation.
- Edit mode works for until click selection is used (due to the selection
code using EditDerivedMesh created ad-hoc).
- Lots of tools will lack tagging synchronization of copied datablock for
sync with original ID.
= How to move forward? =
There is some tedious work related on going over all the tools, checking
whether they need to work with original or final evaluated object and make
the required changes.
Additionally, there need synchronization tag done in fair amount of tools
and operators as well. For example, currently it's not possible to change
render engine without re-opening the file or forcing dependency graph for
re-build via python console.
There is also now some thoughts required about copying evaluated properties
between objects or from collection to a new object. Perhaps easiest way
would be to move base flag flush to Object ID node and tag new objects for
update instead of doing manual copy.
here is some WIP patch which moves such evaluaiton / flush:
https://developer.blender.org/F635479
Lots of TODOs in the code, with possible optimization.
= How to test? =
This is a feature under heavy development, so obviously it is disabled by
default. The only reason it goes to 2.8 branch is to avoid possible merge
hell.
In order to enable this feature use WITH_DEPSGRAPH_COPY_ON_WRITE CMake
configuration option.
2017-06-14 10:26:24 +02:00
|
|
|
id_node->finalize_build(graph);
|
2018-06-20 17:42:57 +02:00
|
|
|
int flag = 0;
|
2018-10-24 19:38:50 +03:00
|
|
|
/* Tag rebuild if special evaluation flags changed. */
|
|
|
|
|
if (id_node->eval_flags != id_node->previous_eval_flags) {
|
2018-12-06 17:52:37 +01:00
|
|
|
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
|
2018-10-24 19:38:50 +03:00
|
|
|
}
|
2018-12-03 18:09:45 +03:00
|
|
|
/* Tag rebuild if the custom data mask changed. */
|
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
|
|
|
if (id_node->customdata_masks != id_node->previous_customdata_masks) {
|
2018-12-06 17:52:37 +01:00
|
|
|
flag |= ID_RECALC_GEOMETRY;
|
2018-12-03 18:09:45 +03:00
|
|
|
}
|
2018-05-31 16:44:34 +02:00
|
|
|
if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
|
2018-12-06 17:52:37 +01:00
|
|
|
flag |= ID_RECALC_COPY_ON_WRITE;
|
2018-07-27 14:13:47 +02:00
|
|
|
/* This means ID is being added to the dependency graph first
|
2019-01-31 12:56:40 +01:00
|
|
|
* time, which is similar to "ob-visible-change" */
|
2018-07-27 14:13:47 +02:00
|
|
|
if (GS(id->name) == ID_OB) {
|
2018-12-06 17:52:37 +01:00
|
|
|
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
|
2018-07-27 14:13:47 +02:00
|
|
|
}
|
2017-11-24 16:44:54 +01:00
|
|
|
}
|
2018-06-20 17:42:57 +02:00
|
|
|
if (flag != 0) {
|
2019-01-31 12:56:40 +01:00
|
|
|
graph_id_tag_update(bmain,
|
|
|
|
|
graph,
|
|
|
|
|
id_node->id_orig,
|
|
|
|
|
flag,
|
|
|
|
|
DEG_UPDATE_SOURCE_RELATIONS);
|
2018-06-20 17:42:57 +02:00
|
|
|
}
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace DEG
|