Kage Studio 0.7.230612
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
scene.h
Go to the documentation of this file.
1/*
2 * Kage Studio - a simple free and open source vector-based 2D animation software
3 * Copyright (C) 2011~2023 Mj Mendoza IV
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
19 *
20 */
21#ifndef GTKMM_KAGE_SCENE_H
22 #define GTKMM_KAGE_SCENE_H
23
24 #include <vector>
25 #include "color.h"
26
27 #include "frame.h"
28 #include "layer.h"
29 #include "../vectordatamanager.h"
30
31 #include "../../util/string/stringhelper.h"
32
33 #include <gdkmm/color.h>
34 //class Kage; //forward declaration
35
36 using namespace std;
37
38 class KageFrame; //forward declaration
39 class KageLayer; //forward declaration
40
41 class KageDocument; //forward declaration
42
43 class KageScene {
44 protected:
45 void init(KageDocument *p_document);
46
47 unsigned int ID;
49 bool _saved;
50 unsigned int _activeLayer;
51 public:
52 static bool LOADING_MODE;
53 KageScene(KageDocument *p_document, string p_filepath);
54
55 vector<KageLayer *> Layers;
56
57 bool open(string p_filepath);
58 bool save();
59
60 bool isSelected();
61 bool isSaved();
62
63 public:
64 KageScene(KageDocument *p_document);
65 KageScene(KageDocument *p_document, KageScene *p_scene);
66 virtual ~KageScene();
67 void addLayer(unsigned int p_layer);
68 void deleteFrameset(unsigned int p_layer);
69 bool addFrame();
70 bool extendFrame();
71 bool duplicateFrame();
72 bool removeFrame();
73 void setCurrentFrame(unsigned int p_frame);
74 void setCurrentFrameByID(unsigned int p_frameID);
75 unsigned int getCurrentFrame();
76 void setCurrentLayer(unsigned int p_currentLayer);
77 void setCurrentLayerByID(unsigned int p_layerID);
78 unsigned int getCurrentLayer(); //currently used by getFrame()
79 unsigned int layerCount();
80 unsigned int frameCount();
81 void selectAll(bool p_selectAll);
83 KageFrame *getFrameAt(unsigned int p_frame);
85 KageLayer *getLayerAt(unsigned int p_layer);
86
87 void renderStage(); //used by KageFrame
88
89 bool removeAllFrames();
90
91 bool moveToTop();
92 bool moveUp();
93 bool moveDown();
94 bool moveToBottom();
95
96 vector<unsigned int> raiseSelectedShape(vector<unsigned int> p_selectedShapes);
97 vector<unsigned int> lowerSelectedShape(vector<unsigned int> p_selectedShapes);
98 vector<unsigned int> raiseToTopSelectedShape(vector<unsigned int> p_selectedShapes);
99 vector<unsigned int> lowerToBottomSelectedShape(vector<unsigned int> p_selectedShapes);
100 vector<unsigned int> groupSelectedShapes(vector<unsigned int> p_selectedShapes);
101 vector<unsigned int> ungroupSelectedShapes(vector<unsigned int> p_selectedShapes);
102 vector<unsigned int> duplicateShapes(vector<unsigned int> p_selectedShapes);
103 bool flipHorizontalSelectedShape(vector<unsigned int> p_selectedShapes);
104 bool flipVerticalSelectedShape(vector<unsigned int> p_selectedShapes);
105
106 bool recenterRotationPoint(vector<unsigned int> p_selectedShapes);
107
108 bool addDataToFrame(VectorDataManager p_vectorsData);
109 bool setFrameData(VectorDataManager p_vectorsData);
111 VectorDataManager getFrameDataAt(unsigned int p_frame);
112
113 bool forceSetTween(unsigned int p_tween);
114 bool setTween(unsigned int p_tween);
115 unsigned int getTween();
116
117 bool switchToPreviousFrame();
118 bool switchToPreviousFrame(unsigned int p_frameID);
119 bool switchToNextFrame();
120 bool switchToNextFrame(unsigned int p_frameID);
121
122 void setFrameExtension(KageFrame::extension p_extension);
123 //Kage *_kage;
126
127 unsigned int getActiveLayerID();
128 void setActiveLayerID(unsigned int p_layerID);
129 };
130#endif //GTKMM_KAGE_SCENE_H
Definition: document.h:84
Definition: frame.h:36
extension
Definition: frame.h:40
Definition: layer.h:39
Definition: scene.h:43
bool flipHorizontalSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:477
VectorDataManager getFrameDataAt(unsigned int p_frame)
Definition: scene.cpp:544
bool forceSetTween(unsigned int p_tween)
NOTE: "Frame" – NOT "frame ID".
Definition: scene.cpp:556
bool setFrameData(VectorDataManager p_vectorsData)
Definition: scene.cpp:523
void setFrameExtension(KageFrame::extension p_extension)
Called by KageFrame for navigating to Next Frame.
Definition: scene.cpp:692
KageScene * _parent
Definition: scene.h:125
bool open(string p_filepath)
Definition: scene.cpp:41
vector< unsigned int > groupSelectedShapes(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:442
void setCurrentLayerByID(unsigned int p_layerID)
Definition: scene.cpp:191
void setCurrentFrameByID(unsigned int p_frameID)
Definition: scene.cpp:235
vector< unsigned int > duplicateShapes(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:465
bool addFrame()
Definition: scene.cpp:100
bool duplicateFrame()
Definition: scene.cpp:117
bool removeFrame()
Definition: scene.cpp:134
vector< unsigned int > lowerSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:408
vector< unsigned int > raiseSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:397
bool moveToBottom()
Definition: scene.cpp:380
KageLayer * getLayer()
Definition: scene.cpp:302
unsigned int getActiveLayerID()
Definition: scene.cpp:702
bool moveDown()
Definition: scene.cpp:362
bool switchToNextFrame()
Called by KageFrame for navigating to Previous Frame.
Definition: scene.cpp:642
unsigned int frameCount()
Definition: scene.cpp:77
bool switchToPreviousFrame()
Definition: scene.cpp:595
KageFrame * getFrameAt(unsigned int p_frame)
Definition: scene.cpp:288
void setCurrentFrame(unsigned int p_frame)
Definition: scene.cpp:205
bool moveToTop()
Definition: scene.cpp:323
static bool LOADING_MODE
Definition: scene.h:52
KageDocument * _document
Definition: scene.h:124
vector< unsigned int > ungroupSelectedShapes(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:453
KageLayer * getLayerAt(unsigned int p_layer)
Definition: scene.cpp:310
unsigned int _activeLayer
Definition: scene.h:50
unsigned int layerCount()
Definition: scene.cpp:74
bool _saved
Definition: scene.h:49
void deleteFrameset(unsigned int p_layer)
Definition: scene.cpp:95
void selectAll(bool p_selectAll)
Definition: scene.cpp:264
vector< unsigned int > raiseToTopSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:419
bool _selected
Definition: scene.h:48
bool flipVerticalSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:488
virtual ~KageScene()
Definition: scene.cpp:69
bool removeAllFrames()
Definition: scene.cpp:159
vector< KageLayer * > Layers
Definition: scene.h:55
bool save()
Definition: scene.cpp:46
unsigned int ID
Definition: scene.h:47
void init(KageDocument *p_document)
Definition: scene.cpp:30
vector< unsigned int > lowerToBottomSelectedShape(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:430
bool recenterRotationPoint(vector< unsigned int > p_selectedShapes)
Definition: scene.cpp:500
unsigned int getTween()
Definition: scene.cpp:582
bool setTween(unsigned int p_tween)
Definition: scene.cpp:569
unsigned int getCurrentLayer()
Definition: scene.cpp:176
bool isSaved()
Definition: scene.cpp:55
void addLayer(unsigned int p_layer)
Definition: scene.cpp:85
bool extendFrame()
Definition: scene.cpp:148
bool addDataToFrame(VectorDataManager p_vectorsData)
Definition: scene.cpp:512
void renderStage()
Definition: scene.cpp:259
bool isSelected()
Definition: scene.cpp:52
void setCurrentLayer(unsigned int p_currentLayer)
Definition: scene.cpp:179
void setActiveLayerID(unsigned int p_layerID)
Definition: scene.cpp:172
unsigned int getCurrentFrame()
Definition: scene.cpp:195
KageFrame * getFrame()
Definition: scene.cpp:274
bool moveUp()
Definition: scene.cpp:344
VectorDataManager getFrameData()
Definition: scene.cpp:533
Definition: vectordatamanager.h:37