From e703145293df288cf11fe1ed684131dda35beeb7 Mon Sep 17 00:00:00 2001 From: Yannic Schoof Date: Tue, 15 Feb 2022 11:39:42 -0800 Subject: [PATCH] AtomsCrowdGenerator: Fix clashing agent variation names 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. --- src/AtomsGaffer/AtomsCrowdGenerator.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/AtomsGaffer/AtomsCrowdGenerator.cpp b/src/AtomsGaffer/AtomsCrowdGenerator.cpp index 6067a20..eb6bdbd 100644 --- a/src/AtomsGaffer/AtomsCrowdGenerator.cpp +++ b/src/AtomsGaffer/AtomsCrowdGenerator.cpp @@ -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/" 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/" or "/agents//" + // "/agents//" BranchCreator::hashBranchChildNames( parentPath, branchPath, context, h ); agentChildNamesHash( parentPath, context, h ); + h.append( branchPath[1] ); h.append( branchPath.back() ); } else { - // "/agents///..." + // "/agents////..." AgentScope scope( context, branchPath ); h = variationsPlug()->childNamesPlug()->hash(); }