IECore::ConstObjectPtr BranchCreator::computeObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { return computeBranchObject( parentPath, branchPath, context ); } else { return inPlug()->objectPlug()->getValue(); } }
void BranchCreator::hashObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { hashBranchObject( parentPath, branchPath, context, h ); } else { h = inPlug()->objectPlug()->hash(); } }
IECore::ConstInternedStringVectorDataPtr BranchCreator::computeChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { return computeBranchChildNames( parentPath, branchPath, context ); } else if( parentMatch == Filter::ExactMatch ) { return mapping->member<InternedStringVectorData>( g_childNamesKey ); } else { return inPlug()->childNamesPlug()->getValue(); } }
void BranchCreator::hashChildNames( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { hashBranchChildNames( parentPath, branchPath, context, h ); } else if( parentMatch == Filter::ExactMatch ) { h = mapping->member<InternedStringVectorData>( g_childNamesKey )->Object::hash(); } else { h = inPlug()->childNamesPlug()->hash(); } }
Imath::Box3f BranchCreator::computeBound( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { return computeBranchBound( parentPath, branchPath, context ); } else if( parentMatch == Filter::ExactMatch || parentMatch == Filter::DescendantMatch ) { Box3f result = inPlug()->boundPlug()->getValue(); result.extendBy( unionOfTransformedChildBounds( path, outPlug() ) ); return result; } else { return inPlug()->boundPlug()->getValue(); } }
void BranchCreator::hashBound( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const { ConstCompoundDataPtr mapping = boost::static_pointer_cast<const CompoundData>( mappingPlug()->getValue() ); ScenePath parentPath, branchPath; Filter::Result parentMatch = parentAndBranchPaths( mapping.get(), path, parentPath, branchPath ); if( parentMatch == Filter::AncestorMatch ) { hashBranchBound( parentPath, branchPath, context, h ); } else if( parentMatch == Filter::ExactMatch || parentMatch == Filter::DescendantMatch ) { SceneProcessor::hashBound( path, context, parent, h ); inPlug()->boundPlug()->hash( h ); h.append( hashOfTransformedChildBounds( path, outPlug() ) ); } else { h = inPlug()->boundPlug()->hash(); } }
IECoreImage::ImagePrimitivePtr ImagePlug::image() const { Format format = formatPlug()->getValue(); Box2i dataWindow = dataWindowPlug()->getValue(); Box2i newDataWindow( Imath::V2i( 0 ) ); if( !BufferAlgo::empty( dataWindow ) ) { newDataWindow = format.toEXRSpace( dataWindow ); } else { dataWindow = newDataWindow; } Box2i newDisplayWindow = format.toEXRSpace( format.getDisplayWindow() ); IECoreImage::ImagePrimitivePtr result = new IECoreImage::ImagePrimitive( newDataWindow, newDisplayWindow ); ConstCompoundDataPtr metadata = metadataPlug()->getValue(); result->blindData()->Object::copyFrom( metadata.get() ); ConstStringVectorDataPtr channelNamesData = channelNamesPlug()->getValue(); const vector<string> &channelNames = channelNamesData->readable(); vector<float *> imageChannelData; for( vector<string>::const_iterator it = channelNames.begin(), eIt = channelNames.end(); it!=eIt; it++ ) { FloatVectorDataPtr cd = new FloatVectorData; vector<float> &c = cd->writable(); c.resize( result->channelSize(), 0.0f ); result->channels[*it] = cd; imageChannelData.push_back( &(c[0]) ); } CopyTile copyTile( imageChannelData, channelNames, dataWindow ); ImageAlgo::parallelProcessTiles( this, channelNames, copyTile, dataWindow ); return result; }