Main Index : Reference :

PluginTag


Description

A plugin tag class.

Definition

class PluginTag : BaseTag
{
public:
  PluginTag();

  [int] GetID() = 0;

  [bool] MultipleAllowed();
  [bool] DisplayAllowed();
  
  [BaseBitmap] GetIcon();
  [string] GetHelpText();
  
  [bool] UseMenu();
  [string] GetName();

  [bool] Edit();

  [bool] Copy([PluginTag] dest);
  [bool] Save([HyperFile] hf);
  [bool] Load([HyperFile] hf);

  [bool] Message([int] type, [VariableChanged,BaseContainer] data);
}

Explanation

A class to derive plugin tags from.

Members

GetID()

[int] GetID() = 0;

Should return the id of the plugin. Must be overloaded in derived classes.


MultipleAllowed()

[bool] MultipleAllowed();

Should return TRUE if multiple tags of this type are allowed on one object, otherwise FALSE. Not overloading this function is the same as returning TRUE.

DisplayAllowed()

[bool] DisplayAllowed();

Should return TRUE if the tag is to show an icon in the editor, otherwise FALSE. Not overloading this function is the same as returning TRUE.


GetIcon()

[BaseBitmap] GetIcon();

Should return a bitmap of size PLUGINTAG_ICON_SIZE * PLUGINTAG_ICON_SIZE for showing in the editor. If this function isn't overloaded, a grey icon is showed in the editor. Only necessary if DisplayAllowed() didn't return FALSE.

GetHelpText()

[string] GetHelpText();

Should return a short context sensitive help string for displaying in the global status bar. Feel free to use data from the tag to make the message more helpful, like how the built-in selection tags show their names. Only necessary if DisplayAllowed() didn't return FALSE.


UseMenu()

[bool] UseMenu();

Overload this function and return TRUE if you want your plugin to be added to the New Tag menu in the Object Manager.

GetName()

[string] GetName();

Should return the name of the tag. Only necessary to overload if UseMenu() returns TRUE.


Edit()

[bool] Edit();

Called when the user wants to edit the tag. Normally one should then display a dialog with old settings, allowing the user to change them. The tag data should be stored in the tag's container or in custom variables. Return TRUE if anything was edited. If this function isn't overloaded, trying to edit the tag does nothing. Only necessary if DisplayAllowed() didn't return FALSE.


Copy( dest )

[bool] Copy([PluginTag] dest);

This function must be overloaded if one wants to use custom variables in the derived tag (i.e. not only the container). The function should copy any custom variables from this to dest and return TRUE. Otherwise the custom variables are lost when C4D wants to copy the tag.

Save( hf )

[bool] Save([HyperFile] hf);

This function must be overloaded if one wants one's custom variables to be saved to disk. Use the HyperFile object that C4D sends to the function, hf, to save all of your variables and return TRUE.

Tips: It might be a good idea to use the first field in the HyperFile to save a version number for the plugin. Otherwise future versions of the plugin, with possibly different variables, won't know how to load the old tag's data.

Load( hf )

[bool] Load([HyperFile] hf);

This function must be overloaded to load saved variables from disk. Load them from the HyperFile object in the same order as they were stored by Save() and return TRUE.


Message( type, data )

[bool] Message([int] type, [VariableChanged,BaseContainer] data);

Overload this function to be able to receive messages, like MSG_POINTS_CHANGED.