Depsgraph: Make node an owner of its name

The initial idea of using char pointer was to save some
memory since the dependency graph was kind of the one
with the main database.

Nowadays dependency graph should be separatable from the
main database and being self-sustainable.

Other issue which was caused by this pointer is the
re-tagging of operations during relations update: it is
possible to have node which as tagged for update but had
the owner of the name removed (i.e. driver or bone was
removed).
This commit is contained in:
Sergey Sharybin 2019-02-18 16:24:51 +01:00
parent c3ceefb671
commit d02ad52b2d
5 changed files with 6 additions and 5 deletions

View File

@ -377,7 +377,8 @@ void DepsgraphNodeBuilder::end_build()
if (comp_node == NULL) {
continue;
}
OperationNode *op_node = comp_node->find_operation(entry_tag.opcode, entry_tag.name, entry_tag.name_tag);
OperationNode *op_node = comp_node->find_operation(
entry_tag.opcode, entry_tag.name.c_str(), entry_tag.name_tag);
if (op_node == NULL) {
continue;
}

View File

@ -238,7 +238,7 @@ protected:
ID *id_orig;
NodeType component_type;
OperationCode opcode;
const char *name;
string name;
int name_tag;
};
vector<SavedEntryTag> saved_entry_tags_;

View File

@ -155,7 +155,7 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from,
return false;
}
/* ... BUT, we also need to check if it's same bone. */
if (!STREQ(op_from->owner->name, op_to->owner->name)) {
if (op_from->owner->name != op_to->owner->name) {
return false;
}
return true;

View File

@ -155,7 +155,7 @@ struct Node {
* have relationships between these nodes. */
typedef vector<Relation *> Relations;
const char *name; /* Identifier - mainly for debugging purposes. */
string name; /* Identifier - mainly for debugging purposes. */
NodeType type; /* Structural type of node. */
Relations inlinks; /* Nodes which this one depends on. */
Relations outlinks; /* Nodes which depend on this one. */

View File

@ -164,7 +164,7 @@ OperationNode *ComponentNode::find_operation(OperationIDKey key) const
for (OperationNode *op_node : operations) {
if (op_node->opcode == key.opcode &&
op_node->name_tag == key.name_tag &&
STREQ(op_node->name, key.name))
STREQ(op_node->name.c_str(), key.name))
{
node = op_node;
break;