Class SpaceArrayCallback

3DS Max Plug-In SDK

Class SpaceArrayCallback

See Also: Class Interface, Class ShapeObject, Class Spline3D, Class Point3.

class SpaceArrayCallback

Description:

This class is available in release 3.0 and later only.

This is the callback object for the method Interface::DoSpaceArrayDialog(SpaceArrayCallback *sacb=NULL)=0

This is the method which brings up the Spacing tool. This lets the user distribute objects based on the current selection along a path defined by a spline or a pair of points.

The callback is mostly for use for plug-ins that need to use the spacing tool as a way of generating spacing information. If one wants to customize the default behaviour of the dialog, they derive a class from this one and implement the virtual methods. The non-virtuals simply provide access to the spacing information. This is both for setting the defaults before calling the spacing tool as well as getting out the information after using the spacing tool.

Methods:

public:

Prototype:

SpaceArrayCallback();

Remarks:

Constructor. The data members are initialized as follows:

path = NULL; start = end = space = 0.0f; count = 1; oType = NODE_CPY; sType = SPACE_CENTER; follow = false; context = CTXT_FREE; width = 0.0f; countLimit = INT_MAX;

Prototype:

virtual ~SpaceArrayCallback();

Remarks:

Destructor.

Prototype:

virtual bool isModal();

Remarks:

Implemented by the Plug-in.

If this method returns false, the dialog is presented as a modeless dialog.

Default Implementation:

{ return true; }

Prototype:

virtual bool doPickPath();

Remarks:

Implemented by the Plug-in.

If this method returns true, the path picking buttons are turned on.

Default Implementation:

{ return false; }

Prototype:

virtual TCHAR *dialogTitle();

Remarks:

Implemented by the Plug-in.

Returns the title for the dialog (e.g. Space Array Tool).

Default Implementation:

{ return _T(""); }

Prototype:

virtual TCHAR *startMessage();

Remarks:

Implemented by the Plug-in.

Returns the message to be displayed in the static display right after the dialog comes up.

Default Implementation:

{ return _T(""); }

Prototype:

virtual TCHAR *buttonText();

Remarks:

Implemented by the Plug-in.

Returns the button text.

Default Implementation:

{ return _T("OK"); }

Prototype:

virtual bool isSilent();

Remarks:

Implemented by the Plug-in.

If this method returns true, the spacing tool generates points, but the actual dialog is not presented to the user. This is currently used, for example, by the Stairs in VIZ to generate spacing information for the mesh.

Default Implementation:

{ return false; }

Prototype:

virtual bool doObjectType();

Remarks:

Implemented by the Plug-in.

If this method returns false, then the Instance, Copy, Reference radio buttons are disabled (greyed out).

Default Implementation:

{ return true; }

Prototype:

virtual void proc();

Remarks:

Implemented by the Plug-in.

This method is called after the spacing information is generated. It is here that a developer using this callback could get the updated values, perform some calculation of their own, etc.

Default Implementation:

{}

Prototype:

ShapeObject *getPath();

Remarks:

Implemented by the System.

Returns a pointer to the path ShapeObject.

Prototype:

void setPath(ShapeObject *p);

Remarks:

Implemented by the System.

Sets the path used (as a ShapeObject).

Parameters:

ShapeObject *p

Points to the shape object to use as a path.

Prototype:

void setPath(Point3 pt1, Point3 pt2);

Remarks:

Implemented by the System.

Sets the points for the path.

Parameters:

Point3 pt1

One of the endpoints.

Point3 pt2

The other endpoint.

Prototype:

void setPath(Spline3D *s);

Remarks:

Implemented by the System.

Sets the path used.

Parameters:

Spline3D *s

Points to the path to use.

Prototype:

float getStart();

Remarks:

Implemented by the System.

Returns the start offset.

Prototype:

float getEnd();

Remarks:

Implemented by the System.

Returns the end offset.

Prototype:

float getSpace();

Remarks:

Implemented by the System.

Returns the spacing.

Prototype:

int getCount();

Remarks:

Implemented by the System.

Returns the object count.

Prototype:

void setContext(CTYPE c);

Remarks:

Implemented by the System.

Sets the context.

Parameters:

CTYPE c

One of the following values:

CTXT_FREE - Free Center

CTXT_CNTRCOUNT - Divide Evenly, Objects at Ends

CTXT_CNTRSPACE - Centered, Specify Spacing

CTXT_END - End Offset

CTXT_ENDCOUNT - End Offset, Divide Evenly

CTXT_ENDSPACE - End Offset, Specify Spacing

CTXT_START - Start Offset

CTXT_STARTCOUNT - Start Offset, Divide Evenly

CTXT_STARTSPACE - Start Offset, Specify Spacing

CTXT_FULLSPACE - Specify Offset and Spacing

CTXT_FULLCOUNT - Specify Offsets, Divide Evenly

CTXT_ENDLOCK - Space from End, Unbounded

CTXT_ENDLOCKCOUNT - Space from End, Specify Number

CTXT_ENDLOCKSPACE - Space from End, Specify Spacing

CTXT_STARTLOCK - Space from Start, Unbounded

CTXT_STARTLOCKCOUNT - Space from Start, Specify Number

CTXT_STARTLOCKSPACE - Space from Start, Specify Spacing

CTXT_FULLLOCKSPACE - Specify Spacing, Matching Offsets

CTXT_FULLLOCKCOUNT - Divide Evenly, No Objects at Ends

Prototype:

int getContext();

Remarks:

Implemented by the System.

Returns the context. See setContext() above.

Prototype:

float getWidth();

Remarks:

Implemented by the System.

Returns the width. This is the width of the object to be arrayed. It is a single value so can be calculated any way the user wishes. In the default spacing tool this is calculated based on the x size of the bounding box.

Prototype:

void setWidth(float nWidth);

Remarks:

Implemented by the System.

Sets the width. See getWidth() above.

Parameters:

float nWidth

The width to set.

Prototype:

void setStart(float f);

Remarks:

Implemented by the System.

Sets the start offset.

Parameters:

float f

The start offset to set.

Prototype:

void setEnd(float f);

Remarks:

Implemented by the System.

Sets the end offset.

Parameters:

float f

The end offset to set.

Prototype:

void setSpace(float f);

Remarks:

Implemented by the System.

Sets the spacing.

Parameters:

float f

The spacing to set.

Prototype:

void setCount(int n);

Remarks:

Implemented by the System.

Sets the count.

Parameters:

int n

The count to set.

Prototype:

bool getFollow();

Remarks:

Implemented by the System.

Returns true if Follow is set (checked); otherwise false.

Prototype:

void setFollow(bool t);

Remarks:

Implemented by the System.

Sets the Follow state (checkbox).

Parameters:

bool t

Use true for checked; false for un-checked.

Prototype:

OTYPE getObjectCreationType();

Remarks:

Implemented by the System.

Returns the object creation type. One of the following values:

NODE_CPY -- Copy

NODE_INST -- Instance

NODE_REF -- Reference

Prototype:

void setObjectCreationType(OTYPE t);

Remarks:

Implemented by the System.

Sets the object creation type. One of the following values:

NODE_CPY -- Copy

NODE_INST -- Instance

NODE_REF -- Reference

Prototype:

STYPE getSpacingType();

Remarks:

Implemented by the System.

Returns the spacing type. One of the following values:

SPACE_CENTER

SPACE_EDGE

Prototype:

void setSpacingType(STYPE s);

Remarks:

Implemented by the System.

Sets the spacing type.

Parameters:

STYPE s

One of the following values:

SPACE_CENTER

SPACE_EDGE

Prototype:

void setMessage(char *buf);

Remarks:

Implemented by the System.

Sets the message string.

Prototype:

void setCountLimit(int limit);

Remarks:

Implemented by the System.

Sets a limit on the count.

Parameters:

int limit

The limit to set.

Prototype:

int getCountLimit();

Remarks:

Implemented by the System.

Returns the limit on the count.