Skip to content

Commit

Permalink
AtomsCrowdGenerator: Fix clashing agent variation names
Browse files Browse the repository at this point in the history
Hashing the branch child names did not take into account that multiple
agents might have equal varation names.

We match the `hashBranchChildNames` method with
`computeBranchChildNames` and hash every part of the `branchPath`
individually to make sure the hashes are unique.
  • Loading branch information
yannci committed Feb 17, 2022
1 parent 422537b commit e703145
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/AtomsGaffer/AtomsCrowdGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,20 +1008,27 @@ void AtomsCrowdGenerator::hashBranchChildNames( const ScenePath &parentPath, con
else if( branchPath.size() == 1 )
{
// "/agents"
BranchCreator::hashBranchChildNames( parentPath, branchPath, context, h );
agentChildNamesHash( parentPath, context, h );
}
else if( branchPath.size() == 2 )
{
// "/agents/<agentType>"
BranchCreator::hashBranchChildNames( parentPath, branchPath, context, h );
agentChildNamesHash( parentPath, context, h );
h.append( branchPath.back() );
}
else if( branchPath.size() <= 3 )
else if( branchPath.size() == 3 )
{
// "/agents/<agentType>" or "/agents/<agentType>/<variation>"
// "/agents/<agentType>/<variation>"
BranchCreator::hashBranchChildNames( parentPath, branchPath, context, h );
agentChildNamesHash( parentPath, context, h );
h.append( branchPath[1] );
h.append( branchPath.back() );
}
else
{
// "/agents/<agentName>/<id>/..."
// "/agents/<agentType>/<variation>/<id>/..."
AgentScope scope( context, branchPath );
h = variationsPlug()->childNamesPlug()->hash();
}
Expand Down

0 comments on commit e703145

Please sign in to comment.