Depsgraph: Add utility function to get depsgraph from node handle

The idea is to use this function for modifiers' updateDepsgraph functions
instead of doing direct scene->depsgraph access.
This commit is contained in:
2017-06-12 14:41:46 +02:00
parent 987ec1d030
commit 1ba6ef25b6
4 changed files with 16 additions and 0 deletions

View File

@@ -153,6 +153,8 @@ void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
eDepsObjectComponentType component,
const char *description);
struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *handle);
void DEG_add_special_eval_flag(struct Depsgraph *graph, struct ID *id, short flag);
/* Utility functions for physics modifiers */

View File

@@ -371,6 +371,11 @@ void DepsgraphRelationBuilder::add_forcefield_relations(const OperationKey &key,
pdEndEffectors(&effectors);
}
Depsgraph *DepsgraphRelationBuilder::getGraph()
{
return m_graph;
}
/* **** Functions to build relations between entities **** */
void DepsgraphRelationBuilder::begin_build(Main *bmain)

View File

@@ -233,6 +233,8 @@ struct DepsgraphRelationBuilder
template <typename KeyType>
OperationDepsNode *find_operation_node(const KeyType &key);
Depsgraph *getGraph();
protected:
RootDepsNode *find_node(const RootKey &key) const;
TimeSourceDepsNode *find_node(const TimeSourceKey &key) const;

View File

@@ -166,6 +166,13 @@ void DEG_add_bone_relation(DepsNodeHandle *handle,
description);
}
struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *handle)
{
DEG::DepsNodeHandle *deg_handle = get_handle(handle);
DEG::DepsgraphRelationBuilder *relation_builder = deg_handle->builder;
return reinterpret_cast<Depsgraph *>(relation_builder->getGraph());
}
void DEG_add_special_eval_flag(Depsgraph *graph, ID *id, short flag)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);