Depsgraph: Remove subgraph nodes
Those were never finished nor used. Again, starting from clean state before we go into more complicated details.
This commit is contained in:
@@ -321,41 +321,6 @@ void DepsgraphNodeBuilder::build_group(Scene *scene,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
|
|
||||||
{
|
|
||||||
/* sanity checks */
|
|
||||||
if (!group)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* create new subgraph's data */
|
|
||||||
Depsgraph *subgraph = reinterpret_cast<Depsgraph *>(DEG_graph_new());
|
|
||||||
|
|
||||||
DepsgraphNodeBuilder subgraph_builder(m_bmain, subgraph);
|
|
||||||
|
|
||||||
/* add group objects */
|
|
||||||
LINKLIST_FOREACH (GroupObject *, go, &group->gobject) {
|
|
||||||
/*Object *ob = go->ob;*/
|
|
||||||
|
|
||||||
/* Each "group object" is effectively a separate instance of the
|
|
||||||
* underlying object data. When the group is evaluated, the transform
|
|
||||||
* results and/or some other attributes end up getting overridden by
|
|
||||||
* the group.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a node for representing subgraph. */
|
|
||||||
SubgraphDepsNode *subgraph_node = m_graph->add_subgraph_node(&group->id);
|
|
||||||
subgraph_node->graph = subgraph;
|
|
||||||
|
|
||||||
/* Make a copy of the data this node will need? */
|
|
||||||
/* XXX: do we do this now, or later? */
|
|
||||||
/* TODO: need API function which queries graph's ID's hash, and duplicates
|
|
||||||
* those blocks thoroughly with all outside links removed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return subgraph_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
|
void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
|
||||||
{
|
{
|
||||||
const bool has_object = (ob->id.tag & LIB_TAG_DOIT);
|
const bool has_object = (ob->id.tag & LIB_TAG_DOIT);
|
||||||
|
@@ -62,7 +62,6 @@ namespace DEG {
|
|||||||
struct Depsgraph;
|
struct Depsgraph;
|
||||||
struct DepsNode;
|
struct DepsNode;
|
||||||
struct RootDepsNode;
|
struct RootDepsNode;
|
||||||
struct SubgraphDepsNode;
|
|
||||||
struct IDDepsNode;
|
struct IDDepsNode;
|
||||||
struct TimeSourceDepsNode;
|
struct TimeSourceDepsNode;
|
||||||
struct ComponentDepsNode;
|
struct ComponentDepsNode;
|
||||||
@@ -125,7 +124,6 @@ struct DepsgraphNodeBuilder {
|
|||||||
int name_tag = -1);
|
int name_tag = -1);
|
||||||
|
|
||||||
void build_scene(Main *bmain, Scene *scene);
|
void build_scene(Main *bmain, Scene *scene);
|
||||||
SubgraphDepsNode *build_subgraph(Group *group);
|
|
||||||
void build_group(Scene *scene, Base *base, Group *group);
|
void build_group(Scene *scene, Base *base, Group *group);
|
||||||
void build_object(Scene *scene, Base *base, Object *ob);
|
void build_object(Scene *scene, Base *base, Object *ob);
|
||||||
void build_object_transform(Scene *scene, Object *ob);
|
void build_object_transform(Scene *scene, Object *ob);
|
||||||
|
@@ -78,7 +78,6 @@ struct Depsgraph;
|
|||||||
struct DepsNode;
|
struct DepsNode;
|
||||||
struct DepsNodeHandle;
|
struct DepsNodeHandle;
|
||||||
struct RootDepsNode;
|
struct RootDepsNode;
|
||||||
struct SubgraphDepsNode;
|
|
||||||
struct IDDepsNode;
|
struct IDDepsNode;
|
||||||
struct TimeSourceDepsNode;
|
struct TimeSourceDepsNode;
|
||||||
struct ComponentDepsNode;
|
struct ComponentDepsNode;
|
||||||
|
@@ -80,17 +80,16 @@ static const int deg_debug_node_type_color_map[][2] = {
|
|||||||
{DEPSNODE_TYPE_ROOT, 0},
|
{DEPSNODE_TYPE_ROOT, 0},
|
||||||
{DEPSNODE_TYPE_TIMESOURCE, 1},
|
{DEPSNODE_TYPE_TIMESOURCE, 1},
|
||||||
{DEPSNODE_TYPE_ID_REF, 2},
|
{DEPSNODE_TYPE_ID_REF, 2},
|
||||||
{DEPSNODE_TYPE_SUBGRAPH, 3},
|
|
||||||
|
|
||||||
/* Outer Types */
|
/* Outer Types */
|
||||||
{DEPSNODE_TYPE_PARAMETERS, 4},
|
{DEPSNODE_TYPE_PARAMETERS, 3},
|
||||||
{DEPSNODE_TYPE_PROXY, 5},
|
{DEPSNODE_TYPE_PROXY, 4},
|
||||||
{DEPSNODE_TYPE_ANIMATION, 6},
|
{DEPSNODE_TYPE_ANIMATION, 5},
|
||||||
{DEPSNODE_TYPE_TRANSFORM, 7},
|
{DEPSNODE_TYPE_TRANSFORM, 6},
|
||||||
{DEPSNODE_TYPE_GEOMETRY, 8},
|
{DEPSNODE_TYPE_GEOMETRY, 7},
|
||||||
{DEPSNODE_TYPE_SEQUENCER, 9},
|
{DEPSNODE_TYPE_SEQUENCER, 8},
|
||||||
{DEPSNODE_TYPE_SHADING, 10},
|
{DEPSNODE_TYPE_SHADING, 9},
|
||||||
{DEPSNODE_TYPE_CACHE, 11},
|
{DEPSNODE_TYPE_CACHE, 10},
|
||||||
{-1, 0}
|
{-1, 0}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -380,19 +379,6 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DEPSNODE_TYPE_SUBGRAPH:
|
|
||||||
{
|
|
||||||
SubgraphDepsNode *sub_node = (SubgraphDepsNode *)node;
|
|
||||||
if (sub_node->graph) {
|
|
||||||
deg_debug_graphviz_node_cluster_begin(ctx, node);
|
|
||||||
deg_debug_graphviz_graph_nodes(ctx, sub_node->graph);
|
|
||||||
deg_debug_graphviz_node_cluster_end(ctx);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
deg_debug_graphviz_node_single(ctx, node);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DEPSNODE_TYPE_PARAMETERS:
|
case DEPSNODE_TYPE_PARAMETERS:
|
||||||
case DEPSNODE_TYPE_ANIMATION:
|
case DEPSNODE_TYPE_ANIMATION:
|
||||||
case DEPSNODE_TYPE_TRANSFORM:
|
case DEPSNODE_TYPE_TRANSFORM:
|
||||||
@@ -432,11 +418,6 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
|
|||||||
const IDDepsNode *id_node = (const IDDepsNode *)node;
|
const IDDepsNode *id_node = (const IDDepsNode *)node;
|
||||||
return BLI_ghash_size(id_node->components) > 0;
|
return BLI_ghash_size(id_node->components) > 0;
|
||||||
}
|
}
|
||||||
case DEPSNODE_TYPE_SUBGRAPH:
|
|
||||||
{
|
|
||||||
SubgraphDepsNode *sub_node = (SubgraphDepsNode *)node;
|
|
||||||
return sub_node->graph != NULL;
|
|
||||||
}
|
|
||||||
case DEPSNODE_TYPE_PARAMETERS:
|
case DEPSNODE_TYPE_PARAMETERS:
|
||||||
case DEPSNODE_TYPE_ANIMATION:
|
case DEPSNODE_TYPE_ANIMATION:
|
||||||
case DEPSNODE_TYPE_TRANSFORM:
|
case DEPSNODE_TYPE_TRANSFORM:
|
||||||
|
@@ -75,7 +75,6 @@ Depsgraph::Depsgraph()
|
|||||||
{
|
{
|
||||||
BLI_spin_init(&lock);
|
BLI_spin_init(&lock);
|
||||||
id_hash = BLI_ghash_ptr_new("Depsgraph id hash");
|
id_hash = BLI_ghash_ptr_new("Depsgraph id hash");
|
||||||
subgraphs = BLI_gset_ptr_new("Depsgraph subgraphs");
|
|
||||||
entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags");
|
entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +82,7 @@ Depsgraph::~Depsgraph()
|
|||||||
{
|
{
|
||||||
/* Free root node - it won't have been freed yet... */
|
/* Free root node - it won't have been freed yet... */
|
||||||
clear_id_nodes();
|
clear_id_nodes();
|
||||||
clear_subgraph_nodes();
|
|
||||||
BLI_ghash_free(id_hash, NULL, NULL);
|
BLI_ghash_free(id_hash, NULL, NULL);
|
||||||
BLI_gset_free(subgraphs, NULL);
|
|
||||||
BLI_gset_free(entry_tags, NULL);
|
BLI_gset_free(entry_tags, NULL);
|
||||||
if (this->root_node != NULL) {
|
if (this->root_node != NULL) {
|
||||||
OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
|
OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
|
||||||
@@ -293,34 +290,6 @@ TimeSourceDepsNode *Depsgraph::find_time_source(const ID *id) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubgraphDepsNode *Depsgraph::add_subgraph_node(const ID *id)
|
|
||||||
{
|
|
||||||
DepsNodeFactory *factory = deg_get_node_factory(DEPSNODE_TYPE_SUBGRAPH);
|
|
||||||
SubgraphDepsNode *subgraph_node =
|
|
||||||
(SubgraphDepsNode *)factory->create_node(id, "", id->name + 2);
|
|
||||||
|
|
||||||
/* Add to subnodes list. */
|
|
||||||
BLI_gset_insert(subgraphs, subgraph_node);
|
|
||||||
|
|
||||||
return subgraph_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Depsgraph::remove_subgraph_node(SubgraphDepsNode *subgraph_node)
|
|
||||||
{
|
|
||||||
BLI_gset_remove(subgraphs, subgraph_node, NULL);
|
|
||||||
OBJECT_GUARDED_DELETE(subgraph_node, SubgraphDepsNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Depsgraph::clear_subgraph_nodes()
|
|
||||||
{
|
|
||||||
GSET_FOREACH_BEGIN(SubgraphDepsNode *, subgraph_node, subgraphs)
|
|
||||||
{
|
|
||||||
OBJECT_GUARDED_DELETE(subgraph_node, SubgraphDepsNode);
|
|
||||||
}
|
|
||||||
GSET_FOREACH_END();
|
|
||||||
BLI_gset_clear(subgraphs, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDDepsNode *Depsgraph::find_id_node(const ID *id) const
|
IDDepsNode *Depsgraph::find_id_node(const ID *id) const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<IDDepsNode *>(BLI_ghash_lookup(id_hash, id));
|
return reinterpret_cast<IDDepsNode *>(BLI_ghash_lookup(id_hash, id));
|
||||||
@@ -458,7 +427,6 @@ void Depsgraph::add_entry_tag(OperationDepsNode *node)
|
|||||||
void Depsgraph::clear_all_nodes()
|
void Depsgraph::clear_all_nodes()
|
||||||
{
|
{
|
||||||
clear_id_nodes();
|
clear_id_nodes();
|
||||||
clear_subgraph_nodes();
|
|
||||||
BLI_ghash_clear(id_hash, NULL, NULL);
|
BLI_ghash_clear(id_hash, NULL, NULL);
|
||||||
if (this->root_node) {
|
if (this->root_node) {
|
||||||
OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
|
OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
|
||||||
|
@@ -52,7 +52,6 @@ struct DepsNode;
|
|||||||
struct RootDepsNode;
|
struct RootDepsNode;
|
||||||
struct TimeSourceDepsNode;
|
struct TimeSourceDepsNode;
|
||||||
struct IDDepsNode;
|
struct IDDepsNode;
|
||||||
struct SubgraphDepsNode;
|
|
||||||
struct ComponentDepsNode;
|
struct ComponentDepsNode;
|
||||||
struct OperationDepsNode;
|
struct OperationDepsNode;
|
||||||
|
|
||||||
@@ -113,10 +112,6 @@ struct Depsgraph {
|
|||||||
|
|
||||||
TimeSourceDepsNode *find_time_source(const ID *id = NULL) const;
|
TimeSourceDepsNode *find_time_source(const ID *id = NULL) const;
|
||||||
|
|
||||||
SubgraphDepsNode *add_subgraph_node(const ID *id);
|
|
||||||
void remove_subgraph_node(SubgraphDepsNode *subgraph_node);
|
|
||||||
void clear_subgraph_nodes();
|
|
||||||
|
|
||||||
IDDepsNode *find_id_node(const ID *id) const;
|
IDDepsNode *find_id_node(const ID *id) const;
|
||||||
IDDepsNode *add_id_node(ID *id, const char *name = "");
|
IDDepsNode *add_id_node(ID *id, const char *name = "");
|
||||||
void remove_id_node(const ID *id);
|
void remove_id_node(const ID *id);
|
||||||
@@ -146,9 +141,6 @@ struct Depsgraph {
|
|||||||
/* "root" node - the one where all evaluation enters from. */
|
/* "root" node - the one where all evaluation enters from. */
|
||||||
RootDepsNode *root_node;
|
RootDepsNode *root_node;
|
||||||
|
|
||||||
/* Subgraphs referenced in tree. */
|
|
||||||
GSet *subgraphs;
|
|
||||||
|
|
||||||
/* Indicates whether relations needs to be updated. */
|
/* Indicates whether relations needs to be updated. */
|
||||||
bool need_update;
|
bool need_update;
|
||||||
|
|
||||||
|
@@ -96,10 +96,6 @@ typedef enum eDepsNode_Type {
|
|||||||
* but not usually part of main graph.
|
* but not usually part of main graph.
|
||||||
*/
|
*/
|
||||||
DEPSNODE_TYPE_ID_REF,
|
DEPSNODE_TYPE_ID_REF,
|
||||||
/* Isolated sub-graph - used for keeping instanced data separate from
|
|
||||||
* instances using them.
|
|
||||||
*/
|
|
||||||
DEPSNODE_TYPE_SUBGRAPH,
|
|
||||||
|
|
||||||
/* **** Outer Types **** */
|
/* **** Outer Types **** */
|
||||||
|
|
||||||
@@ -107,9 +103,7 @@ typedef enum eDepsNode_Type {
|
|||||||
* (i.e. just SDNA property setting).
|
* (i.e. just SDNA property setting).
|
||||||
*/
|
*/
|
||||||
DEPSNODE_TYPE_PARAMETERS,
|
DEPSNODE_TYPE_PARAMETERS,
|
||||||
/* Generic "Proxy-Inherit" Component
|
/* Generic "Proxy-Inherit" Component. */
|
||||||
* XXX: Also for instancing of subgraphs?
|
|
||||||
*/
|
|
||||||
DEPSNODE_TYPE_PROXY,
|
DEPSNODE_TYPE_PROXY,
|
||||||
/* Animation Component
|
/* Animation Component
|
||||||
*
|
*
|
||||||
|
@@ -170,7 +170,6 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
|
|||||||
case DEPSNODE_TYPE_ROOT:
|
case DEPSNODE_TYPE_ROOT:
|
||||||
case DEPSNODE_TYPE_TIMESOURCE:
|
case DEPSNODE_TYPE_TIMESOURCE:
|
||||||
case DEPSNODE_TYPE_ID_REF:
|
case DEPSNODE_TYPE_ID_REF:
|
||||||
case DEPSNODE_TYPE_SUBGRAPH:
|
|
||||||
case DEPSNODE_TYPE_PARAMETERS:
|
case DEPSNODE_TYPE_PARAMETERS:
|
||||||
case DEPSNODE_TYPE_SEQUENCER:
|
case DEPSNODE_TYPE_SEQUENCER:
|
||||||
/* Ignore, does not translate to object component. */
|
/* Ignore, does not translate to object component. */
|
||||||
|
@@ -289,43 +289,12 @@ void IDDepsNode::finalize_build()
|
|||||||
DEG_DEPSNODE_DEFINE(IDDepsNode, DEPSNODE_TYPE_ID_REF, "ID Node");
|
DEG_DEPSNODE_DEFINE(IDDepsNode, DEPSNODE_TYPE_ID_REF, "ID Node");
|
||||||
static DepsNodeFactoryImpl<IDDepsNode> DNTI_ID_REF;
|
static DepsNodeFactoryImpl<IDDepsNode> DNTI_ID_REF;
|
||||||
|
|
||||||
/* Subgraph Node ========================================== */
|
|
||||||
|
|
||||||
/* Initialize 'subgraph' node - from pointer data given. */
|
|
||||||
void SubgraphDepsNode::init(const ID *id, const char *UNUSED(subdata))
|
|
||||||
{
|
|
||||||
/* Store ID-ref if provided. */
|
|
||||||
this->root_id = (ID *)id;
|
|
||||||
|
|
||||||
/* NOTE: graph will need to be added manually,
|
|
||||||
* as we don't have any way of passing this down.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free 'subgraph' node */
|
|
||||||
SubgraphDepsNode::~SubgraphDepsNode()
|
|
||||||
{
|
|
||||||
/* Only free if graph not shared, of if this node is the first
|
|
||||||
* reference to it...
|
|
||||||
*/
|
|
||||||
// XXX: prune these flags a bit...
|
|
||||||
if ((this->flag & SUBGRAPH_FLAG_FIRSTREF) || !(this->flag & SUBGRAPH_FLAG_SHARED)) {
|
|
||||||
/* Free the referenced graph. */
|
|
||||||
DEG_graph_free(reinterpret_cast< ::Depsgraph* >(graph));
|
|
||||||
graph = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEG_DEPSNODE_DEFINE(SubgraphDepsNode, DEPSNODE_TYPE_SUBGRAPH, "Subgraph Node");
|
|
||||||
static DepsNodeFactoryImpl<SubgraphDepsNode> DNTI_SUBGRAPH;
|
|
||||||
|
|
||||||
void deg_register_base_depsnodes()
|
void deg_register_base_depsnodes()
|
||||||
{
|
{
|
||||||
deg_register_node_typeinfo(&DNTI_ROOT);
|
deg_register_node_typeinfo(&DNTI_ROOT);
|
||||||
deg_register_node_typeinfo(&DNTI_TIMESOURCE);
|
deg_register_node_typeinfo(&DNTI_TIMESOURCE);
|
||||||
|
|
||||||
deg_register_node_typeinfo(&DNTI_ID_REF);
|
deg_register_node_typeinfo(&DNTI_ID_REF);
|
||||||
deg_register_node_typeinfo(&DNTI_SUBGRAPH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DEG
|
} // namespace DEG
|
||||||
|
@@ -185,41 +185,6 @@ struct IDDepsNode : public DepsNode {
|
|||||||
DEG_DEPSNODE_DECLARE;
|
DEG_DEPSNODE_DECLARE;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Subgraph Reference. */
|
|
||||||
struct SubgraphDepsNode : public DepsNode {
|
|
||||||
void init(const ID *id, const char *subdata);
|
|
||||||
~SubgraphDepsNode();
|
|
||||||
|
|
||||||
/* Instanced graph. */
|
|
||||||
Depsgraph *graph;
|
|
||||||
|
|
||||||
/* ID-block at root of subgraph (if applicable). */
|
|
||||||
ID *root_id;
|
|
||||||
|
|
||||||
/* Number of nodes which use/reference this subgraph - if just 1, it may be
|
|
||||||
* possible to merge into main,
|
|
||||||
*/
|
|
||||||
size_t num_users;
|
|
||||||
|
|
||||||
/* (eSubgraphRef_Flag) assorted settings for subgraph node. */
|
|
||||||
int flag;
|
|
||||||
|
|
||||||
DEG_DEPSNODE_DECLARE;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Flags for subgraph node */
|
|
||||||
typedef enum eSubgraphRef_Flag {
|
|
||||||
/* Subgraph referenced is shared with another reference, so shouldn't
|
|
||||||
* free on exit.
|
|
||||||
*/
|
|
||||||
SUBGRAPH_FLAG_SHARED = (1 << 0),
|
|
||||||
|
|
||||||
/* Node is first reference to subgraph, so it can be freed when we are
|
|
||||||
* removed.
|
|
||||||
*/
|
|
||||||
SUBGRAPH_FLAG_FIRSTREF = (1 << 1),
|
|
||||||
} eSubgraphRef_Flag;
|
|
||||||
|
|
||||||
void deg_register_base_depsnodes();
|
void deg_register_base_depsnodes();
|
||||||
|
|
||||||
} // namespace DEG
|
} // namespace DEG
|
||||||
|
@@ -44,9 +44,6 @@ typedef enum eDepsOperation_Flag {
|
|||||||
DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
|
DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
|
||||||
|
|
||||||
/* node was directly modified, causing need for update */
|
/* node was directly modified, causing need for update */
|
||||||
/* XXX: intention is to make it easier to tell when we just need to
|
|
||||||
* take subgraphs.
|
|
||||||
*/
|
|
||||||
DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
|
DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
|
||||||
|
|
||||||
/* Operation is evaluated using CPython; has GIL and security
|
/* Operation is evaluated using CPython; has GIL and security
|
||||||
|
Reference in New Issue
Block a user