*@brief Moves of the given pixel the selected tracks. * This takes into account the zoom factor. **/
| 1432 | * This takes into account the zoom factor. |
| 1433 | **/ |
| 1434 | bool |
| 1435 | TrackerNodeInteract::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 | |
| 1486 | void |
| 1487 | TrackerNodeInteract::transformPattern(double time, |
no test coverage detected