SnapCore Class Reference Snapping

#include <c4d_snapdata.h>

详细描述

The Snap Interface, must be allocated either with AutoAlloc ,或 Alloc() and freed after use with Free() .

私有成员函数

  SnapCore ()

Alloc/Free

static SnapCore Alloc (void)
static void  Free ( SnapCore *&p)

Snap/Intersect

Bool   Init ( BaseDocument *doc, BaseDraw *bd, AtomArray *exclude=nullptr)
Bool   更新 (void)
Bool   Snap (const 向量 &p, SnapResult &result, SNAPFLAGS flags= SNAPFLAGS::NONE )
Bool   Intersect (const 向量 &p, const 向量 &n, Bool plane, SnapResult &result, SNAPFLAGS flags= SNAPFLAGS::NONE )

Inferred

BaseObject AddInferred ( BaseDocument *doc, const 矩阵 &mat, INFERREDGUIDETYPE type)
Bool   FlushInferred (void)

杂项

void  SetToolObject ( BaseObject *op)
void  SetCustomExcludeList ( maxon::BaseArray < SnapExclude > *snapExcludeList)

构造函数 & 析构函数文档编制

◆  SnapCore()

SnapCore () private

成员函数文档编制

◆  Alloc()

static SnapCore * Alloc ( void  )
static

Allocates a snap core. Destroy the allocated snap core with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated snap core, or nullptr if the allocation failed.

◆  Free()

static void Free ( SnapCore *&  p )
static

Destructs snap cores allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in] p The snap core to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  Init()

Bool Init ( BaseDocument doc ,
BaseDraw bd ,
AtomArray exclude = nullptr  
)

Snap initialization routine.

参数
[in] doc The current document. The caller owns the pointed document.
[in] bd The BaseDraw to initialize. The caller owns the pointed BaseDraw .
[in] exclude An array of objects to exclude from being snapped to. The caller owns the pointed array.
返回
True on success of initializing the snap.

◆  Update()

Bool 更新 ( void  )

Updates the snaps to use the current settings.

返回
true if successful, otherwise false .

◆  Snap()

Bool Snap ( const 向量 p ,
SnapResult result ,
SNAPFLAGS   flags = SNAPFLAGS::NONE  
)

Snap routine.

参数
[in] p The position to snap to in global space.
[out] result The position to snap to in global space.
[in] flags The flags to limit snapping on selection or to a specific type: SNAPFLAGS
返回
true on success of finding a snap point, false if no point was found in range to snap to.

◆  Intersect()

Bool Intersect ( const 向量 p ,
const 向量 n ,
Bool   plane ,
SnapResult result ,
SNAPFLAGS   flags = SNAPFLAGS::NONE  
)

Snap intersection routine.

参数
[in] p The position to snap to in global space.
[in] n The normal of the guide being intersected with in global space.
[in] plane true if the intersection should be with a plane, false if with a ray/line.
[out] result The result of the successful intersection, user owns this.
[in] flags The flags to limit snapping on selection or to a specific type: SNAPFLAGS
返回
true on success of finding an intersection, false if no intersection was found in range.

◆  AddInferred()

BaseObject * AddInferred ( BaseDocument doc ,
const 矩阵 mat ,
INFERREDGUIDETYPE   type  
)

Adds an inferred guide point, line or plane to the scene for snapping to.

参数
[in] doc The current document. The caller owns the pointed document.
[in] mat The matrix for the point (axis), line, or plane, z points along the line or as the normal for the plane.
[in] type The type of inferred guide to add: INFERREDGUIDETYPE
返回
true on success of adding the guide, false for a memory error attempting to do so.

◆  FlushInferred()

Bool FlushInferred ( void  )

Flushes inferred system guides and inferred elements.

注意
Should be called at mouse release.
返回
true if all inferred guides were removed, otherwise false .

◆  SetToolObject()

void SetToolObject ( BaseObject op )

Sets the active object and pass it to snap system if is created from current tool.

注意
Important for tool guide.
参数
[in] op The new object created in the tool. The caller owns the pointed object.

◆  SetCustomExcludeList()

void SetCustomExcludeList ( maxon::BaseArray < SnapExclude > *  snapExcludeList )

Passes to the snap a new exclusion list.

注意
Has to be done before a snap call and will stay valid just for the next snap session.
This is useful if different exclusion types are needed during the drag without reinitializing the class.
参数
[in] snapExcludeList A pointer to a maxon::BaseArray of exclusion data or nullptr to clear internal pointer. The caller owns the pointed array.