MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / onOverlayPenMotion

Method onOverlayPenMotion

Engine/TrackerNode.cpp:1543–2270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541} // penDown
1542
1543bool
1544TrackerNode::onOverlayPenMotion(double time,
1545 const RenderScale & /*renderScale*/,
1546 ViewIdx view,
1547 const QPointF & viewportPos,
1548 const QPointF & pos,
1549 double /*pressure*/,
1550 double /*timestamp*/)
1551{
1552 std::pair<double, double> pixelScale;
1553 OverlaySupport* overlay = getCurrentViewportForOverlays();
1554
1555 assert(overlay);
1556 overlay->getPixelScale(pixelScale.first, pixelScale.second);
1557 bool didSomething = false; // Set if an actual action was performed based on mouse motion.
1558 bool redraw = false; // Set if we just need a redraw (e.g., hover state changed).
1559 TrackerContextPtr context = getNode()->getTrackerContext();
1560 Point delta;
1561 delta.x = pos.x() - _imp->ui->lastMousePos.x();
1562 delta.y = pos.y() - _imp->ui->lastMousePos.y();
1563
1564
1565 if (_imp->ui->hoverState != eDrawStateInactive) {
1566 _imp->ui->hoverState = eDrawStateInactive;
1567 _imp->ui->hoverMarker.reset();
1568 redraw = true;
1569 }
1570
1571 std::vector<TrackMarkerPtr> allMarkers;
1572 context->getAllMarkers(&allMarkers);
1573 bool trackingPageSecret = context->getTrackingPageKnob()->getIsSecret();
1574 bool hoverProcess = false;
1575 for (std::vector<TrackMarkerPtr>::iterator it = allMarkers.begin(); it != allMarkers.end(); ++it) {
1576 if (!(*it)->isEnabled(time) || trackingPageSecret) {
1577 continue;
1578 }
1579
1580 bool isSelected = context->isMarkerSelected( (*it) );
1581 KnobDoublePtr centerKnob = (*it)->getCenterKnob();
1582 KnobDoublePtr offsetKnob = (*it)->getOffsetKnob();
1583 KnobDoublePtr ptnTopLeft = (*it)->getPatternTopLeftKnob();
1584 KnobDoublePtr ptnTopRight = (*it)->getPatternTopRightKnob();
1585 KnobDoublePtr ptnBtmRight = (*it)->getPatternBtmRightKnob();
1586 KnobDoublePtr ptnBtmLeft = (*it)->getPatternBtmLeftKnob();
1587 KnobDoublePtr searchWndTopRight = (*it)->getSearchWindowTopRightKnob();
1588 KnobDoublePtr searchWndBtmLeft = (*it)->getSearchWindowBottomLeftKnob();
1589 QPointF center;
1590 center.rx() = centerKnob->getValueAtTime(time, 0);
1591 center.ry() = centerKnob->getValueAtTime(time, 1);
1592
1593 QPointF offset;
1594 offset.rx() = offsetKnob->getValueAtTime(time, 0);
1595 offset.ry() = offsetKnob->getValueAtTime(time, 1);
1596 if ( _imp->ui->isNearbyPoint(centerKnob, viewportPos.x(), viewportPos.y(), POINT_TOLERANCE, time) ) {
1597 _imp->ui->hoverState = eDrawStateHoveringCenter;
1598 _imp->ui->hoverMarker = *it;
1599 hoverProcess = true;
1600 } else if ( ( (offset.x() != 0) || (offset.y() != 0) ) && _imp->ui->isNearbyPoint(QPointF( center.x() + offset.x(), center.y() + offset.y() ), viewportPos.x(), viewportPos.y(), POINT_TOLERANCE) ) {

Callers

nothing calls this directly

Calls 15

maxFunction · 0.85
clampFunction · 0.85
getTrackerContextMethod · 0.80
getAllMarkersMethod · 0.80
getIsSecretMethod · 0.80
getTrackingPageKnobMethod · 0.80
isMarkerSelectedMethod · 0.80
getOffsetKnobMethod · 0.80
getPatternTopLeftKnobMethod · 0.80
getPatternBtmLeftKnobMethod · 0.80

Tested by

no test coverage detected