3ds Max C++ API Reference
Loading...
Searching...
No Matches
CreateMouseCallBack Class Referenceabstract

#include <maxapi.h>

+ Inheritance diagram for CreateMouseCallBack:

Public Member Functions

virtual ~CreateMouseCallBack ()
 
virtual int proc (ViewExp *vpt, int msg, int point, int flags, IPoint2 m, Matrix3 &mat)=0
 
virtual int override (int mode)
 
virtual BOOL StartNewCreation ()
 
virtual BOOL TolerateOrthoMode ()
 

Additional Inherited Members

- 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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Detailed Description

See also
Class BaseObject (method GetCreateMouseCallBack()), Class ViewExp, Class Matrix3, Class IPoint2.

Description:
This is the callback object for handling the creation process of a plug-in object.

Constructor & Destructor Documentation

◆ ~CreateMouseCallBack()

virtual ~CreateMouseCallBack ( )
inlinevirtual
Remarks
Destructor.
1877{}

Member Function Documentation

◆ proc()

virtual int proc ( ViewExp vpt,
int  msg,
int  point,
int  flags,
IPoint2  m,
Matrix3 mat 
)
pure virtual
Remarks
This is the method where the developer defines the user / mouse interaction that takes place during the creation phase of an object.
Parameters:
ViewExp *vpt

The viewport the creation process is taking place in.

int msg

This message describes the type of event that occurred. See Mouse Callback Messages int point

The point number. this is 0 for the first click, 1 for the second, etc.

int flags

These flags describe the state of the mouse button and keyboard Shift/Ctrl/Alt keys. See Mouse Call Back Flags IPoint2 m

The 2D screen point that the user clicked on. Methods in the viewport interface allow this point to be converted into a world space ray or a 3D view space point. A world space ray can be intersected with the active construction plane which results in a point on the active construction plane. See Class ViewExp.

Matrix3& mat

This represents the transformation of the object relative to the construction plane. Typically the plug-in would get a point on the construction plane based on the screen point that the user clicked on and set the translation component of this matrix based on that point.
Returns
Return one of the following value to indicate the state of the creation process:

CREATE_CONTINUE

The creation process should continue. In this case the mouse is captured.

CREATE_STOP

The creation process has terminated normally. In this case the mouse is no longer captured and input is then allowed again from any viewport.

CREATE_ABORT

The creation process has been aborted. The system will delete the created object and node.
Note
The Interface::StopCreating() method should not be called from a create call-back procedure, but instead the proper code should be returned to end the plugin creation process.

Implemented in OneClickCreateCallBack.

◆ override()

virtual int override ( int  mode)
inlinevirtual
Remarks
This method is used to override the default drag mode. Most plug-in will not need to replace the default implementation of this method. What this does is change the way the messages are sent relative to the mouse clicking.

Normally the messages are sent as follows: When the user clicks down this generates a MOUSE_POINT message. Then the user drags the mouse with the button down and a series of MOUSE_MOVE messages are sent. When they let up on the mouse button a MOUSE_POINT messages is generated. Then as the mouse is moved a series of MOUSE_MOVE messages are sent. Then they click down on the mouse again, but this time a point message is not generated until the button is released. All future points are then only sent after the mouse button has been pressed and released.
Parameters:
int mode

The current drag mode. See below.
Returns
One of the following drag modes should be returned:

CLICK_MODE_DEFAULT

Returned to indicate the use of the system mouse mode.

CLICK_DRAG_CLICK

This is the default behavior as described above.

CLICK_MOVE_CLICK

In this mode, the first point is entered by clicking the mouse button down and then letting it up. This generates point 0. In other words, a MOUSE_POINT message is only generated after the user has pressed and released the mouse button.

CLICK_DOWN_POINT

In this mode, point messages are sent on mouse-down only. CLICK_TWO_POINTS

In this mode, each mouse click sends 2 MOUSE_POINT messages. One for button down, the other for button up.
Default Implementation:
{ return mode; }
Sample Code:
A sample program that uses the override method is /MAXSDK/SAMPLES/OBJECTS/SPLINE.CPP.It uses CLICK_DOWN_POINT.
1962{ return mode; } // Defaults to mode supplied

◆ StartNewCreation()

virtual BOOL StartNewCreation ( )
inlinevirtual
Remarks
This gets called by the CreationManager to determine if the mouse proc is really starting a new object. The mouse proc for creating always returns CREATE_STOP, which is how it keeps the mouse from being captured, and this function tells the system if it is really ready to start a new object. Thus, this is called only if the mouse proc returned CREATE_STOP to see if the object is really in a state to start a new node.
Returns
TRUE if the mouse proc is ready to start a new object; otherwise FALSE.
Default Implementation:
{ return TRUE; }
1976{ return TRUE; }

◆ TolerateOrthoMode()

virtual BOOL TolerateOrthoMode ( )
inlinevirtual
Remarks
Called by the system to determine if ortho mode makes sense for this creation. Typically this only makes sense for splines and NURBS curves.
Returns
TRUE if ortho mode is okay; otherwise FALSE.
Default Implementation:
{ return FALSE; }
1985{ return FALSE; }