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