Main Index : Reference :
class BaseSelect
{
public:
BaseSelect();
[bool] Init();
[bool] Deselect([int] num);
[bool] Select([int] num);
[bool] Toggle([int] num);
[bool] DeselectAll();
[bool] SelectAll([int] min, [int] max);
[bool] ToggleAll([int] min, [int] max);
[bool] IsSelected([int] num);
[int] GetCount();
[bool] CopyTo([BaseSelect] dest);
[BaseSelect] GetClone();
}
This class is used to keep track of point and polygon selections. Using a bit array for marking every point either as selected or deselected can be very memory expensive. Imagine having an object with 500.000 points and only 1 point is selected! One would need at least 2 MByte of ram for this array. Instead, CINEMA 4D uses a clever internal compression algorithm to reduce memory size by a factor of 1000 and more. Nevertheless access is very fast.
[bool] Init();
Resets the selection and all internal cache data. Returns TRUE
if successful.
[bool] Deselect([int] num);
Deselects element num
. Returns TRUE
if successful.
[bool] Select([int] num);
Selects element num
. Returns TRUE
if successful.
[bool] Toggle([int] num);
Toggles the selection state of element num
. Returns TRUE
if successful.
[bool] DeselectAll();
Deselects all elements. Returns TRUE
if successful.
[bool] SelectAll([int] min, [int] max);
Selects all elements from min
to max
. Returns TRUE
if successful.
[bool] ToggleAll([int] min, [int] max);
Toggles the selection state of all elements from min
to max
. Returns TRUE
if successful.
[bool] IsSelected([int] num);
Returns the selection state of element num
.
[int] GetCount();
Returns the number of selected elements.
[bool] CopyTo([BaseSelect] dest);
Copies the selection to dest
. Returns TRUE
if successful.
[BaseSelect] GetClone();
Returns a copy of the selection.
// Prints all selected points of an object
var obj = doc->FindObject("MyObject");
var select = obj->GetPointSelection();
var i = 0;
var found = 0;
for (i = 0; i < obje->GetPointCount(); i++)
{
if (found >= select->GetCount()) break;
if (select->IsSelected(i))
{
println(obj->GetPoint(i));
found++;
}
}