Merge pull request #2830 from shun-iwasawa/g/geometric_tool_for_spline

Enable Geometric Tool for Motion Path
This commit is contained in:
Rodney 2019-10-16 21:45:39 -05:00 committed by GitHub
commit 60fff429f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 29 deletions

View file

@ -852,7 +852,7 @@ public:
void leftButtonDown(const TPointD &p, const TMouseEvent &e) override { void leftButtonDown(const TPointD &p, const TMouseEvent &e) override {
/* m_active = getApplication()->getCurrentObject()->isSpline() || /* m_active = getApplication()->getCurrentObject()->isSpline() ||
(bool) getImage(true);*/ (bool) getImage(true);*/
if (!getApplication()->getCurrentObject()->isSpline())
m_active = touchImage(); // NEEDS to be done even if(m_active), due m_active = touchImage(); // NEEDS to be done even if(m_active), due
if (!m_active) // to the HORRIBLE m_frameCreated / m_levelCreated if (!m_active) // to the HORRIBLE m_frameCreated / m_levelCreated
return; // mechanism. touchImage() is the ONLY function return; // mechanism. touchImage() is the ONLY function
@ -1092,11 +1092,11 @@ public:
m_primitive->setIsPrompting(false); m_primitive->setIsPrompting(false);
if (ret == 2 || ret == 0) return; if (ret == 2 || ret == 0) return;
} }
QMutexLocker lock(vi->getMutex());
TUndo *undo = new UndoPath( TUndo *undo = new UndoPath(
getXsheet()->getStageObject(getObjectId())->getSpline()); getXsheet()->getStageObject(getObjectId())->getSpline());
while (vi->getStrokeCount() > 0) vi->deleteStroke(0); while (vi->getStrokeCount() > 0) vi->deleteStroke(0);
vi->addStroke(stroke, false); vi->addStroke(stroke, false);
notifyImageChanged();
TUndoManager::manager()->add(undo); TUndoManager::manager()->add(undo);
} else { } else {
int styleId = TTool::getApplication()->getCurrentLevelStyleIndex(); int styleId = TTool::getApplication()->getCurrentLevelStyleIndex();
@ -1719,8 +1719,7 @@ void MultiLinePrimitive::leftButtonDown(const TPointD &pos,
void MultiLinePrimitive::leftButtonDrag(const TPointD &pos, void MultiLinePrimitive::leftButtonDrag(const TPointD &pos,
const TMouseEvent &e) { const TMouseEvent &e) {
if (m_vertex.size() == 0 || m_isSingleLine) return; if (m_vertex.size() == 0 || m_isSingleLine) return;
if (m_speedMoved || if (m_speedMoved || tdistance2(m_vertex[m_vertex.size() - 1], pos) >
tdistance2(m_vertex[m_vertex.size() - 1], pos) >
sq(7.0 * m_tool->getPixelSize())) { sq(7.0 * m_tool->getPixelSize())) {
moveSpeed(m_mousePosition - pos); moveSpeed(m_mousePosition - pos);
m_speedMoved = true; m_speedMoved = true;
@ -2067,7 +2066,8 @@ TStroke *EllipsePrimitive::makeStroke() const {
return 0; return 0;
return makeEllipticStroke( return makeEllipticStroke(
getThickness(), TPointD(0.5 * (m_selectingRect.x0 + m_selectingRect.x1), getThickness(),
TPointD(0.5 * (m_selectingRect.x0 + m_selectingRect.x1),
0.5 * (m_selectingRect.y0 + m_selectingRect.y1)), 0.5 * (m_selectingRect.y0 + m_selectingRect.y1)),
fabs(0.5 * (m_selectingRect.x1 - m_selectingRect.x0)), fabs(0.5 * (m_selectingRect.x1 - m_selectingRect.x0)),
fabs(0.5 * (m_selectingRect.y1 - m_selectingRect.y0))); fabs(0.5 * (m_selectingRect.y1 - m_selectingRect.y0)));

View file

@ -858,6 +858,14 @@ QString TTool::updateEnabled() {
m_application->getCurrentObject()->getObjectId().getIndex()); m_application->getCurrentObject()->getObjectId().getIndex());
} }
// Check against splines
if (spline && (toolType & TTool::LevelTool)) {
return (targetType & Splines)
? (enable(true), QString())
: (enable(false), QObject::tr("The current tool cannot be "
"used to edit a motion path."));
}
// Check against unplaced columns (not in filmstrip mode) // Check against unplaced columns (not in filmstrip mode)
if (column && !filmstrip) { if (column && !filmstrip) {
if (column->isLocked()) if (column->isLocked())
@ -903,14 +911,6 @@ QString TTool::updateEnabled() {
// Check LevelRead & LevelWrite tools // Check LevelRead & LevelWrite tools
if (toolType & TTool::LevelTool) { if (toolType & TTool::LevelTool) {
// Check against splines
if (spline) {
return (targetType & Splines)
? (enable(true), QString())
: (enable(false), QObject::tr("The current tool cannot be "
"used to edit a motion path."));
}
// Check against empty levels // Check against empty levels
if (!xl) if (!xl)
return (targetType & EmptyTarget) ? (enable(true), QString()) return (targetType & EmptyTarget) ? (enable(true), QString())