MCPcopy Create free account
hub / github.com/ImageEngine/cortex / construct

Function construct

src/IECorePython/SplineBinding.cpp:82–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81template<typename T>
82static T *construct( const typename T::Basis &basis, object o )
83{
84 typename T::PointContainer points;
85 int s = extract<int>( o.attr( "__len__" )() );
86 for( int i=0; i<s; i++ )
87 {
88 object e = o[i];
89 int es = extract<int>( e.attr( "__len__" )() );
90 if( es!=2 )
91 {
92 throw Exception( "Each entry in the point sequence must contain two values." );
93 }
94 object xo = e[0];
95 object yo = e[1];
96 typename T::XType x = extract<typename T::XType>( xo );
97 typename T::YType y = extract<typename T::YType>( yo );
98 points.insert( typename T::PointContainer::value_type( x, y ) );
99 }
100 return new T( basis, points );
101}
102
103template<typename T>
104static boost::python::tuple points( const T &s )

Callers 4

LuminanceTextureMethod · 0.50
AlphaTextureMethod · 0.50
ColorTextureMethod · 0.50
constructMethod · 0.50

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected