OpenToonz - An open-source full-featured 2D animation creation software
C
#assistants: deselect assistant when image or tool switched
Ivan Mahonin9bb114865bf2
diff --git a/toonz/sources/tnztools/editassistantstool.cpp b/toonz/sources/tnztools/editassistantstool.cppindex 908f80697..aad88bd34 100644--- a/toonz/sources/tnztools/editassistantstool.cpp+++ b/toonz/sources/tnztools/editassistantstool.cpp@@ -124,6 +124,7 @@ protected:bool m_dragging;bool m_dragAllPoints;+ TSmartHolderT<TImage> m_currentImage;TMetaObjectH m_currentAssistant;bool m_currentAssistantCreated;bool m_currentAssistantChanged;@@ -172,8 +173,10 @@ public:{ return TTool::LevelWriteTool; }int getCursorId() const override{ return ToolCursor::StrokeSelectCursor; }- void onImageChanged() override- { getViewer()->GLInvalidateAll(); }+ void onImageChanged() override {+ if (m_currentImage != getImage(false)) resetCurrentPoint();+ getViewer()->GLInvalidateAll();+ }void updateAssistantTypes() {std::wstring value = m_assistantType.getValue();@@ -206,8 +209,13 @@ public:return &m_allProperties;}- void onActivate() override- { updateAssistantTypes(); }+ void onActivate() override {+ updateAssistantTypes();+ resetCurrentPoint();+ }++ void onDeactivate() override+ { resetCurrentPoint(); }void updateTranslation() override {m_assistantType.setQStringName( tr("Assistant Type") );@@ -339,6 +347,7 @@ protected:void resetCurrentPoint(bool updateOptionsBox = true) {close();+ m_currentImage.reset();m_currentAssistant.reset();m_currentAssistantCreated = false;m_currentAssistantChanged = false;@@ -346,12 +355,21 @@ protected:m_currentPointName.reset();m_currentPointOffset = TPointD();m_currentAssistantBackup.reset();++ // deselect points+ if (Closer closer = read(ModeImage))+ for(TMetaObjectListCW::iterator i = (*m_reader)->begin(); i != (*m_reader)->end(); ++i)+ if (*i)+ if (const TAssistant *assistant = (*i)->getHandler<TAssistant>())+ assistant->deselectAll();+if (updateOptionsBox) this->updateOptionsBox();}bool findCurrentPoint(const TPointD &position, double pixelSize = 1, bool updateOptionsBox = true) {resetCurrentPoint(false);if (Closer closer = read(ModeImage)) {+ m_currentImage.set(m_readImage);for(TMetaObjectListCW::iterator i = (*m_reader)->begin(); i != (*m_reader)->end(); ++i) {if (!*i) continue;