!XT (BREAK-16) (Sandbox) Remove double-newlines at the end of files.
[CRYENGINE.git] / Code / Sandbox / Plugins / EditorCommon / Models / CharacterAnimationsModel.cpp
blob27dca0a705fe8e370b0a92667234cb980aa0d131
1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "stdafx.h"
4 #include "CharacterAnimationsModel.h"
6 #include <CryAnimation/ICryAnimation.h>
8 int CCharacterAnimationsModel::rowCount(const QModelIndex& parent) const
10 if (!parent.isValid())
12 return m_animationSet.GetAnimationCount();
14 return 0;
17 int CCharacterAnimationsModel::columnCount(const QModelIndex& parent) const
19 return 1;
22 QVariant CCharacterAnimationsModel::data(const QModelIndex& index, int role) const
24 if (index.isValid() && index.row() < m_animationSet.GetAnimationCount())
26 switch (role)
28 case Qt::DisplayRole:
29 case Qt::EditRole:
30 switch (index.column())
32 case 0:
33 return m_animationSet.GetNameByAnimID(index.row());
35 break;
36 case Qt::DecorationRole:
37 default:
38 break;
42 return QVariant();
45 QVariant CCharacterAnimationsModel::headerData(int section, Qt::Orientation orientation, int role) const
47 if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
49 switch (section)
51 case 0:
52 return QObject::tr("Animation Name");
53 default:
54 break;
57 return QVariant();
60 QModelIndex CCharacterAnimationsModel::index(int row, int column, const QModelIndex& parent) const
62 if (row >= 0 && row < m_animationSet.GetAnimationCount())
64 return QAbstractItemModel::createIndex(row, column, reinterpret_cast<quintptr>(m_animationSet.GetNameByAnimID(row)));
66 return QModelIndex();
69 QModelIndex CCharacterAnimationsModel::parent(const QModelIndex& index) const
71 return QModelIndex();