CustomGuiData Class Referenceabstract

#include <c4d_customguidata.h>

Inheritance diagram for CustomGuiData:

Detailed Description

A data class for creating custom GUIs for data types. These can be used in descriptions for the Attribute Manager.
Use RegisterCustomGuiPlugin() to register the custom GUI plugin.

Note
Even if a library is not created it is needed to call InstallLibrary() for a dummy library during registration:
Bool RegisterExampleDataTypeGui(void)
{
static BaseCustomGuiLib mylib;
ClearMem(&mylib, sizeof(mylib));
if (!InstallLibrary(MYCUSTOMGUI_ID, &mylib, 1000, sizeof(mylib)))
return false;
return RegisterCustomGuiPlugin("My Custom GUI", 0, NewObj(MyCustomGui));
}

Public Member Functions

virtual Int32 GetId ()=0
 
virtual CDialog * Alloc (const BaseContainer &settings)=0
 
virtual void Free (CDialog *dlg, void *userdata)=0
 
virtual const CharGetResourceSym ()=0
 
virtual CustomPropertyGetProperties ()
 
virtual Int32 GetResourceDataType (Int32 *&table)
 
CUSTOMGUIPLUGIN * GetPlugin ()
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData (void)
 
void Destructor (void)
 

Member Function Documentation

§ GetId()

virtual Int32 GetId ( )
pure virtual

Called to get the plugin ID of the custom GUI.

Returns
A unique plugin ID. Must be obtained from http://www.plugincafe.com

§ Alloc()

virtual CDialog* Alloc ( const BaseContainer settings)
pure virtual

Called to allocate a sub-dialog for the custom GUI.
Normally this method override should look like this:

virtual CDialog* Alloc(const BaseContainer& settings)
{
T* dlg = NewObj(T(settings, GetPlugin()));
if (!dlg)
return nullptr;
CDialog *cdlg = dlg->Get();
if (!cdlg)
return nullptr;
return cdlg;
}

In the above code T stands for a type derived from iCustomGui.

Parameters
[in]settingsThe settings for the GUI. (Using the IDs defined by GetProperties().)
Returns
The allocated sub-dialog.

§ Free()

virtual void Free ( CDialog *  dlg,
void *  userdata 
)
pure virtual

Called to free sub-dialogs allocated by Alloc().
Normally this method override should look like this:

virtual void Free(CDialog *dlg, void *userdata)
{
if (!dlg || !userdata)
return;
T* sub = static_cast<T*>(userdata);
DeleteObj(sub);
}

In the above code T stands for a type derived from iCustomGui.

Parameters
[in,out]dlgThe sub-dialog to free.
[in]userdataThe user data.

§ GetResourceSym()

virtual const Char* GetResourceSym ( )
pure virtual

Called to get the symbol to use in resource files, for example "GRADIENT".

Note
Only 7-bit ASCII characters are allowed, hence the Char type.
Returns
A pointer to a global const Char* string with the resource symbol.

§ GetProperties()

virtual CustomProperty* GetProperties ( )
virtual

Called to get the properties that the custom GUI accepts in resource files.

See also
CustomProperty.
Returns
A pointer to a global array of CustomProperty elements, ended with a CUSTOMTYPE_END property:
CustomProperty bitmapbuttonprops[] =
{
{ CUSTOMTYPE_END, 0, nullptr }
};

§ GetResourceDataType()

virtual Int32 GetResourceDataType ( Int32 *&  table)
virtual

Called to return the IDs of compatible data types for the custom GUI.

See also
CustomDataTypeClass::GetConversionsFrom.
Parameters
[out]tableSet this to point to a global array with the IDs of compatible data types for the custom GUI.
Returns
The length of the array pointed by table, or 0 if table has not been set.

§ GetPlugin()

CUSTOMGUIPLUGIN* GetPlugin ( )

Gets the plugin structure for the custom GUI.

Returns
The custom GUI plugin structure. Cinema 4D owns the pointed plugin structure.