Ejemplo n.º 1
0
 ReturnType operator()( typename T::ConstPtr data ) const
 {
     const typename T::BaseType *begin = data->baseReadable();
     const typename T::BaseType *end = begin + data->baseSize();
     for( ; begin != end; begin++ )
     {
         m_container.push_back( (typename Container::value_type)*begin );
     }
     return true;
 }
ToHoudiniCurvesConverter::RemoveDuplicateEnds::ReturnType ToHoudiniCurvesConverter::RemoveDuplicateEnds::operator()( typename T::ConstPtr data ) const
{
	assert( data );

	typedef typename T::ValueType::value_type ValueType;

	const std::vector<ValueType> &origValues = data->readable();

	typename T::Ptr result = new T();
	std::vector<ValueType> &newValues = result->writable();
	
	size_t index = 0;
	for ( size_t i=0; i < m_vertsPerCurve.size(); i++ )
	{
		for ( size_t j=0; j < (size_t)m_vertsPerCurve[i]; j++, index++ )
		{
			if ( j > 1 && j < (size_t)m_vertsPerCurve[i]-2 )
			{
				newValues.push_back( origValues[index] );
			}
		}
	}
	
	return result;
}
Ejemplo n.º 3
0
	ReturnType operator()( typename T::ConstPtr data )
	{
		typedef typename T::ValueType Container;
		typedef typename Container::value_type V;

		const Container &input = data->readable();
		
		V2i paddedSize = m_size + V2i( 2 ); // padding with the border value makes the iteration easier later
		
		m_output.resize( paddedSize.x * paddedSize.y );

		V threshold = (V)m_threshold;

		std::fill( m_output.begin(), m_output.begin() + paddedSize.x, m_borderValue ); // 1 scanline padding at top
		int ii = 0;
		int oi = paddedSize.x;
		for( int y=0; y<m_size.y; y++ )
		{
			m_output[oi++] = m_borderValue; // 1 pixel padding at left
			for( int x=0; x<m_size.x; x++ )
			{
				m_output[oi++] = input[ii++] > threshold ? 1 : 0;
			}
			m_output[oi++] = m_borderValue; // 1 pixel padding at right
		}
		std::fill( m_output.begin() + oi, m_output.begin() + oi + paddedSize.x, m_borderValue ); // 1 scanline padding at bottom 
	}
Ejemplo n.º 4
0
	bool operator() ( typename T::ConstPtr data )
	{
		assert( data );

		const typename T::ValueType &v = data->readable();

		return v.size() == m_variableSize;
	}
	ReturnType operator()( typename T::ConstPtr data ) const
	{
		return sizeof( typename T::BaseType ) * data->baseSize();
	}
static std::string decToHexVector( typename T::ConstPtr v )
{
	const typename T::ValueType &c = v->readable();
	return IECore::decToHex( c.begin(), c.end() );
}
		void operator()( typename T::ConstPtr data, const F& functor )
		{
			assert( data );

			throw InvalidArgumentException( ( boost::format( "ToMayaImageConverter: Invalid data type \"%s\" for channel \"%s\"." ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_channelName ).str() );
		}
Ejemplo n.º 8
0
		void operator()( typename T::ConstPtr data, const F& functor )
		{
			assert( data );
			throw InvalidArgumentException( ( boost::format( "CurveExtrudeOp: Invalid data type \"%s\" for uniform primitive variable \"%s\"." ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_primVarName ).str() );
                }
Ejemplo n.º 9
0
		void operator()( typename T::ConstPtr data, const F& functor )
		{
			assert( data );

			throw InvalidArgumentException( ( boost::format( "ImageFile: Invalid data type \"%s\" for channel %s while reading %s" ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_channelName % functor.m_pathName ).str() );
		}