Public Member Functions

IOsnapManager Class Reference

Search for all occurrences

Detailed Description

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

Description:
This class is available in release 2.0 and later only.

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.

#include <omanapi.h>

Inheritance diagram for IOsnapManager:
Inheritance graph
[legend]

List of all members.

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 OsnapHit GetHit ()=0
virtual ViewExp GetVpt ()=0
virtual INode GetNode ()=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

Member Function Documentation

virtual BOOL getactive ( ) const [pure virtual]
Remarks:
This method is used internally but may be called to determine if the OsnapManager is currently on.
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.
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.
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.
virtual BOOL RefPointWasSnapped ( ) [pure virtual]
Remarks:
This method tells you if the point on the top of the reference stack was actually snapped.
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;
        // . . .
    }
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.
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.
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.
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.
virtual INode* GetNode ( ) [pure virtual]
Remarks:
Returns a pointer to the node which is currently being snapped.
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().
virtual Matrix3 GetObjectTM ( ) [pure virtual]
Remarks:
Returns the object transformation matrix of the node which is currently being snapped.
virtual TimeValue GetTime ( ) [pure virtual]
Remarks:
Returns the animation time of the current scene traversal.
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.
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.
virtual BOOL TestAFlag ( int  mask ) [pure virtual]
virtual Point3 GetCurrentPoint ( ) [pure virtual]

IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager
IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager IOsnapManager