PBAccessor Class Reference

#include <iparamb2.h>

Class Description

See also
Structure ParamDef, ParamType, ParamType2, Class ReferenceMaker, Structure PB2Value.

Description:
Any parameter in a block can have an accessor callback object that has its Get() or Set() method called whenever the parameter is accessed. This may be used to provide access to dynamically-computed virtual parameters and sometimes to allow parameter-specific processing by the class as the parameter in the block is modified (such as keeping object data members up-to-date).

The Get() and Set() methods are called at all times when a parameter is accessed, including parameters that are animated. The Get() method is called after the controller is accessed, so the current controller value is seen and can be optionally overridden in the Get() method. Note that the controller is accessed whenever the 3ds Max time is changed (such as a frame slider move) and so the Get() method will be called each frame as this happens.

A pointer to an instance of this class is a data member of the ParamDef structure.
+ Inheritance diagram for PBAccessor:

Public Types

enum  tab_changes {
  tab_insert, tab_append, tab_delete, tab_ref_deleted,
  tab_setcount, tab_sort
}
 

Public Member Functions

virtual void Get (PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
 
virtual void Set (PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
virtual BOOL KeyFrameAtTime (ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
virtual MSTR GetLocalName (ReferenceMaker *owner, ParamID id, int tabIndex)
 
virtual void TabChanged (tab_changes changeCode, Tab< PB2Value > *tab, ReferenceMaker *owner, ParamID id, int tabIndex, int count)
 
virtual void DeleteThis ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 

Additional Inherited Members

- 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...
 

Member Enumeration Documentation

Enumerator
tab_insert 
tab_append 
tab_delete 
tab_ref_deleted 
tab_setcount 
tab_sort 
Definition: iparamb2.h:2052
Definition: iparamb2.h:2052
Definition: iparamb2.h:2052
Definition: iparamb2.h:2052
Definition: iparamb2.h:2052
Definition: iparamb2.h:2052

Member Function Documentation

virtual void Get ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t,
Interval valid 
)
inlinevirtual
Remarks
This method is called when the specified owner object accesses (gets) the value v. This is called after the controller is accessed, so the current controller value is seen and can be optionally overridden in the this method. Note that the controller is accessed whenever the 3ds Max time is changed (such as a slider move) and so this method will be called each frame as this happens.
Parameters:
PB2Value& v

The value being accessed.

ReferenceMaker* owner

Points to the owner of the parameter.

ParamID id

The permanent ID of the parameter.

int tabIndex

If the parameter is a Tab<> this is the zero based index of the parameter in the table.

TimeValue t

The current time the get is taking place.

Interval &valid

The validity interval for the value.
Default Implementation:
{}
1994 { }
virtual void Set ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t 
)
inlinevirtual
Remarks
This method is called when the specified owner objects sets the value v. This is called just before calling SetValue() on the parameters controller, so it can take note of the value going in and change it if desired.
Parameters:
PB2Value& v

The value being set.

ReferenceMaker* owner

Points to the owner of the parameter.

ParamID id

The permanent ID of the parameter.

int tabIndex

If the parameter is a Tab<> this is the zero based index of the parameter in the table.

TimeValue t

The current time the set is taking place.
Default Implementation:
{}
2013 { }
virtual BOOL KeyFrameAtTime ( ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t 
)
inlinevirtual
Remarks
Checks to see if a keyframe exists for the given parameter at the given time. Returns TRUE if a keyframe exists at the specified time; otherwise FALSE. For parameters not directly hosted in the parameter block that are internally animatable, this provides a keyframe query callback so that any ParamMap2 spinners associated with these 'virtual' parameters can show keyframe status for the underlying parameter. In these cases, developers should implement this method for the parameter usually asking the underlying parameter for its keyframe state.
Parameters:
ReferenceMaker* owner

Points to the owner of the parameter.

ParamID id

The permanent ID of the parameter.

int tabIndex

TimeValue t

The current time.
Default Implementation:
{ return FALSE; }
2033 { return FALSE; }
virtual MSTR GetLocalName ( ReferenceMaker owner,
ParamID  id,
int  tabIndex 
)
inlinevirtual
Remarks
This allows a plug-in to provide a dynamically-created local name for a parameter or Tab<> parameter entry. If you specify the P_COMPUTED_NAME parameter flag, you also need to suppy a p_accessorPBAccessor instance pointer that has this method implemented.
Parameters:
ReferenceMaker* owner

Points to the owner of the parameter.

ParamID id

The permanent ID of the parameter.

int tabIndex

If the parameter is a Tab<> this is the zero based index of the parameter in the table.
Default Implementation:
{ return _M(""); }
2050 { return _M(""); }
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67
virtual void TabChanged ( tab_changes  changeCode,
Tab< PB2Value > *  tab,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
int  count 
)
inlinevirtual
Remarks
This method is called when a Tab<> parameter has a change made to its table structure.
Parameters:
tab_changes changeCode

Describes the change that has just occurred to the Tab<> parameter. One of the following enumerations:

enum tab_changes { tab_insert, tab_append, tab_delete, tab_ref_deleted, tab_setcount, tab_sort };

Tab<PB2Value>* tab

Points to the actual Tab<> in the pblock parameter.

ReferenceMaker* owner

Points to the owner of the parameter.

ParamID id

The permanent ID of the parameter.

int tabIndex

The start index of the change (for tab_insert, tab_append, tab_delete, tab_ref_deleted)

int count

The number of elements changed (for tab_insert, tab_append, tab_delete).
2073 { }
virtual void DeleteThis ( )
inlinevirtual
Remarks
This method that can be used to destroy dynamically allocated instances of this class.
Default Implementation:
{ }
2079 { };