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
 
Status 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
 
Status 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 44 of file object.cpp.

◆ ~Object()

Object::~Object ( )

Definition at line 49 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 425 of file object.cpp.

◆ addLayer()

bool Object::addLayer ( Layer *  layer)

Definition at line 376 of file object.cpp.

◆ addNewBitmapLayer()

LayerBitmap * Object::addNewBitmapLayer ( )

Definition at line 121 of file object.cpp.

◆ addNewCameraLayer()

LayerCamera * Object::addNewCameraLayer ( )

Definition at line 151 of file object.cpp.

◆ addNewSoundLayer()

LayerSound * Object::addNewSoundLayer ( )

Definition at line 141 of file object.cpp.

◆ addNewVectorLayer()

LayerVector * Object::addNewVectorLayer ( )

Definition at line 131 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 342 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 317 of file object.cpp.

◆ copyFileToDataFolder()

QString Object::copyFileToDataFolder ( const QString &  strFilePath)

Definition at line 763 of file object.cpp.

◆ createWorkingDir()

void Object::createWorkingDir ( )

Definition at line 161 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 357 of file object.cpp.

◆ deleteLayer() [2/2]

void Object::deleteLayer ( Layer *  layer)

Definition at line 365 of file object.cpp.

◆ deleteWorkingDir()

void Object::deleteWorkingDir ( ) const

Definition at line 194 of file object.cpp.

◆ exportFrames()

Status 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 792 of file object.cpp.

◆ exportIm()

Status 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 904 of file object.cpp.

◆ exportPalette()

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

Definition at line 515 of file object.cpp.

◆ exportPaletteGPL()

void Object::exportPaletteGPL ( QFile &  file) const

Definition at line 477 of file object.cpp.

◆ exportPalettePencil()

void Object::exportPalettePencil ( QFile &  file) const

Definition at line 494 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 254 of file object.cpp.

◆ findLayerByName()

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

Definition at line 266 of file object.cpp.

◆ getColor()

ColorRef Object::getColor ( int  index) const

Definition at line 387 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 229 of file object.cpp.

◆ getLayerBelow()

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

Definition at line 239 of file object.cpp.

◆ getLayerCount()

int Object::getLayerCount ( ) const

Definition at line 935 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 211 of file object.cpp.

◆ getUniqueLayerID()

int Object::getUniqueLayerID ( )

Definition at line 224 of file object.cpp.

◆ importPalette()

bool Object::importPalette ( const QString &  filePath)

Definition at line 660 of file object.cpp.

◆ importPaletteGPL()

void Object::importPaletteGPL ( QFile &  file)

Definition at line 540 of file object.cpp.

◆ importPalettePencil()

void Object::importPalettePencil ( QFile &  file)

Definition at line 623 of file object.cpp.

◆ init()

void Object::init ( )

Definition at line 60 of file object.cpp.

◆ isColorInUse()

bool Object::isColorInUse ( int  index) const

Definition at line 430 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 679 of file object.cpp.

◆ loadXML()

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

Definition at line 80 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 409 of file object.cpp.

◆ moveVectorColor()

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

Definition at line 414 of file object.cpp.

◆ openPalette()

void Object::openPalette ( const QString &  filePath)

Definition at line 646 of file object.cpp.

◆ paintImage()

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

Definition at line 708 of file object.cpp.

◆ removeColor()

void Object::removeColor ( int  index)

Definition at line 447 of file object.cpp.

◆ renameColor()

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

Definition at line 463 of file object.cpp.

◆ savePalette()

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

Definition at line 468 of file object.cpp.

◆ saveXML()

QDomElement Object::saveXML ( QDomDocument &  doc) const

Definition at line 68 of file object.cpp.

◆ setActiveFramePoolSize()

void Object::setActiveFramePoolSize ( int  sizeInMB)

Definition at line 976 of file object.cpp.

◆ setColor()

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

Definition at line 397 of file object.cpp.

◆ setColorRef()

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

Definition at line 404 of file object.cpp.

◆ setData()

void Object::setData ( const ObjectData &  d)

Definition at line 940 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 204 of file object.cpp.

◆ swapLayers()

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

Definition at line 301 of file object.cpp.

◆ takeLayer()

Layer * Object::takeLayer ( int  layerId)

Definition at line 280 of file object.cpp.

◆ totalKeyFrameCount()

int Object::totalKeyFrameCount ( ) const

Definition at line 945 of file object.cpp.

◆ updateActiveFrames()

void Object::updateActiveFrames ( int  frame) const

Definition at line 955 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 Fri Dec 19 2025 07:54:22 for Pencil2D by doxygen 1.9.6 based on revision 7fd8cd9e03f2d31750e199ecec202e5c0f30e532