Depsgraph: introduce blender::deg namespace

Reviewers: sergey

Differential Revision: https://developer.blender.org/D8150
This commit is contained in:
Jacques Lucke 2020-06-29 15:19:56 +02:00
parent 81fb08ad57
commit cb5bfb32ba
96 changed files with 615 additions and 414 deletions

View File

@ -50,7 +50,8 @@
#include "DEG_depsgraph.h"
namespace DEG {
namespace blender {
namespace deg {
bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig)
{
@ -240,4 +241,5 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -29,7 +29,8 @@ struct Main;
struct Object;
struct bPoseChannel;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
class DepsgraphBuilderCache;
@ -58,4 +59,5 @@ bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig);
bool deg_check_base_in_depsgraph(const Depsgraph *graph, Base *base);
void deg_graph_build_finalize(Main *bmain, Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -31,7 +31,8 @@
#include "BKE_animsys.h"
namespace DEG {
namespace blender {
namespace deg {
/* Animated property storage. */
@ -177,4 +178,5 @@ AnimatedPropertyStorage *DepsgraphBuilderCache::ensureInitializedAnimatedPropert
return animated_property_storage;
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -31,7 +31,8 @@ struct ID;
struct PointerRNA;
struct PropertyRNA;
namespace DEG {
namespace blender {
namespace deg {
class DepsgraphBuilderCache;
@ -99,4 +100,5 @@ class DepsgraphBuilderCache {
Map<ID *, AnimatedPropertyStorage *> animated_property_storage_map_;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -37,7 +37,8 @@
#include "intern/depsgraph.h"
#include "intern/depsgraph_relation.h"
namespace DEG {
namespace blender {
namespace deg {
namespace {
@ -234,4 +235,5 @@ void deg_graph_detect_cycles(Depsgraph *graph)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,11 +23,13 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
/* Detect and solve dependency cycles. */
void deg_graph_detect_cycles(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "DNA_ID.h"
namespace DEG {
namespace blender {
namespace deg {
BuilderMap::BuilderMap()
{
@ -58,4 +59,5 @@ int BuilderMap::getIDTag(ID *id) const
return id_tags_.lookup_default(id, 0);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
struct ID;
namespace DEG {
namespace blender {
namespace deg {
class BuilderMap {
public:
@ -78,4 +79,5 @@ class BuilderMap {
Map<ID *, int> id_tags_;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -119,7 +119,8 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
/* ************ */
/* Node Builder */
@ -1899,4 +1900,5 @@ void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/,
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -64,7 +64,8 @@ struct bNodeTree;
struct bPoseChannel;
struct bSound;
namespace DEG {
namespace blender {
namespace deg {
struct ComponentNode;
struct Depsgraph;
@ -290,4 +291,5 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
BuilderMap built_map_;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -54,7 +54,8 @@
#include "intern/node/deg_node_component.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
void DepsgraphNodeBuilder::build_pose_constraints(Object *object,
bPoseChannel *pchan,
@ -344,4 +345,5 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl
op_node->set_as_exit();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "DNA_scene_types.h"
namespace DEG {
namespace blender {
namespace deg {
void DepsgraphNodeBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer)
{
@ -83,4 +84,5 @@ void DepsgraphNodeBuilder::build_scene_compositor(Scene *scene)
build_nodetree(scene->nodetree);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -55,7 +55,8 @@
#include "intern/node/deg_node_component.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb)
{
@ -174,4 +175,5 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene,
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -28,7 +28,8 @@
#include "BLI_utildefines.h"
namespace DEG {
namespace blender {
namespace deg {
RootPChanMap::RootPChanMap()
{
@ -77,4 +78,5 @@ bool RootPChanMap::has_common_root(const char *bone1, const char *bone2) const
return Set<StringRefNull>::Intersects(*bone1_roots, *bone2_roots);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
struct RootPChanMap {
/* Constructor and destructor - Create and free the internal map respectively. */
@ -49,4 +50,5 @@ struct RootPChanMap {
Map<StringRefNull, Set<StringRefNull>> map_;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -118,7 +118,8 @@
#include "intern/depsgraph_relation.h"
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
/* ***************** */
/* Relations Builder */
@ -321,7 +322,7 @@ void DepsgraphRelationBuilder::add_customdata_mask(Object *object,
{
if (customdata_masks != DEGCustomDataMeshMasks() && object != nullptr &&
object->type == OB_MESH) {
DEG::IDNode *id_node = graph_->find_id_node(&object->id);
IDNode *id_node = graph_->find_id_node(&object->id);
if (id_node == nullptr) {
BLI_assert(!"ID should always be valid");
@ -334,7 +335,7 @@ void DepsgraphRelationBuilder::add_customdata_mask(Object *object,
void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag)
{
DEG::IDNode *id_node = graph_->find_id_node(id);
IDNode *id_node = graph_->find_id_node(id);
if (id_node == nullptr) {
BLI_assert(!"ID should always be valid");
}
@ -2984,4 +2985,5 @@ void DepsgraphRelationBuilder::constraint_walk(bConstraint * /*con*/,
data->builder->build_id(id);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -84,7 +84,8 @@ struct bSound;
struct PropertyRNA;
namespace DEG {
namespace blender {
namespace deg {
struct ComponentNode;
struct DepsNodeHandle;
@ -385,6 +386,7 @@ struct DepsNodeHandle {
const char *default_name;
};
} // namespace DEG
} // namespace deg
} // namespace blender
#include "intern/builder/deg_builder_relations_impl.h"

View File

@ -28,7 +28,8 @@
#include "DNA_ID.h"
#include "DNA_object_types.h"
namespace DEG {
namespace blender {
namespace deg {
template<typename KeyType>
OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType &key)
@ -215,4 +216,5 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency(const KeyFrom &k
return true;
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "intern/builder/deg_builder_relations.h"
namespace DEG {
namespace blender {
namespace deg {
////////////////////////////////////////////////////////////////////////////////
// Time source.
@ -192,4 +193,5 @@ string RNAPathKey::identifier() const
return string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')";
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -58,7 +58,8 @@
#include "intern/depsgraph_relation.h"
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
/* IK Solver Eval Steps */
void DepsgraphRelationBuilder::build_ik_pose(Object *object,
@ -509,4 +510,5 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "DNA_scene_types.h"
namespace DEG {
namespace blender {
namespace deg {
void DepsgraphRelationBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer)
{
@ -71,4 +72,5 @@ void DepsgraphRelationBuilder::build_scene_compositor(Scene *scene)
build_nodetree(scene->nodetree);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -56,7 +56,8 @@
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
{
@ -153,4 +154,5 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene,
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -33,7 +33,8 @@
#include "intern/depsgraph_relation.h"
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
static inline bool is_unused_noop(OperationNode *op_node)
{
@ -84,4 +85,5 @@ void deg_graph_remove_unused_noops(Depsgraph *graph)
(::Depsgraph *)graph, BUILD, "Removed %d relations to no-op nodes\n", num_removed_relations);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,11 +23,13 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
/* Remove all no-op nodes that have zero outgoing relations. */
void deg_graph_remove_unused_noops(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -48,7 +48,8 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
/* ********************************* ID Data ******************************** */
@ -369,4 +370,5 @@ RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id)
return id_data.get();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -30,7 +30,8 @@ struct ID;
struct PointerRNA;
struct PropertyRNA;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
struct Node;
@ -94,4 +95,5 @@ class RNANodeQuery {
RNANodeQueryIDData *ensure_id_data(const ID *id);
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -33,7 +33,8 @@
#include "intern/depsgraph.h"
#include "intern/depsgraph_relation.h"
namespace DEG {
namespace blender {
namespace deg {
/* -------------------------------------------------- */
@ -109,4 +110,5 @@ void deg_graph_transitive_reduction(Depsgraph *graph)
DEG_DEBUG_PRINTF((::Depsgraph *)graph, BUILD, "Removed %d relations\n", num_removed_relations);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,11 +23,13 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
/* Performs a transitive reduction to remove redundant relations. */
void deg_graph_transitive_reduction(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "BKE_global.h"
namespace DEG {
namespace blender {
namespace deg {
DepsgraphDebug::DepsgraphDebug()
: flags(G.debug), is_ever_evaluated(false), graph_evaluation_start_time_(0)
@ -97,4 +98,5 @@ string color_end(void)
return string(TRUECOLOR_ANSI_COLOR_FINISH);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -30,7 +30,8 @@
#include "DEG_depsgraph_debug.h"
namespace DEG {
namespace blender {
namespace deg {
class DepsgraphDebug {
public:
@ -89,4 +90,5 @@ bool terminal_do_color(void);
string color_for_pointer(const void *pointer);
string color_end(void);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -40,10 +40,13 @@
#include "intern/node/deg_node_operation.h"
#include "intern/node/deg_node_time.h"
namespace deg = blender::deg;
/* ****************** */
/* Graphviz Debugging */
namespace DEG {
namespace blender {
namespace deg {
#define NL "\r\n"
@ -578,7 +581,8 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx, const De
}
}
} // namespace DEG
} // namespace deg
} // namespace blender
void DEG_debug_relations_graphviz(const Depsgraph *graph, FILE *f, const char *label)
{
@ -586,29 +590,29 @@ void DEG_debug_relations_graphviz(const Depsgraph *graph, FILE *f, const char *l
return;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
DEG::DebugContext ctx;
deg::DebugContext ctx;
ctx.file = f;
DEG::deg_debug_fprintf(ctx, "digraph depgraph {" NL);
DEG::deg_debug_fprintf(ctx, "rankdir=LR;" NL);
DEG::deg_debug_fprintf(ctx, "graph [");
DEG::deg_debug_fprintf(ctx, "compound=true");
DEG::deg_debug_fprintf(ctx, ",labelloc=\"t\"");
DEG::deg_debug_fprintf(ctx, ",fontsize=%f", DEG::deg_debug_graphviz_graph_label_size);
DEG::deg_debug_fprintf(ctx, ",fontname=\"%s\"", DEG::deg_debug_graphviz_fontname);
DEG::deg_debug_fprintf(ctx, ",label=\"%s\"", label);
DEG::deg_debug_fprintf(ctx, ",splines=ortho");
DEG::deg_debug_fprintf(ctx, ",overlap=scalexy"); // XXX: only when using neato
DEG::deg_debug_fprintf(ctx, "];" NL);
deg::deg_debug_fprintf(ctx, "digraph depgraph {" NL);
deg::deg_debug_fprintf(ctx, "rankdir=LR;" NL);
deg::deg_debug_fprintf(ctx, "graph [");
deg::deg_debug_fprintf(ctx, "compound=true");
deg::deg_debug_fprintf(ctx, ",labelloc=\"t\"");
deg::deg_debug_fprintf(ctx, ",fontsize=%f", deg::deg_debug_graphviz_graph_label_size);
deg::deg_debug_fprintf(ctx, ",fontname=\"%s\"", deg::deg_debug_graphviz_fontname);
deg::deg_debug_fprintf(ctx, ",label=\"%s\"", label);
deg::deg_debug_fprintf(ctx, ",splines=ortho");
deg::deg_debug_fprintf(ctx, ",overlap=scalexy"); // XXX: only when using neato
deg::deg_debug_fprintf(ctx, "];" NL);
DEG::deg_debug_graphviz_graph_nodes(ctx, deg_graph);
DEG::deg_debug_graphviz_graph_relations(ctx, deg_graph);
deg::deg_debug_graphviz_graph_nodes(ctx, deg_graph);
deg::deg_debug_graphviz_graph_relations(ctx, deg_graph);
DEG::deg_debug_graphviz_legend(ctx);
deg::deg_debug_graphviz_legend(ctx);
DEG::deg_debug_fprintf(ctx, "}" NL);
deg::deg_debug_fprintf(ctx, "}" NL);
}
#undef NL

View File

@ -36,7 +36,10 @@
#define NL "\r\n"
namespace DEG {
namespace deg = blender::deg;
namespace blender {
namespace deg {
namespace {
struct DebugContext {
@ -147,7 +150,8 @@ void deg_debug_stats_gnuplot(const DebugContext &ctx)
}
} // namespace
} // namespace DEG
} // namespace deg
} // namespace blender
void DEG_debug_stats_gnuplot(const Depsgraph *depsgraph,
FILE *f,
@ -157,10 +161,10 @@ void DEG_debug_stats_gnuplot(const Depsgraph *depsgraph,
if (depsgraph == nullptr) {
return;
}
DEG::DebugContext ctx;
deg::DebugContext ctx;
ctx.file = f;
ctx.graph = (DEG::Depsgraph *)depsgraph;
ctx.graph = (deg::Depsgraph *)depsgraph;
ctx.label = label;
ctx.output_filename = output_filename;
DEG::deg_debug_stats_gnuplot(ctx);
deg::deg_debug_stats_gnuplot(ctx);
}

View File

@ -23,7 +23,8 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
// Utility class which takes care of calculating average of time series, such as
// FPS counters.
@ -68,4 +69,5 @@ template<int MaxSamples> class AveragedTimeSampler {
int next_sample_index_;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -55,7 +55,10 @@
#include "intern/node/deg_node_operation.h"
#include "intern/node/deg_node_time.h"
namespace DEG {
namespace deg = blender::deg;
namespace blender {
namespace deg {
Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
: time_source(nullptr),
@ -258,7 +261,8 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
return id_node->id_cow;
}
} // namespace DEG
} // namespace deg
} // namespace blender
/* **************** */
/* Public Graph API */
@ -266,9 +270,9 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
/* Initialize a new Depsgraph */
Depsgraph *DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
{
DEG::Depsgraph *deg_depsgraph = OBJECT_GUARDED_NEW(
DEG::Depsgraph, bmain, scene, view_layer, mode);
DEG::register_graph(deg_depsgraph);
deg::Depsgraph *deg_depsgraph = OBJECT_GUARDED_NEW(
deg::Depsgraph, bmain, scene, view_layer, mode);
deg::register_graph(deg_depsgraph);
return reinterpret_cast<Depsgraph *>(deg_depsgraph);
}
@ -279,11 +283,11 @@ void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
Scene *scene,
ViewLayer *view_layer)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
const bool do_update_register = deg_graph->bmain != bmain;
if (do_update_register && deg_graph->bmain != NULL) {
DEG::unregister_graph(deg_graph);
deg::unregister_graph(deg_graph);
}
deg_graph->bmain = bmain;
@ -291,7 +295,7 @@ void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
deg_graph->view_layer = view_layer;
if (do_update_register) {
DEG::register_graph(deg_graph);
deg::register_graph(deg_graph);
}
}
@ -301,15 +305,15 @@ void DEG_graph_free(Depsgraph *graph)
if (graph == nullptr) {
return;
}
using DEG::Depsgraph;
DEG::Depsgraph *deg_depsgraph = reinterpret_cast<DEG::Depsgraph *>(graph);
DEG::unregister_graph(deg_depsgraph);
using deg::Depsgraph;
deg::Depsgraph *deg_depsgraph = reinterpret_cast<deg::Depsgraph *>(graph);
deg::unregister_graph(deg_depsgraph);
OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph);
}
bool DEG_is_evaluating(const struct Depsgraph *depsgraph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(depsgraph);
return deg_graph->is_evaluating;
}
@ -322,19 +326,19 @@ bool DEG_is_active(const struct Depsgraph *depsgraph)
* cases. */
return false;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(depsgraph);
return deg_graph->is_active;
}
void DEG_make_active(struct Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
deg_graph->is_active = true;
/* TODO(sergey): Copy data from evaluated state to original. */
}
void DEG_make_inactive(struct Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
deg_graph->is_active = false;
}

View File

@ -47,7 +47,8 @@ struct ID;
struct Scene;
struct ViewLayer;
namespace DEG {
namespace blender {
namespace deg {
struct IDNode;
struct Node;
@ -169,4 +170,5 @@ struct Depsgraph {
Map<const ID *, ListBase *> *physics_relations[DEG_PHYSICS_RELATIONS_NUM];
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -64,22 +64,24 @@
/* ****************** */
/* External Build API */
static DEG::NodeType deg_build_scene_component_type(eDepsSceneComponentType component)
namespace deg = blender::deg;
static deg::NodeType deg_build_scene_component_type(eDepsSceneComponentType component)
{
switch (component) {
case DEG_SCENE_COMP_PARAMETERS:
return DEG::NodeType::PARAMETERS;
return deg::NodeType::PARAMETERS;
case DEG_SCENE_COMP_ANIMATION:
return DEG::NodeType::ANIMATION;
return deg::NodeType::ANIMATION;
case DEG_SCENE_COMP_SEQUENCER:
return DEG::NodeType::SEQUENCER;
return deg::NodeType::SEQUENCER;
}
return DEG::NodeType::UNDEFINED;
return deg::NodeType::UNDEFINED;
}
static DEG::DepsNodeHandle *get_node_handle(DepsNodeHandle *node_handle)
static deg::DepsNodeHandle *get_node_handle(DepsNodeHandle *node_handle)
{
return reinterpret_cast<DEG::DepsNodeHandle *>(node_handle);
return reinterpret_cast<deg::DepsNodeHandle *>(node_handle);
}
void DEG_add_scene_relation(DepsNodeHandle *node_handle,
@ -87,9 +89,9 @@ void DEG_add_scene_relation(DepsNodeHandle *node_handle,
eDepsSceneComponentType component,
const char *description)
{
DEG::NodeType type = deg_build_scene_component_type(component);
DEG::ComponentKey comp_key(&scene->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::NodeType type = deg_build_scene_component_type(component);
deg::ComponentKey comp_key(&scene->id, type);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
}
@ -98,9 +100,9 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::NodeType type = deg::nodeTypeFromObjectComponent(component);
deg::ComponentKey comp_key(&object->id, type);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
}
@ -108,9 +110,9 @@ void DEG_add_simulation_relation(DepsNodeHandle *node_handle,
Simulation *simulation,
const char *description)
{
DEG::OperationKey operation_key(
&simulation->id, DEG::NodeType::SIMULATION, DEG::OperationCode::SIMULATION_EVAL);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::OperationKey operation_key(
&simulation->id, deg::NodeType::SIMULATION, deg::OperationCode::SIMULATION_EVAL);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(operation_key, deg_node_handle, description);
}
@ -119,9 +121,9 @@ void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component);
DEG::ComponentKey comp_key(&cache_file->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::NodeType type = deg::nodeTypeFromObjectComponent(component);
deg::ComponentKey comp_key(&cache_file->id, type);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
}
@ -131,9 +133,9 @@ void DEG_add_bone_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component);
DEG::ComponentKey comp_key(&object->id, type, bone_name);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::NodeType type = deg::nodeTypeFromObjectComponent(component);
deg::ComponentKey comp_key(&object->id, type, bone_name);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
}
@ -142,18 +144,18 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
DEG::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
deg::NodeType type = deg::nodeTypeFromObjectComponent(component);
deg::ComponentKey comp_key(&object->id, type);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
/* Add relation from source to the node handle. */
relation_builder->add_node_handle_relation(comp_key, deg_node_handle, description);
/* Node deduct point cache component and connect source to it. */
ID *id = DEG_get_id_from_handle(node_handle);
DEG::ComponentKey point_cache_key(id, DEG::NodeType::POINT_CACHE);
DEG::Relation *rel = relation_builder->add_relation(comp_key, point_cache_key, "Point Cache");
deg::ComponentKey point_cache_key(id, deg::NodeType::POINT_CACHE);
deg::Relation *rel = relation_builder->add_relation(comp_key, point_cache_key, "Point Cache");
if (rel != nullptr) {
rel->flag |= DEG::RELATION_FLAG_FLUSH_USER_EDIT_ONLY;
rel->flag |= deg::RELATION_FLAG_FLUSH_USER_EDIT_ONLY;
}
else {
fprintf(stderr, "Error in point cache relation from %s to ^%s.\n", object->id.name, id->name);
@ -164,22 +166,22 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
struct ID *id,
const char *description)
{
DEG::OperationKey operation_key(
id, DEG::NodeType::GENERIC_DATABLOCK, DEG::OperationCode::GENERIC_DATABLOCK_UPDATE);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::OperationKey operation_key(
id, deg::NodeType::GENERIC_DATABLOCK, deg::OperationCode::GENERIC_DATABLOCK_UPDATE);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(operation_key, deg_node_handle, description);
}
void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle,
const char *description)
{
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_modifier_to_transform_relation(deg_node_handle, description);
}
void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle, ID *id, uint32_t flag)
{
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_special_eval_flag(id, flag);
}
@ -187,41 +189,41 @@ void DEG_add_customdata_mask(struct DepsNodeHandle *node_handle,
struct Object *object,
const CustomData_MeshMasks *masks)
{
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_customdata_mask(object, DEG::DEGCustomDataMeshMasks(masks));
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_customdata_mask(object, deg::DEGCustomDataMeshMasks(masks));
}
struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle)
{
DEG::DepsNodeHandle *deg_handle = get_node_handle(node_handle);
deg::DepsNodeHandle *deg_handle = get_node_handle(node_handle);
return deg_handle->node->owner->owner->id_orig;
}
struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle)
{
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
DEG::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
return reinterpret_cast<Depsgraph *>(relation_builder->getGraph());
}
/* ******************** */
/* Graph Building API's */
static void graph_build_finalize_common(DEG::Depsgraph *deg_graph, Main *bmain)
static void graph_build_finalize_common(deg::Depsgraph *deg_graph, Main *bmain)
{
/* Detect and solve cycles. */
DEG::deg_graph_detect_cycles(deg_graph);
deg::deg_graph_detect_cycles(deg_graph);
/* Simplify the graph by removing redundant relations (to optimize
* traversal later). */
/* TODO: it would be useful to have an option to disable this in cases where
* it is causing trouble. */
if (G.debug_value == 799) {
DEG::deg_graph_transitive_reduction(deg_graph);
deg::deg_graph_transitive_reduction(deg_graph);
}
/* Store pointers to commonly used valuated datablocks. */
deg_graph->scene_cow = (Scene *)deg_graph->get_cow_id(&deg_graph->scene->id);
/* Flush visibility layer and re-schedule nodes for update. */
DEG::deg_graph_build_finalize(bmain, deg_graph);
deg::deg_graph_build_finalize(bmain, deg_graph);
DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(deg_graph), false);
#if 0
if (!DEG_debug_consistency_check(deg_graph)) {
@ -243,21 +245,21 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
start_time = PIL_check_seconds_timer();
}
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
/* Perform sanity checks. */
BLI_assert(BLI_findindex(&scene->view_layers, view_layer) != -1);
BLI_assert(deg_graph->scene == scene);
BLI_assert(deg_graph->view_layer == view_layer);
DEG::DepsgraphBuilderCache builder_cache;
deg::DepsgraphBuilderCache builder_cache;
/* Generate all the nodes in the graph first */
DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
node_builder.begin_build();
node_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY);
node_builder.build_view_layer(scene, view_layer, deg::DEG_ID_LINKED_DIRECTLY);
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation order. */
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
relation_builder.begin_build();
relation_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY);
relation_builder.build_view_layer(scene, view_layer, deg::DEG_ID_LINKED_DIRECTLY);
relation_builder.build_copy_on_write_relations();
relation_builder.build_driver_relations();
/* Finalize building. */
@ -277,19 +279,19 @@ void DEG_graph_build_for_render_pipeline(Depsgraph *graph,
if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
start_time = PIL_check_seconds_timer();
}
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
/* Perform sanity checks. */
BLI_assert(deg_graph->scene == scene);
deg_graph->is_render_pipeline_depsgraph = true;
DEG::DepsgraphBuilderCache builder_cache;
deg::DepsgraphBuilderCache builder_cache;
/* Generate all the nodes in the graph first */
DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
node_builder.begin_build();
node_builder.build_scene_render(scene, view_layer);
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation
* order. */
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
relation_builder.begin_build();
relation_builder.build_scene_render(scene, view_layer);
relation_builder.build_copy_on_write_relations();
@ -309,20 +311,20 @@ void DEG_graph_build_for_compositor_preview(
if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
start_time = PIL_check_seconds_timer();
}
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
/* Perform sanity checks. */
BLI_assert(deg_graph->scene == scene);
deg_graph->is_render_pipeline_depsgraph = true;
DEG::DepsgraphBuilderCache builder_cache;
deg::DepsgraphBuilderCache builder_cache;
/* Generate all the nodes in the graph first */
DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
node_builder.begin_build();
node_builder.build_scene_render(scene, view_layer);
node_builder.build_nodetree(nodetree);
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation
* order. */
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
deg::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
relation_builder.begin_build();
relation_builder.build_scene_render(scene, view_layer);
relation_builder.build_nodetree(nodetree);
@ -349,7 +351,8 @@ void DEG_graph_build_for_compositor_preview(
* This way we avoid high-poly character body pulled into the dependency graph when it's coming
* from a library into an animation file and the dependency graph constructed for a proxy rig. */
namespace DEG {
namespace blender {
namespace deg {
namespace {
class DepsgraphFromIDsFilter {
@ -433,7 +436,8 @@ class DepsgraphFromIDsRelationBuilder : public DepsgraphRelationBuilder {
};
} // namespace
} // namespace DEG
} // namespace deg
} // namespace blender
void DEG_graph_build_from_ids(Depsgraph *graph,
Main *bmain,
@ -446,25 +450,25 @@ void DEG_graph_build_from_ids(Depsgraph *graph,
if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
start_time = PIL_check_seconds_timer();
}
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
/* Perform sanity checks. */
BLI_assert(BLI_findindex(&scene->view_layers, view_layer) != -1);
BLI_assert(deg_graph->scene == scene);
BLI_assert(deg_graph->view_layer == view_layer);
DEG::DepsgraphBuilderCache builder_cache;
deg::DepsgraphBuilderCache builder_cache;
/* Generate all the nodes in the graph first */
DEG::DepsgraphFromIDsNodeBuilder node_builder(bmain, deg_graph, &builder_cache, ids, num_ids);
deg::DepsgraphFromIDsNodeBuilder node_builder(bmain, deg_graph, &builder_cache, ids, num_ids);
node_builder.begin_build();
node_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY);
node_builder.build_view_layer(scene, view_layer, deg::DEG_ID_LINKED_DIRECTLY);
for (int i = 0; i < num_ids; ++i) {
node_builder.build_id(ids[i]);
}
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation order. */
DEG::DepsgraphFromIDsRelationBuilder relation_builder(
deg::DepsgraphFromIDsRelationBuilder relation_builder(
bmain, deg_graph, &builder_cache, ids, num_ids);
relation_builder.begin_build();
relation_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY);
relation_builder.build_view_layer(scene, view_layer, deg::DEG_ID_LINKED_DIRECTLY);
for (int i = 0; i < num_ids; ++i) {
relation_builder.build_id(ids[i]);
}
@ -482,7 +486,7 @@ void DEG_graph_build_from_ids(Depsgraph *graph,
void DEG_graph_tag_relations_update(Depsgraph *graph)
{
DEG_DEBUG_PRINTF(graph, TAG, "%s: Tagging relations for update.\n", __func__);
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
deg_graph->need_update = true;
/* NOTE: When relations are updated, it's quite possible that
* we've got new bases in the scene. This means, we need to
@ -490,16 +494,16 @@ void DEG_graph_tag_relations_update(Depsgraph *graph)
*
* TODO(sergey): Try to make it so we don't flush updates
* to the whole depsgraph. */
DEG::IDNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
deg::IDNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
if (id_node != nullptr) {
id_node->tag_update(deg_graph, DEG::DEG_UPDATE_SOURCE_RELATIONS);
id_node->tag_update(deg_graph, deg::DEG_UPDATE_SOURCE_RELATIONS);
}
}
/* Create or update relations in the specified graph. */
void DEG_graph_relations_update(Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer)
{
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)graph;
deg::Depsgraph *deg_graph = (deg::Depsgraph *)graph;
if (!deg_graph->need_update) {
/* Graph is up to date, nothing to do. */
return;
@ -511,7 +515,7 @@ void DEG_graph_relations_update(Depsgraph *graph, Main *bmain, Scene *scene, Vie
void DEG_relations_tag_update(Main *bmain)
{
DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) {
for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) {
DEG_graph_tag_relations_update(reinterpret_cast<Depsgraph *>(depsgraph));
}
}

View File

@ -42,27 +42,29 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_time.h"
namespace deg = blender::deg;
void DEG_debug_flags_set(Depsgraph *depsgraph, int flags)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
deg_graph->debug.flags = flags;
}
int DEG_debug_flags_get(const Depsgraph *depsgraph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(depsgraph);
return deg_graph->debug.flags;
}
void DEG_debug_name_set(struct Depsgraph *depsgraph, const char *name)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
deg_graph->debug.name = name;
}
const char *DEG_debug_name_get(struct Depsgraph *depsgraph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(depsgraph);
return deg_graph->debug.name.c_str();
}
@ -70,8 +72,8 @@ bool DEG_debug_compare(const struct Depsgraph *graph1, const struct Depsgraph *g
{
BLI_assert(graph1 != nullptr);
BLI_assert(graph2 != nullptr);
const DEG::Depsgraph *deg_graph1 = reinterpret_cast<const DEG::Depsgraph *>(graph1);
const DEG::Depsgraph *deg_graph2 = reinterpret_cast<const DEG::Depsgraph *>(graph2);
const deg::Depsgraph *deg_graph1 = reinterpret_cast<const deg::Depsgraph *>(graph1);
const deg::Depsgraph *deg_graph2 = reinterpret_cast<const deg::Depsgraph *>(graph2);
if (deg_graph1->operations.size() != deg_graph2->operations.size()) {
return false;
}
@ -103,18 +105,18 @@ bool DEG_debug_graph_relations_validate(Depsgraph *graph,
bool DEG_debug_consistency_check(Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
/* Validate links exists in both directions. */
for (DEG::OperationNode *node : deg_graph->operations) {
for (DEG::Relation *rel : node->outlinks) {
for (deg::OperationNode *node : deg_graph->operations) {
for (deg::Relation *rel : node->outlinks) {
int counter1 = 0;
for (DEG::Relation *tmp_rel : node->outlinks) {
for (deg::Relation *tmp_rel : node->outlinks) {
if (tmp_rel == rel) {
counter1++;
}
}
int counter2 = 0;
for (DEG::Relation *tmp_rel : rel->to->inlinks) {
for (deg::Relation *tmp_rel : rel->to->inlinks) {
if (tmp_rel == rel) {
counter2++;
}
@ -130,16 +132,16 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
}
}
for (DEG::OperationNode *node : deg_graph->operations) {
for (DEG::Relation *rel : node->inlinks) {
for (deg::OperationNode *node : deg_graph->operations) {
for (deg::Relation *rel : node->inlinks) {
int counter1 = 0;
for (DEG::Relation *tmp_rel : node->inlinks) {
for (deg::Relation *tmp_rel : node->inlinks) {
if (tmp_rel == rel) {
counter1++;
}
}
int counter2 = 0;
for (DEG::Relation *tmp_rel : rel->from->outlinks) {
for (deg::Relation *tmp_rel : rel->from->outlinks) {
if (tmp_rel == rel) {
counter2++;
}
@ -153,19 +155,19 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
}
/* Validate node valency calculated in both directions. */
for (DEG::OperationNode *node : deg_graph->operations) {
for (deg::OperationNode *node : deg_graph->operations) {
node->num_links_pending = 0;
node->custom_flags = 0;
}
for (DEG::OperationNode *node : deg_graph->operations) {
for (deg::OperationNode *node : deg_graph->operations) {
if (node->custom_flags) {
printf("Node %s is twice in the operations!\n", node->identifier().c_str());
return false;
}
for (DEG::Relation *rel : node->outlinks) {
if (rel->to->type == DEG::NodeType::OPERATION) {
DEG::OperationNode *to = (DEG::OperationNode *)rel->to;
for (deg::Relation *rel : node->outlinks) {
if (rel->to->type == deg::NodeType::OPERATION) {
deg::OperationNode *to = (deg::OperationNode *)rel->to;
BLI_assert(to->num_links_pending < to->inlinks.size());
++to->num_links_pending;
}
@ -173,10 +175,10 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
node->custom_flags = 1;
}
for (DEG::OperationNode *node : deg_graph->operations) {
for (deg::OperationNode *node : deg_graph->operations) {
int num_links_pending = 0;
for (DEG::Relation *rel : node->inlinks) {
if (rel->from->type == DEG::NodeType::OPERATION) {
for (deg::Relation *rel : node->inlinks) {
if (rel->from->type == deg::NodeType::OPERATION) {
num_links_pending++;
}
}
@ -205,7 +207,7 @@ void DEG_stats_simple(const Depsgraph *graph,
size_t *r_operations,
size_t *r_relations)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
/* number of operations */
if (r_operations) {
@ -219,17 +221,17 @@ void DEG_stats_simple(const Depsgraph *graph,
size_t tot_outer = 0;
size_t tot_rels = 0;
for (DEG::IDNode *id_node : deg_graph->id_nodes) {
for (deg::IDNode *id_node : deg_graph->id_nodes) {
tot_outer++;
for (DEG::ComponentNode *comp_node : id_node->components.values()) {
for (deg::ComponentNode *comp_node : id_node->components.values()) {
tot_outer++;
for (DEG::OperationNode *op_node : comp_node->operations) {
for (deg::OperationNode *op_node : comp_node->operations) {
tot_rels += op_node->inlinks.size();
}
}
}
DEG::TimeSourceNode *time_source = deg_graph->find_time_source();
deg::TimeSourceNode *time_source = deg_graph->find_time_source();
if (time_source != nullptr) {
tot_rels += time_source->inlinks.size();
}
@ -243,13 +245,13 @@ void DEG_stats_simple(const Depsgraph *graph,
}
}
static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
static deg::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
{
const char *name = DEG_debug_name_get(depsgraph);
if (name[0] == '\0') {
return "";
}
return "[" + DEG::string(name) + "]: ";
return "[" + deg::string(name) + "]: ";
}
void DEG_debug_print_begin(struct Depsgraph *depsgraph)
@ -270,9 +272,9 @@ void DEG_debug_print_eval(struct Depsgraph *depsgraph,
depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::color_for_pointer(object_address).c_str(),
deg::color_for_pointer(object_address).c_str(),
object_address,
DEG::color_end().c_str());
deg::color_end().c_str());
fflush(stdout);
}
@ -292,14 +294,14 @@ void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::color_for_pointer(object_address).c_str(),
deg::color_for_pointer(object_address).c_str(),
object_address,
DEG::color_end().c_str(),
deg::color_end().c_str(),
subdata_comment,
subdata_name,
DEG::color_for_pointer(subdata_address).c_str(),
deg::color_for_pointer(subdata_address).c_str(),
subdata_address,
DEG::color_end().c_str());
deg::color_end().c_str());
fflush(stdout);
}
@ -320,15 +322,15 @@ void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::color_for_pointer(object_address).c_str(),
deg::color_for_pointer(object_address).c_str(),
object_address,
DEG::color_end().c_str(),
deg::color_end().c_str(),
subdata_comment,
subdata_name,
subdata_index,
DEG::color_for_pointer(subdata_address).c_str(),
deg::color_for_pointer(subdata_address).c_str(),
subdata_address,
DEG::color_end().c_str());
deg::color_end().c_str());
fflush(stdout);
}
@ -348,14 +350,14 @@ void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::color_for_pointer(object_address).c_str(),
deg::color_for_pointer(object_address).c_str(),
object_address,
DEG::color_end().c_str(),
deg::color_end().c_str(),
parent_comment,
parent_name,
DEG::color_for_pointer(parent_address).c_str(),
deg::color_for_pointer(parent_address).c_str(),
parent_address,
DEG::color_end().c_str());
deg::color_end().c_str());
fflush(stdout);
}
@ -373,9 +375,9 @@ void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::color_for_pointer(object_address).c_str(),
deg::color_for_pointer(object_address).c_str(),
object_address,
DEG::color_end().c_str(),
deg::color_end().c_str(),
time);
fflush(stdout);
}

View File

@ -45,44 +45,46 @@
#include "intern/depsgraph.h"
namespace deg = blender::deg;
/* Evaluate all nodes tagged for updating. */
void DEG_evaluate_on_refresh(Main *bmain, Depsgraph *graph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene);
/* Update time on primary timesource. */
DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
deg::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = deg_graph->ctime;
/* Update time in scene. */
if (deg_graph->scene_cow) {
BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime);
}
DEG::deg_graph_flush_updates(bmain, deg_graph);
DEG::deg_evaluate_on_refresh(deg_graph);
deg::deg_graph_flush_updates(bmain, deg_graph);
deg::deg_evaluate_on_refresh(deg_graph);
deg_graph->need_update_time = false;
}
/* Frame-change happened for root scene that graph belongs to. */
void DEG_evaluate_on_framechange(Main *bmain, Depsgraph *graph, float ctime)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
deg_graph->ctime = ctime;
/* Update time on primary timesource. */
DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
deg::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = ctime;
deg_graph->need_update_time = true;
DEG::deg_graph_flush_updates(bmain, deg_graph);
deg::deg_graph_flush_updates(bmain, deg_graph);
/* Update time in scene. */
if (deg_graph->scene_cow) {
BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime);
}
/* Perform recalculation updates. */
DEG::deg_evaluate_on_refresh(deg_graph);
deg::deg_evaluate_on_refresh(deg_graph);
deg_graph->need_update_time = false;
}
bool DEG_needs_eval(Depsgraph *graph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
return !deg_graph->entry_tags.is_empty() || deg_graph->need_update_time;
}

View File

@ -44,6 +44,8 @@
#include "depsgraph.h"
namespace deg = blender::deg;
/*************************** Evaluation Query API *****************************/
static ePhysicsRelationType modifier_to_relation_type(unsigned int modifier_type)
@ -63,7 +65,7 @@ static ePhysicsRelationType modifier_to_relation_type(unsigned int modifier_type
ListBase *DEG_get_effector_relations(const Depsgraph *graph, Collection *collection)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
if (deg_graph->physics_relations[DEG_PHYSICS_EFFECTOR] == nullptr) {
return nullptr;
}
@ -77,7 +79,7 @@ ListBase *DEG_get_collision_relations(const Depsgraph *graph,
Collection *collection,
unsigned int modifier_type)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
const ePhysicsRelationType type = modifier_to_relation_type(modifier_type);
if (deg_graph->physics_relations[type] == nullptr) {
return nullptr;
@ -96,7 +98,7 @@ void DEG_add_collision_relations(DepsNodeHandle *handle,
const char *name)
{
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
deg::Depsgraph *deg_graph = (deg::Depsgraph *)depsgraph;
ListBase *relations = build_collision_relations(deg_graph, collection, modifier_type);
LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
Object *ob1 = relation->ob;
@ -119,7 +121,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
const char *name)
{
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
deg::Depsgraph *deg_graph = (deg::Depsgraph *)depsgraph;
ListBase *relations = build_effector_relations(deg_graph, effector_weights->group);
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob == object) {
@ -158,7 +160,8 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
/******************************** Internal API ********************************/
namespace DEG {
namespace blender {
namespace deg {
ListBase *build_effector_relations(Depsgraph *graph, Collection *collection)
{
@ -218,4 +221,5 @@ void clear_physics_relations(Depsgraph *graph)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -26,7 +26,8 @@
struct Collection;
struct ListBase;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -36,4 +37,5 @@ ListBase *build_collision_relations(Depsgraph *graph,
unsigned int modifier_type);
void clear_physics_relations(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -47,39 +47,41 @@
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/node/deg_node_id.h"
namespace deg = blender::deg;
struct Scene *DEG_get_input_scene(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
return deg_graph->scene;
}
struct ViewLayer *DEG_get_input_view_layer(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
return deg_graph->view_layer;
}
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
return deg_graph->mode;
}
float DEG_get_ctime(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
return deg_graph->ctime;
}
bool DEG_id_type_updated(const Depsgraph *graph, short id_type)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
return deg_graph->id_type_updated[BKE_idtype_idcode_to_index(id_type)] != 0;
}
bool DEG_id_type_any_updated(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
/* Loop over all ID types. */
for (int id_type_index = 0; id_type_index < MAX_LIBARRAY; id_type_index++) {
@ -93,7 +95,7 @@ bool DEG_id_type_any_updated(const Depsgraph *graph)
bool DEG_id_type_any_exists(const Depsgraph *depsgraph, short id_type)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(depsgraph);
return deg_graph->id_type_exist[BKE_idtype_idcode_to_index(id_type)] != 0;
}
@ -108,8 +110,8 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
return 0;
}
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(id));
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(id));
if (id_node == nullptr) {
/* TODO(sergey): Does it mean we need to check set scene? */
return 0;
@ -131,8 +133,8 @@ void DEG_get_customdata_mask_for_object(const Depsgraph *graph,
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));
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 == nullptr) {
/* TODO(sergey): Does it mean we need to check set scene? */
return;
@ -147,17 +149,17 @@ void DEG_get_customdata_mask_for_object(const Depsgraph *graph,
Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
Scene *scene_cow = deg_graph->scene_cow;
/* TODO(sergey): Shall we expand data-block here? Or is it OK to assume
* that caller is OK with just a pointer in case scene is not updated yet? */
BLI_assert(scene_cow != nullptr && DEG::deg_copy_on_write_is_expanded(&scene_cow->id));
BLI_assert(scene_cow != nullptr && deg::deg_copy_on_write_is_expanded(&scene_cow->id));
return scene_cow;
}
ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph)
{
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph);
Scene *scene_cow = DEG_get_evaluated_scene(graph);
if (scene_cow == nullptr) {
return nullptr; /* Happens with new, not-yet-built/evaluated graphes. */
@ -184,8 +186,8 @@ ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
/* TODO(sergey): This is a duplicate of Depsgraph::get_cow_id(),
* but here we never do assert, since we don't know nature of the
* incoming ID data-block. */
const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
const DEG::IDNode *id_node = deg_graph->find_id_node(id);
const deg::Depsgraph *deg_graph = (const deg::Depsgraph *)depsgraph;
const deg::IDNode *id_node = deg_graph->find_id_node(id);
if (id_node == nullptr) {
return id;
}
@ -309,7 +311,7 @@ bool DEG_is_evaluated_object(const Object *object)
bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
{
const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
const deg::Depsgraph *deg_graph = (const deg::Depsgraph *)depsgraph;
/* Check whether relations are up to date. */
if (deg_graph->need_update) {
return false;

View File

@ -40,9 +40,12 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace deg = blender::deg;
/* ************************ DEG TRAVERSAL ********************* */
namespace DEG {
namespace blender {
namespace deg {
namespace {
typedef deque<OperationNode *> TraversalQueue;
@ -262,14 +265,15 @@ void deg_foreach_id(const Depsgraph *depsgraph, DEGForeachIDCallback callback, v
}
} // namespace
} // namespace DEG
} // namespace deg
} // namespace blender
void DEG_foreach_dependent_ID(const Depsgraph *depsgraph,
const ID *id,
DEGForeachIDCallback callback,
void *user_data)
{
DEG::deg_foreach_dependent_ID((const DEG::Depsgraph *)depsgraph, id, callback, user_data);
deg::deg_foreach_dependent_ID((const deg::Depsgraph *)depsgraph, id, callback, user_data);
}
void DEG_foreach_dependent_ID_component(const Depsgraph *depsgraph,
@ -279,8 +283,8 @@ void DEG_foreach_dependent_ID_component(const Depsgraph *depsgraph,
DEGForeachIDComponentCallback callback,
void *user_data)
{
DEG::deg_foreach_dependent_ID_component(
(const DEG::Depsgraph *)depsgraph, id, source_component_type, flags, callback, user_data);
deg::deg_foreach_dependent_ID_component(
(const deg::Depsgraph *)depsgraph, id, source_component_type, flags, callback, user_data);
}
void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph,
@ -288,10 +292,10 @@ void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph,
DEGForeachIDCallback callback,
void *user_data)
{
DEG::deg_foreach_ancestor_ID((const DEG::Depsgraph *)depsgraph, id, callback, user_data);
deg::deg_foreach_ancestor_ID((const deg::Depsgraph *)depsgraph, id, callback, user_data);
}
void DEG_foreach_ID(const Depsgraph *depsgraph, DEGForeachIDCallback callback, void *user_data)
{
DEG::deg_foreach_id((const DEG::Depsgraph *)depsgraph, callback, user_data);
deg::deg_foreach_id((const deg::Depsgraph *)depsgraph, callback, user_data);
}

View File

@ -59,6 +59,8 @@
# define INVALIDATE_WORK_DATA
#endif
namespace deg = blender::deg;
/* ************************ DEG ITERATORS ********************* */
namespace {
@ -169,14 +171,14 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
invert_m4_m4(data->temp_dupli_object.imat, data->temp_dupli_object.obmat);
iter->current = &data->temp_dupli_object;
BLI_assert(DEG::deg_validate_copy_on_write_datablock(&data->temp_dupli_object.id));
BLI_assert(deg::deg_validate_copy_on_write_datablock(&data->temp_dupli_object.id));
return true;
}
return false;
}
void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
void deg_iterator_objects_step(BLI_Iterator *iter, deg::IDNode *id_node)
{
/* Set it early in case we need to exit and we are running from within a loop. */
iter->skip = true;
@ -193,17 +195,17 @@ void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
}
switch (id_node->linked_state) {
case DEG::DEG_ID_LINKED_DIRECTLY:
case deg::DEG_ID_LINKED_DIRECTLY:
if ((data->flag & DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY) == 0) {
return;
}
break;
case DEG::DEG_ID_LINKED_VIA_SET:
case deg::DEG_ID_LINKED_VIA_SET:
if ((data->flag & DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET) == 0) {
return;
}
break;
case DEG::DEG_ID_LINKED_INDIRECTLY:
case deg::DEG_ID_LINKED_INDIRECTLY:
if ((data->flag & DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY) == 0) {
return;
}
@ -211,7 +213,7 @@ void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
}
Object *object = (Object *)id_node->id_cow;
BLI_assert(DEG::deg_validate_copy_on_write_datablock(&object->id));
BLI_assert(deg::deg_validate_copy_on_write_datablock(&object->id));
int ob_visibility = OB_VISIBLE_ALL;
if (data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) {
@ -241,7 +243,7 @@ void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
{
Depsgraph *depsgraph = data->graph;
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
const size_t num_id_nodes = deg_graph->id_nodes.size();
iter->data = data;
@ -261,7 +263,7 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
data->eval_mode = DEG_get_mode(depsgraph);
deg_invalidate_iterator_work_data(data);
DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
if (iter->skip) {
@ -273,7 +275,7 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
{
DEGObjectIterData *data = (DEGObjectIterData *)iter->data;
Depsgraph *depsgraph = data->graph;
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
do {
iter->skip = false;
if (data->dupli_list) {
@ -297,7 +299,7 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
return;
}
DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
} while (iter->skip);
}
@ -314,7 +316,7 @@ void DEG_iterator_objects_end(BLI_Iterator *iter)
/* ************************ DEG ID ITERATOR ********************* */
static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDNode *id_node, bool only_updated)
static void DEG_iterator_ids_step(BLI_Iterator *iter, deg::IDNode *id_node, bool only_updated)
{
ID *id_cow = id_node->id_cow;
@ -339,7 +341,7 @@ static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDNode *id_node, bool
void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
{
Depsgraph *depsgraph = data->graph;
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
const size_t num_id_nodes = deg_graph->id_nodes.size();
iter->data = data;
@ -352,7 +354,7 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
data->id_node_index = 0;
data->num_id_nodes = num_id_nodes;
DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
if (iter->skip) {
@ -364,7 +366,7 @@ void DEG_iterator_ids_next(BLI_Iterator *iter)
{
DEGIDIterData *data = (DEGIDIterData *)iter->data;
Depsgraph *depsgraph = data->graph;
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
do {
iter->skip = false;
@ -375,7 +377,7 @@ void DEG_iterator_ids_next(BLI_Iterator *iter)
return;
}
DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
} while (iter->skip);
}

View File

@ -27,7 +27,8 @@
#include "intern/depsgraph.h"
namespace DEG {
namespace blender {
namespace deg {
static Map<Main *, VectorSet<Depsgraph *>> g_graph_registry;
@ -58,4 +59,5 @@ Span<Depsgraph *> get_all_registered_graphs(Main *bmain)
return {};
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
struct Main;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -35,4 +36,5 @@ void register_graph(Depsgraph *depsgraph);
void unregister_graph(Depsgraph *depsgraph);
Span<Depsgraph *> get_all_registered_graphs(Main *bmain);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -28,7 +28,8 @@
#include "intern/depsgraph_type.h"
#include "intern/node/deg_node.h"
namespace DEG {
namespace blender {
namespace deg {
Relation::Relation(Node *from, Node *to, const char *description)
: from(from), to(to), name(description), flag(0)
@ -64,4 +65,5 @@ void Relation::unlink()
to->inlinks.remove_first_occurrence_and_reorder(this);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,7 +23,8 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Node;
@ -60,4 +61,5 @@ struct Relation {
int flag; /* Bitmask of RelationFlag) */
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -70,10 +70,13 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace deg = blender::deg;
/* *********************** */
/* Update Tagging/Flushing */
namespace DEG {
namespace blender {
namespace deg {
namespace {
@ -510,7 +513,7 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_ti
/* NOTE: It is possible to have this function called with `do_time=false` first and later (prior
* to evaluation though) with `do_time=true`. This means early output checks should be aware of
* this. */
for (DEG::IDNode *id_node : graph->id_nodes) {
for (deg::IDNode *id_node : graph->id_nodes) {
const ID_Type id_type = GS(id_node->id_orig->name);
if (id_type == ID_OB) {
Object *object_orig = reinterpret_cast<Object *>(id_node->id_orig);
@ -525,7 +528,7 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_ti
continue;
}
int flag = 0;
if (!DEG::deg_copy_on_write_is_expanded(id_node->id_cow)) {
if (!deg::deg_copy_on_write_is_expanded(id_node->id_cow)) {
flag |= ID_RECALC_COPY_ON_WRITE;
if (do_time) {
if (BKE_animdata_from_id(id_node->id_orig) != nullptr) {
@ -619,7 +622,7 @@ NodeType geometry_tag_to_component(const ID *id)
void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source)
{
graph_id_tag_update(bmain, nullptr, id, flag, update_source);
for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) {
for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) {
graph_id_tag_update(bmain, depsgraph, id, flag, update_source);
}
@ -684,7 +687,8 @@ void graph_id_tag_update(
}
}
} // namespace DEG
} // namespace deg
} // namespace blender
const char *DEG_update_tag_as_string(IDRecalcFlag flag)
{
@ -759,7 +763,7 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
/* Ideally should not happen, but old depsgraph allowed this. */
return;
}
DEG::id_tag_update(bmain, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
deg::id_tag_update(bmain, id, flag, deg::DEG_UPDATE_SOURCE_USER_EDIT);
}
void DEG_graph_id_tag_update(struct Main *bmain,
@ -767,8 +771,8 @@ void DEG_graph_id_tag_update(struct Main *bmain,
struct ID *id,
int flag)
{
DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph;
DEG::graph_id_tag_update(bmain, graph, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph;
deg::graph_id_tag_update(bmain, graph, id, flag, deg::DEG_UPDATE_SOURCE_USER_EDIT);
}
/* Mark a particular datablock type as having changing. */
@ -784,13 +788,13 @@ void DEG_graph_id_type_tag(Depsgraph *depsgraph, short id_type)
DEG_graph_id_type_tag(depsgraph, ID_SCE);
}
const int id_type_index = BKE_idtype_idcode_to_index(id_type);
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
deg_graph->id_type_updated[id_type_index] = 1;
}
void DEG_id_type_tag(Main *bmain, short id_type)
{
for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) {
for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) {
DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph *>(depsgraph), id_type);
}
}
@ -798,13 +802,13 @@ void DEG_id_type_tag(Main *bmain, short id_type)
/* Update dependency graph when visible scenes/layers changes. */
void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph, const bool do_time)
{
DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph;
DEG::deg_graph_on_visible_update(bmain, graph, do_time);
deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph;
deg::deg_graph_on_visible_update(bmain, graph, do_time);
}
void DEG_on_visible_update(Main *bmain, const bool do_time)
{
for (DEG::Depsgraph *depsgraph : DEG::get_all_registered_graphs(bmain)) {
for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) {
DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(depsgraph), do_time);
}
}
@ -821,7 +825,7 @@ void DEG_ids_check_recalc(
update_ctx.depsgraph = depsgraph;
update_ctx.scene = scene;
update_ctx.view_layer = view_layer;
DEG::deg_editors_scene_update(&update_ctx, updated);
deg::deg_editors_scene_update(&update_ctx, updated);
}
static void deg_graph_clear_id_recalc_flags(ID *id)
@ -837,14 +841,14 @@ static void deg_graph_clear_id_recalc_flags(ID *id)
void DEG_ids_clear_recalc(Main *UNUSED(bmain), Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph);
/* TODO(sergey): Re-implement POST_UPDATE_HANDLER_WORKAROUND using entry_tags
* and id_tags storage from the new dependency graph. */
if (!DEG_id_type_any_updated(depsgraph)) {
return;
}
/* Go over all ID nodes nodes, clearing tags. */
for (DEG::IDNode *id_node : deg_graph->id_nodes) {
for (deg::IDNode *id_node : deg_graph->id_nodes) {
/* TODO: we clear original ID recalc flags here, but this may not work
* correctly when there are multiple depsgraph with others still using
* the recalc flag. */

View File

@ -26,7 +26,8 @@
struct ID;
struct Main;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -40,4 +41,5 @@ void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source);
void graph_id_tag_update(
Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -37,13 +37,15 @@
#include "intern/node/deg_node_factory.h"
#include "intern/node/deg_node_operation.h"
namespace deg = blender::deg;
/* Register all node types */
void DEG_register_node_types(void)
{
/* register node types */
DEG::deg_register_base_depsnodes();
DEG::deg_register_component_depsnodes();
DEG::deg_register_operation_depsnodes();
deg::deg_register_base_depsnodes();
deg::deg_register_component_depsnodes();
deg::deg_register_operation_depsnodes();
}
/* Free registry on exit */
@ -51,7 +53,7 @@ void DEG_free_node_types(void)
{
}
DEG::DEGCustomDataMeshMasks::DEGCustomDataMeshMasks(const CustomData_MeshMasks *other)
deg::DEGCustomDataMeshMasks::DEGCustomDataMeshMasks(const CustomData_MeshMasks *other)
: vert_mask(other->vmask),
edge_mask(other->emask),
face_mask(other->fmask),

View File

@ -50,16 +50,10 @@ struct Depsgraph;
struct CustomData_MeshMasks;
namespace DEG {
namespace blender {
namespace deg {
/* Commonly used types. */
using blender::Map;
using blender::Set;
using blender::Span;
using blender::StringRef;
using blender::StringRefNull;
using blender::Vector;
using blender::VectorSet;
using std::deque;
using std::optional;
using std::pair;
@ -175,4 +169,5 @@ struct DEGCustomDataMeshMasks {
}
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,10 @@
#include "intern/depsgraph_type.h"
namespace DEG {
namespace deg = blender::deg;
namespace blender {
namespace deg {
static DEG_EditorUpdateIDCb deg_editor_update_id_cb = nullptr;
static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = nullptr;
@ -46,11 +49,12 @@ void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx, bool upd
}
}
} // namespace DEG
} // namespace deg
} // namespace blender
/* Set callbacks which are being called when depsgraph changes. */
void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSceneCb scene_func)
{
DEG::deg_editor_update_id_cb = id_func;
DEG::deg_editor_update_scene_cb = scene_func;
deg::deg_editor_update_id_cb = id_func;
deg::deg_editor_update_scene_cb = scene_func;
}

View File

@ -26,10 +26,12 @@
struct DEGEditorUpdateContext;
struct ID;
namespace DEG {
namespace blender {
namespace deg {
void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx, struct ID *id);
void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx, bool updated);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -54,7 +54,8 @@
#include "intern/node/deg_node_operation.h"
#include "intern/node/deg_node_time.h"
namespace DEG {
namespace blender {
namespace deg {
namespace {
@ -416,4 +417,5 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
graph->debug.end_graph_evaluation();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -38,4 +39,5 @@ struct Depsgraph;
*/
void deg_evaluate_on_refresh(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -100,7 +100,8 @@
#include "intern/node/deg_node.h"
#include "intern/node/deg_node_id.h"
namespace DEG {
namespace blender {
namespace deg {
#define DEBUG_PRINT \
if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) \
@ -945,7 +946,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != nullptr);
return deg_expand_copy_on_write_datablock(depsgraph, id_node, node_builder, create_placeholders);
}
@ -969,7 +970,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, const IDNode
/* NOTE: Depsgraph is supposed to have ID node already. */
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, ID *id_orig)
{
DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != nullptr);
return deg_update_copy_on_write_datablock(depsgraph, id_node);
}
@ -1089,7 +1090,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
void deg_evaluate_copy_on_write(struct ::Depsgraph *graph, const IDNode *id_node)
{
const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph);
const Depsgraph *depsgraph = reinterpret_cast<const Depsgraph *>(graph);
DEG_debug_print_eval(graph, __func__, id_node->id_orig->name, id_node->id_cow);
if (id_node->id_orig == &depsgraph->scene->id) {
/* NOTE: This is handled by eval_ctx setup routines, which
@ -1137,4 +1138,5 @@ bool deg_copy_on_write_is_needed(const ID_Type id_type)
return ID_TYPE_IS_COW(id_type);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -43,7 +43,8 @@ struct ID;
struct Depsgraph;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
class DepsgraphNodeBuilder;
@ -98,4 +99,5 @@ bool deg_copy_on_write_is_expanded(const struct ID *id_cow);
bool deg_copy_on_write_is_needed(const ID *id_orig);
bool deg_copy_on_write_is_needed(const ID_Type id_type);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -67,7 +67,8 @@
// catch usage of invalid state.
#undef INVALIDATE_ON_FLUSH
namespace DEG {
namespace blender {
namespace deg {
enum {
ID_STATE_NONE = 0,
@ -227,7 +228,7 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd
ID *id_orig = id_node->id_orig;
ID *id_cow = id_node->id_cow;
/* Gather recalc flags from all changed components. */
for (DEG::ComponentNode *comp_node : id_node->components.values()) {
for (ComponentNode *comp_node : id_node->components.values()) {
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
}
@ -339,9 +340,9 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
if (graph->need_update_time) {
const Scene *scene_orig = graph->scene;
const float ctime = BKE_scene_frame_get(scene_orig);
DEG::TimeSourceNode *time_source = graph->find_time_source();
TimeSourceNode *time_source = graph->find_time_source();
graph->ctime = ctime;
time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME);
time_source->tag_update(graph, DEG_UPDATE_SOURCE_TIME);
}
if (graph->entry_tags.is_empty()) {
return;
@ -392,4 +393,5 @@ void deg_graph_clear_tags(Depsgraph *graph)
graph->entry_tags.clear();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
struct Main;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -39,4 +40,5 @@ void deg_graph_flush_updates(struct Main *bmain, struct Depsgraph *graph);
/* Clear tags from all operation nodes. */
void deg_graph_clear_tags(struct Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -29,7 +29,8 @@
#include "DRW_engine.h"
namespace DEG {
namespace blender {
namespace deg {
RuntimeBackup::RuntimeBackup(const Depsgraph *depsgraph)
: have_backup(false),
@ -116,4 +117,5 @@ void RuntimeBackup::restore_to_id(ID *id)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "intern/eval/deg_eval_runtime_backup_sound.h"
#include "intern/eval/deg_eval_runtime_backup_volume.h"
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -67,4 +68,5 @@ class RuntimeBackup {
VolumeBackup volume_backup;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "intern/depsgraph.h"
namespace DEG {
namespace blender {
namespace deg {
namespace {
@ -141,4 +142,5 @@ void AnimationBackup::restore_to_id(ID *id)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
#include "intern/depsgraph_type.h"
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -62,4 +63,5 @@ class AnimationBackup {
Vector<AnimationValueBackup> values_backup;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,7 +23,8 @@
#include "intern/eval/deg_eval_runtime_backup_modifier.h"
namespace DEG {
namespace blender {
namespace deg {
ModifierDataBackupID::ModifierDataBackupID(const Depsgraph * /*depsgraph*/)
: ModifierDataBackupID(nullptr, eModifierType_None)
@ -46,4 +47,5 @@ uint32_t ModifierDataBackupID::hash() const
return (ptr >> 4) ^ (uintptr_t)type;
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -29,7 +29,8 @@
struct ModifierData;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -57,4 +58,5 @@ class ModifierDataBackupID {
/* Storage for backed up runtime modifier data. */
typedef Map<ModifierDataBackupID, void *> ModifierRuntimeDataBackup;
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
#include "BLI_utildefines.h"
namespace DEG {
namespace blender {
namespace deg {
MovieClipBackup::MovieClipBackup(const Depsgraph * /*depsgraph*/)
{
@ -58,4 +59,5 @@ void MovieClipBackup::restore_to_movieclip(MovieClip *movieclip)
reset();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@ struct MovieClip;
struct MovieClipCache;
struct anim;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -45,4 +46,5 @@ class MovieClipBackup {
struct MovieClipCache *cache;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "BKE_action.h"
#include "BKE_object.h"
namespace DEG {
namespace blender {
namespace deg {
ObjectRuntimeBackup::ObjectRuntimeBackup(const Depsgraph * /*depsgraph*/)
: base_flag(0), base_local_view_bits(0)
@ -185,4 +186,5 @@ void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -30,7 +30,8 @@
struct Object;
namespace DEG {
namespace blender {
namespace deg {
class ObjectRuntimeBackup {
public:
@ -56,4 +57,5 @@ class ObjectRuntimeBackup {
Map<bPoseChannel *, bPoseChannel_Runtime> pose_channel_runtime_data;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,6 +23,8 @@
#include "intern/eval/deg_eval_runtime_backup_pose.h"
namespace DEG {
namespace blender {
namespace deg {
} // namespace DEG
}
} // namespace blender

View File

@ -27,6 +27,8 @@
#include "DNA_action_types.h"
namespace DEG {
namespace blender {
namespace deg {
} // namespace DEG
}
} // namespace blender

View File

@ -28,7 +28,8 @@
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
namespace DEG {
namespace blender {
namespace deg {
SceneBackup::SceneBackup(const Depsgraph *depsgraph) : sequencer_backup(depsgraph)
{
@ -85,4 +86,5 @@ void SceneBackup::restore_to_scene(Scene *scene)
reset();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
struct Scene;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -55,4 +56,5 @@ class SceneBackup {
SequencerBackup sequencer_backup;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "DNA_sequence_types.h"
namespace DEG {
namespace blender {
namespace deg {
SequenceBackup::SequenceBackup(const Depsgraph * /*depsgraph*/)
{
@ -55,4 +56,5 @@ bool SequenceBackup::isEmpty() const
return (scene_sound == nullptr);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
struct Sequence;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -44,4 +45,5 @@ class SequenceBackup {
void *scene_sound;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -29,7 +29,8 @@
#include "BKE_sequencer.h"
#include "BKE_sound.h"
namespace DEG {
namespace blender {
namespace deg {
SequencerBackup::SequencerBackup(const Depsgraph *depsgraph) : depsgraph(depsgraph)
{
@ -66,4 +67,5 @@ void SequencerBackup::restore_to_scene(Scene *scene)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -28,7 +28,8 @@
struct Scene;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -45,4 +46,5 @@ class SequencerBackup {
Map<Sequence *, SequenceBackup> sequences_backup;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -27,7 +27,8 @@
#include "DNA_sound_types.h"
namespace DEG {
namespace blender {
namespace deg {
SoundBackup::SoundBackup(const Depsgraph * /*depsgraph*/)
{
@ -61,4 +62,5 @@ void SoundBackup::restore_to_sound(bSound *sound)
reset();
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
struct bSound;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -44,4 +45,5 @@ class SoundBackup {
void *playback_handle;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -33,7 +33,8 @@
#include <stdio.h>
namespace DEG {
namespace blender {
namespace deg {
VolumeBackup::VolumeBackup(const Depsgraph * /*depsgraph*/) : grids(nullptr)
{
@ -57,4 +58,5 @@ void VolumeBackup::restore_to_volume(Volume *volume)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -26,7 +26,8 @@
struct Volume;
struct VolumeGridVector;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
@ -42,4 +43,5 @@ class VolumeBackup {
char filepath[1024]; /* FILE_MAX */
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
void deg_eval_stats_aggregate(Depsgraph *graph)
{
@ -54,4 +55,5 @@ void deg_eval_stats_aggregate(Depsgraph *graph)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,11 +23,13 @@
#pragma once
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
/* Aggregate operation timings to overall component and ID nodes timing. */
void deg_eval_stats_aggregate(Depsgraph *graph);
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -36,7 +36,8 @@
#include "intern/node/deg_node_operation.h"
#include "intern/node/deg_node_time.h"
namespace DEG {
namespace blender {
namespace deg {
const char *nodeClassAsString(NodeClass node_class)
{
@ -340,4 +341,5 @@ void deg_register_base_depsnodes()
register_node_typeinfo(&DNTI_ID_REF);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
struct ID;
struct Scene;
namespace DEG {
namespace blender {
namespace deg {
struct Depsgraph;
struct OperationNode;
@ -212,4 +213,5 @@ struct Node {
void deg_register_base_depsnodes();
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -38,7 +38,8 @@
#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
namespace DEG {
namespace blender {
namespace deg {
/* *********** */
/* Outer Nodes */
@ -377,4 +378,5 @@ void deg_register_component_depsnodes()
register_node_typeinfo(&DNTI_SIMULATION);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
struct ID;
struct bPoseChannel;
namespace DEG {
namespace blender {
namespace deg {
struct BoneComponentNode;
struct Depsgraph;
@ -200,4 +201,5 @@ struct BoneComponentNode : public ComponentNode {
void deg_register_component_depsnodes();
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -23,7 +23,8 @@
#include "intern/node/deg_node_factory.h"
namespace DEG {
namespace blender {
namespace deg {
/* Global type registry */
static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {nullptr};
@ -42,4 +43,5 @@ DepsNodeFactory *type_get_factory(const NodeType type)
return node_typeinfo_registry[type_as_int];
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -30,7 +30,8 @@
struct ID;
namespace DEG {
namespace blender {
namespace deg {
struct DepsNodeFactory {
virtual NodeType type() const = 0;
@ -56,6 +57,7 @@ void register_node_typeinfo(DepsNodeFactory *factory);
/* Get typeinfo for specified type */
DepsNodeFactory *type_get_factory(const NodeType type);
} // namespace DEG
} // namespace deg
} // namespace blender
#include "intern/node/deg_node_factory_impl.h"

View File

@ -27,7 +27,8 @@
struct ID;
namespace DEG {
namespace blender {
namespace deg {
template<class ModeObjectType> NodeType DepsNodeFactoryImpl<ModeObjectType>::type() const
{
@ -63,4 +64,5 @@ Node *DepsNodeFactoryImpl<ModeObjectType>::create_node(const ID *id,
return node;
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -41,7 +41,8 @@
#include "intern/node/deg_node_factory.h"
#include "intern/node/deg_node_time.h"
namespace DEG {
namespace blender {
namespace deg {
const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
{
@ -212,4 +213,5 @@ IDComponentsMask IDNode::get_visible_components_mask() const
return result;
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -28,7 +28,8 @@
#include "DNA_ID.h"
#include "intern/node/deg_node.h"
namespace DEG {
namespace blender {
namespace deg {
struct ComponentNode;
@ -115,4 +116,5 @@ struct IDNode : public Node {
DEG_DEPSNODE_DECLARE;
};
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -32,7 +32,8 @@
#include "intern/node/deg_node_factory.h"
#include "intern/node/deg_node_id.h"
namespace DEG {
namespace blender {
namespace deg {
const char *operationCodeAsString(OperationCode opcode)
{
@ -270,4 +271,5 @@ void deg_register_operation_depsnodes()
register_node_typeinfo(&DNTI_OPERATION);
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -29,7 +29,8 @@
struct Depsgraph;
namespace DEG {
namespace blender {
namespace deg {
struct ComponentNode;
@ -276,4 +277,5 @@ struct OperationNode : public Node {
void deg_register_operation_depsnodes();
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -28,7 +28,8 @@
#include "intern/depsgraph.h"
#include "intern/depsgraph_relation.h"
namespace DEG {
namespace blender {
namespace deg {
void TimeSourceNode::tag_update(Depsgraph *graph, eUpdateSource /*source*/)
{
@ -38,4 +39,5 @@ void TimeSourceNode::tag_update(Depsgraph *graph, eUpdateSource /*source*/)
}
}
} // namespace DEG
} // namespace deg
} // namespace blender

View File

@ -25,7 +25,8 @@
#include "intern/node/deg_node.h"
namespace DEG {
namespace blender {
namespace deg {
/* Time Source Node. */
struct TimeSourceNode : public Node {
@ -42,4 +43,5 @@ struct TimeSourceNode : public Node {
DEG_DEPSNODE_DECLARE;
};
} // namespace DEG
} // namespace deg
} // namespace blender