Beispiel #1
0
IECore::ConstCompoundObjectPtr CopyImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const
{
	ConstCompoundObjectPtr copyFrom = copyFromPlug()->metadataPlug()->getValue();
	if ( copyFrom->members().empty() )
	{
		return inputMetadata;
	}

	const std::string names = namesPlug()->getValue();
	const bool invert = invertNamesPlug()->getValue();
	if ( !invert && !names.size() )
	{
		return inputMetadata;
	}

	IECore::CompoundObjectPtr result = inputMetadata->copy();
	for ( IECore::CompoundObject::ObjectMap::const_iterator it = copyFrom->members().begin(), eIt = copyFrom->members().end(); it != eIt; ++it )
	{
		bool copy = false;
		if ( matchMultiple( it->first.c_str(), names.c_str() ) != invert )
		{
			copy = true;
		}
		
		if ( copy )
		{
			result->members()[it->first] = it->second;
		}
	}
	
	return result;
}
Beispiel #2
0
IECore::ConstCompoundObjectPtr DeleteImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const
{
	if ( inputMetadata->members().empty() )
	{
		return inputMetadata;
	}

	const std::string names = namesPlug()->getValue();
	const bool invert = invertNamesPlug()->getValue();
	if ( !invert && !names.size() )
	{
		return inputMetadata;
	}

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	for ( IECore::CompoundObject::ObjectMap::const_iterator it = inputMetadata->members().begin(), eIt = inputMetadata->members().end(); it != eIt; ++it )
	{
		bool keep = true;
		if ( StringAlgo::matchMultiple( it->first.c_str(), names.c_str() ) != invert )
		{
			keep = false;
		}

		if ( keep )
		{
			result->members()[it->first] = it->second;
		}
	}

	return result;
}
IECore::ConstCompoundDataPtr CopyImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundData *inputMetadata ) const
{
	ConstCompoundDataPtr copyFrom = copyFromPlug()->metadataPlug()->getValue();
	if( copyFrom->readable().empty() )
	{
		return inputMetadata;
	}

	const std::string names = namesPlug()->getValue();
	const bool invert = invertNamesPlug()->getValue();
	if ( !invert && !names.size() )
	{
		return inputMetadata;
	}

	IECore::CompoundDataPtr result = inputMetadata->copy();
	for( IECore::CompoundData::ValueType::const_iterator it = copyFrom->readable().begin(), eIt = copyFrom->readable().end(); it != eIt; ++it )
	{
		if( StringAlgo::matchMultiple( it->first.c_str(), names.c_str() ) != invert )
		{
			result->writable()[it->first] = it->second;
		}
	}

	return result;
}
Beispiel #4
0
void CopyImageMetadata::affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const
{
	MetadataProcessor::affects( input, outputs );

	if ( input == copyFromPlug()->metadataPlug() || input == namesPlug() || input == invertNamesPlug() )
	{
		outputs.push_back( outPlug()->metadataPlug() );
	}
}
Beispiel #5
0
void CopyImageMetadata::hashProcessedMetadata( const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
	copyFromPlug()->metadataPlug()->hash( h );
	namesPlug()->hash( h );
	invertNamesPlug()->hash( h );
}
Beispiel #6
0
void DeleteImageMetadata::hashProcessedMetadata( const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
	namesPlug()->hash( h );
	invertNamesPlug()->hash( h );
}