Skip to content

Commit

Permalink
Merge pull request #43 from alex-savenko-at-cinesite/hashing_performa…
Browse files Browse the repository at this point in the history
…nce_improvements

AtomsVariationReader: hashing improvements
  • Loading branch information
iaiotom authored Jun 17, 2020
2 parents 78ce226 + e4d2472 commit aebf15d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
7 changes: 2 additions & 5 deletions src/AtomsGaffer/AtomsCrowdGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ ConstCompoundObjectPtr AtomsCrowdGenerator::computeBranchAttributes( const Scene
}

// Need to find with point has the data of the current agent
std::vector<int> agentIdVec = agentIdData->readable();
const std::vector<int> &agentIdVec = agentIdData->readable();
for ( size_t i = 0; i < agentIdVec.size(); ++i )
{
if ( agentIdVec[i] == currentAgentIndex )
Expand Down Expand Up @@ -902,7 +902,7 @@ ConstObjectPtr AtomsCrowdGenerator::computeBranchObject( const ScenePath &parent

// Get the point id that contain the agent data
// We need this only to get blend shapes weights information
std::vector<int> agentIdVec = agentIdData->readable();
const std::vector<int> &agentIdVec = agentIdData->readable();

for ( size_t i = 0; i < agentIdVec.size(); ++i )
{
Expand Down Expand Up @@ -1164,9 +1164,6 @@ ConstPathMatcherDataPtr AtomsCrowdGenerator::computeBranchSet( const ScenePath &
{
agentPath.back() = agentName;

std::vector<std::string> paths;
inputSet->readable().paths( paths );

PathMatcher instanceSet = inputSet->readable().subTree( agentPath );
auto variationNamesData = instanceChildNames->member<CompoundData>( agentName );
if ( !variationNamesData )
Expand Down
9 changes: 5 additions & 4 deletions src/AtomsGaffer/AtomsCrowdReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ Gaffer::ValuePlug::CachePolicy AtomsCrowdReader::computeCachePolicy( const Gaffe

void AtomsCrowdReader::hashSource( const Gaffer::Context *context, MurmurHash &h ) const
{
atomsSimFilePlug()->hash( h );
h.append( atomsSimFilePlug()->getValue() );
refreshCountPlug()->hash( h );
timeOffsetPlug()->hash( h );
agentIdsPlug()->hash( h );
Expand Down Expand Up @@ -632,7 +632,8 @@ ConstObjectPtr AtomsCrowdReader::computeSource( const Gaffer::Context *context )

void AtomsCrowdReader::hashAttributes( const ScenePath &path, const Gaffer::Context *context, const GafferScene::ScenePlug *parent, IECore::MurmurHash &h ) const
{
atomsSimFilePlug()->hash( h );
GafferScene::ObjectSource::hashAttributes( path, context, parent, h );
h.append( atomsSimFilePlug()->getValue() );
refreshCountPlug()->hash( h );
timeOffsetPlug()->hash( h );
agentIdsPlug()->hash( h );
Expand Down Expand Up @@ -775,9 +776,10 @@ IECore::ConstCompoundObjectPtr AtomsCrowdReader::computeAttributes( const SceneN

void AtomsCrowdReader::hash( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ObjectSource::hash( output, context, h );
if( output == enginePlug() )
{
atomsSimFilePlug()->hash( h );
h.append( atomsSimFilePlug()->getValue() );
refreshCountPlug()->hash( h );
timeOffsetPlug()->hash( h );
agentIdsPlug()->hash( h );
Expand All @@ -789,7 +791,6 @@ void AtomsCrowdReader::hash( const Gaffer::ValuePlug *output, const Gaffer::Cont
enginePlug()->hash( h );
h.append( context->getFrame() );
}
ObjectSource::hash( output, context, h );
}

void AtomsCrowdReader::compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const
Expand Down
16 changes: 8 additions & 8 deletions src/AtomsGaffer/AtomsVariationReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ void AtomsVariationReader::hashBound( const ScenePath &path, const Gaffer::Conte
{
SceneNode::hashBound( path, context, parent, h );

atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );

h.append( &path.front(), path.size() );
Expand Down Expand Up @@ -1085,7 +1085,7 @@ void AtomsVariationReader::hashTransform( const ScenePath &path, const Gaffer::C
const ScenePlug *parent, IECore::MurmurHash &h ) const
{
SceneNode::hashTransform( path, context, parent, h );
atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );

h.append( &path.front(), path.size() );
Expand Down Expand Up @@ -1147,7 +1147,7 @@ Imath::M44f AtomsVariationReader::computeTransform( const ScenePath &path, const
void AtomsVariationReader::hashAttributes( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
SceneNode::hashAttributes( path, context, parent, h );
atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );

h.append( &path.front(), path.size() );
Expand Down Expand Up @@ -1369,7 +1369,7 @@ void AtomsVariationReader::hashObject( const ScenePath &path, const Gaffer::Cont
const ScenePlug *parent, IECore::MurmurHash &h ) const
{
SceneNode::hashObject( path, context, parent, h );
atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );
generatePrefPlug()->hash( h );
generateNrefPlug()->hash( h );
Expand Down Expand Up @@ -1461,7 +1461,7 @@ void AtomsVariationReader::hashChildNames( const ScenePath &path, const Gaffer::
const ScenePlug *parent, IECore::MurmurHash &h ) const
{
SceneNode::hashChildNames( path, context, parent, h );
atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );
h.append( &path.front(), path.size() );
}
Expand Down Expand Up @@ -1526,7 +1526,7 @@ void AtomsVariationReader::hashSetNames( const Gaffer::Context *context, const S
{
SceneNode::hashSetNames( context, parent, h );

atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );
}

Expand Down Expand Up @@ -1593,7 +1593,7 @@ void AtomsVariationReader::hashSet( const IECore::InternedString &setName, const
{
SceneNode::hashSet( setName, context, parent, h );

atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );
h.append( setName );
}
Expand Down Expand Up @@ -1706,7 +1706,7 @@ void AtomsVariationReader::hash( const Gaffer::ValuePlug *output, const Gaffer::
{
if( output == enginePlug() )
{
atomsVariationFilePlug()->hash( h );
h.append( atomsVariationFilePlug()->getValue() );
refreshCountPlug()->hash( h );
}

Expand Down

0 comments on commit aebf15d

Please sign in to comment.