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

Method nudgeSelectedTracks

Engine/TrackerNodeInteract.cpp:1434–1484  ·  view source on GitHub ↗

*@brief Moves of the given pixel the selected tracks. * This takes into account the zoom factor. **/

Source from the content-addressed store, hash-verified

1432 * This takes into account the zoom factor.
1433 **/
1434bool
1435TrackerNodeInteract::nudgeSelectedTracks(int x,
1436 int y)
1437{
1438 if (!isInsideSelectedMarkerTexture(lastMousePos)) {
1439 return false;
1440 }
1441 std::list<TrackMarkerPtr> markers;
1442
1443 getContext()->getSelectedMarkers(&markers);
1444
1445 if ( !markers.empty() ) {
1446 std::pair<double, double> pixelScale;
1447 _p->publicInterface->getCurrentViewportForOverlays()->getPixelScale(pixelScale.first, pixelScale.second);
1448 double time = _p->publicInterface->getCurrentTime();
1449 bool createkey = createKeyOnMoveButton.lock()->getValue();
1450
1451 int hasMovedMarker = false;
1452 for (std::list<TrackMarkerPtr>::iterator it = markers.begin(); it != markers.end(); ++it) {
1453
1454 if (!(*it)->isEnabled(time)) {
1455 continue;
1456 }
1457 KnobDoublePtr centerKnob = (*it)->getCenterKnob();
1458 KnobDoublePtr patternCorners[4];
1459 patternCorners[0] = (*it)->getPatternBtmLeftKnob();
1460 patternCorners[1] = (*it)->getPatternTopLeftKnob();
1461 patternCorners[2] = (*it)->getPatternTopRightKnob();
1462 patternCorners[3] = (*it)->getPatternBtmRightKnob();
1463
1464 centerKnob->setValuesAtTime(time, centerKnob->getValueAtTime(time, 0) + x,
1465 centerKnob->getValueAtTime(time, 1) + y,
1466 ViewSpec::all(),
1467 eValueChangedReasonPluginEdited);
1468 for (int i = 0; i < 4; ++i) {
1469 for (int d = 0; d < patternCorners[i]->getDimension(); ++d) {
1470 patternCorners[i]->setValueAtTime(time, patternCorners[i]->getValueAtTime(time, d), ViewSpec::all(), d);
1471 }
1472 }
1473 if (createkey) {
1474 (*it)->setUserKeyframe(time);
1475 }
1476 hasMovedMarker = true;
1477 }
1478 refreshSelectedMarkerTexture();
1479
1480 return hasMovedMarker;
1481 }
1482
1483 return false;
1484}
1485
1486void
1487TrackerNodeInteract::transformPattern(double time,

Callers 1

knobChangedMethod · 0.80

Calls 15

allFunction · 0.85
getSelectedMarkersMethod · 0.80
emptyMethod · 0.80
getPatternBtmLeftKnobMethod · 0.80
getPatternTopLeftKnobMethod · 0.80
setValuesAtTimeMethod · 0.80
setUserKeyframeMethod · 0.80
getPixelScaleMethod · 0.45
getCurrentTimeMethod · 0.45

Tested by

no test coverage detected