3ds Max C++ API Reference
Loading...
Searching...
No Matches
PBAccessor Class Reference

#include <iparamb2.h>

+ 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)
 
void Get (PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t, Interval &&valid=FOREVER)
 
virtual void Set (PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
virtual void PreSet (PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
virtual void PostSet (const PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
virtual BOOL KeyFrameAtTime (ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t)
 
 __declspec (deprecated) virtual MSTR GetLocalName(ReferenceMaker *owner
 
virtual MSTR GetLocalName (ReferenceMaker *owner, ParamID id, int tabIndex, bool localized)
 
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.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Public Attributes

ParamID id
 
ParamID int tabIndex MAX_SEALED
 

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

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

Member Enumeration Documentation

◆ tab_changes

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

Member Function Documentation

◆ Get() [1/2]

virtual void Get ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t,
Interval valid 
)
inlinevirtual
Remarks
This method is called when IParamBlock2::GetValue is called on parameter 'id', and the parameter value is v. This method is called after the controller is accessed, so the current controller value is seen and can be optionally overridden in 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
v- The value being accessed.
owner- Points to the owner of the parameter block.
id- The permanent ID of the parameter.
tabIndex- If the parameter is a Tab<> this is the zero based index of the parameter in the table.
t- The current time the get is taking place.

valid- The validity interval to update.
The intersection of the provided "valid" interval with the interval for the provided TimeValue and returned as the updated interval value.
Default Implementation:
{} Notes: The content of 'v' is the value from the IParamBlock2 parameter, and can be changed by this Get method. If the parameter type is such that the parameter value is a data value held by a pointer (v.p, v.p4, v.m, v.p2) that pointer is guaranteed to be non-null, and the Get method must not set it to null. Either the existing data value must be updated in-place (pointer unchanged), or the existing data value must be deleted (typically using PB2Value::Free) and a new pointer assigned. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_STRING or TYPE_FILENAME, v.s contains a pointer to a copy of the string, and owns this copy. v.s may be null. The string can be modified in place, or can be replaced with a new string using the PB2Value's ReplaceString method. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_BITMAP, v.bm contains a pointer to a PBBitmap, and owns this pointer. v.bm may be null. The PBBitmap can be modified in place, or the existing PBBitmap must be deleted (typically using PB2Value::Free) and a new pointer assigned (typically by cloning a PBBitmap. The PB2Value will free this pointer when it is done using the data.

Reimplemented in MSPluginPBAccessor.

2116{ }

◆ Get() [2/2]

void Get ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t,
Interval &&  valid = FOREVER 
)
inline
Remarks
Use this overload when validity interval is irrelevant
See also
PBAccessor::Get
2121 {
2122 Get(v, owner, id, tabIndex, t, valid);
2123 }
virtual void Get(PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
Definition: iparamb2.h:2116

◆ Set()

virtual void Set ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t 
)
inlinevirtual
Remarks
This method is called when IParamBlock2::SetValue is called on parameter 'id', and the parameter value being set is v. This is called just before calling SetValue() on the parameter's 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 block.

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:
{} Notes: The content of 'v' is the value being set on the IParamBlock2 parameter, and can be changed by this Set method. If you get the value of the parameter from the parameter block from within the Set method, whether the value returned will be the existing value or the new value varies by parameter type and whether the parameter is animatable. For parameter types that correspond to data types such as float, integer, and point3, the Set method is called before the parameter block parameter is set unless the parameter block parameter is already animated or setting the value would cause it to be animated. If the parameter block parameter would remain constant after the set, the Set method is called after the parameter block parameter is set. If the parameter type is such that the parameter value is a data value held by a pointer (v.p, v.p4, v.m, v.p2) that pointer is guaranteed to be non-null, and the Set method must not set it to null. Either the existing data value must be updated in-place (pointer unchanged), or the existing data value must be deleted (typically using PB2Value::Free) and a new pointer assigned. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_STRING or TYPE_FILENAME, v.s contains a pointer to a copy of the string, and owns this copy. v.s may be null. The string can be modified in place, or can be replaced with a new string using the PB2Value's ReplaceString method. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_BITMAP, v.bm contains a pointer to a PBBitmap, and owns this pointer. v.bm may be null. The PBBitmap can be modified in place, or the existing PBBitmap must be deleted (typically using PB2Value::Free) and a new pointer assigned (typically by cloning a PBBitmap. The PB2Value will free this pointer when it is done using the data.

Reimplemented in MSPluginPBAccessor.

2164{ }

◆ PreSet()

virtual void PreSet ( PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t 
)
inlinevirtual
Remarks
This method is called when IParamBlock2::SetValue is called on parameter 'id', and the parameter value being set is v. This is called before setting the parameter's value or calling SetValue() on the parameter's 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 block.

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:
{} Notes: The content of 'v' is the value being set, and can be changed by the PreSet method. If you get the value of the parameter from the parameter block from within the PreSet method, the value returned will be the existing value. If the parameter type is such that the parameter value is a data value held by a pointer (v.p, v.p4, v.m, v.p2) that pointer is guaranteed to be non-null, and the PreSet method must not set it to null. Either the existing data value must be updated in-place (pointer unchanged), or the existing data value must be deleted (typically using PB2Value::Free) and a new pointer assigned. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_STRING or TYPE_FILENAME, v.s contains a pointer to a copy of the string, and owns this copy. v.s may be null. The string can be modified in place, or can be replaced with a new string using the PB2Value's ReplaceString method. The PB2Value will free this pointer when it is done using the data. If the parameter type is TYPE_BITMAP, v.bm contains a pointer to a PBBitmap, and owns this pointer. v.bm may be null. The PBBitmap can be modified in place, or the existing PBBitmap must be deleted (typically using PB2Value::Free) and a new pointer assigned (typically by cloning a PBBitmap. The PB2Value will free this pointer when it is done using the data.

Reimplemented in MSPluginPBAccessor.

2201{ }

◆ PostSet()

virtual void PostSet ( const PB2Value v,
ReferenceMaker owner,
ParamID  id,
int  tabIndex,
TimeValue  t 
)
inlinevirtual
Remarks
This method is called when IParamBlock2::SetValue is called on parameter 'id', and the parameter value being set is v. This is called after setting the parameter's value or calling SetValue() on the parameter's controller.
Parameters:
const PB2Value& v

The value that was set.

ReferenceMaker* owner

Points to the owner of the parameter block.

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:
{} Notes: The content of 'v' is the value that was set, and cannot be changed by the PostSet method. If you get the value of the parameter from the parameter block from within the PostSet method, the value returned will be the new value. If the parameter type is such that the parameter value is a data value held by a pointer (v.p, v.p4, v.m, v.p2) that pointer is guaranteed to be non-null.

Reimplemented in MSPluginPBAccessor.

2228{ }

◆ KeyFrameAtTime()

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

ParamID id

The permanent ID of the parameter.

int tabIndex

TimeValue t

The current time.
Default Implementation:
{ return FALSE; }

Reimplemented in MSPluginPBAccessor.

2249{ return FALSE; }

◆ __declspec()

__declspec ( deprecated  )
Note
This method has been deprecated in terms of implementation as of 3ds Max 2022. Plugin developers should implement GetLocalName(ReferenceMaker* owner, ParamID id, int tabIndex, bool localized) instead. This method can no longer be overriden and calls to it are now forwarded to the function that replaced it with a "bool localized" value of true. This is done so that plugin developers who do not localize their plugins don't have to update all the places where they call this method. Plugin developers who do localize their plugins should analyze the places where they call this method to decide what value to pass it for the "bool localized" parameter.
See also
PBAccessor::GetLocalName(ReferenceMaker* owner, ParamID id, int tabIndex, bool localized)

◆ GetLocalName()

virtual MSTR GetLocalName ( ReferenceMaker owner,
ParamID  id,
int  tabIndex,
bool  localized 
)
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 supply a p_accessorPBAccessor instance pointer that has this method implemented.
Parameters:
ReferenceMaker* owner

Points to the owner of the parameter block.

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

If true, then the name returned should be localized in the language 3ds Max is currently using. Otherwise it should be the name in English. If a plugin does not provide localized string resources, it can disregard this parameter and always return the name in English.
Default Implementation:
{ return _M(""); }
2284 {
2285 return _M("");
2286 }
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

◆ TabChanged()

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

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

Reimplemented in MSPluginPBAccessor.

2310{ }

◆ DeleteThis()

virtual void DeleteThis ( )
inlinevirtual
Remarks
This method that can be used to destroy dynamically allocated instances of this class.
Default Implementation:
{ }

Reimplemented in MSPluginPBAccessor.

2317{ };

Member Data Documentation

◆ id

ParamID id

◆ MAX_SEALED

ParamID int tabIndex MAX_SEALED
Initial value:
{
return GetLocalName(owner, id, tabIndex, true)
virtual MSTR GetLocalName(ReferenceMaker *owner, ParamID id, int tabIndex, bool localized)
Definition: iparamb2.h:2283