Skip to content

Commit

Permalink
#5622: Entity fingerprint is insensitive to the order of its child nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 23, 2021
1 parent f1a74e7 commit 8db4960
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions radiantcore/entity/EntityNode.cpp
Expand Up @@ -223,19 +223,26 @@ std::size_t EntityNode::getFingerprint()
math::combineHash(hash, std::hash<std::string>()(pair.second));
}

// Entities need to include any child hashes
// Entities need to include any child hashes, but be insensitive to their order
std::set<std::size_t> childFingerprints;

foreachNode([&](const scene::INodePtr& child)
{
auto comparable = std::dynamic_pointer_cast<scene::IComparableNode>(child);

if (comparable)
{
math::combineHash(hash, comparable->getFingerprint());
childFingerprints.insert(comparable->getFingerprint());
}

return true;
});

for (auto childFingerprint : childFingerprints)
{
math::combineHash(hash, childFingerprint);
}

return hash;
}

Expand Down

0 comments on commit 8db4960

Please sign in to comment.