Crossfire Resources Editor
crossfire-crossfire-server
utils
cre
animations
AnimationPanel.cpp
Go to the documentation of this file.
1
/*
2
* Crossfire -- cooperative multi-player graphical RPG and adventure game
3
*
4
* Copyright (c) 2022 the Crossfire Development Team
5
*
6
* Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7
* welcome to redistribute it under certain conditions. For details, please
8
* see COPYING and LICENSE.
9
*
10
* The authors can be reached via e-mail at <crossfire@metalforge.org>.
11
*/
12
13
#include <Qt>
14
15
#include "global.h"
16
#include "artifact.h"
17
#include "object.h"
18
#include "face.h"
19
20
#include "
AnimationPanel.h
"
21
#include "
AnimationControl.h
"
22
#include "
CREUtils.h
"
23
24
#include "assets.h"
25
#include "AssetsManager.h"
26
#include "Archetypes.h"
27
#include "
CREMapInformationManager.h
"
28
#include "
assets/AssetModel.h
"
29
#include "
animations/AnimationWrapper.h
"
30
31
AnimationPanel::AnimationPanel
(QWidget* parent,
AssetModel
*assets) :
AssetTWrapperPanel
(parent) {
32
addAssetUseTree
(tr(
"Used by"
), assets,
"self"
);
33
34
myFaces
=
addWidget
(
""
,
new
QTreeWidget(
this
),
false
,
nullptr
,
nullptr
);
35
myFaces
->setColumnCount(1);
36
myFaces
->setHeaderLabel(tr(
"Faces"
));
37
myFaces
->setIconSize(QSize(32, 32));
38
39
myDisplay
=
addWidget
(
""
,
new
AnimationControl
(
this
),
false
,
nullptr
,
nullptr
);
40
}
41
42
void
AnimationPanel::updateItem
() {
43
myDisplay
->
setAnimation
(
myItem
);
44
45
myFaces
->clear();
46
auto
root =
CREUtils::faceNode
(NULL);
47
myFaces
->addTopLevelItem(root);
48
root->setExpanded(
true
);
49
50
for
(
int
face = 0; face <
myItem
->num_animations; face++)
51
{
52
CREUtils::faceNode
(
myItem
->faces[face], root);
53
}
54
}
AssetWrapperPanel::addAssetUseTree
AssetUseTree * addAssetUseTree(const QString &label, AssetModel *assets, const char *property)
Definition:
AssetWrapperPanel.cpp:150
AnimationPanel::myDisplay
AnimationControl * myDisplay
Definition:
AnimationPanel.h:38
AssetModel.h
CREUtils.h
AnimationWrapper.h
AnimationPanel::AnimationPanel
AnimationPanel(QWidget *parent, AssetModel *assets)
Definition:
AnimationPanel.cpp:31
AnimationControl.h
AnimationControl::setAnimation
void setAnimation(const Animations *animation, int facings=-1)
Definition:
AnimationControl.cpp:41
AssetTWrapperPanel
Definition:
AssetWrapperPanel.h:92
AnimationPanel.h
CREMapInformationManager.h
AnimationControl
Definition:
AnimationControl.h:27
AnimationPanel::updateItem
virtual void updateItem() override
Definition:
AnimationPanel.cpp:42
CREUtils::faceNode
static QTreeWidgetItem * faceNode(QTreeWidgetItem *parent)
Definition:
CREUtils.cpp:46
AnimationPanel::myFaces
QTreeWidget * myFaces
Definition:
AnimationPanel.h:37
AssetTWrapperPanel< Animations >::myItem
Animations * myItem
Definition:
AssetWrapperPanel.h:106
AssetModel
Definition:
AssetModel.h:29
AssetWrapperPanel::addWidget
T * addWidget(const QString &label, T *widget, bool sideBySide, const char *property, const char *widgetProperty)
Definition:
AssetWrapperPanel.h:64
Generated by
1.8.17