Skip to content

Commit

Permalink
Fix graphical glitch in the actor faceset view in the database
Browse files Browse the repository at this point in the history
The actor faceset view in the database sometimes had graphical
artifacts if no actor was selected. This is fixed now.
  • Loading branch information
rueter37 committed Dec 13, 2021
1 parent 9eb499c commit 54ec224
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/ui/viewer/faceset_graphics_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

FaceSetGraphicsItem::FaceSetGraphicsItem(ProjectData& project, const QPixmap pix) :
QGraphicsItem(), m_project(project), m_image(pix) {
if (pix.isNull()) {
m_image = QPixmap(48, 48);
m_image.fill(QColor(255, 255, 255, 0));
}
}

QRect FaceSetGraphicsItem::faceRect() const {
Expand All @@ -51,7 +55,13 @@ void FaceSetGraphicsItem::refresh(const lcf::rpg::Actor& actor) {
void FaceSetGraphicsItem::refresh(QString filename, int index) {
if (m_filename != filename) {
m_filename = filename;
m_image = ImageLoader::Load(m_project.project().findFile(FACESET, filename, FileFinder::FileType::Image));
QString path = m_project.project().findFile(FACESET, filename, FileFinder::FileType::Image);
if (!path.isEmpty()) {
m_image = ImageLoader::Load(path);
} else {
m_image = QPixmap(48, 48);
m_image.fill(QColor(255, 255, 255, 0));
}
}
setIndex(index);
update();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/viewer/faceset_graphics_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ProjectData;

class FaceSetGraphicsItem : public QGraphicsItem {
public:
explicit FaceSetGraphicsItem(ProjectData& m_project, const QPixmap pix = QPixmap(192,192));
explicit FaceSetGraphicsItem(ProjectData& m_project, const QPixmap pix = QPixmap());

QRect faceRect() const;
QRectF boundingRect() const override;
Expand Down

0 comments on commit 54ec224

Please sign in to comment.