Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • managers
layermanager.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#ifndef LAYER_MANAGER_H
19#define LAYER_MANAGER_H
20
21#include "basemanager.h"
22#include "layer.h"
23
24class LayerBitmap;
25class LayerVector;
26class LayerCamera;
27class LayerSound;
28
29
30class LayerManager : public BaseManager
31{
32 Q_OBJECT
33
34public:
35 explicit LayerManager(Editor* editor);
36 ~LayerManager() override;
37 bool init() override;
38 Status load(Object*) override;
39 Status save(Object*) override;
40
41 // Layer Management
42 Layer* currentLayer();
43 Layer* currentLayer(int offset);
44 Layer* getLayer(int index);
45 LayerCamera* getCameraLayerBelow(int layerIndex) const;
46 Layer* findLayerByName(QString sName, Layer::LAYER_TYPE type = Layer::UNDEFINED);
47 Layer* findLayerById(int layerId) const;
48 Layer* getLastCameraLayer();
49 int currentLayerIndex();
50 void setCurrentLayer(int nIndex);
51 void setCurrentLayer(Layer* layer);
52 int count();
53
54 bool canDeleteLayer(int index) const;
55 Status deleteLayer(int index);
56 Status renameLayer(Layer*, const QString& newName);
57 void notifyLayerChanged(Layer*);
58
59 void gotoNextLayer();
60 void gotoPreviouslayer();
61
63 Layer* createLayer(Layer::LAYER_TYPE type, const QString& strLayerName);
64 LayerBitmap* createBitmapLayer(const QString& strLayerName);
65 LayerVector* createVectorLayer(const QString& strLayerName);
66 LayerCamera* createCameraLayer(const QString& strLayerName);
67 LayerSound* createSoundLayer(const QString& strLayerName);
68
69 // KeyFrame Management
70 int lastFrameAtFrame(int frameIndex);
71 int firstKeyFrameIndex();
72
73 int animationLength(bool includeSounds = true);
74
76 void notifyAnimationLengthChanged();
77
78 QString nameSuggestLayer(const QString& name);
79 int getLastLayerIndex() { return count() - 1; }
80
81signals:
82 void currentLayerWillChange(int index);
83 void currentLayerChanged(int index);
84 void layerCountChanged(int count);
85 void animationLengthChanged(int length);
86 void layerDeleted(int index);
87
88private:
89 int getIndex(Layer*) const;
90
91 int mLastCameraLayerIdx = 0;
92};
93
94#endif
BaseManager
Definition: basemanager.h:29
Editor
Definition: editor.h:71
LayerBitmap
Definition: layerbitmap.h:26
LayerCamera
Definition: layercamera.h:30
Layer
Definition: layer.h:33
LayerManager
Definition: layermanager.h:31
LayerManager::animationLength
int animationLength(bool includeSounds=true)
Get the length of current project.
Definition: layermanager.cpp:352
LayerManager::createLayer
Layer * createLayer(Layer::LAYER_TYPE type, const QString &strLayerName)
Returns a new Layer with the given LAYER_TYPE.
Definition: layermanager.cpp:187
LayerManager::notifyAnimationLengthChanged
void notifyAnimationLengthChanged()
This should be emitted whenever the animation length frames, eg.
Definition: layermanager.cpp:386
LayerSound
Definition: layersound.h:26
LayerVector
Definition: layervector.h:26
Object
Definition: object.h:42
Status
Definition: pencilerror.h:40
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QString
Generated on Fri Nov 13 2026 12:01:03 for Pencil2D by doxygen 1.9.6 based on revision 3f1e1d4b3be7f7c4a38e44a6b96b0e8e74438e32