Skip to content

Commit

Permalink
fixed children with name containg separation character
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-toolchefs committed Apr 2, 2019
1 parent ca8152c commit 6add849
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/AtomsGaffer/AtomsVariationReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public :

const auto& agentTypeName = agentTypeNames[aTypeId];
auto& agentTypeRoot = m_root.children[agentTypeName];
agentTypeRoot.name = agentTypeName;
auto agentTypePtr = m_variations.getAgentTypeVariationPtr( agentTypeName);
if ( !agentTypePtr )
continue;
Expand Down Expand Up @@ -358,7 +359,10 @@ public :
currentRoot->variations.insert(variationName);
for( const auto& objName: objectNames )
{
if ( objName == "" )
continue;
currentRoot = &currentRoot->children[objName];
currentRoot->name = objName;
currentRoot->variations.insert( variationName );
auto objIt = currentMap->getTypedEntry<AtomsCore::MapMetadata>( objName );
if ( !objIt )
Expand Down Expand Up @@ -405,7 +409,10 @@ public :
AtomsDagNode* currentRoot = &agentTypeRoot;
currentRoot->variations.insert( variationName + ":" + lodName );
for ( const auto &objName: lodObjectNames ) {
if ( objName == "" )
continue;
currentRoot = &currentRoot->children[objName];
currentRoot->name = objName;
currentRoot->variations.insert( variationName + ":" + lodName );
auto objIt = currentMap->getTypedEntry<AtomsCore::MapMetadata>(objName);
if (!objIt) {
Expand Down Expand Up @@ -538,8 +545,14 @@ public :

AtomsDagNode* childRootNode = nullptr;
if ( rootNode ) {
childRootNode = &rootNode->children[it->first];
childRootNode->data = meshGroup;
std::vector<std::string> objectNames;
AtomsUtils::splitString( it->first, '|', objectNames );

if ( objectNames.size() > 0)
{
childRootNode = &rootNode->children[objectNames.back()];
childRootNode->data = meshGroup;
}
}
flatMeshHierarchy( meshGroup.get(), outMap, childRootNode );
}
Expand Down Expand Up @@ -836,21 +849,28 @@ public :
const std::string& currentPath ) const
{
if ( node->data ) {

auto sets = node->data->getTypedEntry<const AtomsCore::StringArrayMetadata>( "sets" );
if ( sets ) {
auto& setVec = sets->get();
for ( auto& currentSet: setVec ) {
if ( currentSet == setName ) {
for ( auto& variation: node->variations )
paths.push_back( variation + "/" + currentPath );
for ( auto& variation: node->variations ) {
paths.push_back(variation + "/" + currentPath);
}
break;
}
}
}
}

for ( auto it = node->children.cbegin(); it != node->children.cend(); ++it ) {
collectAllPathFromSetName( setName, &it->second, paths, currentPath + "/" + it->first );
if (currentPath.empty() || currentPath == "/")
{
collectAllPathFromSetName(setName, &it->second, paths, it->first);
} else {
collectAllPathFromSetName(setName, &it->second, paths, currentPath + "/" + it->first);
}
}
}

Expand Down Expand Up @@ -1576,6 +1596,7 @@ IECore::ConstPathMatcherDataPtr AtomsVariationReader::computeSet( const IECore::
}
auto &result = resultData->writable();


if ( !engineData->isDefaultSet( setName ) ) {
const EngineData::AtomsDagNode *rootNode = &engineData->root();
for ( auto it = rootNode->children.cbegin(); it != rootNode->children.cend(); ++it ) {
Expand Down

0 comments on commit 6add849

Please sign in to comment.