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

Function rampRepr

src/IECorePython/RampBinding.cpp:54–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53template<typename T>
54std::string rampRepr( object x )
55{
56 std::stringstream s;
57 const std::string name = extract<std::string>( x.attr( "__class__").attr( "__name__" ) );
58 s << "IECore." << name << "( ";
59 const T ramp = extract<T>( x );
60 s << "(";
61 int i = 0;
62 int l = ramp.points.size();
63 typename T::PointContainer::const_iterator it;
64 for( it = ramp.points.begin(); it != ramp.points.end(); it++, i++ )
65 {
66 // TODO - without this const_cast I get a link error because the const version of repr<Color3f>
67 // hasn't been defined
68 s << " ( " << it->first << ", " << IECorePython::repr( const_cast<typename T::YType&>( it->second ) ) << " )";
69 if( i!=l-1 )
70 {
71 s << ",";
72 }
73 }
74 s << "), ";
75 const std::string interpStr = extract<std::string>( object( ramp.interpolation ).attr( "__str__")() );
76 s << "IECore.RampInterpolation." << interpStr;
77 s << ")";
78 return s.str();
79}
80
81template<typename T>
82T *rampConstruct( object o, const RampInterpolation &interpolation )

Callers

nothing calls this directly

Calls 4

reprFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected