CommandData Class Reference

#include <c4d_commanddata.h>

Inheritance diagram for CommandData:

Detailed Description

A data class for creating command plugins. (Previously known as menu plugins.)
Use RegisterCommandPlugin() to register a command plugin.

Public Member Functions

virtual Bool Execute (BaseDocument *doc)
 
virtual Bool ExecuteSubID (BaseDocument *doc, Int32 subid)
 
virtual Bool ExecuteOptionID (BaseDocument *doc, Int32 plugid, Int32 subid)
 
virtual Int32 GetState (BaseDocument *doc)
 
virtual Bool GetSubContainer (BaseDocument *doc, BaseContainer &submenu)
 
virtual Bool RestoreLayout (void *secret)
 
virtual String GetScriptName (void)
 
virtual Bool Message (Int32 type, void *data)
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData (void)
 
void Destructor (void)
 

Member Function Documentation

§ Execute()

virtual Bool Execute ( BaseDocument doc)
virtual

Executes the command.

Parameters
[in]docThe active document. Cinema 4D owns the pointed document.
Returns
true if the command was executed successfully, otherwise false.

§ ExecuteSubID()

virtual Bool ExecuteSubID ( BaseDocument doc,
Int32  subid 
)
virtual

Executes the command with the sub-command ID that was given by GetSubContainer().

Parameters
[in]docThe active document. Cinema 4D owns the pointed document.
[in]subidThe sub-command ID.
Returns
true if the command was executed successfully, otherwise false.

§ ExecuteOptionID()

virtual Bool ExecuteOptionID ( BaseDocument doc,
Int32  plugid,
Int32  subid 
)
virtual

Executes the command when the user calls it through its options dialog.

Parameters
[in]docThe active document. Cinema 4D owns the pointed document.
[in]plugidThe command plugin ID.
[in]subidThe sub-command ID. Only available for plugins that have sub-IDs (which normally are called using ExecuteSubID).
Returns
true if the command was executed successfully, otherwise false.

§ GetState()

virtual Int32 GetState ( BaseDocument doc)
virtual

Called to get the state of the command.

Note
Affects how it is displayed in menus and toolbars.
Parameters
[in]docThe active document. Cinema 4D owns the pointed document.
Returns
A combination of the 2 command flags: CMD_ENABLED CMD_VALUE.

§ GetSubContainer()

virtual Bool GetSubContainer ( BaseDocument doc,
BaseContainer submenu 
)
virtual

Called to get the command sub-menu.
Container submenu is passed to create dynamic sub-container entries.

Note
The menu entries on the top level will all be placed at the point where the command plugin was placed.
To create a sub-menu, place the entries as sub-containers in the returned container with ID 0. In the sub-container, place a string with ID 1 to name it:
bc.SetString(1, "Submenu Test");
bc.SetString(1000, "First Entry");
submenu.InsData(0, bc);
Use &d& and &c& to disable and check items.
Parameters
[in]docThe active document. Cinema 4D owns the pointed document.
[in]submenuFill with the sub-menu structure.
Returns
true if the sub-menu container was filled, otherwise false.

§ RestoreLayout()

virtual Bool RestoreLayout ( void *  secret)
virtual

Called when loading a layout and restoring async dialogs.

Warning
If implemented then it must create the dialog and call dialog->RestoreLayout.
If the command has more than one dialog, RestoreLayoutSecret::subid gives the ID of the sub-dialog to restore.
Note
If not implemented Cinema 4D will create an empty "???" dialog.
Parameters
[in]secretPoints to a RestoreLayoutSecret structure.
Returns
true if the dialog was restored, otherwise false.

§ GetScriptName()

virtual String GetScriptName ( void  )
virtual

Called to get the script name of the command.

Note
If implemented the command is stored by name rather than by ID in layouts, shortcuts and menus.
Returns
The script name for the command.

§ Message()

virtual Bool Message ( Int32  type,
void *  data 
)
virtual

Called to respond to command messages.

Parameters
[in]typeThe message type: MSG_COMMAND
[in]dataThe message data. Depends on the command message type.
Returns
true if the message was processed, otherwise false.