GluonEngine::Asset Class Reference

The base class on which all Asset handlers are constructed. More...

#include <asset.h>

Inheritance diagram for GluonEngine::Asset:
GluonCore::GluonObject QObject GluonEngine::MaterialAsset GluonEngine::Scene GluonEngine::ScriptAsset GluonEngine::ScriptingAsset GluonEngine::SoundAsset GluonEngine::TextureAsset

List of all members.

Public Slots

virtual void load ()

Signals

void dataChanged ()

Public Member Functions

Q_INVOKABLE Asset (QObject *parent=0)
 ~Asset ()
virtual void setName (const QString &newName)
virtual void setFile (const QUrl &newFile)
virtual QUrl file () const
virtual QString absolutePath () const
virtual QIcon icon () const
virtual const QList
< AssetTemplate * > 
templates ()
virtual QList< QAction * > actions ()
virtual const QMimeData * data () const
virtual QString childrenToGDL (int indentLevel=0) const
virtual bool isLoaded () const

Protected Member Functions

QMimeData * mimeData () const
void setLoaded (bool loaded)

Properties

QUrl file

Detailed Description

The base class on which all Asset handlers are constructed.

The Asset class is a fat interface used to allow file access to GluonEngine based games without allowing direct access to the file system.

Definition at line 82 of file asset.h.


Constructor & Destructor Documentation

Asset::Asset ( QObject parent = 0  ) 

Definition at line 47 of file asset.cpp.

Asset::~Asset (  ) 

Definition at line 54 of file asset.cpp.


Member Function Documentation

QString Asset::absolutePath (  )  const [virtual]

Return the absolute path of this asset's file.

Note that this should never be called from a script.

Returns:
The absolute path of this asset's file.

Definition at line 96 of file asset.cpp.

QList< QAction * > Asset::actions (  )  [virtual]

Retrieve a list of actions relating to the current asset.

Returns:
A QList of QActions that can be shown in pop-up menus and other places.

Reimplemented in GluonEngine::MaterialAsset.

Definition at line 126 of file asset.cpp.

QString Asset::childrenToGDL ( int  indentLevel = 0  )  const [virtual]

The specialization of toGDL on the Asset class does not recurse. This allows Assets to handle their own children in a flexible manner, without polluting the GDL with that information.

Reimplemented from GluonCore::GluonObject.

Reimplemented in GluonEngine::MaterialAsset.

Definition at line 147 of file asset.cpp.

const QMimeData * Asset::data (  )  const [virtual]

This function should return a QMimeType containing the data the asset represents. This is done to avoid having varying methods of accessing the data represented by various assets. If more than one data accessor function is needed, more can of course be constructed, but data() should always return the primary data for the asset.

Definition at line 113 of file asset.cpp.

void GluonEngine::Asset::dataChanged (  )  [signal]

This signal is fired when ever the data represented by the Asset instance changes, and should be an indication that the data should be updated.

See also:
data()
virtual QUrl GluonEngine::Asset::file (  )  const [virtual]
QIcon Asset::icon (  )  const [virtual]

An icon to represent the asset. Think of it as a thumbnail representation of the contents of the asset. The default implementation returns a null icon

Reimplemented in GluonEngine::MaterialAsset, and GluonEngine::TextureAsset.

Definition at line 107 of file asset.cpp.

bool Asset::isLoaded (  )  const [virtual]

Convenience function to test whether the file has been loaded or not.

Definition at line 135 of file asset.cpp.

void Asset::load (  )  [virtual, slot]
QMimeData * Asset::mimeData (  )  const [protected]

Definition at line 156 of file asset.cpp.

void Asset::setFile ( const QUrl &  newFile  )  [virtual]

Reimplemented in GluonEngine::ScriptingAsset, and GluonEngine::Scene.

Definition at line 83 of file asset.cpp.

void Asset::setLoaded ( bool  loaded  )  [protected]

Definition at line 162 of file asset.cpp.

void Asset::setName ( const QString &  newName  )  [virtual]

An extension on the GluonCore::GluonObject::setName function which changes the file name of the Asset when setting a new name for the Asset.

Note:
As always, be aware that the requested name is not always the name which is set, as two objects with the same parent cannot have the same name.
Parameters:
newName The requested new name for the asset
See also:
file, GluonCore::GluonObject::name

Reimplemented from GluonCore::GluonObject.

Reimplemented in GluonEngine::MaterialAsset, GluonEngine::TextureAsset, and GluonEngine::Scene.

Definition at line 61 of file asset.cpp.

const QList< AssetTemplate * > Asset::templates (  )  [virtual]

The templates provided by the asset. The default implementation returns no templates, as many assets will not be able to provide templates.

Reimplemented in GluonEngine::MaterialAsset, GluonEngine::ScriptAsset, and GluonEngine::ScriptingAsset.

Definition at line 119 of file asset.cpp.


Property Documentation

QUrl Asset::file [read, write]

The file name of the represented file, relative to the GameProject's position on the file system. Importantly, this cannot contain parent definitions (meaning no .. in the path string), and as this essentially sandboxes GluonEngine based games.

Definition at line 92 of file asset.h.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:43 2010 for Gluon by  doxygen 1.6.3