Skip to content

Commit

Permalink
Add placeholder faceset for actor preview
Browse files Browse the repository at this point in the history
The actor preview uses now a placeholder faceset if the actor has not
a faceset set. This makes all actor selection items the same height
and reduces console spam.
  • Loading branch information
rueter37 committed Dec 13, 2021
1 parent 07e476b commit 9eb499c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/model/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ lcf::rpg::Actor& ActorModel::data() {
}

QPixmap ActorModel::preview() {
QPixmap faceSet = ImageLoader::Load(m_project.project().findFile("FaceSet", ToQString(m_data.face_name), FileFinder::FileType::Image));
QString path = m_project.project().findFile("FaceSet", ToQString(m_data.face_name), FileFinder::FileType::Image);
if (!path.isEmpty()) {
QPixmap faceSet = ImageLoader::Load(path);
int x = (m_data.face_index % 4) * 48;
int y = (m_data.face_index / 4) * 48;

int x = (m_data.face_index % 4) * 48;
int y = (m_data.face_index / 4) * 48;
return faceSet.copy(x, y, 48, 48);
} else {
QPixmap faceSet = QPixmap(48, 48);
faceSet.fill(QColor(255, 255, 255, 0));

return faceSet.copy(x, y, 48, 48);
return faceSet;
}
}

const lcf::rpg::Actor& ActorModel::data() const {
Expand Down

0 comments on commit 9eb499c

Please sign in to comment.