Fix background image reset

Reset background image when document switched
master
huxingyi 2020-12-08 08:27:37 +09:30
parent cef6deeda3
commit 0ddd76edc2
4 changed files with 11 additions and 1 deletions

View File

@ -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;

View File

@ -473,6 +473,7 @@ public:
const std::vector<RigBone> *resultRigBones() const;
const std::map<int, RigVertexWeights> *resultRigWeights() const;
void updateTurnaround(const QImage &image);
void clearTurnaround();
void updateTextureImage(QImage *image);
void updateTextureNormalImage(QImage *image);
void updateTextureMetalnessImage(QImage *image);

View File

@ -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")) {

View File

@ -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;