Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
KageAssetManager Class Reference

#include <assetmanager.h>

Inheritance diagram for KageAssetManager:
Collaboration diagram for KageAssetManager:

Public Member Functions

 KageAssetManager (Kage *p_kage)
 
virtual ~KageAssetManager ()
 
unsigned int assetCount ()
 
unsigned int addAsset (std::string p_name="")
 
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 file.
 
void deleteAsset ()
 
bool removeAllAssets ()
 
void setSelected (KageAsset *p_asset)
 
void setAboveAssetSelected (KageAsset *p_asset)
 For use by Asset when Arrow Up is pressed.
 
void setBelowAssetSelected (KageAsset *p_asset)
 For use by Asset when Arrow Down is pressed.
 
KageAssetgetAsset ()
 
unsigned int getCurrentAsset ()
 
void setCurrentAsset (unsigned int p_asset)
 
void setCurrentAssetByID (unsigned int p_assetID)
 
void renderStage ()
 
KageAsset::AssetType getAssetType ()
 
void setAssetType (KageAsset::AssetType p_assetType)
 
void render (unsigned int p_renderID)
 
void forceRender ()
 
void renameAsset (KageAsset *p_asset)
 
void renameAsset ()
 
void setLabel (std::string p_label)
 Sets the label of current active Asset.
 
std::string getLabel ()
 
bool moveToTop ()
 
bool moveUp ()
 
bool moveDown ()
 
bool moveToBottom ()
 
bool exists (std::string p_filePath)
 
void setAssetHash (std::string p_assetHash)
 
std::string getImagePathByID (unsigned int p_index)
 
std::string getImageByID (unsigned int p_id)
 
std::string getFilePathAt (unsigned int p_index)
 
std::string getFileNameAt (unsigned int p_index)
 
std::string getLabelAt (unsigned int p_index)
 
std::string getHashAt (unsigned int p_index)
 
std::string getIDAt (unsigned int p_index)
 
bool setFilePathAt (unsigned int p_index, std::string p_filePath)
 For use by Kage when Opening.
 
bool setFileNameAt (unsigned int p_index, std::string p_fileName)
 For use by Kage when Opening.
 
bool setHashAt (unsigned int p_index, std::string p_hash)
 
std::string saveAssetsTo (std::string p_path)
 
void renderLibrary (unsigned int p_ID)
 

Data Fields

std::string _KageStudioAsset
 
Kage_kage
 
unsigned int _selectedAssetID
 

Protected Attributes

unsigned int assetCtr
 
std::vector< Gtk::Button * > labels
 
std::vector< KageAsset * > assets
 
unsigned int _currentAssetID
 
unsigned int _currentAssetIndex
 

Constructor & Destructor Documentation

◆ KageAssetManager()

KageAssetManager::KageAssetManager ( Kage * p_kage)
Here is the call graph for this function:

◆ ~KageAssetManager()

KageAssetManager::~KageAssetManager ( )
virtual

Member Function Documentation

◆ addAsset()

unsigned int KageAssetManager::addAsset ( std::string p_name = "")

TODO:

  1. [DONE] check p_name exists – done in Kage with AssetManager
  2. [DONE]if project is saved, copy file to project path [DONE] else, copy file to temporary
  3. [DONE] create hash for path and filesize for future check by assetManager if already existing in Library use kHash from Quixie

TODO:

  1. [DONE] check if file p_name exists
  2. [DONE] if existing, copy to temp path
  3. [DONE] load copied file – use original path as hash
  4. [DONE] select image on stage
  5. draw rectangle on selected image on stage
  6. resize image on stage
  7. [DONE] delete image on stage
  8. [DONE] add image on stage FROM LIBRARY (double click)
  9. [DONE] add image on stage FROM ASSET (double click)
  10. add image on stage FROM LIBRARY (drag-n-drop)
  11. add image on stage FROM ASSET (drag-n-drop)
Here is the call graph for this function:

◆ addImageAsset()

unsigned int KageAssetManager::addImageAsset ( std::string p_name = "")

Used by Kage when opening KAGE files with PNG Assets Blindly accepts that p_name is actually a PNG file.

Parameters
p_nameImage file with full path
Returns
unsigned int
Here is the call graph for this function:

◆ assetCount()

unsigned int KageAssetManager::assetCount ( )

For use of Kage when exporting/saving to file.

Returns
size of array of KageAsset
Here is the caller graph for this function:

◆ deleteAsset()

void KageAssetManager::deleteAsset ( )
Here is the call graph for this function:

◆ exists()

bool KageAssetManager::exists ( std::string p_filePath)

Checks all Asset if already imported

Parameters
p_filePathAsset's full path1
Returns
true if p_filePath is in AssetManager. Otherwise, false.
Here is the call graph for this function:

◆ forceRender()

void KageAssetManager::forceRender ( )

◆ getAsset()

KageAsset * KageAssetManager::getAsset ( )

Not to be confused of getCurrentAsset(). This function returns the pointer to active KageAsset Object to caller

Returns
pointer to registered active asset
Here is the call graph for this function:

◆ getAssetType()

KageAsset::AssetType KageAssetManager::getAssetType ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentAsset()

unsigned int KageAssetManager::getCurrentAsset ( )

For use of Kage. To keep track of active Asset in-check of all assets in KageAssetManager.

Returns
index of registered active asset
See also
setCurrentAsset()
Here is the call graph for this function:

◆ getFileNameAt()

std::string KageAssetManager::getFileNameAt ( unsigned int p_index)

For use by saveAssetsTo when Exporting; returns path like image.png

Parameters
p_index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFilePathAt()

std::string KageAssetManager::getFilePathAt ( unsigned int p_index)

For use by saveAssetsTo when Exporting; returns path like /home/creek23/assets/

Parameters
p_index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHashAt()

std::string KageAssetManager::getHashAt ( unsigned int p_index)

For use by saveAssetsTo when Exporting; returns hash of '/home/creek23/assets/image.png'

Parameters
p_index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIDAt()

std::string KageAssetManager::getIDAt ( unsigned int p_index)

◆ getImageByID()

std::string KageAssetManager::getImageByID ( unsigned int p_id)

For use by Stage when rendering an Asset, it needs the image path (why not the loaded image object?)

Parameters
p_id
Here is the call graph for this function:

◆ getImagePathByID()

std::string KageAssetManager::getImagePathByID ( unsigned int p_index)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabel()

std::string KageAssetManager::getLabel ( )
Here is the call graph for this function:

◆ getLabelAt()

std::string KageAssetManager::getLabelAt ( unsigned int p_index)

For use by saveAssetsTo when Exporting; returns label as scene on AssetManager

Parameters
p_index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveDown()

bool KageAssetManager::moveDown ( )

NOTE: assets are organized as index 0 as BOTTOM and last index is TOP

See also
moveToBottom() moveToTop() moveUp()
Returns
True if successfully moved to bottom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveToBottom()

bool KageAssetManager::moveToBottom ( )

NOTE: assets are organized as index 0 as BOTTOM and last index is TOP

See also
moveDown() moveToTop() moveUp()
Returns
True if successfully moved to bottom
Here is the call graph for this function:

◆ moveToTop()

bool KageAssetManager::moveToTop ( )

NOTE: assets are organized as index 0 as BOTTOM and last index is TOP

See also
moveDown() moveToBottom() moveUp()
Returns
True if successfully moved to bottom
Here is the call graph for this function:

◆ moveUp()

bool KageAssetManager::moveUp ( )

NOTE: assets are organized as index 0 as BOTTOM and last index is TOP

See also
moveDown() moveToBottom() moveToTop()
Returns
True if successfully moved to bottom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllAssets()

bool KageAssetManager::removeAllAssets ( )
Here is the call graph for this function:

◆ renameAsset() [1/2]

void KageAssetManager::renameAsset ( )

For use of Kage when User clicked Asset->Rename

See also
renameAsset(KageAsset)
Here is the call graph for this function:

◆ renameAsset() [2/2]

void KageAssetManager::renameAsset ( KageAsset * p_asset)

For use of KageAsset when User double-clicked Asset

See also
renameAsset()
Here is the call graph for this function:

◆ render()

void KageAssetManager::render ( unsigned int p_renderID)
Here is the call graph for this function:

◆ renderLibrary()

void KageAssetManager::renderLibrary ( unsigned int p_ID)

◆ renderStage()

void KageAssetManager::renderStage ( )

For use of KageAsset. When a KageAsset's visibility is clicked, this function will be called to reflect Asset's visibility on stage.

Here is the call graph for this function:

◆ saveAssetsTo()

std::string KageAssetManager::saveAssetsTo ( std::string p_path)

For use by Kage when Exporting; returns XML string as part of .kage file

Parameters
p_path
Here is the call graph for this function:

◆ setAboveAssetSelected()

void KageAssetManager::setAboveAssetSelected ( KageAsset * p_asset)

For use by Asset when Arrow Up is pressed.

Parameters
p_assetsource asset where Key Press happened
Here is the call graph for this function:

◆ setAssetHash()

void KageAssetManager::setAssetHash ( std::string p_assetHash)

Set's an Asset's hash

Parameters
p_assetHash
Here is the call graph for this function:

◆ setAssetType()

void KageAssetManager::setAssetType ( KageAsset::AssetType p_assetType)

Set the AssetType of the selected Asset

Parameters
p_assetTypewhich AssetType to set
Here is the call graph for this function:

◆ setBelowAssetSelected()

void KageAssetManager::setBelowAssetSelected ( KageAsset * p_asset)

For use by Asset when Arrow Down is pressed.

Parameters
p_assetsource asset where Key Press happened
Here is the call graph for this function:

◆ setCurrentAsset()

void KageAssetManager::setCurrentAsset ( unsigned int p_asset)

For use of Kage. When a KageFrame is clicked, KageFramesetManager will call this function via Kage then sets currently active Asset via Index

Parameters
p_assetis index of Asset known to KageFrame
See also
getCurrentAsset()
Here is the call graph for this function:

◆ setCurrentAssetByID()

void KageAssetManager::setCurrentAssetByID ( unsigned int p_assetID)

For use of Kage. When a KageFrame is clicked, KageFramesetManager will call this function via Kage then sets currently active Asset via Asset ID

Parameters
p_assetIDis assetID of Asset known to KageFrame
See also
getCurrentAsset()
Here is the call graph for this function:

◆ setFileNameAt()

bool KageAssetManager::setFileNameAt ( unsigned int p_index,
std::string p_fileName )

For use by Kage when Opening.

Parameters
p_index
p_fileName
Returns
true if asset index exists
false
Here is the call graph for this function:

◆ setFilePathAt()

bool KageAssetManager::setFilePathAt ( unsigned int p_index,
std::string p_filePath )

For use by Kage when Opening.

Parameters
p_index
p_filepath
Returns
true if asset index exists
false
Here is the call graph for this function:

◆ setHashAt()

bool KageAssetManager::setHashAt ( unsigned int p_index,
std::string p_hash )
Here is the call graph for this function:

◆ setLabel()

void KageAssetManager::setLabel ( std::string p_label)

Sets the label of current active Asset.

Parameters
p_labelthe new label for the active Asset
Here is the call graph for this function:

◆ setSelected()

void KageAssetManager::setSelected ( KageAsset * p_asset)

For use of KageAsset. When a KageAsset is clicked, previously clicked KageAsset should be un-selected.

Parameters
p_assetis pointer to KageAsset who called this function
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _currentAssetID

unsigned int KageAssetManager::_currentAssetID
protected

◆ _currentAssetIndex

unsigned int KageAssetManager::_currentAssetIndex
protected

◆ _kage

Kage* KageAssetManager::_kage

◆ _KageStudioAsset

std::string KageAssetManager::_KageStudioAsset

◆ _selectedAssetID

unsigned int KageAssetManager::_selectedAssetID

◆ assetCtr

unsigned int KageAssetManager::assetCtr
protected

◆ assets

std::vector<KageAsset*> KageAssetManager::assets
protected

◆ labels

std::vector<Gtk::Button*> KageAssetManager::labels
protected

The documentation for this class was generated from the following files: