THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/05/2008 at 15:03, xxxxxxxx wrote:
He's using COFFEE, not C++ (I've done this myself about a million times). :)
Examine this code to see how it should be done:
// Included symbols
include "c4d_symbols.h"
// Global references
var resource;
var plugin_path;
var plugin_icon;
var d;
// CLASS: Drop Object Menu - Register plugin in menu
class DropObject_MenuPlugin : MenuPlugin
{
public:
DropObject_MenuPlugin();
GetID();
GetIcon();
GetName();
GetHelp();
Execute(doc);
RestoreLayout(secret);
}
DropObject_MenuPlugin::DropObject_MenuPlugin() { super(); }
DropObject_MenuPlugin::GetID() { return PLUGIN_MENU_ID; }
DropObject_MenuPlugin::GetIcon() { return plugin_icon; }
DropObject_MenuPlugin::GetName() { return resource->GetString(PLUGIN_MENU_TEXT); }
DropObject_MenuPlugin::GetHelp() { return resource->GetString(PLUGIN_MENU_HELP_TEXT); }
DropObject_MenuPlugin::Execute(doc)
{
// Perform operation
d->Open(TRUE,-1,-1);
}
DropObject_MenuPlugin::RestoreLayout(secret)
{
// Called by C4D to restore the dialog
if (!d) d = new(FloorDialog);
d->RestoreLayout(secret);
}
// Start of plugin
main()
{
// Load Resource
if (!(plugin_path = GeGetRootFilename())) println("Unable to find plugin!");
plugin_path->RemoveLast();
if (!(resource = new(GeResource, plugin_path))) println("Unable to load resource!");
// Load Icons
var icon_file = plugin_path->GetClone();
icon_file->AddLast("pluginicon.tif");
plugin_icon = new(BaseBitmap,1,1);
plugin_icon->Load(icon_file);
// Register Plugins
Register(DropObject_MenuPlugin);
// Create non-modal dialog
d = new(FloorDialog);
}