From 0ddd76edc28321d99d58a01a40b85559a8cd4235 Mon Sep 17 00:00:00 2001 From: huxingyi Date: Tue, 8 Dec 2020 08:27:37 +0930 Subject: [PATCH] Fix background image reset Reset background image when document switched --- src/document.cpp | 7 +++++++ src/document.h | 1 + src/documentwindow.cpp | 2 ++ src/skeletongraphicswidget.cpp | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/document.cpp b/src/document.cpp index 3003558e..d918e309 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -932,6 +932,13 @@ void Document::updateTurnaround(const QImage &image) emit turnaroundChanged(); } +void Document::clearTurnaround() +{ + turnaround = QImage(); + turnaroundPngByteArray.clear(); + emit turnaroundChanged(); +} + void Document::updateTextureImage(QImage *image) { delete textureImageByteArray; diff --git a/src/document.h b/src/document.h index 3698b950..a379a43c 100644 --- a/src/document.h +++ b/src/document.h @@ -473,6 +473,7 @@ public: const std::vector *resultRigBones() const; const std::map *resultRigWeights() const; void updateTurnaround(const QImage &image); + void clearTurnaround(); void updateTextureImage(QImage *image); void updateTextureNormalImage(QImage *image); void updateTextureMetalnessImage(QImage *image); diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp index bdf2e4bb..08f4cdd8 100644 --- a/src/documentwindow.cpp +++ b/src/documentwindow.cpp @@ -1432,6 +1432,7 @@ void DocumentWindow::newDocument() m_document->clearHistories(); m_document->resetScript(); m_document->reset(); + m_document->clearTurnaround(); m_document->saveSnapshot(); } @@ -1779,6 +1780,7 @@ void DocumentWindow::openPathAs(const QString &path, const QString &asName) m_document->clearHistories(); m_document->resetScript(); m_document->reset(); + m_document->clearTurnaround(); m_document->saveSnapshot(); if (path.endsWith(".xml")) { diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index e4390e75..20b5571c 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -722,7 +722,7 @@ void SkeletonGraphicsWidget::turnaroundChanged() void SkeletonGraphicsWidget::updateTurnaround() { const QImage *turnaroundImage = &m_document->turnaround; - QImage onePixel(16, 10, QImage::Format_ARGB32); + QImage onePixel(2, 1, QImage::Format_ARGB32); if (turnaroundImage->isNull()) { onePixel.fill(Qt::transparent); turnaroundImage = &onePixel;