3ds Max C++ API Reference
IOsnapManager Class Referenceabstract

#include <omanapi.h>

+ Inheritance diagram for IOsnapManager:

Public Member Functions

virtual BOOL getactive () const =0
 
virtual BOOL getAxisConstraint ()=0
 
virtual void RecordHit (OsnapHit *somehit)=0
 
virtual BOOL OKForRelativeSnap ()=0
 
virtual BOOL RefPointWasSnapped ()=0
 
virtual Point3 GetRefPoint (BOOL top=TRUE)=0
 
virtual BOOL IsHolding ()=0
 
virtual OsnapHitGetHit ()=0
 
virtual ViewExpGetVpt ()=0
 
virtual INodeGetNode ()=0
 
virtual int GetSnapStrength ()=0
 
virtual Matrix3 GetObjectTM ()=0
 
virtual TimeValue GetTime ()=0
 
virtual void wTranspoint (Point3 *inpt, IPoint3 *outpt)=0
 
virtual void Reset ()=0
 
virtual BOOL TestAFlag (int mask)=0
 
virtual Point3 GetCurrentPoint ()=0
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
 
virtual UtilExport Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=nullptr)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

See also
Class OsnapHit, Class INode, Class ViewExp, Class Matrix3, The Advanced Topics section on Snapping.

Description:
This class provides an interface to the OsnapManager. Developers who implement osnaps need to record hits with the osnap manager. Developers implementing command modes are responsible for getting the snap preview done and may be responsible for initializing and closing point sequences. See the Advanced Topics section on Snapping for more details.

Member Function Documentation

◆ getactive()

virtual BOOL getactive ( ) const
pure virtual
Remarks
This method is used internally but may be called to determine if the OsnapManager is currently on.

◆ getAxisConstraint()

virtual BOOL getAxisConstraint ( )
pure virtual
Remarks
This method is used internally but may be called to determine if the OsnapManager will use the system level axis constraints when performing translation.

◆ RecordHit()

virtual void RecordHit ( OsnapHit somehit)
pure virtual
Remarks
When a plugin osnap finds a hit, it should call this method to record it with the manager. This will enter the hit in a stack which is sorted based on proximity to the cursor position. When multiple hits are recorded with the manager, the user has the ability to cycle throught the stack.
Parameters:
OsnapHit* somehit

A pointer to the hit to record. The Osnap plugin should instantiate the hits and the manager is responsible for freeing them.

◆ OKForRelativeSnap()

virtual BOOL OKForRelativeSnap ( )
pure virtual
Remarks
Some snaps only make sense relative to a reference point. Consider, for example, the tangent snap which looks for points of tangency on splines. You can only find a tangent point relative to a second point. As objects are created and manipulated, the OsnapManager maintains a list of the Points that have been input to the current command mode. This method tells you if the first point has been recorded.

◆ RefPointWasSnapped()

virtual BOOL RefPointWasSnapped ( )
pure virtual
Remarks
This method tells you if the point on the top of the reference stack was actually snapped.

◆ GetRefPoint()

virtual Point3 GetRefPoint ( BOOL  top = TRUE)
pure virtual
Remarks
This method retrieves the Point on the top of the reference stack. The point returned is in world space. Note that calling this method when the stack is empty will crash the program. Remember to call OKForRelativeSnap() first. Here are the first few lines of the tangent snap's main method.

void ShapeSnap::Snap(Object* pobj, IPoint2 *p, TimeValue t) {
if(!theman->OKForRelativeSnap())
return;
// Get the reference point
Point3 relpoint(theman->GetRefPoint()); //the last point the user clicked.
// Transform the reference point into the node's coordinate system
Matrix3 tm = theman->GetObjectTM();
relpoint = Inverse(tm) * relpoint;
// . . .
}
Definition: ipoint2.h:30
Definition: matrix3.h:99
The object class is the base class for all objects.
Definition: object.h:1428
Definition: point3.h:54
DMatrix3 Inverse(const DMatrix3 &m)
Return the inverse of the matrix.
int TimeValue
Definition: maxtypes.h:31
Parameters:
BOOL top = TRUE

The default is to return the top of the stack, i.e. the last point which was input to the command mode. If you pass FALSE, the bottom of the stack will be returned.

◆ IsHolding()

virtual BOOL IsHolding ( )
pure virtual
Remarks
This method is used internally. This method tells if the any hits were recorded with the OsnapManager during the last scene traversal.

◆ GetHit()

virtual OsnapHit& GetHit ( )
pure virtual
Remarks
This method is used internally. It returns the current hit i.e. the hit which the manager is currently displaying.

◆ GetVpt()

virtual ViewExp* GetVpt ( )
pure virtual
Remarks
Returns a pointer to a ViewExp. This is only valid for the duration of the current scene traversal. It is guaranteed to be valid while in a plugin's Snap() method.

◆ GetNode()

virtual INode* GetNode ( )
pure virtual
Remarks
Returns a pointer to the node which is currently being snapped.

◆ GetSnapStrength()

virtual int GetSnapStrength ( )
pure virtual
Remarks
Returns the current snap strength. This is the radius of a circular area about the cursor. It is the plugin's responsibility to determine if any "interesting" parts of the object lie within this area. For testing points, see the method OsnapManager::CheckPotentialHit().

◆ GetObjectTM()

virtual Matrix3 GetObjectTM ( )
pure virtual
Remarks
Returns the object transformation matrix of the node which is currently being snapped.

◆ GetTime()

virtual TimeValue GetTime ( )
pure virtual
Remarks
Returns the animation time of the current scene traversal.

◆ wTranspoint()

virtual void wTranspoint ( Point3 inpt,
IPoint3 outpt 
)
pure virtual
Remarks
This method is not currently used. The method transforms a point in the current node's object space into screen space.
Parameters:
Point3 *inpt

A pointer to the object space point.

IPoint3 *outpt

A pointer to storage for the screen space point.

◆ Reset()

virtual void Reset ( )
pure virtual
Remarks
This method may be called to clear out the OsnapManager's reference point stack. Typically this is handled internally. However, objects which implement their own creation processes may need to call this method upon completion of a creation cycle.

◆ TestAFlag()

virtual BOOL TestAFlag ( int  mask)
pure virtual

◆ GetCurrentPoint()

virtual Point3 GetCurrentPoint ( )
pure virtual