Skip to content

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

C

Added "Select All" function for vector images (#1042)

Martin van Zijld1006d8551b5
diff --git a/toonz/sources/include/tools/strokeselection.h b/toonz/sources/include/tools/strokeselection.h
index 02d371fe6..0757b3afc 100644
--- a/toonz/sources/include/tools/strokeselection.h
+++ b/toonz/sources/include/tools/strokeselection.h
@@ -79,6 +79,8 @@ public:
void enableCommands() override;
+ void selectAll();
+
private:
TVectorImageP m_vi; //!< Selected vector image.
IndexesContainer m_indexes; //!< Selected stroke indexes in m_vi.
diff --git a/toonz/sources/tnztools/strokeselection.cpp b/toonz/sources/tnztools/strokeselection.cpp
index 020519d3c..22ac15c05 100644
--- a/toonz/sources/tnztools/strokeselection.cpp
+++ b/toonz/sources/tnztools/strokeselection.cpp
@@ -455,6 +455,27 @@ void StrokeSelection::removeEndpoints() {
m_updateSelectionBBox = false;
}
+
+//=============================================================================
+//
+// selectAll
+//
+//-----------------------------------------------------------------------------
+
+void StrokeSelection::selectAll() {
+ if (!m_vi) return;
+
+ int sCount = int(m_vi->getStrokeCount());
+
+ for (int s = 0; s < sCount; ++s) {
+ m_indexes.insert(s);
+ }
+
+ StrokeSelection *selection = dynamic_cast<StrokeSelection *>(
+ TTool::getApplication()->getCurrentSelection()->getSelection());
+ if (selection) selection->notifyView();
+}
+
//=============================================================================
//
// deleteStrokes
@@ -613,6 +634,7 @@ void StrokeSelection::enableCommands() {
enableCommand(m_groupCommand.get(), MI_ExitGroup, &TGroupCommand::exitGroup);
enableCommand(this, MI_RemoveEndpoints, &StrokeSelection::removeEndpoints);
+ enableCommand(this, MI_SelectAll, &StrokeSelection::selectAll);
}
//===================================================================