UserData

Functions

CID

GetClassID

void *

As

const void *

As

class T_As

As

class T_As

As

UserData

~UserData

void

UnlinkFrom

Detailed Description

class UserData : public RED::Object

Generic class for custom user data.

@related Saving and Reloading a Custom Container , class RED::UserDataRaw

The RED::UserData is a data container that can be freely associated to any scene graph object. Shapes, materials fonts and images expose the RED::IUserData interface, so that user data can be stored on them, according to the application needs.

As long as a class inheriting RED::UserData implements valid chunk writing and reading methods, instances of this class will be automatically loaded from and saved to .red files.

Subclassed by RED::UserDataRaw

Public Functions

virtual void *As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

virtual const void *As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
UserData()

Default constructor.

virtual ~UserData()

Default destructor.

virtual void UnlinkFrom(RED::Object *iObject) = 0

Method called when the user data are unlinked from a RED::Object instance.

A RED::UserData object can be linked exclusively to a RED::IUserData instance by making the latter the owner of the former (see RED::IUserData::SetUserData). In such a case, destroying the RED::IUserData instance will destroy the linked RED::UserData too. If not the owner, destroying the RED::IUserData will automatically call the UnlinkFrom method to inform the RED::UserData object of the lost of connectivity with the RED::IUserData instance.

Note that a call to UnlinkFrom can also occur when the RED::IUserData instance gets linked with another RED::UserData object, replacing the current connection.

Parameters

iObject – Pointer to the object from which the user data are being unlinked.

Public Static Functions

static inline RED::CID GetClassID()