-
首页
-
C4D R23.110 C++ SDK
BaseSelect Class Reference
#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.
-
注意
-
Has to be created with
Alloc()
and destroyed with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
构造函数 & 析构函数文档编制
◆
BaseSelect()
◆
~BaseSelect()
成员函数文档编制
◆
Alloc()
Allocates a base selection. Destroy the allocated base selection with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated base selection, or
nullptr
if the allocation failed.
◆
Free()
Destructs base selections allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
bs
|
The base selection to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
GetCount()
Int32
GetCount
|
(
|
void
|
|
)
|
const
|
Gets the number of selected elements.
-
返回
-
The number of selected elements.
◆
GetSegments()
Int32
GetSegments
|
(
|
void
|
|
)
|
const
|
Gets the number of segments that contain elements.
-
注意
-
For example: with the selections
0
..
4
,
6
..
7
,
9
..
12
,
GetSegments()
would return
3
and
GetCount()
would return
11
.
-
返回
-
The number of segments with selected elements.
◆
Select()
Selects an element.
-
参数
-
[in]
|
num
|
The element index to select.
|
-
返回
-
true
if the element was already selected, otherwise
false
.
◆
SelectAll()
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
).
|
-
返回
-
Success of selecting the elements.
◆
Deselect()
[1/2]
Deselects an element.
-
参数
-
[in]
|
num
|
The element index to deselect.
|
-
返回
-
true
if the element was already deselected, otherwise
false
.
◆
DeselectAll()
Bool
DeselectAll
|
(
|
void
|
|
)
|
|
Deselects all elements.
-
返回
-
Success of deselecting all elements.
◆
Toggle()
Toggles the selection state of an element.
-
参数
-
[in]
|
num
|
The element index to toggle.
|
-
返回
-
Success of changing the selection state of the element.
◆
ToggleAll()
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.
|
-
返回
-
Success of changing the selection state.
◆
GetRange()
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.
|
-
返回
-
true
if if the range was successfully retrieved, otherwise
false
. Only
false
if
seg
is not
0
<=
seg
<
GetSegments()
The spans are always sorted (spans with higher index have higher numbers for
a
/
b
), also
b
is always >=
a
.
◆
IsSelected()
Checks the selection state of an element.
To efficiently go through selections use the following code:
Int32
seg = 0, a, b, i;
while
(bs->GetRange(seg++,
LIMIT<Int32>::MAX
, &a, &b))
{
for
(i=a; i<=b; ++i)
{
// Do something. 'i' is the selected element
}
}
This is faster than:
for
(i=0; i<maxelements; i++)
{
if
(bs->IsSelected(i))
{
// Do something
}
}
-
参数
-
[in]
|
num
|
The element index to get the state for.
|
-
返回
-
true
if the element
num
is selected, otherwise
false
.
◆
CopyTo()
Copies the selection elements to another
BaseSelect
.
-
参数
-
[out]
|
dest
|
The destination selection. The caller owns the pointed selection.
|
-
返回
-
true
if selection elements were copied successfully, otherwise
false
.
◆
GetClone()
Makes a duplicate of the selection with its elements.
-
返回
-
The cloned
BaseSelect
or
nullptr
if failed. The caller owns the pointed
BaseSelect
.
◆
Merge()
Selects all elements that are in
src
.
-
参数
-
[in]
|
src
|
The source selection. The caller owns the pointed selection.
|
-
返回
-
true
if the selection elements were merged successfully, otherwise
false
.
◆
Deselect()
[2/2]
Deselects all elements that are in
src
.
-
参数
-
[in]
|
src
|
The source selection. The caller owns the pointed selection.
|
-
返回
-
true
if the selection elements were deselected successfully, otherwise
false
.
◆
Cross()
Intersects all elements in
src
.
-
参数
-
[in]
|
src
|
The source selection. The caller owns the pointed selection.
|
-
返回
-
true
if the selection elements were crossed successfully, otherwise
false
.
◆
FromArray()
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.
-
警告
-
The old selection will completely be overridden.
-
参数
-
[in]
|
selection
|
An array of elements to select. The caller owns the pointed array.
|
[in]
|
count
|
The number of elements in the array.
|
-
返回
-
true
if the elements from the array were selected successfully, otherwise
false
.
◆
ToArray()
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.
-
警告
-
The array is created with
NewMemClear()
and must be freed with
DeleteMem()
afterward.
-
参数
-
[in]
|
count
|
The number of elements to place into the array.
|
-
返回
-
The array containing the selected elements or
nullptr
if failed. The caller owns the pointed array.
◆
ToBitSet()
-
返回
-
true
if the elements from the array were selected successfully, otherwise
false
.
◆
Read()
Reads a selection from a file.
-
参数
-
[in]
|
hf
|
The file to read a selection from. The caller owns the pointed hyper file.
|
-
返回
-
true
if a selection was successfully read, otherwise
false
.
◆
Write()
Writes the selection to a file.
-
参数
-
[in]
|
hf
|
The file to write the selection to. The caller owns the pointed hyper file.
|
◆
FindSegment()
Calculates which segment contains the element
num
and returns it in
segment
.
-
参数
-
[in]
|
num
|
An element number.
|
[out]
|
segment
|
Assigned the found segment index.
|
-
返回
-
true
if the segment was found, otherwise
false
.
◆
GetDirty()
Gets the dirty counter of the selection.
-
注意
-
The dirty counter is increased every time a function that changes the selection is called.
-
返回
-
The dirty counter.
◆
GetLastElement()
Int32
GetLastElement
|
(
|
void
|
|
)
|
const
|
Gets the last selected element, e.g. the last element selected through
Select()
.
-
返回
-
The last selected element.
◆
IsAllSelected()
Checks if all elements from zero to num-1 are selected.
-
参数
-
[in]
|
num
|
Number of elements to check.
|
-
返回
-
True, if all elements are selected.
◆
IsNothingSelected()
Bool
IsNothingSelected
|
(
|
|
)
|
const
|
Checks if nothing is selected.
-
返回
-
True, if nothing is selected.
◆
GetData()
Private
.
◆
CopyFrom()
Private
.
maxon::Int32 Int32
定义:
ge_sys_math.h:58