Skip to content

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

C

implement selective option for segment eraser

pojienieef20306ff865
diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cpp
index 2155597a2..766a7a024 100644
--- a/toonz/sources/tnztools/vectorerasertool.cpp
+++ b/toonz/sources/tnztools/vectorerasertool.cpp
@@ -1262,6 +1262,7 @@ void EraserTool::eraseSegments(const TVectorImageP vi, TStroke *eraseStroke) {
if (!vi || !eraseStroke) return;
int strokeNumber = vi->getStrokeCount();
+ int colorStyle = TTool::getApplication()->getCurrentLevelStyleIndex();
std::vector<int> touchedStrokeIndex;
std::vector<std::vector<double>> touchedStrokeW;
std::vector<std::vector<DoublePair>> touchedStrokeRanges;
@@ -1273,6 +1274,10 @@ void EraserTool::eraseSegments(const TVectorImageP vi, TStroke *eraseStroke) {
TStroke *stroke = vi->getStroke(i);
bool touched = false;
+ if (m_selective.getValue() && stroke->getStyle() != colorStyle) {
+ continue;
+ }
+
intersect(eraseStroke, stroke, intersections, false);
for (auto &intersection : intersections) {