|
4 | 4 | #pragma once |
5 | 5 |
|
6 | 6 | #include <math.h> |
| 7 | +#include <ofxCore.h> |
7 | 8 |
|
8 | 9 | #include <array> |
9 | 10 | #include <cassert> |
|
13 | 14 | #include <type_traits> |
14 | 15 | #include <vector> |
15 | 16 |
|
16 | | -#include <ofxCore.h> |
17 | 17 | #include "ofxExceptions.h" |
18 | 18 | #include "ofxLog.h" |
19 | 19 | #include "ofxPropsMetadata.h" |
@@ -506,6 +506,62 @@ class PropertyAccessor { |
506 | 506 | return *this; |
507 | 507 | } |
508 | 508 |
|
| 509 | + // For 2-d (PointD) single-type properties |
| 510 | + template <PropId id, |
| 511 | + std::enable_if_t<properties::PropTraits<id>::def.dimension == 2 && |
| 512 | + !properties::PropTraits<id>::is_multitype && |
| 513 | + std::is_same_v<typename properties::PropTraits<id>::type, double>, |
| 514 | + int> = 0> |
| 515 | + PropertyAccessor &set(OfxPointD values, bool error_if_missing = true) { |
| 516 | + assert(propset_ != nullptr); |
| 517 | + this->template set<id>(values.x, 0, error_if_missing); |
| 518 | + this->template set<id>(values.y, 1, error_if_missing); |
| 519 | + return *this; |
| 520 | + } |
| 521 | + |
| 522 | + // For 2-d (PointI) single-type properties |
| 523 | + template <PropId id, |
| 524 | + std::enable_if_t<properties::PropTraits<id>::def.dimension == 2 && |
| 525 | + !properties::PropTraits<id>::is_multitype && |
| 526 | + std::is_same_v<typename properties::PropTraits<id>::type, double>, |
| 527 | + int> = 0> |
| 528 | + PropertyAccessor &set(OfxPointI values, bool error_if_missing = true) { |
| 529 | + assert(propset_ != nullptr); |
| 530 | + this->template set<id>(values.x, 0, error_if_missing); |
| 531 | + this->template set<id>(values.y, 1, error_if_missing); |
| 532 | + return *this; |
| 533 | + } |
| 534 | + |
| 535 | + // For 4-d (RectD) single-type properties |
| 536 | + template <PropId id, |
| 537 | + std::enable_if_t<properties::PropTraits<id>::def.dimension == 4 && |
| 538 | + !properties::PropTraits<id>::is_multitype && |
| 539 | + std::is_same_v<typename properties::PropTraits<id>::type, double>, |
| 540 | + int> = 0> |
| 541 | + PropertyAccessor &set(OfxRectD values, bool error_if_missing = true) { |
| 542 | + assert(propset_ != nullptr); |
| 543 | + this->template set<id>(values.x1, 0, error_if_missing); |
| 544 | + this->template set<id>(values.y1, 1, error_if_missing); |
| 545 | + this->template set<id>(values.x2, 2, error_if_missing); |
| 546 | + this->template set<id>(values.y2, 3, error_if_missing); |
| 547 | + return *this; |
| 548 | + } |
| 549 | + |
| 550 | + // For 4-d (RectI) single-type properties |
| 551 | + template <PropId id, |
| 552 | + std::enable_if_t<properties::PropTraits<id>::def.dimension == 4 && |
| 553 | + !properties::PropTraits<id>::is_multitype && |
| 554 | + std::is_same_v<typename properties::PropTraits<id>::type, double>, |
| 555 | + int> = 0> |
| 556 | + PropertyAccessor &set(OfxRectI values, bool error_if_missing = true) { |
| 557 | + assert(propset_ != nullptr); |
| 558 | + this->template set<id>(values.x1, 0, error_if_missing); |
| 559 | + this->template set<id>(values.y1, 1, error_if_missing); |
| 560 | + this->template set<id>(values.x2, 2, error_if_missing); |
| 561 | + this->template set<id>(values.y2, 3, error_if_missing); |
| 562 | + return *this; |
| 563 | + } |
| 564 | + |
509 | 565 | // For multi-type properties - require explicit ElementType |
510 | 566 | template <PropId id, typename ElementType> |
511 | 567 | PropertyAccessor &setAllTyped(const std::initializer_list<ElementType> &values, |
|
0 commit comments