// SelectionSetManager: plugin.cpp : Defines the initialization routines for the plugin DLL. // #include "stdafx.h" #define PLUGIN_COUNT 2 //#define PLUGIN_COUNT 2 // A Manager + building blocks #define SELECTIONSETMANAGER_BEHAVIORS_GUID CKGUID(0x499019b,0x30942c41) #ifdef CK_LIB #define RegisterBehaviorDeclarations Register_SelectionSetManager_BehaviorDeclarations #define InitInstance _SelectionSetManager_InitInstance #define ExitInstance _SelectionSetManager_ExitInstance #define CKGetPluginInfoCount CKGet_SelectionSetManager_PluginInfoCount #define CKGetPluginInfo CKGet_SelectionSetManager_PluginInfo #define g_PluginInfo g_SelectionSetManager_PluginInfo #else #define RegisterBehaviorDeclarations RegisterBehaviorDeclarations #define InitInstance InitInstance #define ExitInstance ExitInstance #define CKGetPluginInfoCount CKGetPluginInfoCount #define CKGetPluginInfo CKGetPluginInfo #define g_PluginInfo g_PluginInfo #endif CKPluginInfo g_PluginInfo[PLUGIN_COUNT]; CKERROR InitInstance(CKContext* context); int CKGetPluginInfoCount() { return PLUGIN_COUNT; } CKPluginInfo* CKGetPluginInfo(int Index) { int Plugin = 0; g_PluginInfo[Plugin].m_Author = "Virtools"; g_PluginInfo[Plugin].m_Description = "SelectionSetManager"; g_PluginInfo[Plugin].m_Extension = ""; g_PluginInfo[Plugin].m_Type = CKPLUGIN_MANAGER_DLL; g_PluginInfo[Plugin].m_Version = 0x00000001; g_PluginInfo[Plugin].m_InitInstanceFct = InitInstance; g_PluginInfo[Plugin].m_GUID = SELECTIONSETMANAGER_GUID; g_PluginInfo[Plugin].m_Summary = "SelectionSetManager Plugin"; // Hack: use different string to impede user deactivation if (PLUGIN_COUNT>1) { Plugin++; g_PluginInfo[Plugin].m_Author = "Virtools"; g_PluginInfo[Plugin].m_Description = "SelectionSetManager Building Blocks"; g_PluginInfo[Plugin].m_Extension = ""; g_PluginInfo[Plugin].m_Type = CKPLUGIN_BEHAVIOR_DLL; g_PluginInfo[Plugin].m_Version = 0x00000001; g_PluginInfo[Plugin].m_InitInstanceFct = NULL; g_PluginInfo[Plugin].m_GUID = SELECTIONSETMANAGER_BEHAVIORS_GUID ; g_PluginInfo[Plugin].m_Summary = "SelectionSetManager Behaviors Plugin"; } return &g_PluginInfo[Index]; } // If no manager is used in the plugin // these functions are optional and can be exported. // Virtools will call 'InitInstance' when loading the behavior library // and 'ExitInstance' when unloading it. // It is a good place to perform Attributes Types declaration, // registering new enums or new parameter types. CKERROR InitInstance(CKContext* context) { SelectionSetManager* setmgr = new SelectionSetManager(context); //bind & attribute done in constructor return CK_OK; } CKERROR ExitInstance(CKContext* context) { SelectionSetManager* setmgr = (SelectionSetManager*)context->GetManagerByGuid(SELECTIONSETMANAGER_GUID); if (setmgr) delete setmgr; //unbind & attribute done in destructor return CK_OK; } void RegisterBehaviorDeclarations(XObjectDeclarationArray *reg) { RegisterBehavior(reg, FillBehaviorGetSelectionSets); RegisterBehavior(reg, FillBehaviorLoadSelectionSet); RegisterBehavior(reg, FillBehaviorUnloadSelectionSet); RegisterBehavior(reg, FillBehaviorSaveSelectionSet); RegisterBehavior(reg, FillBehaviorDeleteSelectionSet); RegisterBehavior(reg, FillBehaviorGetSelectionSetProperties); RegisterBehavior(reg, FillBehaviorSetSelectionSetProperties); //RegisterBehavior(reg, FillBehaviorAddToSelectionSet); //RegisterBehavior(reg, FillBehaviorRemoveFromSelectionSet); }