#include <c4d_baseselect.h>
This class is used to keep track of point and polygon selections, it may also be used to track other types of element selections.
Private Member Functions | |
BaseSelect () | |
~BaseSelect () | |
Alloc/Free | |
static BaseSelect * | Alloc (void) |
static void | Free (BaseSelect *&bs) |
Selection/Segment Count | |
Int32 | GetCount (void) const |
Int32 | GetSegments (void) const |
Select/Deselect/Toggle | |
Bool | Select (Int32 num) |
Bool | SelectAll (Int32 min, Int32 max, Bool deselectAll=true) |
Bool | Deselect (Int32 num) |
Bool | DeselectAll (void) |
Bool | Toggle (Int32 num) |
Bool | ToggleAll (Int32 min, Int32 max) |
Get/Check Selection | |
Bool | GetRange (Int32 seg, Int32 maxElements, Int32 *a, Int32 *b) const |
Bool | IsSelected (Int32 num) const |
Copy/Clone | |
Bool | CopyTo (BaseSelect *dest, Bool alwaysDirty=true) const |
BaseSelect * | GetClone (void) const |
Merge/Deselect/cross | |
Bool | Merge (const BaseSelect *src) |
Bool | Deselect (const BaseSelect *src) |
Bool | Cross (const BaseSelect *src) |
Conversion from/to Array | |
Bool | FromArray (UChar *selection, Int32 count) |
UChar * | ToArray (Int32 count) const |
Bool | ToBitSet (Int32 count, maxon::BaseBitSet< maxon::DefaultAllocator > &bitSet) const |
Read/Write | |
Bool | Read (HyperFile *hf) |
void | Write (HyperFile *hf) |
Miscellaneous | |
Bool | FindSegment (Int32 num, Int32 *segment) const |
Int32 | GetDirty () const |
Int32 | GetLastElement (void) const |
Bool | IsAllSelected (Int32 num) const |
Bool | IsNothingSelected () const |
Bool | IsEqual (const BaseSelect &other) const |
Private | |
BaseSelectData * | GetData () |
Bool | CopyFrom (BaseSelectData *ndata, Int32 ncnt) |
|
private |
|
private |
|
static |
|
static |
Int32 GetCount | ( | void | ) | const |
Gets the number of selected elements.
Int32 GetSegments | ( | void | ) | const |
Gets the number of segments that contain elements.
Selects an element.
[in] | num | The element index to select. |
Selects all elements in the given range.
[in] | min | The first element to select. |
[in] | max | The last element in the range to select. |
[in] | deselectAll | Since R17. Deselects all previously selected elements before creating the new selection (equivalent to SELECTION_NEW). |
Deselects an element.
[in] | num | The element index to deselect. |
Bool DeselectAll | ( | void | ) |
Deselects all elements.
Toggles the selection state of an element.
[in] | num | The element index to toggle. |
Toggles the selection state of all elements in the given range.
[in] | min | The first element to toggle. |
[in] | max | The last element to toggle in the range. |
Gets the selected elements contained in a segment.
[in] | seg | The segment to get the elements for. 0 <= seg < GetSegments() |
[in] | maxElements | The maximum value for a and b. Makes sure a and b are < maxElements. Pass LIMIT<Int32>::MAX for no additional checks. |
[out] | a | Assigned the index of the first selected element. |
[out] | b | Assigned the index of the last selected element. |
Checks the selection state of an element.
To efficiently go through selections use the following code:
This is faster than:
[in] | num | The element index to get the state for. |
Bool CopyTo | ( | BaseSelect * | dest, |
Bool | alwaysDirty = true |
||
) | const |
Copies the selection elements to another BaseSelect.
[out] | dest | The destination selection. The caller owns the pointed selection. @paran[in] alwaysDirty If true, the destination BaseSelect is always made dirty. Otherwise it is only made dirty when it is different than the source. |
BaseSelect* GetClone | ( | void | ) | const |
Makes a duplicate of the selection with its elements.
Bool Merge | ( | const BaseSelect * | src | ) |
Selects all elements that are in src.
[in] | src | The source selection. The caller owns the pointed selection. |
Bool Deselect | ( | const BaseSelect * | src | ) |
Deselects all elements that are in src.
[in] | src | The source selection. The caller owns the pointed selection. |
Bool Cross | ( | const BaseSelect * | src | ) |
Intersects all elements in src.
[in] | src | The source selection. The caller owns the pointed selection. |
Gets a number of selected elements from an array. The elements in the array are interpreted as Bool: 0 means the element is unselected, and 1 means it is selected.
[in] | selection | An array of elements to select. The caller owns the pointed array. |
[in] | count | The number of elements in the array. |
Gets an array of selected elements. The elements in the array are interpreted as Bool: 0 means the element is unselected, and 1 means it is selected.
[in] | count | The number of elements to place into the array. |
Bool ToBitSet | ( | Int32 | count, |
maxon::BaseBitSet< maxon::DefaultAllocator > & | bitSet | ||
) | const |
Reads a selection from a file.
[in] | hf | The file to read a selection from. The caller owns the pointed hyper file. |
void Write | ( | HyperFile * | hf | ) |
Writes the selection to a file.
[in] | hf | The file to write the selection to. The caller owns the pointed hyper file. |
Calculates which segment contains the element num and returns it in segment.
[in] | num | An element number. |
[out] | segment | Assigned the found segment index. |
Int32 GetDirty | ( | ) | const |
Gets the dirty counter of the selection.
Int32 GetLastElement | ( | void | ) | const |
Gets the last selected element, e.g. the last element selected through Select().
Checks if all elements from zero to num-1 are selected.
[in] | num | Number of elements to check. |
Bool IsNothingSelected | ( | ) | const |
Checks if nothing is selected.
Bool IsEqual | ( | const BaseSelect & | other | ) | const |
Checks if two BaseSelect are equal.
[in] | other | The BaseSelect to compare with. |
BaseSelectData* GetData | ( | void | ) |
Private.
Bool CopyFrom | ( | BaseSelectData * | ndata, |
Int32 | ncnt | ||
) |
Private.