SnapData Class Reference

#include <c4d_snapdata.h>

Inheritance diagram for SnapData:

Detailed Description

A data class for creating snap mode plugins. For example Polygon Snap, Edge Snap, Spline Snap, Vertex Snap and so on.

Use RegisterSnapPlugin() to register a snap mode plugin.

Public Member Functions

virtual Bool Init (void)
 
virtual void Free (void)
 
virtual Bool InitSnap (const SnapStruct &ss)
 
virtual Bool Snap (const Vector &p, const SnapStruct &ss, SnapPoint &result)
 
virtual Bool Intersect (const Vector &p, const Vector &n, Bool plane, const SnapStruct &ss, SnapPoint &result)
 
virtual void FreeSnap (const SnapStruct &ss)
 
virtual Bool Draw (const SnapStruct &ss, BaseDocument *doc, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt)
 
virtual Bool GetCursorInfo (const SnapStruct &ss, BaseDocument *doc, BaseDraw *bd, Float x, Float y, BaseContainer &result)
 
virtual Bool MouseInput (const SnapStruct &ss, BaseDocument *doc, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
virtual Bool KeyboardInput (const SnapStruct &ss, BaseDocument *doc, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData (void)
 
void Destructor (void)
 

Member Function Documentation

§ Init()

virtual Bool Init ( void  )
virtual

Called to initialize the snap plugin.

Returns
true if successful, otherwise false.

§ Free()

virtual void Free ( void  )
virtual

Called to free the snap plugin instance.

§ InitSnap()

virtual Bool InitSnap ( const SnapStruct ss)
virtual

Called to prepare snapping to begin.

Parameters
[in]ssThe passed snap context structure.
Returns
true if successful, otherwise false.

§ Snap()

virtual Bool Snap ( const Vector p,
const SnapStruct ss,
SnapPoint result 
)
virtual

Called for 3D Snap detection.

Parameters
[in]pThe position being snapped to in world coordinates.
[in]ssThe passed Snap context structure.
[out]resultAssign data about the resulting snap point if one is generated.
Returns
true if a snap occurred, otherwise false.

§ Intersect()

virtual Bool Intersect ( const Vector p,
const Vector n,
Bool  plane,
const SnapStruct ss,
SnapPoint result 
)
virtual

Called for guide intersection.

Parameters
[in]pThe position being snapped to in world coordinates.
[in]nThe guide normal in world coordinates.
[in]planetrue if the guide is a plane, false if it is a ray/line.
[in]ssThe passed Snap context structure.
[out]resultAssign data about the resulting intersection points if they are generated.
Returns
true if an intersection occurred, otherwise false.

§ FreeSnap()

virtual void FreeSnap ( const SnapStruct ss)
virtual

Called to free any stored data after snapping has occurred.

Parameters
[in]ssThe passed Snap context structure.

§ Draw()

virtual Bool Draw ( const SnapStruct ss,
BaseDocument doc,
BaseDraw bd,
BaseDrawHelp bh,
BaseThread bt 
)
virtual

Called for custom draw during snap.

Parameters
[in]ssThe passed Snap context structure.
[in]docThe current document passed by the tool. The caller owns the pointed document.
[in]bdThe current BaseDraw passed by the tool. The caller owns the pointed BaseDraw.
[in]bhThe current BaseDrawHelp passed by the tool. The caller owns the pointed BaseDrawHelp.
[in]btThe current BaseThread passed by the tool. The caller owns the pointed BaseThread.
Returns
true if successful, otherwise false.

§ GetCursorInfo()

virtual Bool GetCursorInfo ( const SnapStruct ss,
BaseDocument doc,
BaseDraw bd,
Float  x,
Float  y,
BaseContainer result 
)
virtual

Called to intercept the GetCursorInfo purely for the snap.

Parameters
[in]ssThe passed Snap context structure.
[in]docThe current document passed by the tool. The caller owns the pointed document.
[in]bdThe current BaseDraw passed by the tool. The caller owns the pointed BaseDraw.
[in]xThe mouse x position passed by the tool.
[in]yThe mouse y position passed by the tool.
[out]resultThe message container passed by the tool.
Returns
true if to override the active tool, otherwise false.

§ MouseInput()

virtual Bool MouseInput ( const SnapStruct ss,
BaseDocument doc,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

Called to intercept the MouseInput purely for the snap.

Parameters
[in]ssThe passed Snap context structure.
[in]docThe current document passed by the tool. The caller owns the pointed document.
[in]bdThe current BaseDraw passed by the tool. The caller owns the pointed BaseDraw.
[in]winThe current EditorWindow passed by the tool. The caller owns the pointed EditorWindow.
[in]msgThe message container passed by the tool.
Returns
true if to override the active tool, otherwise false.

§ KeyboardInput()

virtual Bool KeyboardInput ( const SnapStruct ss,
BaseDocument doc,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

Called to intercept the KeyboardInput purely for the snap.

Parameters
[in]ssThe passed Snap context structure.
[in]docThe current document passed by the tool. The caller owns the pointed document.
[in]bdThe current BaseDraw passed by the tool. The caller owns the pointed BaseDraw.
[in]winThe current EditorWindow passed by the tool. The caller owns the pointed EditorWindow.
[in]msgThe message container passed by the tool.
Returns
true if to override the active tool, otherwise false.