Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Object Class Referencefinal
+ Collaboration diagram for Object:
Collaboration graph
[legend]

Public Member Functions

 Object (Object const &)=delete
 
 Object (Object &&)=delete
 
Object & operator= (Object const &)=delete
 
Object & operator= (Object &&)=delete
 
void init ()
 
void createWorkingDir ()
 
void deleteWorkingDir () const
 
void setWorkingDir (const QString &path)
 
QString filePath () const
 
void setFilePath (const QString &strFileName)
 
QString workingDir () const
 
QString dataDir () const
 
void setDataDir (const QString &dirPath)
 
QString mainXMLFile () const
 
void setMainXMLFile (const QString &file)
 
QDomElement saveXML (QDomDocument &doc) const
 
bool loadXML (const QDomElement &element, ProgressCallback progressForward)
 
void paintImage (QPainter &painter, int frameNumber, bool background, bool antialiasing) const
 
QString copyFileToDataFolder (const QString &strFilePath)
 
ColorRef getColor (int index) const
 
void setColor (int index, const QColor &newColor)
 
void setColorRef (int index, const ColorRef &newColorRef)
 
void movePaletteColor (int start, int end)
 
void moveVectorColor (int start, int end)
 
void addColor (const ColorRef &newColor)
 
void addColorAtIndex (int index, const ColorRef &newColor)
 
void removeColor (int index)
 
bool isColorInUse (int index) const
 
void renameColor (int i, const QString &text)
 
int getColorCount ()
 
bool importPalette (const QString &filePath)
 
void importPaletteGPL (QFile &file)
 
void importPalettePencil (QFile &file)
 
void openPalette (const QString &filePath)
 
bool exportPalette (const QString &filePath) const
 
void exportPaletteGPL (QFile &file) const
 
void exportPalettePencil (QFile &file) const
 
QString savePalette (const QString &filePath) const
 
void loadDefaultPalette ()
 
LayerBitmap * addNewBitmapLayer ()
 
LayerVector * addNewVectorLayer ()
 
LayerSound * addNewSoundLayer ()
 
LayerCamera * addNewCameraLayer ()
 
int getLayerCount () const
 
Layer * getLayer (int i) const
 
Layer * getLayerBelow (int i, Layer::LAYER_TYPE type) const
 
Layer * findLayerByName (const QString &strName, Layer::LAYER_TYPE type=Layer::UNDEFINED) const
 
Layer * findLayerById (int layerId) const
 
Layer * takeLayer (int layerId)
 
bool swapLayers (int i, int j)
 
bool canSwapLayers (int layerIndexLeft, int layerIndexRight) const
 Allows you to check whether two layers can be swappped, before doing the actual operation.
 
bool canDeleteLayer (int index) const
 Allows you to check whether the layer at the given index can be deleted.
 
void deleteLayer (int i)
 
void deleteLayer (Layer *)
 
bool addLayer (Layer *layer)
 
template<typename T >
std::vector< T * > getLayersByType () const
 
bool exportFrames (int frameStart, int frameEnd, const LayerCamera *cameraLayer, QSize exportSize, QString filePath, QString format, bool transparency, bool exportKeyframesOnly, const QString &layerName, bool antialiasing, QProgressDialog *progress, int progressMax) const
 
bool exportIm (int frameStart, const QTransform &view, QSize cameraSize, QSize exportSize, const QString &filePath, const QString &format, bool antialiasing, bool transparency) const
 
void modification ()
 
bool isModified () const
 
void setModified (bool b)
 
int getUniqueLayerID ()
 
ObjectData * data ()
 
const ObjectData * data () const
 
void setData (const ObjectData &)
 
int totalKeyFrameCount () const
 
void updateActiveFrames (int frame) const
 
void setActiveFramePoolSize (int sizeInMB)
 

Private Member Functions

int getMaxLayerID ()
 

Private Attributes

QString mFilePath
 
QString mWorkingDirPath
 
QString mDataDirPath
 
QString mMainXMLFile
 
QList< Layer * > mLayers
 
bool modified = false
 
QList< ColorRef > mPalette
 
ObjectData mData
 
std::unique_ptr< ActiveFramePool > mActiveFramePool
 

Detailed Description

Definition at line 41 of file object.h.

Constructor & Destructor Documentation

◆ Object()

Object::Object ( )
explicit

Definition at line 43 of file object.cpp.

◆ ~Object()

Object::~Object ( )

Definition at line 48 of file object.cpp.

Member Function Documentation

◆ addColor()

void Object::addColor ( const ColorRef &  newColor)
inline

Definition at line 83 of file object.h.

◆ addColorAtIndex()

void Object::addColorAtIndex ( int  index,
const ColorRef &  newColor 
)

Definition at line 424 of file object.cpp.

◆ addLayer()

bool Object::addLayer ( Layer *  layer)

Definition at line 375 of file object.cpp.

◆ addNewBitmapLayer()

LayerBitmap * Object::addNewBitmapLayer ( )

Definition at line 120 of file object.cpp.

◆ addNewCameraLayer()

LayerCamera * Object::addNewCameraLayer ( )

Definition at line 150 of file object.cpp.

◆ addNewSoundLayer()

LayerSound * Object::addNewSoundLayer ( )

Definition at line 140 of file object.cpp.

◆ addNewVectorLayer()

LayerVector * Object::addNewVectorLayer ( )

Definition at line 130 of file object.cpp.

◆ canDeleteLayer()

bool Object::canDeleteLayer ( int  index) const

Allows you to check whether the layer at the given index can be deleted.

Parameters
[in]indexThe layer index to check
Returns
true if the layer can be deleted, otherwise false

Definition at line 341 of file object.cpp.

◆ canSwapLayers()

bool Object::canSwapLayers ( int  layerIndexLeft,
int  layerIndexRight 
) const

Allows you to check whether two layers can be swappped, before doing the actual operation.

Parameters
[in]layerIndexLeftThe first layer to compare
[in]layerIndexRightThe second layer to compare
Returns
true if layers can be swapped, otherwise false

Definition at line 316 of file object.cpp.

◆ copyFileToDataFolder()

QString Object::copyFileToDataFolder ( const QString &  strFilePath)

Definition at line 762 of file object.cpp.

◆ createWorkingDir()

void Object::createWorkingDir ( )

Definition at line 160 of file object.cpp.

◆ data() [1/2]

ObjectData * Object::data ( )
inline

Definition at line 161 of file object.h.

◆ data() [2/2]

const ObjectData * Object::data ( ) const
inline

Definition at line 162 of file object.h.

◆ dataDir()

QString Object::dataDir ( ) const
inline

Definition at line 63 of file object.h.

◆ deleteLayer() [1/2]

void Object::deleteLayer ( int  i)

Definition at line 356 of file object.cpp.

◆ deleteLayer() [2/2]

void Object::deleteLayer ( Layer *  layer)

Definition at line 364 of file object.cpp.

◆ deleteWorkingDir()

void Object::deleteWorkingDir ( ) const

Definition at line 193 of file object.cpp.

◆ exportFrames()

bool Object::exportFrames ( int  frameStart,
int  frameEnd,
const LayerCamera *  cameraLayer,
QSize  exportSize,
QString  filePath,
QString  format,
bool  transparency,
bool  exportKeyframesOnly,
const QString &  layerName,
bool  antialiasing,
QProgressDialog *  progress = nullptr,
int  progressMax = 50 
) const

Definition at line 791 of file object.cpp.

◆ exportIm()

bool Object::exportIm ( int  frameStart,
const QTransform &  view,
QSize  cameraSize,
QSize  exportSize,
const QString &  filePath,
const QString &  format,
bool  antialiasing,
bool  transparency 
) const

Definition at line 884 of file object.cpp.

◆ exportPalette()

bool Object::exportPalette ( const QString &  filePath) const

Definition at line 514 of file object.cpp.

◆ exportPaletteGPL()

void Object::exportPaletteGPL ( QFile &  file) const

Definition at line 476 of file object.cpp.

◆ exportPalettePencil()

void Object::exportPalettePencil ( QFile &  file) const

Definition at line 493 of file object.cpp.

◆ filePath()

QString Object::filePath ( ) const
inline

Definition at line 58 of file object.h.

◆ findLayerById()

Layer * Object::findLayerById ( int  layerId) const

Definition at line 253 of file object.cpp.

◆ findLayerByName()

Layer * Object::findLayerByName ( const QString &  strName,
Layer::LAYER_TYPE  type = Layer::UNDEFINED 
) const

Definition at line 265 of file object.cpp.

◆ getColor()

ColorRef Object::getColor ( int  index) const

Definition at line 386 of file object.cpp.

◆ getColorCount()

int Object::getColorCount ( )
inline

Definition at line 88 of file object.h.

◆ getLayer()

Layer * Object::getLayer ( int  i) const

Definition at line 228 of file object.cpp.

◆ getLayerBelow()

Layer * Object::getLayerBelow ( int  i,
Layer::LAYER_TYPE  type 
) const

Definition at line 238 of file object.cpp.

◆ getLayerCount()

int Object::getLayerCount ( ) const

Definition at line 905 of file object.cpp.

◆ getLayersByType()

template<typename T >
std::vector< T * > Object::getLayersByType ( ) const
inline

Definition at line 137 of file object.h.

◆ getMaxLayerID()

int Object::getMaxLayerID ( )
private

Definition at line 210 of file object.cpp.

◆ getUniqueLayerID()

int Object::getUniqueLayerID ( )

Definition at line 223 of file object.cpp.

◆ importPalette()

bool Object::importPalette ( const QString &  filePath)

Definition at line 659 of file object.cpp.

◆ importPaletteGPL()

void Object::importPaletteGPL ( QFile &  file)

Definition at line 539 of file object.cpp.

◆ importPalettePencil()

void Object::importPalettePencil ( QFile &  file)

Definition at line 622 of file object.cpp.

◆ init()

void Object::init ( )

Definition at line 59 of file object.cpp.

◆ isColorInUse()

bool Object::isColorInUse ( int  index) const

Definition at line 429 of file object.cpp.

◆ isModified()

bool Object::isModified ( ) const
inline

Definition at line 156 of file object.h.

◆ loadDefaultPalette()

void Object::loadDefaultPalette ( )

Definition at line 678 of file object.cpp.

◆ loadXML()

bool Object::loadXML ( const QDomElement &  element,
ProgressCallback  progressForward 
)

Definition at line 79 of file object.cpp.

◆ mainXMLFile()

QString Object::mainXMLFile ( ) const
inline

Definition at line 66 of file object.h.

◆ modification()

void Object::modification ( )
inline

Definition at line 155 of file object.h.

◆ movePaletteColor()

void Object::movePaletteColor ( int  start,
int  end 
)

Definition at line 408 of file object.cpp.

◆ moveVectorColor()

void Object::moveVectorColor ( int  start,
int  end 
)

Definition at line 413 of file object.cpp.

◆ openPalette()

void Object::openPalette ( const QString &  filePath)

Definition at line 645 of file object.cpp.

◆ paintImage()

void Object::paintImage ( QPainter &  painter,
int  frameNumber,
bool  background,
bool  antialiasing 
) const

Definition at line 707 of file object.cpp.

◆ removeColor()

void Object::removeColor ( int  index)

Definition at line 446 of file object.cpp.

◆ renameColor()

void Object::renameColor ( int  i,
const QString &  text 
)

Definition at line 462 of file object.cpp.

◆ savePalette()

QString Object::savePalette ( const QString &  filePath) const

Definition at line 467 of file object.cpp.

◆ saveXML()

QDomElement Object::saveXML ( QDomDocument &  doc) const

Definition at line 67 of file object.cpp.

◆ setActiveFramePoolSize()

void Object::setActiveFramePoolSize ( int  sizeInMB)

Definition at line 946 of file object.cpp.

◆ setColor()

void Object::setColor ( int  index,
const QColor &  newColor 
)

Definition at line 396 of file object.cpp.

◆ setColorRef()

void Object::setColorRef ( int  index,
const ColorRef &  newColorRef 
)

Definition at line 403 of file object.cpp.

◆ setData()

void Object::setData ( const ObjectData &  d)

Definition at line 910 of file object.cpp.

◆ setDataDir()

void Object::setDataDir ( const QString &  dirPath)
inline

Definition at line 64 of file object.h.

◆ setFilePath()

void Object::setFilePath ( const QString &  strFileName)
inline

Definition at line 59 of file object.h.

◆ setMainXMLFile()

void Object::setMainXMLFile ( const QString &  file)
inline

Definition at line 67 of file object.h.

◆ setModified()

void Object::setModified ( bool  b)
inline

Definition at line 157 of file object.h.

◆ setWorkingDir()

void Object::setWorkingDir ( const QString &  path)

Definition at line 203 of file object.cpp.

◆ swapLayers()

bool Object::swapLayers ( int  i,
int  j 
)

Definition at line 300 of file object.cpp.

◆ takeLayer()

Layer * Object::takeLayer ( int  layerId)

Definition at line 279 of file object.cpp.

◆ totalKeyFrameCount()

int Object::totalKeyFrameCount ( ) const

Definition at line 915 of file object.cpp.

◆ updateActiveFrames()

void Object::updateActiveFrames ( int  frame) const

Definition at line 925 of file object.cpp.

◆ workingDir()

QString Object::workingDir ( ) const
inline

Definition at line 61 of file object.h.

Member Data Documentation

◆ mActiveFramePool

std::unique_ptr<ActiveFramePool> Object::mActiveFramePool
mutableprivate

Definition at line 183 of file object.h.

◆ mData

ObjectData Object::mData
private

Definition at line 182 of file object.h.

◆ mDataDirPath

QString Object::mDataDirPath
private

Definition at line 174 of file object.h.

◆ mFilePath

QString Object::mFilePath
private

Definition at line 172 of file object.h.

◆ mLayers

QList<Layer*> Object::mLayers
private

Definition at line 177 of file object.h.

◆ mMainXMLFile

QString Object::mMainXMLFile
private

Definition at line 175 of file object.h.

◆ modified

bool Object::modified = false
private

Definition at line 178 of file object.h.

◆ mPalette

QList<ColorRef> Object::mPalette
private

Definition at line 180 of file object.h.

◆ mWorkingDirPath

QString Object::mWorkingDirPath
private

Definition at line 173 of file object.h.


The documentation for this class was generated from the following files:
  • core_lib/src/structure/object.h
  • core_lib/src/structure/object.cpp
Generated on Thu May 8 2025 04:47:54 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39