Skip to content

Commit 54ec224

Browse files
author
rueter37
committed
Fix graphical glitch in the actor faceset view in the database
The actor faceset view in the database sometimes had graphical artifacts if no actor was selected. This is fixed now.
1 parent 9eb499c commit 54ec224

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ui/viewer/faceset_graphics_item.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
FaceSetGraphicsItem::FaceSetGraphicsItem(ProjectData& project, const QPixmap pix) :
2727
QGraphicsItem(), m_project(project), m_image(pix) {
28+
if (pix.isNull()) {
29+
m_image = QPixmap(48, 48);
30+
m_image.fill(QColor(255, 255, 255, 0));
31+
}
2832
}
2933

3034
QRect FaceSetGraphicsItem::faceRect() const {
@@ -51,7 +55,13 @@ void FaceSetGraphicsItem::refresh(const lcf::rpg::Actor& actor) {
5155
void FaceSetGraphicsItem::refresh(QString filename, int index) {
5256
if (m_filename != filename) {
5357
m_filename = filename;
54-
m_image = ImageLoader::Load(m_project.project().findFile(FACESET, filename, FileFinder::FileType::Image));
58+
QString path = m_project.project().findFile(FACESET, filename, FileFinder::FileType::Image);
59+
if (!path.isEmpty()) {
60+
m_image = ImageLoader::Load(path);
61+
} else {
62+
m_image = QPixmap(48, 48);
63+
m_image.fill(QColor(255, 255, 255, 0));
64+
}
5565
}
5666
setIndex(index);
5767
update();

src/ui/viewer/faceset_graphics_item.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ProjectData;
2727

2828
class FaceSetGraphicsItem : public QGraphicsItem {
2929
public:
30-
explicit FaceSetGraphicsItem(ProjectData& m_project, const QPixmap pix = QPixmap(192,192));
30+
explicit FaceSetGraphicsItem(ProjectData& m_project, const QPixmap pix = QPixmap());
3131

3232
QRect faceRect() const;
3333
QRectF boundingRect() const override;

0 commit comments

Comments
 (0)