Ejemplo n.º 1
0
void Shader::parameterHash( const Gaffer::Plug *parameterPlug, NetworkBuilder &network, IECore::MurmurHash &h ) const
{
	const Plug *inputPlug = parameterPlug->source<Plug>();
	if( inputPlug != parameterPlug )
	{
		const Shader *n = IECore::runTimeCast<const Shader>( inputPlug->node() );
		if( n && ( inputPlug == n->outPlug() || n->outPlug()->isAncestorOf( inputPlug ) ) )
		{
			h.append( network.shaderHash( n ) );
			if( inputPlug != n->outPlug() )
			{
				// shader has multiple outputs - we need to make sure the particular
				// output in question is taken into account by the hash.
				h.append( inputPlug->relativeName( n->outPlug() ) );
			}
			return;
		}
		// fall through to hash plug value
	}

	const ValuePlug *vplug = IECore::runTimeCast<const ValuePlug>( parameterPlug );
	if( vplug )
	{
		vplug->hash( h );
	}
	else
	{
		h.append( parameterPlug->typeId() );
	}
}