diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_TrackPositionOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_TrackPositionOperation.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc index 993410e3e84..0f4be16a620 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc @@ -42,14 +42,24 @@ TrackPositionOperation::TrackPositionOperation() this->m_relativeFrame = 0; this->m_speed_output = false; flags.is_set_operation = true; + is_track_position_calculated_ = false; } void TrackPositionOperation::initExecution() { + if (!is_track_position_calculated_) { + calc_track_position(); + } +} + +void TrackPositionOperation::calc_track_position() +{ + is_track_position_calculated_ = true; MovieTracking *tracking = nullptr; MovieClipUser user = {0}; MovieTrackingObject *object; + track_position_ = 0; zero_v2(this->m_markerPos); zero_v2(this->m_relativePos); @@ -114,6 +124,14 @@ void TrackPositionOperation::initExecution() } } } + + track_position_ = this->m_markerPos[this->m_axis] - this->m_relativePos[this->m_axis]; + if (this->m_axis == 0) { + track_position_ *= this->m_width; + } + else { + track_position_ *= this->m_height; + } } void TrackPositionOperation::executePixelSampled(float output[4], @@ -131,6 +149,14 @@ void TrackPositionOperation::executePixelSampled(float output[4], } } +const float *TrackPositionOperation::get_constant_elem() +{ + if (!is_track_position_calculated_) { + calc_track_position(); + } + return &track_position_; +} + void TrackPositionOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { |