Class GenericNamedSelSetList

3DS Max Plug-In SDK

Class GenericNamedSelSetList

See Also: Class BitArray.

Description:

This class is available in release 3.0 and later only.

This class is a tool for manipulating lists of named selection sets. This class is used by modifiers such as the edit mesh, mesh select, spline select and edit patch.

All methods of this class are implemented by the system.

Data Members:

public:

Tab<TSTR*> names;

A table of names, one for each selection set.

Tab<BitArray*> sets;

The bit array pointers for the selection sets.

Tab<DWORD> ids;

A table of Ids, one for each selection set.

Methods:

public:

Prototype:

~GenericNamedSelSetList();

Remarks:

Destructor. The names and sets are deleted.

Prototype:

BitArray *GetSet(TSTR name);

Remarks:

Returns a pointer to the bit array corresponding to the specified name. If the set is not found NULL is returned.

Parameters:

TSTR name

The name of the selection set to retrieve.

Prototype:

BitArray *GetSet(DWORD id);

Remarks:

Returns a poniter to the bit array corresponding to the specified ID. If the set is not found NULL is returned.

Parameters:

DWORD id

The id of the selection set to retrieve.

Prototype:

BitArray *GetSetByIndex(int index);

Remarks:

Returns a pointer to the bit array corresponding to the specified index in the list. If the set is not found NULL is returned.

Parameters:

int index

The zero based index of the selection set to retrieve (>= 0 and < sets.Count()).

Prototype:

int Count();

Remarks:

Returns the number of selection sets.

Prototype:

void AppendSet(BitArray &nset, DWORD id=0, TSTR name=_T(""));

Remarks:

Appends the named selection set data to the list of sets maintained by this class.

Parameters:

BitArray &nset

The selection set data to append.

DWORD id=0

An ID for the selection set.

TSTR name=_T("")

The name for the selection set.

Prototype:

void InsertSet(int pos, BitArray &nset, DWORD id=0, TSTR &name=TSTR(""));

Remarks:

Inserts the named selection set data into the list of sets maintained by this class.

Parameters:

int pos

The position in the list where this named selection set should be inserted. If pos >= Count(), AppendSet() is automatically used instead.

BitArray &nset

The selection set data to insert.

DWORD id=0

An ID for the selection set.

TSTR &name=TSTR("")

The name for the selection set.

Prototype:

int InsertSet(BitArray &nset,DWORD id=0,TSTR &name=TSTR(""));

Remarks:

This method is similar to InsertSet() above, however instead of accepting an explicit location this method inserts the new set alphabetically in the list. (Of course, this requires an alphabetized list to work properly, although there's no problem if the list is not alphabetized.)

Parameters:

BitArray &nset

The selection set data to insert.

DWORD id=0

An ID for the selection set.

TSTR &name=TSTR("")

The name for the selection set.

Return Value:

The position where the set was inserted.

Prototype:

BOOL RemoveSet(TSTR name);

Remarks:

Removes the selection set whose name is passed.

Parameters:

TSTR name

The name of the selection set to remove.

Return Value:

TRUE on success; otherwise FALSE.

Prototype:

BOOL RemoveSet(DWORD id);

Remarks:

Removes the selection set whose ID is passed.

Parameters:

DWORD id

The id of the selection set to retrieve.

Return Value:

TRUE on success; otherwise FALSE.

Prototype:

void SetSize(int size);

Remarks:

Resizes the selectin set bit arrays to the specified number of bits. The old selection set data is preserved.

Parameters:

int size

The new size for the bit arrays in bits.

Prototype:

void DeleteSetElements(BitArray &set,int m=1);

Remarks:

This method is not currently used. What it does however, is go through all of the named selection sets and deletes array elements according to which bits are set in the given bit array. It could be used to keep the named selection set bit arrays in line with the vertex array (for example).

Prototype:

void DeleteSet(int i);

Remarks:

Deletes the named selection set whose index is passed.

Parameters:

int i

The zero based index of the set to delete (>=0 and < sets.Count()).

Prototype:

BOOL RenameSet(TSTR &oldName, TSTR &newName);

Remarks:

This locates the named selection set oldName and renames it to newName.

Parameters:

TSTR &oldName

The old name of the set.

TSTR &newName

The new name for the set.

Return Value:

TRUE if the operation succeeded; otherwise FALSE. It will only fail if the oldName set is not present.

Prototype:

void Alphabetize();

Remarks:

Alphabetizes the list of names.

Prototype:

IOResult Load(ILoad *iload);

Remarks:

This method is used internally to load the selection sets from disk.

Prototype:

IOResult Save(ISave *isave);

Remarks:

This method is used internally to save the selection sets to disk.

Prototype:

BitArray &operator[](int i);

Remarks:

Returns a reference to the 'i-th' selection set.

Parameters:

int i

The zero based index of the selection set to return.

Prototype:

GenericNamedSelSetList& operator=(GenericNamedSelSetList& from);

Remarks:

Assignment operator. This list of sets is emptied and then copied from the list passed.

Parameters:

GenericNamedSelSetList& from

The list of selection sets to copy.