Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
assetmanager.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~2024 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
22#ifndef GTKMM_KAGE_ASSET_MANAGER_H
23 #define GTKMM_KAGE_ASSET_MANAGER_H
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/button.h>
28 #include "asset.h"
29 #include "../../label_rename.h"
31
32 #include <filesystem>
33
34 class Kage;
35
36 class KageAssetManager : public Gtk::VBox {
37 public:
38 KageAssetManager(Kage *p_kage);
39 virtual ~KageAssetManager();
40 unsigned int assetCount();
41 unsigned int addAsset(std::string p_name = "");
42 unsigned int addImageAsset(std::string p_name = "");
43 void deleteAsset();
44 bool removeAllAssets();
45 void setSelected(KageAsset *p_asset);
46 void setAboveAssetSelected(KageAsset *p_asset);
47 void setBelowAssetSelected(KageAsset *p_asset);
49 unsigned int getCurrentAsset();
50 void setCurrentAsset(unsigned int p_asset);
51 void setCurrentAssetByID(unsigned int p_assetID);
52 void renderStage();
53
55 void setAssetType(KageAsset::AssetType p_assetType);
56
57 void render(unsigned int p_renderID);
58 void forceRender();
59
60 void renameAsset(KageAsset *p_asset);
61 void renameAsset();
62 void setLabel(std::string p_label);
63 std::string getLabel();
64
65 bool moveToTop();
66 bool moveUp();
67 bool moveDown();
68 bool moveToBottom();
69
70 bool exists(std::string p_filePath);
71 void setAssetHash(std::string p_assetHash);
72
73 std::string _KageStudioAsset;
74 std::string getImagePathByID(unsigned int p_index);
75 std::string getImageByID(unsigned int p_id);
76 std::string getFilePathAt(unsigned int p_index);
77 std::string getFileNameAt(unsigned int p_index);
78 std::string getLabelAt(unsigned int p_index);
79 std::string getHashAt(unsigned int p_index);
80 std::string getIDAt(unsigned int p_index);
81 bool setFilePathAt(unsigned int p_index, std::string p_filePath);
82 bool setFileNameAt(unsigned int p_index, std::string p_fileName);
83 bool setHashAt(unsigned int p_index, std::string p_hash);
84
85 std::string saveAssetsTo(std::string p_path);
86
87
88 void renderLibrary(unsigned int p_ID);
89
91
92 unsigned int _selectedAssetID;
93 protected:
94 unsigned int assetCtr;
95 std::vector<Gtk::Button*> labels;
96 std::vector<KageAsset*> assets;
97 unsigned int _currentAssetID;
98 unsigned int _currentAssetIndex;
99 };
100#endif // GTKMM_KAGE_ASSET_MANAGER_H
forward declaration
Definition asset.h:32
AssetType
Definition asset.h:34
void setAssetHash(std::string p_assetHash)
Definition assetmanager.cpp:696
unsigned int assetCtr
Definition assetmanager.h:94
std::string getHashAt(unsigned int p_index)
Definition assetmanager.cpp:825
unsigned int _selectedAssetID
Definition assetmanager.h:92
virtual ~KageAssetManager()
Definition assetmanager.cpp:34
bool setFileNameAt(unsigned int p_index, std::string p_fileName)
For use by Kage when Opening.
Definition assetmanager.cpp:786
bool setFilePathAt(unsigned int p_index, std::string p_filePath)
For use by Kage when Opening.
Definition assetmanager.cpp:761
std::string getImagePathByID(unsigned int p_index)
Definition assetmanager.cpp:709
std::string getFileNameAt(unsigned int p_index)
Definition assetmanager.cpp:797
std::string getLabelAt(unsigned int p_index)
Definition assetmanager.cpp:807
void renderLibrary(unsigned int p_ID)
Definition assetmanager.cpp:303
void setAssetType(KageAsset::AssetType p_assetType)
Definition assetmanager.cpp:263
void deleteAsset()
Definition assetmanager.cpp:206
std::string getLabel()
Definition assetmanager.cpp:550
unsigned int _currentAssetID
Definition assetmanager.h:97
void setCurrentAssetByID(unsigned int p_assetID)
Definition assetmanager.cpp:449
unsigned int _currentAssetIndex
Definition assetmanager.h:98
bool moveToTop()
Definition assetmanager.cpp:569
void render(unsigned int p_renderID)
Definition assetmanager.cpp:277
unsigned int addImageAsset(std::string p_name="")
Used by Kage when opening KAGE files with PNG Assets Blindly accepts that p_name is actually a PNG fi...
Definition assetmanager.cpp:142
unsigned int addAsset(std::string p_name="")
Definition assetmanager.cpp:38
void setLabel(std::string p_label)
Sets the label of current active Asset.
Definition assetmanager.cpp:536
std::string saveAssetsTo(std::string p_path)
Definition assetmanager.cpp:836
void renderStage()
Definition assetmanager.cpp:477
void setCurrentAsset(unsigned int p_asset)
Definition assetmanager.cpp:420
KageAsset::AssetType getAssetType()
Definition assetmanager.cpp:247
KageAsset * getAsset()
Definition assetmanager.cpp:383
KageAssetManager(Kage *p_kage)
Definition assetmanager.cpp:25
bool setHashAt(unsigned int p_index, std::string p_hash)
Definition assetmanager.cpp:814
std::vector< Gtk::Button * > labels
Definition assetmanager.h:95
bool exists(std::string p_filePath)
Definition assetmanager.cpp:678
std::string getImageByID(unsigned int p_id)
Definition assetmanager.cpp:739
void setSelected(KageAsset *p_asset)
Definition assetmanager.cpp:320
std::string _KageStudioAsset
Definition assetmanager.h:73
Kage * _kage
Definition assetmanager.h:90
unsigned int getCurrentAsset()
Definition assetmanager.cpp:402
bool moveToBottom()
Definition assetmanager.cpp:652
bool moveDown()
Definition assetmanager.cpp:623
std::string getIDAt(unsigned int p_index)
void setBelowAssetSelected(KageAsset *p_asset)
For use by Asset when Arrow Down is pressed.
Definition assetmanager.cpp:366
unsigned int assetCount()
Definition assetmanager.cpp:491
void renameAsset()
Definition assetmanager.cpp:510
void forceRender()
Definition assetmanager.cpp:293
std::vector< KageAsset * > assets
Definition assetmanager.h:96
bool removeAllAssets()
Definition assetmanager.cpp:307
std::string getFilePathAt(unsigned int p_index)
Definition assetmanager.cpp:772
void setAboveAssetSelected(KageAsset *p_asset)
For use by Asset when Arrow Up is pressed.
Definition assetmanager.cpp:348
bool moveUp()
Definition assetmanager.cpp:594
Definition kage.h:74