From d3120e6dec0475b256fd57ca753e64e0186458f9 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Thu, 18 Nov 2021 17:33:37 -0500 Subject: [PATCH] Change locked horizon movement to Shift+Alt --- toonz/sources/tnztools/perspectivetool.cpp | 38 +++++++++------------- toonz/sources/toonz/statusbar.cpp | 10 ++++-- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/toonz/sources/tnztools/perspectivetool.cpp b/toonz/sources/tnztools/perspectivetool.cpp index 1244db55..3d372a94 100644 --- a/toonz/sources/tnztools/perspectivetool.cpp +++ b/toonz/sources/tnztools/perspectivetool.cpp @@ -1194,13 +1194,11 @@ void PerspectiveTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { TPointD rotationPos = obj->getRotationPos(); TPointD spacingPos = obj->getSpacingPos(); - if (m_isShifting) - obj->shiftPerspectiveObject(dPos); - else if (m_isCenterMoving) { // Moving + if (m_isShifting) { if (obj->isHorizon() && e.isAltPressed()) { double distance = std::sqrt(std::pow(dPos.x, 2) + std::pow(dPos.y, 2)); - double rotation = mainObj->getRotation(); + double rotation = obj->getRotation(); if (rotation != 90 && rotation != 270) { if (dPos.x < 0) distance *= -1; if (rotation > 90 && rotation < 270) distance *= -1; @@ -1212,28 +1210,24 @@ void PerspectiveTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { dPos = newCenter - objCenterPoint; } + obj->shiftPerspectiveObject(dPos); + } else if (m_isCenterMoving) { // Moving TPointD newCenterPoint = objCenterPoint + dPos; obj->setCenterPoint(newCenterPoint); - if (obj->isHorizon() && e.isAltPressed()) { - // Move Rotation/Space controls to maintain angle/spacing - obj->setRotationPos(rotationPos + dPos); - obj->setSpacingPos(spacingPos + dPos); - } else { - // Recalculate Angle - double dx = rotationPos.x - newCenterPoint.x; - double dy = rotationPos.y - newCenterPoint.y; - double newAngle = std::atan2(dy, dx) / (3.14159 / 180); - if (obj->getType() == PerspectiveType::VanishingPoint) newAngle += 90; - obj->setRotation(newAngle); + // Recalculate Angle + double dx = rotationPos.x - newCenterPoint.x; + double dy = rotationPos.y - newCenterPoint.y; + double newAngle = std::atan2(dy, dx) / (3.14159 / 180); + if (obj->getType() == PerspectiveType::VanishingPoint) newAngle += 90; + obj->setRotation(newAngle); - // Recalculate Spacing - double newSpacing = - calculateSpacing(obj->getType(), spacingPos, rotationPos, - obj->getRotation(), objCenterPoint); - obj->setSpacing(newSpacing); - if (obj == mainObj) updateMeasuredValueToolOptions(); - } + // Recalculate Spacing + double newSpacing = + calculateSpacing(obj->getType(), spacingPos, rotationPos, + obj->getRotation(), objCenterPoint); + obj->setSpacing(newSpacing); + if (obj == mainObj) updateMeasuredValueToolOptions(); // Also Move Left and Right Handles if (obj->getType() == PerspectiveType::VanishingPoint) { diff --git a/toonz/sources/toonz/statusbar.cpp b/toonz/sources/toonz/statusbar.cpp index 3059a6fb..c3127ed6 100644 --- a/toonz/sources/toonz/statusbar.cpp +++ b/toonz/sources/toonz/statusbar.cpp @@ -346,16 +346,20 @@ std::unordered_map StatusBar::makeMap( lMap.insert({"T_Ruler", tr("Ruler Tool: Measures distances on the canvas")}); lMap.insert({"T_PerspectiveGrid", tr("Perspective Grid Tool: Set up perspective grids") + spacer + - tr("%1%2Move Perspective Objects") + tr("%1%2Move entire object") .arg(trModKey("Shift")) .arg(cmdTextSeparator) + spacer + - tr("%1%2Select/Deselect multiple; +A to Select All") + tr("%1%2Select/Deselect multiple") .arg(trModKey("Ctrl")) .arg(cmdTextSeparator) + spacer + - tr("%1%2Snap rotation/space; Move center along horizon") + tr("%1%2Snap rotation/spacing") .arg(trModKey("Alt")) + .arg(cmdTextSeparator) + + spacer + + tr("%1%2Move object along horizon") + .arg(trModKey("Shift+Alt")) .arg(cmdTextSeparator)}); lMap.insert( {"T_Finger", tr("Finger Tool: Smudges small areas to cover with line")});