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

Method readAttribute

src/IECoreScene/SampledSceneInterface.cpp:110–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110ConstObjectPtr SampledSceneInterface::readAttribute( const Name &name, double time ) const
111{
112 size_t sample1, sample2;
113 double x = attributeSampleInterval( name, time, sample1, sample2 );
114
115 if( x == 0 )
116 {
117 return readAttributeAtSample( name, sample1 );
118 }
119 if( x == 1 )
120 {
121 return readAttributeAtSample( name, sample2 );
122 }
123
124 ConstObjectPtr attributeObj1 = readAttributeAtSample( name, sample1 );
125 ConstObjectPtr attributeObj2 = readAttributeAtSample( name, sample2 );
126
127 ObjectPtr attributeObj = linearObjectInterpolation( attributeObj1.get(), attributeObj2.get(), x );
128 if( !attributeObj )
129 {
130 // failed to interpolate, return the closest one
131 return ( x >= 0.5 ? attributeObj2 : attributeObj1 );
132 }
133 return attributeObj;
134}
135
136ConstObjectPtr SampledSceneInterface::readObject( double time, const Canceller *canceller ) const
137{

Callers

nothing calls this directly

Calls 4

attributeSampleIntervalFunction · 0.85
readAttributeAtSampleFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected