Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix(tools): keep the vector frame range preview on the viewer

Ahl761abd807d0f57
diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
index 09a3bad25..5d7a1b24e 100644
--- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
@@ -724,12 +724,14 @@ void ToonzVectorBrushTool::onActivate() {
}
resetFrameRange();
updateModifiers();
+ m_skipStrokeUntilDown = false;
// TODO:app->editImageOrSpline();
}
//--------------------------------------------------------------------------------------------------
void ToonzVectorBrushTool::onImageChanged() {
+ if (m_active) m_skipStrokeUntilDown = true;
m_inputmanager.reset();
m_active = false;
m_tracks.clear();
@@ -745,6 +747,7 @@ void ToonzVectorBrushTool::onDeactivate() {
// End current stroke.
m_inputmanager.finishTracks();
resetFrameRange();
+ m_skipStrokeUntilDown = false;
}
//--------------------------------------------------------------------------------------------------
@@ -1197,6 +1200,13 @@ void ToonzVectorBrushTool::handleMouseEvent(MouseEventType type,
if (control != m_inputmanager.state.isKeyPressed(TKey::control))
m_inputmanager.keyEvent(control, TKey::control, t, nullptr);
+ if (m_skipStrokeUntilDown) {
+ if (type == ME_DOWN)
+ m_skipStrokeUntilDown = false;
+ else if (type != ME_MOVE)
+ return;
+ }
+
TPointD snappedPos = pos;
bool pickerMode = getViewer() && getViewer()->getGuidedStrokePickerMode();
bool snapInvert = alt && (!control || type == ME_MOVE || type == ME_DOWN);
@@ -1557,7 +1567,20 @@ void ToonzVectorBrushTool::snap(const TPointD &pos, bool snapEnabled, bool withS
void ToonzVectorBrushTool::draw() {
m_pixelSize = getPixelSize();
m_inputmanager.draw();
-
+
+ for (TrackList::iterator i = m_rangeTracks.begin(); i != m_rangeTracks.end();
+ ++i) {
+ if (i->isEmpty()) continue;
+ TPointD offset1 = TPointD(5, 5);
+ TPointD offset2 = TPointD(-offset1.x, offset1.y);
+ TPointD point = i->getFirstPoint();
+ glColor3d(1.0, 0.0, 0.0);
+ i->drawAllFragments();
+ glColor3d(0.0, 0.6, 0.0);
+ tglDrawSegment(point - offset1, point + offset1);
+ tglDrawSegment(point - offset2, point + offset2);
+ }
+
/*--ショートカットでのツール切り替え時に赤点が描かれるのを防止する--*/
if (m_minThick == 0 && m_maxThick == 0 &&
!Preferences::instance()->getShow0ThickLines())
@@ -1579,19 +1602,6 @@ void ToonzVectorBrushTool::draw() {
tglDrawCircle(m_snapPointSelf, snapMarkRadius);
}
- // frame range
- for(TrackList::iterator i = m_rangeTracks.begin(); i != m_rangeTracks.end(); ++i) {
- if (i->isEmpty()) continue;
- TPointD offset1 = TPointD(5, 5);
- TPointD offset2 = TPointD(-offset1.x, offset1.y);
- TPointD point = i->getFirstPoint();
- glColor3d(1.0, 0.0, 0.0);
- i->drawAllFragments();
- glColor3d(0.0, 0.6, 0.0);
- tglDrawSegment(point - offset1, point + offset1);
- tglDrawSegment(point - offset2, point + offset2);
- }
-
if (getApplication()->getCurrentObject()->isSpline()) return;
if (Preferences::instance()->isUseStrokeEndCursor())
diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.h b/toonz/sources/tnztools/toonzvectorbrushtool.h
index 357d892ac..3b117c0f2 100644
--- a/toonz/sources/tnztools/toonzvectorbrushtool.h
+++ b/toonz/sources/tnztools/toonzvectorbrushtool.h
@@ -261,6 +261,7 @@ protected:
m_presetsManager; //!< Manager for presets of this tool instance
bool m_active, m_firstTime, m_isPath, m_presetsLoaded, m_firstFrameRange;
+ bool m_skipStrokeUntilDown = false;
bool m_propertyUpdating;
double m_cameraDpi;