3ds Max C++ API Reference
IBrushPresetMgr Class Referenceabstract

Interface to the brush preset manager. More...

#include <IBrushPresets.h>

+ Inheritance diagram for IBrushPresetMgr:

Public Member Functions

 DECLARE_DESCRIPTOR (IBrushPresetMgr)
 
virtual void RegisterContext (IBrushPresetContext *context)=0
 Registers a context with the manager. More...
 
virtual void UnRegisterContext (IBrushPresetContext *context)=0
 Unregisters a context with the manager. More...
 
virtual IBrushPresetContextGetContext (Class_ID contextID)=0
 Returns a context object from its ID. More...
 
virtual int GetNumContexts ()=0
 Returns the number of contexts. More...
 
virtual Class_ID GetContextID (int contextIndex)=0
 Translates the index number of a context into the corresponding context ID. More...
 
virtual int GetContextIndex (Class_ID contextID)=0
 Translates the ID of a context into the corresponding context index number. More...
 
virtual int BeginContext (Class_ID contextID)=0
 Notifies the manager that a context is activated. More...
 
virtual int EndContext (Class_ID contextID)=0
 Notifies the manager that a context is deactived. More...
 
virtual BOOL IsContextActive (Class_ID contextID)=0
 Returns TRUE if the given context is active, FALSE otherwise. More...
 
virtual IBrushPresetGetPreset (int presetID)=0
 Returns a brush preset object from its ID, or NULL if no preset exists with the given ID. More...
 
virtual IBrushPresetCreatePreset ()=0
 Creates a new preset, and adds a corresponding button to the brush preset toolbar. More...
 
virtual void DeletePreset (IBrushPreset *preset)=0
 Deletes a preset, removing the corresponding button from the brush preset toolbar. More...
 
virtual int GetNumPresets ()=0
 Returns the current number of brush presets. More...
 
virtual int GetPresetID (int presetIndex)=0
 Translates the index number of a brush preset into the corresponding preset ID. More...
 
virtual int GetPresetIndex (int presetID)=0
 Translates the ID of a brush preset into the corresponding preset index number. More...
 
virtual int GetActivePreset ()=0
 Returns the ID of the active preset. More...
 
virtual void SetActivePreset (int presetID)=0
 Sets the active preset. More...
 
virtual void OnContextUpdated (Class_ID contextID)=0
 Notifies the manager that a parameter has changed within a brush preset context. More...
 
virtual int ReadConfig (const MCHAR *cfg=NULL)=0
 Reads a brush preset file, including the preset values and the layout of the toolbar. More...
 
virtual int WriteConfig (const MCHAR *cfg=NULL)=0
 Writes a brush preset file, including the preset values and the layout of the toolbar. More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=nullptr)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClasspc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

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.

Member Function Documentation

◆ DECLARE_DESCRIPTOR()

DECLARE_DESCRIPTOR ( IBrushPresetMgr  )

◆ RegisterContext()

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]contextThe context to register

◆ UnRegisterContext()

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]contextThe context to unregister

◆ GetContext()

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]contextIDThe ID of the context

◆ GetNumContexts()

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.

◆ GetContextID()

virtual Class_ID GetContextID ( int  contextIndex)
pure virtual

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

Parameters
[in]contextIndexThe index of the context
Returns
The context ID, or Class_ID(0,0) if the index is out of range

◆ GetContextIndex()

virtual int GetContextIndex ( Class_ID  contextID)
pure virtual

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

Parameters
[in]contextIDThe ID of the context
Returns
The index of the context, or -1 if no context exists with the given ID

◆ BeginContext()

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]contextIDThe ID of the context

◆ EndContext()

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]contextIDThe ID of the context

◆ IsContextActive()

virtual BOOL IsContextActive ( Class_ID  contextID)
pure virtual

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

Parameters
[in]contextIDThe ID of the context

◆ GetPreset()

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]presetIDThe ID of the preset

◆ CreatePreset()

virtual IBrushPreset* CreatePreset ( )
pure virtual

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

◆ DeletePreset()

virtual void DeletePreset ( IBrushPreset preset)
pure virtual

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

◆ GetNumPresets()

virtual int GetNumPresets ( )
pure virtual

Returns the current number of brush presets.

◆ GetPresetID()

virtual int GetPresetID ( int  presetIndex)
pure virtual

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

Parameters
[in]presetIndexThe index of the preset
Returns
The preset ID, or zero if the index is out of range

◆ GetPresetIndex()

virtual int GetPresetIndex ( int  presetID)
pure virtual

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

Parameters
[in]presetIDThe ID of the preset
Returns
The index of the preset, or -1 if no preset exists with the given ID

◆ GetActivePreset()

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.

◆ SetActivePreset()

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]presetIDThe ID of the preset

◆ OnContextUpdated()

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]contextIDThe ID of the updated context

◆ ReadConfig()

virtual int ReadConfig ( const MCHAR cfg = NULL)
pure virtual

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

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

◆ WriteConfig()

virtual int WriteConfig ( const MCHAR cfg = NULL)
pure virtual

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

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