| 465 | |
| 466 | template<typename X, typename Y> |
| 467 | void Ramp<X,Y>::fromDeprecatedSpline( const IECore::Spline<X, Y> &deprecated ) |
| 468 | { |
| 469 | // This is sort of similar to fromOSL, except the source is an old Cortex Spline instead of |
| 470 | // separate position and value vectors. In theory, there might be some way to share a bit more |
| 471 | // code here, but it's probably not worth refactoring for the sake of this method, which it |
| 472 | // should be possible to remove in the future ( once we no longer need to support old SCC files ) |
| 473 | |
| 474 | if( deprecated.basis == CubicBasis<X>::bezier() ) |
| 475 | { |
| 476 | int count = 0; |
| 477 | for( const auto &i : deprecated.points ) |
| 478 | { |
| 479 | if( ( count % 3 ) == 0 ) |
| 480 | { |
| 481 | points.insert( i ); |
| 482 | } |
| 483 | count++; |
| 484 | } |
| 485 | |
| 486 | interpolation = RampInterpolation::MonotoneCubic; |
| 487 | |
| 488 | // Unlike fromOSL, we don't check whether monotoneCubic actually matches the original bezier |
| 489 | // ... if the source data is from an scc produced by old Gaffer, then it should have come from |
| 490 | // a monotoneCubic. |
| 491 | |
| 492 | return; |
| 493 | } |
| 494 | else |
| 495 | { |
| 496 | points = deprecated.points; |
| 497 | } |
| 498 | |
| 499 | if( deprecated.basis == CubicBasis<X>::bSpline() ) |
| 500 | { |
| 501 | interpolation = RampInterpolation::BSpline; |
| 502 | } |
| 503 | else if( deprecated.basis == CubicBasis<X>::linear() ) |
| 504 | { |
| 505 | interpolation = RampInterpolation::Linear; |
| 506 | } |
| 507 | else if( deprecated.basis == CubicBasis<X>::constant() ) |
| 508 | { |
| 509 | interpolation = RampInterpolation::Constant; |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | interpolation = RampInterpolation::CatmullRom; |
| 514 | } |
| 515 | |
| 516 | trimEndPoints( points ); |
| 517 | |
| 518 | } |
| 519 | |
| 520 | template<typename X, typename Y> |
| 521 | inline bool Ramp<X,Y>::operator==( const Ramp<X,Y> &rhs ) const |
no test coverage detected