Fix motion path issues (#505)
This commit is contained in:
parent
b8cc17a0f0
commit
5ca6de7e04
4 changed files with 157 additions and 109 deletions
|
@ -1285,14 +1285,16 @@ public:
|
||||||
bool isSpline = false;
|
bool isSpline = false;
|
||||||
if (TTool::getApplication()->getCurrentObject()->isSpline()) {
|
if (TTool::getApplication()->getCurrentObject()->isSpline()) {
|
||||||
isSpline = true;
|
isSpline = true;
|
||||||
if (!ToolUtils::isJustCreatedSpline(vi.getPointer())) {
|
// if (!ToolUtils::isJustCreatedSpline(vi.getPointer())) {
|
||||||
m_primitive->setIsPrompting(true);
|
// m_primitive->setIsPrompting(true);
|
||||||
QString question("Are you sure you want to replace the motion path?");
|
// QString question("Are you sure you want to replace the motion
|
||||||
int ret =
|
// path?");
|
||||||
DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"), 0);
|
// int ret =
|
||||||
m_primitive->setIsPrompting(false);
|
// DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"),
|
||||||
if (ret == 2 || ret == 0) return;
|
// 0);
|
||||||
}
|
// m_primitive->setIsPrompting(false);
|
||||||
|
// if (ret == 2 || ret == 0) return;
|
||||||
|
//}
|
||||||
QMutexLocker lock(vi->getMutex());
|
QMutexLocker lock(vi->getMutex());
|
||||||
TUndo *undo = new UndoPath(
|
TUndo *undo = new UndoPath(
|
||||||
getXsheet()->getStageObject(getObjectId())->getSpline());
|
getXsheet()->getStageObject(getObjectId())->getSpline());
|
||||||
|
|
|
@ -1091,17 +1091,17 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos,
|
||||||
~Cleanup() { m_this->m_track.clear(), m_this->invalidate(); }
|
~Cleanup() { m_this->m_track.clear(), m_this->invalidate(); }
|
||||||
} cleanup = {this};
|
} cleanup = {this};
|
||||||
|
|
||||||
if (!isJustCreatedSpline(vi.getPointer())) {
|
// if (!isJustCreatedSpline(vi.getPointer())) {
|
||||||
m_isPrompting = true;
|
// m_isPrompting = true;
|
||||||
|
|
||||||
QString question("Are you sure you want to replace the motion path?");
|
// QString question("Are you sure you want to replace the motion path?");
|
||||||
int ret =
|
// int ret =
|
||||||
DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"), 0);
|
// DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"), 0);
|
||||||
|
|
||||||
m_isPrompting = false;
|
// m_isPrompting = false;
|
||||||
|
|
||||||
if (ret == 2 || ret == 0) return;
|
// if (ret == 2 || ret == 0) return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
QMutexLocker lock(vi->getMutex());
|
QMutexLocker lock(vi->getMutex());
|
||||||
|
|
||||||
|
|
|
@ -1621,8 +1621,28 @@ void SceneViewer::drawOverlay() {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||||
|
TStageObjectId objId = app->getCurrentObject()->getObjectId();
|
||||||
|
bool isMotionPath = false;
|
||||||
|
|
||||||
|
if (objId == xsh->getStageObjectTree()->getMotionPathViewerId() &&
|
||||||
|
app->getCurrentObject()->isSpline()) {
|
||||||
|
isMotionPath = true;
|
||||||
|
int x0, x1, y0, y1;
|
||||||
|
rect().getCoords(&x0, &y0, &x1, &y1);
|
||||||
|
x0 = (-(x1 / 2)) + 15;
|
||||||
|
y0 = ((y1 / 2)) - 25;
|
||||||
|
glPushMatrix();
|
||||||
|
glScaled(3, 3, 3);
|
||||||
|
glColor3d(1.0, 0.0, 0.0);
|
||||||
|
tglDrawText(TPointD(x0 / 3, y0 / 3),
|
||||||
|
tr("Motion Path Selected").toStdWString());
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
// draw camera
|
// draw camera
|
||||||
if (viewCameraToggle.getStatus() && m_drawEditingLevel == false) {
|
if (!isMotionPath && viewCameraToggle.getStatus() &&
|
||||||
|
m_drawEditingLevel == false) {
|
||||||
unsigned long f = 0;
|
unsigned long f = 0;
|
||||||
if (m_referenceMode == CAMERA_REFERENCE)
|
if (m_referenceMode == CAMERA_REFERENCE)
|
||||||
f |= ViewerDraw::CAMERA_REFERENCE;
|
f |= ViewerDraw::CAMERA_REFERENCE;
|
||||||
|
@ -1661,6 +1681,7 @@ void SceneViewer::drawOverlay() {
|
||||||
rect().getCoords(&x0, &y0, &x1, &y1);
|
rect().getCoords(&x0, &y0, &x1, &y1);
|
||||||
x0 = (-(x1 / 2)) + 15;
|
x0 = (-(x1 / 2)) + 15;
|
||||||
y0 = ((y1 / 2)) - 15;
|
y0 = ((y1 / 2)) - 15;
|
||||||
|
glColor3d(1.0, 0.0, 0.0);
|
||||||
tglDrawDisk(TPointD(x0, y0), 10);
|
tglDrawDisk(TPointD(x0, y0), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3175,15 +3196,20 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d,
|
||||||
TStageObjectId objId = TApp::instance()->getCurrentObject()->getObjectId();
|
TStageObjectId objId = TApp::instance()->getCurrentObject()->getObjectId();
|
||||||
|
|
||||||
TStageObject *pegbar =
|
TStageObject *pegbar =
|
||||||
(objId != TStageObjectId::NoneId &&
|
(objId != TStageObjectId::NoneId) //&&
|
||||||
objId != xsh->getStageObjectTree()->getMotionPathViewerId())
|
// objId != xsh->getStageObjectTree()->getMotionPathViewerId())
|
||||||
? xsh->getStageObject(objId)
|
? xsh->getStageObject(objId)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
|
bool isMotionPathViewer =
|
||||||
|
objId == xsh->getStageObjectTree()->getMotionPathViewerId() &&
|
||||||
|
TApp::instance()->getCurrentObject()->isSpline();
|
||||||
TStageObjectSpline *pegbarSpline = 0;
|
TStageObjectSpline *pegbarSpline = 0;
|
||||||
if (pegbar && pegbar->getSpline()) {
|
if (TApp::instance()->getCurrentObject()->isSpline() && pegbar &&
|
||||||
|
pegbar->getSpline()) {
|
||||||
const TStroke *stroke = 0;
|
const TStroke *stroke = 0;
|
||||||
pegbarSpline = pegbar->getSpline();
|
pegbarSpline = pegbar->getSpline();
|
||||||
|
if (!isMotionPathViewer) {
|
||||||
stroke = pegbar->getSpline()->getStroke();
|
stroke = pegbar->getSpline()->getStroke();
|
||||||
|
|
||||||
if (!stroke) return;
|
if (!stroke) return;
|
||||||
|
@ -3204,7 +3230,8 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d,
|
||||||
aff = TAffine();
|
aff = TAffine();
|
||||||
glTranslated(0, 0, objZ);
|
glTranslated(0, 0, objZ);
|
||||||
} else {
|
} else {
|
||||||
TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
|
TStageObjectId cameraId =
|
||||||
|
xsh->getStageObjectTree()->getCurrentCameraId();
|
||||||
double camZ = xsh->getZ(cameraId, frame);
|
double camZ = xsh->getZ(cameraId, frame);
|
||||||
TAffine camAff = xsh->getPlacement(cameraId, frame);
|
TAffine camAff = xsh->getPlacement(cameraId, frame);
|
||||||
TAffine tmp;
|
TAffine tmp;
|
||||||
|
@ -3256,11 +3283,15 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d,
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int splineCount = xsh->getStageObjectTree()->getSplineCount();
|
int splineCount = xsh->getStageObjectTree()->getSplineCount();
|
||||||
for (int i = 0; i < splineCount; i++) {
|
for (int i = 0; i < splineCount; i++) {
|
||||||
TStageObjectSpline *spline = xsh->getStageObjectTree()->getSpline(i);
|
TStageObjectSpline *spline = xsh->getStageObjectTree()->getSpline(i);
|
||||||
|
|
||||||
if (!spline->getActive()) continue;
|
if (isMotionPathViewer && (pegbarSpline && pegbarSpline == spline))
|
||||||
|
int z;
|
||||||
|
else if (!spline->getActive())
|
||||||
|
continue;
|
||||||
|
|
||||||
const TStroke *stroke = 0;
|
const TStroke *stroke = 0;
|
||||||
int steps = 0;
|
int steps = 0;
|
||||||
|
|
|
@ -12,9 +12,10 @@
|
||||||
#include "toonz/tcolumnhandle.h"
|
#include "toonz/tcolumnhandle.h"
|
||||||
#include "toonz/txshlevel.h"
|
#include "toonz/txshlevel.h"
|
||||||
#include "toonz/txshleveltypes.h"
|
#include "toonz/txshleveltypes.h"
|
||||||
|
#include "toonz/tobjecthandle.h"
|
||||||
#include "toonzqt/tselectionhandle.h"
|
#include "toonzqt/tselectionhandle.h"
|
||||||
#include "toonzqt/selection.h"
|
#include "toonzqt/selection.h"
|
||||||
|
#include "toonz/tstageobjecttree.h"
|
||||||
|
|
||||||
#include "tools/tool.h"
|
#include "tools/tool.h"
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ StatusBar::StatusBar(QWidget* parent) : QStatusBar(parent) {
|
||||||
TApp* app = TApp::instance();
|
TApp* app = TApp::instance();
|
||||||
TFrameHandle* frameHandle = app->getCurrentFrame();
|
TFrameHandle* frameHandle = app->getCurrentFrame();
|
||||||
TXshLevelHandle* levelHandle = app->getCurrentLevel();
|
TXshLevelHandle* levelHandle = app->getCurrentLevel();
|
||||||
|
TObjectHandle* object = app->getCurrentObject();
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
|
@ -46,6 +48,8 @@ StatusBar::StatusBar(QWidget* parent) : QStatusBar(parent) {
|
||||||
SLOT(updateInfoText()));
|
SLOT(updateInfoText()));
|
||||||
ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this,
|
ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this,
|
||||||
SLOT(updateInfoText()));
|
SLOT(updateInfoText()));
|
||||||
|
ret = ret &&
|
||||||
|
connect(object, SIGNAL(objectSwitched()), this, SLOT(updateInfoText()));
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
|
@ -73,6 +77,15 @@ void StatusBar::updateInfoText() {
|
||||||
TApp* app = TApp::instance();
|
TApp* app = TApp::instance();
|
||||||
ToolHandle* toolHandle = app->getCurrentTool();
|
ToolHandle* toolHandle = app->getCurrentTool();
|
||||||
TTool* tool = toolHandle->getTool();
|
TTool* tool = toolHandle->getTool();
|
||||||
|
TObjectHandle* object = app->getCurrentObject();
|
||||||
|
TStageObjectTree* tree =
|
||||||
|
app->getCurrentXsheet()->getXsheet()->getStageObjectTree();
|
||||||
|
if (object->isSpline()) {
|
||||||
|
m_infoLabel->setText(
|
||||||
|
tr("Motion Path Selected: Click on a level or frame to leave motion "
|
||||||
|
"path editing."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string name = tool->getName();
|
std::string name = tool->getName();
|
||||||
tool->getToolType();
|
tool->getToolType();
|
||||||
int target = tool->getTargetType();
|
int target = tool->getTargetType();
|
||||||
|
@ -128,18 +141,19 @@ void StatusBar::makeMap() {
|
||||||
"Animate Tool: Modifies the position, rotation and size of "
|
"Animate Tool: Modifies the position, rotation and size of "
|
||||||
"the current column"});
|
"the current column"});
|
||||||
m_infoMap.insert({"T_Brush", "Brush Tool: Draws in the work area freehand"});
|
m_infoMap.insert({"T_Brush", "Brush Tool: Draws in the work area freehand"});
|
||||||
m_infoMap.insert({"T_BrushVector",
|
m_infoMap.insert(
|
||||||
"Brush Tool: Draws in the work area freehand" + spacer +
|
{"T_BrushVector", "Brush Tool: Draws in the work area freehand" + spacer +
|
||||||
"Shift - Straight Lines" + spacer +
|
"Shift - Straight Lines" + spacer +
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
"Cmd - Straight Lines Snapped to Angles" + spacer +
|
"Cmd - Straight Lines Snapped to Angles" + spacer +
|
||||||
"Cmd + Opt - Add / Remove Vanishing Point" + spacer +
|
"Cmd + Opt - Add / Remove Vanishing Point" +
|
||||||
"Opt - Draw to Vanishing Point" + spacer +
|
spacer + "Opt - Draw to Vanishing Point" + spacer +
|
||||||
"Hold Cmd + Shift - Toggle Snapping"});
|
"Hold Cmd + Shift - Toggle Snapping"});
|
||||||
#else
|
#else
|
||||||
"Control - Straight Lines Snapped to Angles" + spacer +
|
"Control - Straight Lines Snapped to Angles" +
|
||||||
"Ctrl + Alt - Add / Remove Vanishing Point" + spacer +
|
spacer +
|
||||||
"Alt - Draw to Vanishing Point" + spacer +
|
"Ctrl + Alt - Add / Remove Vanishing Point" +
|
||||||
|
spacer + "Alt - Draw to Vanishing Point" + spacer +
|
||||||
"Hold Ctrl + Shift - Toggle Snapping"});
|
"Hold Ctrl + Shift - Toggle Snapping"});
|
||||||
#endif
|
#endif
|
||||||
m_infoMap.insert({"T_BrushSmartRaster",
|
m_infoMap.insert({"T_BrushSmartRaster",
|
||||||
|
@ -154,25 +168,26 @@ void StatusBar::makeMap() {
|
||||||
"Ctrl + Alt - Add / Remove Vanishing Point" + spacer +
|
"Ctrl + Alt - Add / Remove Vanishing Point" + spacer +
|
||||||
"Alt - Draw to Vanishing Point"});
|
"Alt - Draw to Vanishing Point"});
|
||||||
#endif
|
#endif
|
||||||
m_infoMap.insert({"T_BrushRaster",
|
m_infoMap.insert(
|
||||||
"Brush Tool: Draws in the work area freehand" + spacer +
|
{"T_BrushRaster", "Brush Tool: Draws in the work area freehand" + spacer +
|
||||||
"Shift - Straight Lines" + spacer +
|
"Shift - Straight Lines" + spacer +
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
"Cmd - Straight Lines Snapped to Angles" + spacer +
|
"Cmd - Straight Lines Snapped to Angles" + spacer +
|
||||||
"Cmd + Opt - Add / Remove Vanishing Point" + spacer +
|
"Cmd + Opt - Add / Remove Vanishing Point" +
|
||||||
"Opt - Draw to Vanishing Point"});
|
spacer + "Opt - Draw to Vanishing Point"});
|
||||||
#else
|
#else
|
||||||
"Control - Straight Lines Snapped to Angles" + spacer +
|
"Control - Straight Lines Snapped to Angles" +
|
||||||
"Ctrl + Alt - Add / Remove Vanishing Point" + spacer +
|
spacer +
|
||||||
"Alt - Draw to Vanishing Point"});
|
"Ctrl + Alt - Add / Remove Vanishing Point" +
|
||||||
|
spacer + "Alt - Draw to Vanishing Point"});
|
||||||
#endif
|
#endif
|
||||||
m_infoMap.insert({"T_Geometric", "Geometry Tool: Draws geometric shapes"});
|
m_infoMap.insert({"T_Geometric", "Geometry Tool: Draws geometric shapes"});
|
||||||
m_infoMap.insert({ "T_GeometricVector", "Geometry Tool: Draws geometric shapes" +
|
m_infoMap.insert(
|
||||||
spacer +
|
{"T_GeometricVector", "Geometry Tool: Draws geometric shapes" + spacer +
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
"Hold Cmd + Shift - Toggle Snapping" });
|
"Hold Cmd + Shift - Toggle Snapping"});
|
||||||
#else
|
#else
|
||||||
"Hold Ctrl + Shift - Toggle Snapping" });
|
"Hold Ctrl + Shift - Toggle Snapping"});
|
||||||
#endif
|
#endif
|
||||||
m_infoMap.insert({"T_Type", "Type Tool: Adds text"});
|
m_infoMap.insert({"T_Type", "Type Tool: Adds text"});
|
||||||
m_infoMap.insert(
|
m_infoMap.insert(
|
||||||
|
|
Loading…
Reference in a new issue