Rhino C++ API  8.13
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CRhinoPlugIn Class Referenceabstract

#include <rhinoSdkPlugIn.h>

Inheritance diagram for CRhinoPlugIn:
ON_Object CRhinoDigitizerPlugIn CRhinoFileExportPlugIn CRhinoFileImportPlugIn CRhinoRenderPlugIn CRhinoUtilityPlugIn

Public Types

enum  license_capabilities {
  no_capabilities = 0x0, can_be_purchased = 0x1, can_be_specified = 0x2, can_be_evaluated = 0x4,
  evaluation_is_expired = 0x8, supports_rhino_accounts = 0x10, supports_standalone = 0x20, supports_zoo_per_user = 0x40,
  supports_zoo_per_core = 0x80, supports_license_discovery = 0x100, license_dialog_buttons_force_32bit = 0xFFFFFFFF
}
 
enum  plug_in_proc_message_id { plug_in_force_32bit = 0xFFFFFFFF }
 
enum  plugin_load_time {
  load_plugin_disabled = 0, load_plugin_when_needed = 2, load_plugin_at_startup = 1, load_plugin_when_needed_ignore_docked = 6,
  load_plugin_when_needed_or_optionsdlg = 10, load_plugin_when_needed_or_tabbed_dockbar = 18, plugin_load_time_force_32bit = 0xFFFFFFFF
}
 
enum  plugin_type : unsigned int {
  unknown_plugin_type = 0, render_plugin = 0x01, file_export_plugin = 0x02, file_import_plugin = 0x04,
  digitizer_plugin = 0x08, utility_plugin = 0x10, display_pipeline_plugin = 0x20, display_engine_plugin = 0x40
}
 
- Public Types inherited from ON_Object
enum  UserDataConflictResolution : unsigned char {
  UserDataConflictResolution::destination_object = 0, UserDataConflictResolution::source_object = 1, UserDataConflictResolution::source_copycount_gt = 2, UserDataConflictResolution::source_copycount_ge = 3,
  UserDataConflictResolution::destination_copycount_gt = 4, UserDataConflictResolution::destination_copycount_ge = 5, UserDataConflictResolution::delete_item = 6
}
 

Public Member Functions

 CRhinoPlugIn ()
 
virtual ~CRhinoPlugIn ()
 
virtual void AddPagesToDocumentPropertiesDialog (CRhinoOptionsPageCollection &collection)
 
virtual void AddPagesToObjectPropertiesDialog (CRhinoPropertiesPanelPageCollection &collection)
 
virtual void AddPagesToOptionsDialog (CRhinoOptionsPageCollection &collection)
 
virtual BOOL32 AddToPlugInHelpMenu () const
 
virtual BOOL32 CallWriteDocument (const CRhinoFileWriteOptions &options)
 
const ON_SimpleArray< CRhinoCommand * > & CommandList () const
 
bool DisplayPlugInErrorDialog (const wchar_t *message) const
 
const ON_UUID GetLicenseId ()
 
virtual void GetMenuMessageString (HMENU hMenu, UINT nID, ON_wString &wMessage) const
 
BOOL32 GetPlugInFileName (ON_wString &result) const
 
BOOL32 GetPlugInFolder (ON_wString &result) const
 
virtual LPUNKNOWN GetPlugInObjectInterface (const ON_UUID &iid)
 
BOOL32 GetPlugInRegistryKey (ON_wString &result) const
 
class CRhPlugInPrivate * GetPrivateData ()
 Get extended data from plug-in. More...
 
BOOL32 InsertPlugInItemToRhinoMenu (HMENU hTargetMenu, UINT index, MENUITEMINFO *pMi)
 
BOOL32 InsertPlugInMenuToRhinoMenu (HMENU hmenu, int index)
 
BOOL32 InsertPlugInMenuToRhinoMenu (HMENU hmenu, LPCTSTR title)
 
bool IsRhinoCommonPlugIn () const
 
virtual void LoadProfile (LPCTSTR lpszSection, CRhinoProfileContext &pc)
 
virtual const wchar_t * LocalPlugInDescription () const
 
virtual const wchar_t * LocalPlugInName () const
 
virtual BOOL32 OnDisplayPlugInHelp (HWND hWnd) const
 
virtual void OnInitPlugInMenuPopups (WPARAM wparam, LPARAM lparam)
 
virtual int OnLoadPlugIn ()
 
virtual bool OnLoadPlugInErrorString (ON_wString &msg)
 
virtual BOOL32 OnPlugInMenuCommand (WPARAM wparam)
 
virtual void OnRegisterPlugIn (bool bDone)
 
virtual void OnSaveAllSettings ()
 
virtual void OnUnloadPlugIn ()
 
virtual const wchar_t * PlugInDescription () const
 
const wchar_t * PlugInFileName () const
 
virtual HICON PlugInIcon (const ON_2iSize &size)
 
virtual GUID PlugInID () const =0
 
HINSTANCE PlugInInstance () const
 
virtual plugin_load_time PlugInLoadTime ()
 
AFX_MODULE_STATE * PlugInModuleState () const
 
virtual const wchar_t * PlugInName () const =0
 
virtual LRESULT PlugInProc (UINT message, WPARAM wParam, LPARAM lParam)
 This will be used to extend this class without breaking the SDK. More...
 
virtual plugin_type PlugInType () const =0
 
void PlugInTypeString (ON_wString &wResult) const
 
virtual const wchar_t * PlugInVersion () const =0
 
virtual BOOL32 ReadDocument (CRhinoDoc &doc, ON_BinaryArchive &archive, const CRhinoFileReadOptions &options)
 
virtual void RemoveDocumentPropertiesDialogTabs (CRhinoDocumentPropertiesTabs &tab_manager)
 
BOOL32 RemovePlugInMenuFromRhino (HMENU hTargetMenu)
 
virtual void ResetMessageBoxes ()
 
virtual bool SaveAsV3 (const CRhinoFileWriteOptions &options)
 
virtual void SaveProfile (LPCTSTR lpszSection, CRhinoProfileContext &pc)
 
void SaveSettings ()
 
CRhinoSettingsSettings ()
 
virtual BOOL32 WriteDocument (CRhinoDoc &doc, ON_BinaryArchive &archive, const CRhinoFileWriteOptions &options)
 
- Public Member Functions inherited from ON_Object
 ON_Object () ON_NOEXCEPT
 
 ON_Object (const ON_Object &)
 
virtual ~ON_Object ()
 
virtual ON_AggregateComponentStatus AggregateComponentStatus () const
 
bool AttachUserData (class ON_UserData *pUserData)
 
unsigned int ClearAllComponentStates () const
 
virtual unsigned int ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const
 
virtual unsigned int ClearComponentStates (ON_ComponentStatus states_to_clear) const
 
void CopyUserData (const ON_Object &source_object)
 
unsigned int CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution)
 
virtual ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
virtual bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count)
 
virtual void DestroyRuntimeCache (bool bDelete=true)
 
bool DetachUserData (class ON_UserData *pUserData)
 
virtual void Dump (ON_TextLog &) const
 
void EmergencyDestroy ()
 
class ON_UserDataFirstUserData () const
 
virtual unsigned int GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const
 
class ON_UserDataGetUserData (const ON_UUID &userdata_uuid) const
 
bool GetUserString (const wchar_t *key, ON_wString &string_value) const
 
int GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const
 
int GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 
bool IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) const
 
bool IsKindOf (const ON_ClassId *pClassId) const
 
virtual void MarkAggregateComponentStatusAsNotCurrent () const
 
virtual void MemoryRelocate ()
 
virtual ON_UUID ModelObjectId () const
 
void MoveUserData (ON_Object &source_object)
 
unsigned int MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems)
 
virtual ON::object_type ObjectType () const
 
ON_Objectoperator= (const ON_Object &)
 
void PurgeUserData ()
 
virtual bool Read (ON_BinaryArchive &binary_archive)
 
virtual unsigned int SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const
 
virtual unsigned int SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const
 
bool SetUserString (const wchar_t *key, const wchar_t *string_value)
 
int SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace)
 
virtual unsigned int SizeOf () const
 
bool ThisIsNullptr (bool bSilentError) const
 
void TransformUserData (const class ON_Xform &xform)
 
virtual bool UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map)
 
int UserStringCount () const
 
virtual bool Write (ON_BinaryArchive &binary_archive) const
 

Static Public Member Functions

static class CRhinoPlugInRecordGetLoadedPlugIn (ON_UUID uuid)
 
static class CRhinoPlugInRecordGetPlugIn (const wchar_t *lpsFileName)
 
static class CRhinoPlugInRecordGetPlugIn (int nIndex)
 
static class CRhinoPlugInRecordGetPlugIn (ON_UUID uuid)
 
static bool GetPlugInList (class ON_ClassArray< CRhinoPlugInRecord > &result, int nPlugInTypes=0xFFFFFFFF)
 
static int LoadPlugIn (const ON_UUID &uuid, bool bQuietly, bool ignore_load_failed)
 
static bool PlugInConstructionPermitted ()
 
static int PlugInCount ()
 
static const wchar_t * PlugInTypeString (int type)
 
static bool SaveLoadProtectionToRegistry (ON_UUID plugin_uuid, int load_protection)
 

Protected Member Functions

bool GetLicense ()
 
bool GetLicense (unsigned int capabilities, const wchar_t *text_mask)
 
bool GetLicenseOwner (ON_wString &registeredOwner, ON_wString &registeredOrganization)
 
bool IsValid (ON_TextLog *text_log=nullptr) const override
 
bool ReturnLicense ()
 
void SetLicenseCapabilities (const wchar_t *format_string, CRhinoPlugIn::license_capabilities capabilities, ON_UUID licenseId)
 

Protected Attributes

bool m_is_rhino_common_plug_in
 

Friends

class CRhinoCommand
 
class CRhMiniDumpHelper
 
class CRhPlugInManager
 
RHINO_SDK_FUNCTION void RhinoGetPlugInCommandList (const CRhinoPlugIn *plug_in, ON_SimpleArray< const CRhinoCommand * > &cmd_list)
 

Detailed Description

Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. Rhinoceros is a registered trademark of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete Rhino SDK copyright information see http://www.rhino3d.com/developer. class CRhinoPlugIn

Description: This is the base class for every Rhino plug-in type. Never derive directly from this class use one of the following: CRhinoUtilityPlugIn CRhinoFileImportPlugIn CRhinoFileExportPlugIn CRhinoDigitizerPlugIn CRhinoRenderPlugIn CRhinoDisplayPlugIn

Remarks: A plug-in is a DLL and MUST be dynamically linked with MFC DLLs.

Because a plug-in DLL is dynamically linked against the MFC DLLs, any functions exported from this DLL which call into MFC must have the AFX_MANAGE_STATE macro added at the very beginning of the function.

Example:

extern "C" BOOL32 PASCAL EXPORT ExportedFunction() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); ///< normal function body here }

It is very important that this macro appear in each function, prior to any calls into MFC. This means that it must appear as the first statement within the function, even before any object variable declarations as their constructors may generate calls into the MFC DLL.

Please see MFC Technical Notes 33 and 58 for additional details.

Member Enumeration Documentation

◆ license_capabilities

Description: Controls the buttons that will appear on the license notification window that is displayed if a license for the requesting product is not found. Note, the Close button will always be displayed.

Enumerator
no_capabilities 

Only the "Close" button will be displayed<.

can_be_purchased 

Shows "Buy a License" button.

can_be_specified 

Shows "Enter a License" and "Use a Zoo" buttons.

can_be_evaluated 

Shows "Evaluate" button.

evaluation_is_expired 

Shows "Evaluate" button disabled.

supports_rhino_accounts 

Enables UI and interaction with Cloud Zoo for the product requesting a license.

supports_standalone 

Enables UI and support for standalone licenses for the product requesting a license.

supports_zoo_per_user 

Enables UI and interaction with Zoo using one license per user for the product requesting a license.

supports_zoo_per_core 

Enables UI and interaction with Zoo using one license per core for the product requesting a license.

supports_license_discovery 
license_dialog_buttons_force_32bit 

for internal use only, this allows adding additional values without breaking the SDK in the future

◆ plug_in_proc_message_id

Enumerator
plug_in_force_32bit 

for internal use only, this allows adding additional values without breaking the SDK in the future

◆ plugin_load_time

Description: Identifies when Rhino should load this plug-n. This value is written/read from/to the \HEKY_LOCAL_MACHINE\Software\McNeel\Rhinoceros<rhino version>\Plug-ins<plug-in GUID> registry keys "LoadMode" entry.

Enumerator
load_plugin_disabled 

never load plug-in

load_plugin_when_needed 

(default) Load the first time a plug-in command used

load_plugin_at_startup 

Load when Rhino starts.

load_plugin_when_needed_ignore_docked 

Load the first time a plug-in command used NOT when restoring docking control bars.

load_plugin_when_needed_or_optionsdlg 

same as "when needed", plus when the options dialog is shown

load_plugin_when_needed_or_tabbed_dockbar 

same as "when needed", plus when a tabbed dockbar is loaded.

plugin_load_time_force_32bit 

for internal use only, this allows adding additional values without breaking the SDK in the future

◆ plugin_type

enum CRhinoPlugIn::plugin_type : unsigned int

Description: Identifies the plug-in type. The plug-in loader will attempt to cast the one and only plug-in object depending on this type code.

Remarks: These codes map to the following classes: Code: Class Name: unknown_plugin_type Reserved for use by constructor, never use. render_plugin CRhinoRenderPlugIn file_export_plugin CRhinoFileExportPlugIn file_import_plugin CRhinoFileImportPlugIn digitizer_plugin CRhinoDigitizerPlugIn utility_plugin CRhinoUtilityPlugIn display_pipeline_plugin CRhinoDisplayPipelinePlugIn display_engine_plugin CRhinoDisplayEnginePlugIn

Enumerator
unknown_plugin_type 
render_plugin 
file_export_plugin 
file_import_plugin 
digitizer_plugin 
utility_plugin 
display_pipeline_plugin 
display_engine_plugin 

Constructor & Destructor Documentation

◆ CRhinoPlugIn()

CRhinoPlugIn::CRhinoPlugIn ( )

◆ ~CRhinoPlugIn()

virtual CRhinoPlugIn::~CRhinoPlugIn ( )
virtual

Member Function Documentation

◆ AddPagesToDocumentPropertiesDialog()

virtual void CRhinoPlugIn::AddPagesToDocumentPropertiesDialog ( CRhinoOptionsPageCollection collection)
virtual

Description: Override this function if you want to extend the DocumentProperties dialog Parameters: collection [out] - Add IRhinoOptionsPage objects to this collection. Note: Make sure you include the following macro prior to calling new: AFX_MANAGE_STATE(AfxGetStaticModuleState()); Please see MFC Technical Notes 33 and 58 for additional details.

◆ AddPagesToObjectPropertiesDialog()

virtual void CRhinoPlugIn::AddPagesToObjectPropertiesDialog ( CRhinoPropertiesPanelPageCollection collection)
virtual

Description: DEPRECATED method, use IRhinoAddPropertiesPages to add object properties panels instead.

Deprecated:
Use IRhinoAddPropertiesPages to add object properties panels instead.

◆ AddPagesToOptionsDialog()

virtual void CRhinoPlugIn::AddPagesToOptionsDialog ( CRhinoOptionsPageCollection collection)
virtual

Description: Override this function if you want to extend the Options dialog Parameters: collection [out] - Add IRhinoOptionsPage objects to this collection. Note: Make sure you include the following macro prior to calling new: AFX_MANAGE_STATE(AfxGetStaticModuleState()); Please see MFC Technical Notes 33 and 58 for additional details.

◆ AddToPlugInHelpMenu()

virtual BOOL32 CRhinoPlugIn::AddToPlugInHelpMenu ( ) const
virtual

Description: Called by Rhino to determine if the plug-in name should be added to the Rhino Help/Plug-ins menu.

Returns: true = Plug-in name is added to menu. false = Plug-in name is not added to menu.

Remarks: Default is false, to automatically add your plug-in to the Rhino help menu override and return true.

◆ CallWriteDocument()

virtual BOOL32 CRhinoPlugIn::CallWriteDocument ( const CRhinoFileWriteOptions options)
virtual

Description: Called whenever a Rhino is about to save a version 4 .3dm file. Returns: True if the plug-in wants to save document user data in the version 4 .3dm file. The default returns false. Remarks: If you want to save plug-in document data when a model is saved in a version 4 .3dm file, then you must override this function to return true and you must override WriteDocument().

◆ CommandList()

const ON_SimpleArray<CRhinoCommand*>& CRhinoPlugIn::CommandList ( ) const

◆ DisplayPlugInErrorDialog()

bool CRhinoPlugIn::DisplayPlugInErrorDialog ( const wchar_t *  message) const

◆ GetLicense() [1/2]

bool CRhinoPlugIn::GetLicense ( )
protected

Description: Verifies that there is a valid product license for your plug-in, using the Rhino licensing system. If the plug-in is installed as a standalone node, the locally installed license will be validated. If the plug-in is installed as a network node, a loaner license will be requested by the system's assigned Zoo server. If the Zoo server finds and returns a license, then this license will be validated. If no license is found, then the user will be prompted to provide a license key, which will be validated. Validation is provided by your plug-in's one and only CRhinoLicenseValidator-derived class object. Returns: True if a valid license was found. False otherwise.

◆ GetLicense() [2/2]

bool CRhinoPlugIn::GetLicense ( unsigned int  capabilities,
const wchar_t *  text_mask 
)
protected

Description: Verifies that there is a valid product license for your plug-in, using the Rhino licensing system. If the plug-in is installed as a standalone node, the locally installed license will be validated. If the plug-in is installed as a network node, a loaner license will be requested by the system's assigned Zoo server. If the Zoo server finds and returns a license, then this license will be validated. If no license is found, then the user will be prompted to provide a license key, which will be validated. Validation is provided by your plug-in's one and only CRhinoLicenseValidator-derived class object. Parameters: capabilities [in] - an unsigned int made by or-ing ( | ) values from the CRhinoPlugIn::license_capabilities enum. In the event that a license was not found, or if the user wants to change the way your plug-in is licenses, then provide what capabilities your license has by using this enumeration flag. text_mask [in] - In the event that the user needs to be asked for a license, then you can provide a text mask, which helps the user to distinguish between proper and improper user input of your license code. Note, if you do not want to use a text mask, then pass in a null value for this parameter. For more information on text masks, search MSDN for the System.Windows.Forms.MaskedTextBox class. Returns: True if a valid license was found. False otherwise.

Deprecated:
Call SetLicenseCapabilities, then GetLicense(void) instead.

◆ GetLicenseId()

const ON_UUID CRhinoPlugIn::GetLicenseId ( )

Returns the ID to be used by the ZooClient when retrieving and storing licenses for this plug-in. If SetLicenseId() is never called, GetLicenseId() returns PluginId()

◆ GetLicenseOwner()

bool CRhinoPlugIn::GetLicenseOwner ( ON_wString registeredOwner,
ON_wString registeredOrganization 
)
protected

Description: Get the customer name and organization used when entering the product license.

◆ GetLoadedPlugIn()

static class CRhinoPlugInRecord* CRhinoPlugIn::GetLoadedPlugIn ( ON_UUID  uuid)
static

Description: Scan plug-in record list for a loaded plug-in with matching UUID.

Parameters: uuid - [in] UUID to match

Returns: See CRhinoPlugInRecord for description. Will return NULL if nIndex is invalid or list is empty or the plug-in is not currently loaded.

◆ GetMenuMessageString()

virtual void CRhinoPlugIn::GetMenuMessageString ( HMENU  hMenu,
UINT  nID,
ON_wString wMessage 
) const
virtual

Description: Called by Rhino when a plug-in added menu or menu item is activated and the main Rhino windows CFrameWnd::GetMessageString() method is called. The string placed in wMessage will be displayed in the status bar at the bottom of the main Rhino window.

Parameters: hMenu [in] Menu which is requesting the help string nID [in] Menu item ID to get help string for wMessage [out] String to display on the status bar

Remarks: If plug-in adds menu items and wants to check/uncheck or gray them out it should override this function.

◆ GetPlugIn() [1/3]

static class CRhinoPlugInRecord* CRhinoPlugIn::GetPlugIn ( const wchar_t *  lpsFileName)
static

Description: Scan plug-in record list for a plug-in with matching file name.

Parameters: lpsFileName - [in] File name to match

Returns: See CRhinoPlugInRecord for description. Will return NULL if nIndex is invalid or list is empty.

◆ GetPlugIn() [2/3]

static class CRhinoPlugInRecord* CRhinoPlugIn::GetPlugIn ( int  nIndex)
static

Description: Used to enumerate plug-in record list.

Parameters: nIndex - [in] Zero based index of record to get. If >= CRhinoPlugIn::PlugInCount() then NULL is returned.

Returns: Will return NULL if nIndex is invalid or the list is empty otherwise see CRhinoPlugInRecord for description.

◆ GetPlugIn() [3/3]

static class CRhinoPlugInRecord* CRhinoPlugIn::GetPlugIn ( ON_UUID  uuid)
static

Description: Scan plug-in record list for a plug-in with matching UUID.

Parameters: uuid - [in] UUID to match

Returns: See CRhinoPlugInRecord for description. Will return NULL if nIndex is invalid or list is empty.

◆ GetPlugInFileName()

BOOL32 CRhinoPlugIn::GetPlugInFileName ( ON_wString result) const

Description: Used to retrieve full path used to load the plug-in.

Parameters: ON_wString& result = Reference to buffer to receive path

Returns: true = Buffer filled in. false = Unable to fill in buffer.

◆ GetPlugInFolder()

BOOL32 CRhinoPlugIn::GetPlugInFolder ( ON_wString result) const

Description: Get folder plug-in was loaded from.

Parameters: ON_wString& result = Reference to buffer to receive folder name.

Returns: true = Buffer filled in false = Could not determining source folder.

◆ GetPlugInList()

static bool CRhinoPlugIn::GetPlugInList ( class ON_ClassArray< CRhinoPlugInRecord > &  result,
int  nPlugInTypes = 0xFFFFFFFF 
)
static

Description: Scan plug-in record list for plug-in's of type specified.

Parameters: result - [out] Plug-in of nPlugInTypes type. nPlugInTypes - [in] Plug-in types to look for, see CRhinoPlugIn::plug-in_type for options.

Returns: true If any plug-ins are found otherwise false.

◆ GetPlugInObjectInterface()

virtual LPUNKNOWN CRhinoPlugIn::GetPlugInObjectInterface ( const ON_UUID iid)
virtual

Description: Override this function if you want to return an interface pointer for a COM object in your plug-in. Note, if you want your plug-in to support scripting with RhinoScript, you must return the interface pointer of an IDispatch-derived object (IID_IDispatch). Parameter: iid [in] - The requested interface. Return: The IUnknown pointer of the requested interface, if successful. Return NULL on error or if the interface is not supported. Notes: It is the responsibility of the application calling this function to increment and decrement the object's reference count using AddRef() and Release(). If the plug-in object being request is a stack variable, then you will also want to increment the reference counter yourself so the object will not be destroyed when released by the calling application.

◆ GetPlugInRegistryKey()

BOOL32 CRhinoPlugIn::GetPlugInRegistryKey ( ON_wString result) const

◆ GetPrivateData()

class CRhPlugInPrivate* CRhinoPlugIn::GetPrivateData ( )

Get extended data from plug-in.

◆ InsertPlugInItemToRhinoMenu()

BOOL32 CRhinoPlugIn::InsertPlugInItemToRhinoMenu ( HMENU  hTargetMenu,
UINT  index,
MENUITEMINFO *  pMi 
)

Description: Insert an item anywhere in rhino menus Returns: true = Added false = Not added

◆ InsertPlugInMenuToRhinoMenu() [1/2]

BOOL32 CRhinoPlugIn::InsertPlugInMenuToRhinoMenu ( HMENU  hmenu,
int  index 
)

Description: A Plug-in can call this function to add its menu to the Rhino menu bar This version gets a submenu from a main menu by index and uses the title in the main menu.

◆ InsertPlugInMenuToRhinoMenu() [2/2]

BOOL32 CRhinoPlugIn::InsertPlugInMenuToRhinoMenu ( HMENU  hmenu,
LPCTSTR  title 
)

Description: This version takes a submenu and a specific title Returns: true = Menu item added false = Not added.

◆ IsRhinoCommonPlugIn()

bool CRhinoPlugIn::IsRhinoCommonPlugIn ( ) const

Description: Call this method to determine if the plug-in is a C++ or .NET Rhino Common runtime plug-in.

◆ IsValid()

bool CRhinoPlugIn::IsValid ( ON_TextLog text_log = nullptr) const
overrideprotectedvirtual

Description: Tests an object to see if its data members are correctly initialized. Parameters: text_log - [in] if the object is not valid and text_log is not nullptr, then a brief english description of the reason the object is not valid is appended to the log. The information appended to text_log is suitable for low-level debugging purposes by programmers and is not intended to be useful as a high level user interface tool. Returns: @untitled table true object is valid false object is invalid, uninitialized, etc.

Reimplemented from ON_Object.

◆ LoadPlugIn()

static int CRhinoPlugIn::LoadPlugIn ( const ON_UUID uuid,
bool  bQuietly,
bool  ignore_load_failed 
)
static

Description: Load registered plug-in .

Parameters: uuid - [in] Plug-in ID of registered plug-in to load. bQuietly - [in] If true then error messages are not displayed ignore_load_failed - [in] Load plug-in even if previous attempt to load has failed

Returns values less than zero mean an error occurred values 0 and greater mean success

◆ LoadProfile()

virtual void CRhinoPlugIn::LoadProfile ( LPCTSTR  lpszSection,
CRhinoProfileContext pc 
)
virtual

Description: Loads persistent plug-in settings from the Rhino profile. Parameters: lpszSection - [in] profile section to use for this plug-in pc - [in] profile context to use to get at value saved in the Rhino profile. Remarks: Rhino will call LoadProfile after the plug-in is loaded and before the plug-in is used. The default does nothing. See Also: CRhinoPlugIn::SaveProfile

◆ LocalPlugInDescription()

virtual const wchar_t* CRhinoPlugIn::LocalPlugInDescription ( ) const
virtual

◆ LocalPlugInName()

virtual const wchar_t* CRhinoPlugIn::LocalPlugInName ( ) const
virtual

◆ OnDisplayPlugInHelp()

virtual BOOL32 CRhinoPlugIn::OnDisplayPlugInHelp ( HWND  hWnd) const
virtual

Description: Called by Rhino if AddToPlugInHelpMenu() returns true and menu item associated with this plug-in is selected.

Parameters: HWND hWnd = Window handle of the active Rhino interface.

Returns: true = Help displayed successfully. false = Error displaying help

Remarks: If AddToPlugInHelpMenu() was overridden and returns true then override this function and call your plug-in's help file.

◆ OnInitPlugInMenuPopups()

virtual void CRhinoPlugIn::OnInitPlugInMenuPopups ( WPARAM  wparam,
LPARAM  lparam 
)
virtual

Description: Called by Rhino when a plug-in adds a menu or menu item to the Rhino menu and a associate WM_INITMENUPOPUP message is received.

Parameters: Same as Windows WM_INITMENUPOPUP message

Remarks: If plug-in adds menu items and wants to check/uncheck or gray them out it should override this function.

◆ OnLoadPlugIn()

virtual int CRhinoPlugIn::OnLoadPlugIn ( )
virtual

Description: Called one time when a plug-in is loaded.

Returns: 1 = Initialization succeeded, leave the plug-in loaded. 0 = Unable to initialize, unload the plug-in and display load error dialog. -1 = Unable to initialize, unload the plug-in and do not display load error dialog. Note: OnUnloadPlugIn will not be called.

Remarks: Plug-ins are not loaded until after Rhino is started and a default document is created. Because the default document already exists CRhinoEventWatcher::On????Document() functions are not called for the default document. If you need to do any document initialization/synchronization then override this function and do it here. It is not necessary to call CPlugIn::OnLoadPlugIn() from your derived class.

◆ OnLoadPlugInErrorString()

virtual bool CRhinoPlugIn::OnLoadPlugInErrorString ( ON_wString msg)
virtual

Description: If OnLoadPlugIn() returns 0 the Rhino plug-in manager will call this method. If this method sets message to a valid string and returns true then the plug-in on load error dialog will display your custom message.

Parameters: msg [out] Error message to display

Returns: true = Display custom message false = Display system message

See Also: CRhinoPlugIn::OnLoadPlugIn()

◆ OnPlugInMenuCommand()

virtual BOOL32 CRhinoPlugIn::OnPlugInMenuCommand ( WPARAM  wparam)
virtual

Description: Called when a plug-in added menu item is executed.

Parameters: WPARAM wparam = WM_COMMAND WPARAM Passed to Rhino when menu item selected.

Remarks: Override and take action if plug-in adds commands to the Rhino menu.

◆ OnRegisterPlugIn()

virtual void CRhinoPlugIn::OnRegisterPlugIn ( bool  bDone)
virtual

Description: The Following are SOMETIMES overridden, it is not necessary to call the base class version of these functions. Description: Called when plug-in self registration begins and ends.

Remarks: When a plug-in is loaded successfully Rhino registers it so it may be loaded automatically in the future. This method is called at the beginning and end of the registration process.

◆ OnSaveAllSettings()

virtual void CRhinoPlugIn::OnSaveAllSettings ( )
virtual

Description: The Rhino plug-in manager will call this method when Rhino is preparing to close. At this point, the Rhino SDK should still be completely accessible.

See Also: CWinApp::SaveAllSettings CRhinoPlugIn::OnLoadPlugIn()

◆ OnUnloadPlugIn()

virtual void CRhinoPlugIn::OnUnloadPlugIn ( )
virtual

Description: Called one time when plug-in is about to be unloaded. By this time, Rhino's mainframe window has been destroyed, and some of the SDK managers have been deleted. There is also no active document or active view at this time. Thus, you should only be manipulating your own objects. or tools here.

◆ PlugInConstructionPermitted()

static bool CRhinoPlugIn::PlugInConstructionPermitted ( )
static

Description: This function will return true when Rhino is loading a plug-in and a single CRhinoPlugIn() class is permitted to be constructed. If CRhinoPlugIn() is called and CRhinoPlugIn::PlugInConstructionPermitted() is false, it means a plug-in developer is incorrectly constructing a class derived from CRhinoPlugIn(). As soon as CRhinoPlugIn::CRhinoPlugIn() is called, this function will return false. This means that in the constructor of a class derived from CRhinoPlugIn(), this function will always return false. Returns: true if Rhino is loading a plug-in and a single class derived from CRhinoPlugIn is permitted to be constructed.

◆ PlugInCount()

static int CRhinoPlugIn::PlugInCount ( )
static

Description: Returns number of registered and loaded plug-ins.

◆ PlugInDescription()

virtual const wchar_t* CRhinoPlugIn::PlugInDescription ( ) const
virtual

Description: The Following are USUALLY overridden, it is not necessary to call the base class version of these functions. Description: Plug-in description string. This description is used in various user interfaces. Returns: String to display.

◆ PlugInFileName()

const wchar_t* CRhinoPlugIn::PlugInFileName ( ) const

◆ PlugInIcon()

virtual HICON CRhinoPlugIn::PlugInIcon ( const ON_2iSize size)
virtual

Description: Plug-in icon. This image is used in various user interfaces. Parameters: size [in] The size of the requested icon. Example:

HICON CTestPlugIn::PlugInIcon(const ON_2iSize& size) { unsigned int icon_id = RhinoPlugInIconResourceId(); return CRhinoDpi::LoadIcon(AfxGetInstanceHandle(), icon_id, size.cx, size.cy); }

Returns: Handle to icon to display.

◆ PlugInID()

virtual GUID CRhinoPlugIn::PlugInID ( ) const
pure virtual

Description: The following virtual functions must be overridden Description: Plug-in unique identifier. Returns: Reference to a unique plug-in GUID. Remarks: Use Window's GUIDGEN.EXE to create a GUID.

◆ PlugInInstance()

HINSTANCE CRhinoPlugIn::PlugInInstance ( ) const

Description: Helper function to get the HINSTANCE for Rhino received when loading the plug-in.

Returns: HINSTANCE = Module handle.

◆ PlugInLoadTime()

virtual plugin_load_time CRhinoPlugIn::PlugInLoadTime ( )
virtual

Description: Called by Rhino when writing plug-in information to the registry. This information will be read the next time Rhino starts to identify properly installed plug-ins.

Returns: load_plugin_when_needed = Plug-in will not be loaded when Rhino starts. Plug-in will be loaded when a plug-in defined command is run or when a user selects a plug-in defined file import/export type. Plug-in will be loaded if it created control bars and one or more control bar was visible when Rhino last closed. load_plugin_when_needed_ignore_docked = Same as load_plugin_when_needed with the exception that plug-in will NOT be loaded if it created control bars and one or more control bar was visible when Rhino last closed. load_plugin_at_startup = Plug-in is loaded when Rhino is loaded and initialized.

Remarks: Override this function and return load_plugin_at_startup to get your plug-in to load when Rhino does.

◆ PlugInModuleState()

AFX_MODULE_STATE* CRhinoPlugIn::PlugInModuleState ( ) const

◆ PlugInName()

virtual const wchar_t* CRhinoPlugIn::PlugInName ( ) const
pure virtual

Description: Plug-in name display string. This name is displayed by Rhino when loading the plug-in, in the plug-in help menu, and in the Rhino interface for managing plug-ins. Returns: String to display.

◆ PlugInProc()

virtual LRESULT CRhinoPlugIn::PlugInProc ( UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

This will be used to extend this class without breaking the SDK.

◆ PlugInType()

virtual plugin_type CRhinoPlugIn::PlugInType ( ) const
pure virtual

Description: Identifies the type of plug-in. Returns: Codes described above. Remarks: Rhino will attempt to cast the one and only plug-in derived object when loading a plug-in. If it does not cast correctly then the plug-in will not be allowed to load.

Implemented in CRhinoUtilityPlugIn, CRhinoDigitizerPlugIn, CRhinoFileExportPlugIn, CRhinoFileImportPlugIn, and CRhinoRenderPlugIn.

◆ PlugInTypeString() [1/2]

static const wchar_t* CRhinoPlugIn::PlugInTypeString ( int  type)
static

Description: Return descriptive plug-in type string Parameters: int type = CRhinoPlugIn::plugin_type

◆ PlugInTypeString() [2/2]

void CRhinoPlugIn::PlugInTypeString ( ON_wString wResult) const

Description: Return plug-in type code as descriptive UNICODE string

Parameters: ON_wString& wResult = Object to receive description.

◆ PlugInVersion()

virtual const wchar_t* CRhinoPlugIn::PlugInVersion ( ) const
pure virtual

Description: Plug-in version display string. This name is displayed by Rhino when loading the plug-in and in the Rhino interface for managing plug-ins. Returns: String to display.

◆ ReadDocument()

virtual BOOL32 CRhinoPlugIn::ReadDocument ( CRhinoDoc doc,
ON_BinaryArchive archive,
const CRhinoFileReadOptions options 
)
virtual

Description: Called whenever a Rhino document is being loaded and plug-in user data was encountered written by a plug-in with this plug-in's GUID.

Parameters: CRhinoDoc& = Document being loaded ON_BinaryArchive& = OpenNURBS file archive object Rhino is using to read this file. Use ON_BinaryArchive::Read*() functions to read plug-in data. CRhinoFileWriteOptions = Describes what is being written.

Returns: If any ON_BinaryArchive::Read*() functions return false than you should immediately return false otherwise return true when all data was read.

◆ RemoveDocumentPropertiesDialogTabs()

virtual void CRhinoPlugIn::RemoveDocumentPropertiesDialogTabs ( CRhinoDocumentPropertiesTabs tab_manager)
virtual

Description: Override this method if you want to suppress the display of specific document property dialog tabs. Parameters: hwndParent [in] - HWND of parent dialog. tab_manager [in] - See class CRhinoDocumentPropertiesTabs for details

◆ RemovePlugInMenuFromRhino()

BOOL32 CRhinoPlugIn::RemovePlugInMenuFromRhino ( HMENU  hTargetMenu)

Description: Remove menu added by this plug-in Parameters: HMENU hTargetMenu = menu to unload Returns: true = Removed false = menu not found or not added by this plug-in

◆ ResetMessageBoxes()

virtual void CRhinoPlugIn::ResetMessageBoxes ( )
virtual

Description: Override this function if your plug-in has "do not show this dialog again" dialogs and you want on place to reset any/all settings to show that those dialogs.

◆ ReturnLicense()

bool CRhinoPlugIn::ReturnLicense ( )
protected

Description: Returns, or releases, a product license that was obtained from the Rhino licensing system. Note, most plug-ins DO NOT need to call this as the Rhino licensing system will return all licenses when Rhino shuts down. If, for example your plug-in is a rendering plug-in and you want to release your license when your rendering plug-ins is no longer the active renderer, then you can use this function to do this.

◆ SaveAsV3()

virtual bool CRhinoPlugIn::SaveAsV3 ( const CRhinoFileWriteOptions options)
virtual

Description: Called whenever a Rhino is about to save a version 3 .3dm file. Returns: True if the plug-in wants to save document or object user data in the version 3 .3dm file. The default returns false. Remarks: If you want to save plug-in document data when a model is saved in a version 3 .3dm file, then you must override this function to return true and you must override WriteDocument().

◆ SaveLoadProtectionToRegistry()

static bool CRhinoPlugIn::SaveLoadProtectionToRegistry ( ON_UUID  plugin_uuid,
int  load_protection 
)
static

Description: Saves the plug-in's load protection setting. Parameters: plug-in_uuid - [in] If 0, then false is returned and *load_protection is set to 2. load_protection - [out] 0,1: load silently 2: query load Returns: true if the value came from the registry. false if the plug-in_uuid = 0 (*load_protection=2) or no registry entry existed (*load_protection=1)

◆ SaveProfile()

virtual void CRhinoPlugIn::SaveProfile ( LPCTSTR  lpszSection,
CRhinoProfileContext pc 
)
virtual

Description: Save persistent plug-in settings to the Rhino profile. Parameters: lpszSection - [in] profile section to use for this command pc - [in] profile context to use to get at value saved in the Rhino profile. Remarks: Rhino will call SaveProfile before unloading your plug-in and exiting. Override SaveProfile to save plug-in settings that need to persist between Rhino sessions. The default does nothing. See Also: CRhinoPlugIn::LoadProfile

◆ SaveSettings()

void CRhinoPlugIn::SaveSettings ( )

Description: Write settings to disk which will raise a CRhinoPlugInSettingsChanged event.

◆ SetLicenseCapabilities()

void CRhinoPlugIn::SetLicenseCapabilities ( const wchar_t *  format_string,
CRhinoPlugIn::license_capabilities  capabilities,
ON_UUID  licenseId 
)
protected

Description: Sets internal plug-in variables that control how Rhino displays user interface when asking the user for license keys for your plug-in. You must call SetLicenseCapabilities in OnLoadPlugin for Rhino to properly set up the user interface when you call GetLicense, or when the user clicks "Change my license..." in Tools > Options > Licenses Parameters: capabilities [in] - an unsigned int made by or-ing ( | ) values from the CRhinoPlugIn::license_capabilities enum. In the event that a license was not found, or if the user wants to change the way your plug-in is licenses, then provide what capabilities your license has by using this enumeration flag. text_mask [in] - In the event that the user needs to be asked for a license, then you can provide a text mask, which helps the user to distinguish between proper and improper user input of your license code. Note, if you do not want to use a text mask, then pass in a null value for this parameter. For more information on text masks, search MSDN for the System.Windows.Forms.MaskedTextBox class. licenseId [in] - The UUID used by your plug-in to request a license. This may be your plug-ins ID (this->PlugInID()) or another UUID of your choosing. As you release new versions of your plug- ins, and want them to require a new license, you will need to change this licenseId. You'll also need to provide an updated plug-in for the Zoo server, and contact McNeel to support this ID in the Rhino accounts licensing system.

◆ Settings()

CRhinoSettings& CRhinoPlugIn::Settings ( )

Description: Call this method to get access to persistent plug-in settings

◆ WriteDocument()

virtual BOOL32 CRhinoPlugIn::WriteDocument ( CRhinoDoc doc,
ON_BinaryArchive archive,
const CRhinoFileWriteOptions options 
)
virtual

Description: Called when Rhino is saving a .3dm file to allow the plug-in to save document user data.

Parameters: doc - [in] archive - [in] OpenNURBS file archive object Rhino is using to write the file. Use ON_BinaryArchive::Write*() functions to write plug-in data. NOTE WELL: If your plug-in supports writing version 3 and version 4 documents, then you must check archive.Archive3dmVersion() to determine which version of .3dm file is being saved. options - [in] Returns: If any ON_BinaryArchive::Write*() functions return false, then you should immediately return false. Otherwise return true if all data was written successfully. Returning false will cause Rhino to stop saving the file.

Friends And Related Function Documentation

◆ CRhinoCommand

friend class CRhinoCommand
friend

◆ CRhMiniDumpHelper

friend class CRhMiniDumpHelper
friend

◆ CRhPlugInManager

friend class CRhPlugInManager
friend

◆ RhinoGetPlugInCommandList

RHINO_SDK_FUNCTION void RhinoGetPlugInCommandList ( const CRhinoPlugIn plug_in,
ON_SimpleArray< const CRhinoCommand * > &  cmd_list 
)
friend

Member Data Documentation

◆ m_is_rhino_common_plug_in

bool CRhinoPlugIn::m_is_rhino_common_plug_in
protected

This is is should only be set by Rhino Common when creating a runtime plug-in, DO NOT set this.