Public Member Functions

IBrushPresetMgr Class Reference

Search for all occurrences

Detailed Description

Interface to the brush preset manager.

The manager is a singleton object implemented by the system. It maintains the list of contexts and presets. It communicates with the contexts to track which is active, and when a context is updated. It tracks which preset is active in order to store parameters into the preset when contexts are updated. It has functionality to read and write brush preset files. Finally, the brush preset manager provides a maxscript interface to activate and deactivate presets.

#include <IBrushPresets.h>

Inheritance diagram for IBrushPresetMgr:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  DECLARE_DESCRIPTOR (IBrushPresetMgr)
virtual void  RegisterContext (IBrushPresetContext *context)=0
  Registers a context with the manager.
virtual void  UnRegisterContext (IBrushPresetContext *context)=0
  Unregisters a context with the manager.
virtual IBrushPresetContext GetContext (Class_ID contextID)=0
  Returns a context object from its ID.
virtual int  GetNumContexts ()=0
  Returns the number of contexts.
virtual Class_ID  GetContextID (int contextIndex)=0
  Translates the index number of a context into the corresponding context ID.
virtual int  GetContextIndex (Class_ID contextID)=0
  Translates the ID of a context into the corresponding context index number.
virtual int  BeginContext (Class_ID contextID)=0
  Notifies the manager that a context is activated.
virtual int  EndContext (Class_ID contextID)=0
  Notifies the manager that a context is deactived.
virtual BOOL  IsContextActive (Class_ID contextID)=0
  Returns TRUE if the given context is active, FALSE otherwise.
virtual IBrushPreset GetPreset (int presetID)=0
  Returns a brush preset object from its ID, or NULL if no preset exists with the given ID.
virtual IBrushPreset CreatePreset ()=0
  Creates a new preset, and adds a corresponding button to the brush preset toolbar.
virtual void  DeletePreset (IBrushPreset *preset)=0
  Deletes a preset, removing the corresponding button from the brush preset toolbar.
virtual int  GetNumPresets ()=0
  Returns the current number of brush presets.
virtual int  GetPresetID (int presetIndex)=0
  Translates the index number of a brush preset into the corresponding preset ID.
virtual int  GetPresetIndex (int presetID)=0
  Translates the ID of a brush preset into the corresponding preset index number.
virtual int  GetActivePreset ()=0
  Returns the ID of the active preset.
virtual void  SetActivePreset (int presetID)=0
  Sets the active preset.
virtual void  OnContextUpdated (Class_ID contextID)=0
  Notifies the manager that a parameter has changed within a brush preset context.
virtual int  ReadConfig (MCHAR *cfg=NULL)=0
  Reads a brush preset file, including the preset values and the layout of the toolbar.
virtual int  WriteConfig (MCHAR *cfg=NULL)=0
  Writes a brush preset file, including the preset values and the layout of the toolbar.

Member Function Documentation

DECLARE_DESCRIPTOR ( IBrushPresetMgr  )
virtual void RegisterContext ( IBrushPresetContext context ) [pure virtual]

Registers a context with the manager.

Contexts should call this method at system startup, or immediately when loaded into memory to support deferred loading.

Parameters:
[in] context The context to register
virtual void UnRegisterContext ( IBrushPresetContext context ) [pure virtual]

Unregisters a context with the manager.

Contexts may call this method if they are unloaded from memory, but it is not required during normal shutdown.

Parameters:
[in] context The context to unregister
virtual IBrushPresetContext* GetContext ( Class_ID  contextID ) [pure virtual]

Returns a context object from its ID.

This returns the context immediately if it is currently registered, otherwise it loads the context plug-in if it is not in memory but supports deferred loading.

Parameters:
[in] contextID The ID of the context
virtual int GetNumContexts ( ) [pure virtual]

Returns the number of contexts.

This includes all currently registered contexts, plus contexts in deferred plug-ins which were registered previously but are not yet loaded.

virtual Class_ID GetContextID ( int  contextIndex ) [pure virtual]

Translates the index number of a context into the corresponding context ID.

Parameters:
[in] contextIndex The index of the context
Returns:
The context ID, or Class_ID(0,0) if the index is out of range
virtual int GetContextIndex ( Class_ID  contextID ) [pure virtual]

Translates the ID of a context into the corresponding context index number.

Parameters:
[in] contextID The ID of the context
Returns:
The index of the context, or -1 if no context exists with the given ID
virtual int BeginContext ( Class_ID  contextID ) [pure virtual]

Notifies the manager that a context is activated.

This should be called by a context when its UI is opened and ready for painting

Parameters:
[in] contextID The ID of the context
virtual int EndContext ( Class_ID  contextID ) [pure virtual]

Notifies the manager that a context is deactived.

This should be called by a context when its UI is closed

Parameters:
[in] contextID The ID of the context
virtual BOOL IsContextActive ( Class_ID  contextID ) [pure virtual]

Returns TRUE if the given context is active, FALSE otherwise.

Parameters:
[in] contextID The ID of the context
virtual IBrushPreset* GetPreset ( int  presetID ) [pure virtual]

Returns a brush preset object from its ID, or NULL if no preset exists with the given ID.

Parameters:
[in] presetID The ID of the preset
virtual IBrushPreset* CreatePreset ( ) [pure virtual]

Creates a new preset, and adds a corresponding button to the brush preset toolbar.

virtual void DeletePreset ( IBrushPreset preset ) [pure virtual]

Deletes a preset, removing the corresponding button from the brush preset toolbar.

virtual int GetNumPresets ( ) [pure virtual]

Returns the current number of brush presets.

virtual int GetPresetID ( int  presetIndex ) [pure virtual]

Translates the index number of a brush preset into the corresponding preset ID.

Parameters:
[in] presetIndex The index of the preset
Returns:
The preset ID, or zero if the index is out of range
virtual int GetPresetIndex ( int  presetID ) [pure virtual]

Translates the ID of a brush preset into the corresponding preset index number.

Parameters:
[in] presetID The ID of the preset
Returns:
The index of the preset, or -1 if no preset exists with the given ID
virtual int GetActivePreset ( ) [pure virtual]

Returns the ID of the active preset.

This corresponds to the currently checked button on the brush preset toolbar, or zero if no button is checked.

virtual void SetActivePreset ( int  presetID ) [pure virtual]

Sets the active preset.

The button on the brush preset toolbar corresponding to this preset will become checked.

Parameters:
[in] presetID The ID of the preset
virtual void OnContextUpdated ( Class_ID  contextID ) [pure virtual]

Notifies the manager that a parameter has changed within a brush preset context.

Contexts should call this method whenever they are active, and any parameter changes which needs to be stored into the active preset

Parameters:
[in] contextID The ID of the updated context
virtual int ReadConfig ( MCHAR *  cfg = NULL ) [pure virtual]

Reads a brush preset file, including the preset values and the layout of the toolbar.

Parameters:
[in] cfg The path of the file, or NULL to use the standard startup file
Returns:
Non-zero if successful, otherwise zero on error
virtual int WriteConfig ( MCHAR *  cfg = NULL ) [pure virtual]

Writes a brush preset file, including the preset values and the layout of the toolbar.

Parameters:
[in] cfg The path of the file, or NULL to use the standard startup file
Returns:
Non-zero if successful, otherwise zero on error

IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr
IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr IBrushPresetMgr