Class EPoly

3DS Max Plug-In SDK

Class EPoly

See Also: Class FPMixinInterface, Class MNMesh, Class IParamBlock2, List of Edge Data Channels, List of Vertex Data Channels

class EPoly : public FPMixinInterface

Description:

This class is available in release 4.0 and later only.

The EPoly class is the main interface to the Editable Poly Object. This class is a virtual class with no data members. More details can be found in the SDK samples under \MAXSDK\SAMPLES\MESH\EDITABLEPOLY.

 

Cache and update methods

Selection and component flag access

UI Button and Command Mode methods

Transform Methods

Slice plane accessors

Component data access methods

Displacement approximation methods

Drag operations

Regular Operations

Prototype:

FPInterfaceDesc *GetDesc();

Remarks:

This method returns a description of the published function interface (for scripter access to EPoly functions).

Prototype:

virtual MNMesh *GetMeshPtr();

Remarks:

This method returns a pointer to the Editable Poly's MNMesh. See class MNMesh for fun things to do with an MNMesh.

Default Implementation:

{ return NULL; }

Prototype:

virtual IParamBlock2 *getParamBlock();

Remarks:

Gets a pointer to the Editable Poly's parameter block, which can be used to get or set Editable Poly UI parameters. (See class IParamBlock2 for more information on access methods.) Here is a list of the available parameters, as defined in the epolyParameters enum near the top of iEPoly.h. (Please see the Editable Poly documentation in the normal 3ds max User Reference file for more information on these parameters.)

Selection dialog parameters:

ep_by_vertex: select by vertex (checkbox)

ep_ignore_backfacing: Ignore backfacing (checkbox)

ep_show_normals: Currently unused.

ep_normal_size: Currently unused.

Soft Selection dialog parameters:

ep_ss_use: Use soft selection (checkbox)

ep_ss_retro: Currently unused

ep_ss_edist_use: Use edge-based distances to compute soft selection (checkbox)

ep_ss_edist: Maximum number of edges to traverse in computing edge-based distances (int spinner - range: 1-999999)

ep_ss_affect_back: Affect backfacing in soft selection (checkbox)

ep_ss_falloff: Falloff value for soft selection (float spinner)

ep_ss_pinch: Pinch value for soft selection (float spinner)

ep_ss_bubble: Bubble value for soft selection (float spinner)

Edit Geometry dialog parameters:

ep_extrusion_type: Type of face extrusion. (Radio.) Values:

0: Extrude by group (cluster)

1: Extrude by local normals

2: Extrude by polygon - each polygon extrudes separately.

ep_split: Controls whether the Cut algorithm splits the mesh open. (Checkbox)

ep_refine_ends: Currently unused

ep_weld_threshold: Threshold for welding selected vertices. (float spinner)

ep_weld_pixels: Pixel threshold for Target welding (int spinner)

Subdivide dialog parameters:

ep_ms_smoothness: Smoothness value for MeshSmooth type subdivision (float spinner, range 0-1)

ep_ms_smooth: Currently unused.

ep_ms_sep_smooth: Separate by smoothing groups for MeshSmooth type subdivision (checkbox)

ep_ms_sep_mat: Separate by material IDs for MeshSmooth type subdivision (checkbox)

ep_tess_type: Tessellation type (Radio) Values:

0: by edge

1: by face.

ep_tess_tension: Tessellation tension (float spinner)

Surface Properties dialog parameters (object level):

ep_surf_subdivide: Apply NURMS-style MeshSmooth subdivision to polymesh. (checkbox)

ep_surf_subdiv_smooth: Apply MeshSmooth smoothing group algorithm after subdividing (checkbox)

ep_surf_ig_sel: Currently unused.

ep_surf_iter: Number of iterations of subdivision (int spinner)

ep_surf_thresh: "Smoothness" threshold for adaptive subdivision (float spinner, range 0-1)

ep_surf_riter: Render value of iterations (int spinner)

ep_surf_rthresh: Render value of smoothness threshold (float spinner, range 0-1)

ep_surf_use_riter: Use Render iterations value when rendering (checkbox)

ep_surf_use_rthresh: Use Render smoothness threshold when rendering (checkbox)

ep_surf_sep_smooth: Separate by smoothing groups in subdivision (checkbox)

ep_surf_sep_mat: Separate by materials in subdivision (checkbox)

ep_surf_update: Update type for subdivision (radio). Values:

0: Update always

1: Update when rendering

2: Update manually

Surface Properties dialog parameters (vertex level):

ep_vert_sel_color: Target color for select-by-color (color swatch)

ep_vert_selc_r: Tolerance of red values in select-by-color. (int spinner, range 0-255)

ep_vert_selc_g: Tolerance of green values in select-by-color. (int spinner, range 0-255)

ep_vert_selc_b: Tolerance of blue values in select-by-color. (int spinner, range 0-255)

ep_vert_color_selby: Which kind of color to select by in select-by-color. Radio values:

0: Select by regular vertex color

1: Select by vertex illumination

Surface Properties dialog parameters (face level):

ep_face_smooth_thresh: Autosmooth threshold (float spinner, angle units).

Subdivision Displacement parameters (object level):

ep_sd_use: Apply subdivision displacement (checkbox)

ep_sd_split_mesh: Split the mesh (checkbox)

ep_sd_method: Subdivision displacement method (radio). Values:

0: Regular method

1: Spatial method

2: Curvature method

3: Use both spatial & curvature methods.

ep_sd_tess_steps: Tessellation steps (for regular method) (int spinner)

ep_sd_tess_edge: Edge size (for spatial method) (float spinner)

ep_sd_tess_distance: Distance (for curvature method) (float spinner)

ep_sd_tess_angle: Angle value (for curvature method) (float spinner)

ep_sd_view_dependent: View dependency (checkbox)

Advanced Subdivision Displacement parameters:

ep_asd_style: Subdivision style. Radio values:

0: Grid-based

1: Tree-based

2: Delauney algorithm.

ep_asd_min_iters: Minimum number of iterations (grid or tree style) (int spinner)

ep_asd_max_iters: Maximum number of iterations (grid or tree style) (int spinner)

ep_asd_max_tris: Maximum number of triangles (Delauney style) (int spinner)

Default Implementation:

{ return NULL; }

 

Cache and update methods

Prototype:

virtual void LocalDataChanged(DWORD parts);

Remarks:

This method is used to indicate to the EPoly that some parts of its mesh have changed. This is automatically handled by most EPoly methods; you only need to use it if you're directly manipulating the mesh yourself.

Parameters:

DWORD parts

Parts of the mesh that have been changed, such as PART_GEOM, PART_TOPO, etc.

Default Implementation:

{ }

Prototype:

virtual void InvalidateSoftSelectionCache();

Remarks:

This method invalidates soft selection values in the mesh and in any cached data.

Default Implementation:

{ }

Prototype:

virtual void InvalidateDistanceCache();

Remarks:

This method invalidates pre-computed distances on which soft selection values are based (as well as soft selection values) - note this is automatically done when you call LocalDataChanged (PART_GEOM). This should also be done if the soft selection parameters are changed.

Default Implementation:

{ }

Prototype:

virtual void RefreshScreen();

Remarks:

This is a handy method that does a simple call to ip->RedrawViewports. Also updates the named selection dropdown list. Also, if the EPoly project has been compiled as a debug build, it will verify that the MNMesh is free of errors using the MNMesh::CheckAllData method.

Default Implementation:

{ }

Prototype:

virtual bool Editing();

Remarks:

This method indicates if the Editable Poly object is currently being edited in the modifier panel (and has its UI present).

Default Implementation:

{ return FALSE; }

 

Selection and component flag access

Prototype:

virtual int GetEPolySelLevel();

Remarks:

This method returns the EPoly selection level, as defined by the ePolySelLevel enum: One of the following values; EP_SL_OBJECT, EP_SL_VERTEX, EP_SL_EDGE, EP_SL_BORDER, EP_SL_FACE, EP_SL_ELEMENT.

Default Implementation:

{ return EP_SL_OBJECT; }

Prototype:

virtual int GetMNSelLevel();

Remarks:

This method returns the MNMesh's selection level, as defined by the PMeshSelLevel enum in MNMesh.h: one of the following; MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, MNM_SL_FACE. (Note that the Editable Poly selection levels EP_SL_BORDER and EP_SL_ELEMENT are considered varieties of MNM_SL_EDGE and MNM_SL_FACE selection types, respectively.)

Default Implementation:

{ return MNM_SL_OBJECT; }

Prototype:

virtual void SetEPolySelLevel(int level);

Remarks:

This method sets the Editable Poly selection level.

Parameters:

int level

Possible values are defined by the ePolySelLevel enum: one of EP_SL_OBJECT, EP_SL_VERTEX, EP_SL_EDGE, EP_SL_BORDER, EP_SL_FACE, EP_SL_ELEMENT.

Default Implementation:

{ }

Prototype:

virtual bool EpGetVerticesByFlag(BitArray & vset, DWORD flags, DWORD fmask=0x0);

Remarks:

This method fills in a BitArray depending on whether or not each MNVert in the MNMesh has a particular flag or set of flags set or cleared.

Example: for instance to set the BitArray according to selected vertices, you'd just call EpGetVerticesByFlag (vset, MN_SEL). But to find vertices which do not have the MN_DEAD flag set, but which do have the MN_WHATEVER flag set, you'd call EpGetVerticesByFlag (vset, MN_WHATEVER, MN_WHATEVER|MN_DEAD).

Parameters:

BitArray & vset

The array for output to be stored in. The vset will be set to size of the number of verts in the mesh.

DWORD flags

The flags we're looking for in the vertices

DWORD fmask=0x0

The mask of flags we're checking. This is automatically or'd with "flags".

Return Value:

TRUE if successful, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpGetEdgesByFlag(BitArray & eset, DWORD flags, DWORD fmask=0x0);

Remarks:

This method fills in a BitArray depending on whether or not each MNEdge in the MNMesh has a particular flag or set of flags set or cleared.

Example: for instance to set the BitArray according to selected edges, you'd just call EpGetEdgesByFlag (eset, MN_SEL). But to find edges which do not have the MN_DEAD flag set, but which do have the MN_WHATEVER flag set, you'd call EpGetEdgesByFlag (eset, MN_WHATEVER, MN_WHATEVER|MN_DEAD).

Parameters:

BitArray & vset

The array for output to be stored in. eset will be set to size of the number of edges in the mesh.

DWORD flags

The flags we're looking for in the edges

DWORD fmask=0x0

The mask of flags we're checking. This is automatically or'd with "flags".

Return Value:

TRUE if successful, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpGetFacesByFlag(BitArray & fset, DWORD flags, DWORD fmask=0x0);

Remarks:

This method fills in a BitArray depending on whether or not each MNFace in the MNMesh has a particular flag or set of flags set or cleared.

Example: for instance to set the BitArray according to selected faces, you'd just call EpGetFacesByFlag (fset, MN_SEL). But to find faces which do not have the MN_DEAD flag set, but which do have the MN_WHATEVER flag set, you'd call EpGetFacesByFlag (fset, MN_WHATEVER, MN_WHATEVER|MN_DEAD).

Parameters:

BitArray & vset

The array for output to be stored in. fset will be set to size of the number of faces in the mesh.

DWORD flags

The flags we're looking for in the faces

DWORD fmask=0x0

The mask of flags we're checking. This is automatically or'd with "flags".

Return Value:

TRUE if successful, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual void EpSetVertexFlags(BitArray &vset, DWORD flags, DWORD fmask=0x0, bool undoable=true);

Remarks:

This method sets MNVert flags based on a BitArray.

Example: to hide vertices specified by the BitArray, you'd just call EpSetVertexFlags (vset, MN_HIDE). To unhide the vertices, you'd use EpSetVertexFlags (vset, 0, MN_HIDE).

Parameters:

BitArray & vset

This bitarray indicates which vertices should have their flags modified.

DWORD flags

The flags to set.

DWORD fmask=0x0

The flag mask - if it includes bits not in "flags", those bits are cleared in the specified vertices.

bool undoable=true

If (undoable && theHold.Holding()), a restore object for this flag change will be added to the current undo stack.

Default Implementation:

{ return; }

Prototype:

virtual void EpSetEdgeFlags(BitArray &eset, DWORD flags, DWORD fmask = 0x0, bool undoable=true);

Remarks:

This method sets MNEdge flags based on a BitArray.

Example: to select edges specified by the BitArray, you'd just call EpSetEdgeFlags (eset, MN_SEL). To clear selection on the edges, you'd use EpSetEdgeFlags (eset, 0, MN_SEL).

Parameters:

BitArray & vset

This bitarray indicates which edges should have their flags modified.

DWORD flags

The flags to set.

DWORD fmask=0x0

The flag mask - if it includes bits not in "flags", those bits are cleared in the specified edges.

bool undoable=true

If (undoable && theHold.Holding()), a restore object for this flag change will be added to the current undo stack.

Default Implementation:

{ return; }

Prototype:

virtual void EpSetFaceFlags(BitArray &fset, DWORD flags, DWORD fmask = 0x0, bool undoable=true);

Remarks:

This method sets MNFace flags based on a BitArray.

Example: to hide faces specified by the BitArray, you'd just call EpSetFaceFlags (fset, MN_HIDE). To unhide the faes, you'd use EpSetFaceFlags (fset, 0, MN_HIDE).

Parameters:

BitArray & vset

This bitarray indicates which faces should have their flags modified.

DWORD flags

The flags to set.

DWORD fmask=0x0

The flag mask - if it includes bits not in "flags", those bits are cleared in the specified faces.

bool undoable=true

If (undoable && theHold.Holding()), a restore object for this flag change will be added to the current undo stack.

Default Implementation:

{ return; }

 

UI Button and Command Mode methods

These methods allow the developer to simulate pushing the buttons available in the UI. Some buttons in Editable Poly, such as "Delete", complete an operation when pressed. Others, such as "Create", enter into an interactive command mode while they're depressed.

Prototype:

virtual void EpActionButtonOp(int opcode);

Remarks:

Completes the action corresponding to the specified UI button.

Parameters:

int opcode

The list of "button operations" is defined by the epolyButtonOp enum.

Select dialog button operations:

epop_hide: Hide current selection

epop_unhide: Unhide current selection

epop_ns_copy: Copy named selection (brings up UI)

epop_ns_paste: Paste named selection (may bring up UI)

Edit Geometry dialog button operations:

epop_cap: Cap currently selected borders

epop_delete: Delete current selection.

epop_detach: Detach current selection.

epop_attach_list: Attach any number of nodes using the attach by name dialog.

epop_split: Split currently selected edges.

epop_break: Break currently selected vertices

epop_collapse: Collapse current selection

epop_reset_plane: Reset the slice plane

epop_slice: Slice

epop_weld_sel: Weld current vertex or edge selection

epop_create_shape: Create a shape from current edge selection (brings up UI)

epop_make_planar: Make current selection planar

epop_align_grid: Align current selection to construction grid

epop_align_view: Align current selection at right angles to view.

epop_remove_iso_verts: Remove isolated vertices

Subdivide dialog button operations:

epop_meshsmooth: Subdivide by MeshSmooth (NURMS Style)

epop_tessellate: Subdivide by Tessellation

Surface Properties dialog button operations:

Object Level:

epop_update: Update MeshSmooth subdivision

Vertex Level:

epop_selby_vc: Select by vertex color

Face Level:

epop_retriangulate: Retriangulate currently selected faces

epop_flip_normals: Flip normals on currently selected elements

epop_selby_matid: Select faces by Material ID (brings up UI)

epop_selby_smg: Select faces by smoothing groups (brings up UI)

epop_autosmooth: Autosmooth currently selected faces

epop_clear_smg: Clear all smoothing groups on currently selected faces.

 

Default Implementation:

{ }

Prototype:

virtual void EpActionToggleCommandMode(int mode);

Remarks:

If the user is currently in the specified command mode, this method causes them to exit it. If the user is not, this method will enter it.

Parameters:

int mode

The list of command modes is defined by the epolyCommandMode enum and is given here for reference. (Their names are self-explanatory.)

epmode_create_vertex

epmode_create_edge

epmode_create_face

epmode_divide_edge

epmode_divide_face

epmode_extrude_vertex (note: currently inactive)

epmode_extrude_edge (note: currently inactive)

epmode_extrude_face

epmode_chamfer_vertex

epmode_chamfer_edge

epmode_bevel

epmode_sliceplane

epmode_cut_vertex

epmode_cut_edge

epmode_cut_face

epmode_weld

epmode_edit_tri

 

Default Implementation:

{ }

Prototype:

virtual void EpActionEnterPickMode(int mode);

Remarks:

This method enters the specified pick mode, which is like a command mode but relates to picking nodes.

Parameters:

int mode

Currently there is only one pick mode supported by EPoly, which is defined in the epolyPickMode enum: epmode_attach, which allows the user to pick a node to attach to this Editable Poly object.

Default Implementation:

{ }

Prototype:

virtual void EpActionExitCommandModes();

Remarks:

This method exits from any command mode the system currently may be in.

Default Implementation:

{ }

 

Transform Methods

Prototype:

virtual void MoveSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin);

Remarks:

This method moves the current selection (including any soft selection) by the specified amount in the specified coordinate system.

Parameters:

int level

The enum ePolySelLevel, being one of the following values; EP_SL_OBJECT, EP_SL_VERTEX, EP_SL_EDGE, EP_SL_BORDER, EP_SL_FACE, EP_SL_ELEMENT.

TimeValue t

The time at which to apply the move operation.

Matrix3& partm

The parent transformation matrix.

Matrix3& tmAxis

The transformation axis.

Point3& val

The vector describing the translation.

BOOL localOrigin

TRUE to move based on the local origin, otherwise FALSE.

Default Implementation:

{ }

Prototype:

virtual void RotateSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin);

Remarks:

This method rotates the current selection (including any soft selection) by the specified amount in the specified coordinate system.

Parameters:

int level

The enum ePolySelLevel, being one of the following values; EP_SL_OBJECT, EP_SL_VERTEX, EP_SL_EDGE, EP_SL_BORDER, EP_SL_FACE, EP_SL_ELEMENT.

TimeValue t

The time at which to apply the rotate operation.

Matrix3& partm

The parent transformation matrix.

Matrix3& tmAxis

The transformation axis.

Quat& val

The rotation quaternion.

BOOL localOrigin

TRUE to rotate based on the local origin, otherwise FALSE.

Default Implementation:

{ }

Prototype:

virtual void ScaleSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin);

Remarks:

This method scales the current selection (including any soft selection) by the specified amount in the specified coordinate system.

Parameters:

int level

The enum ePolySelLevel, being one of the following values; EP_SL_OBJECT, EP_SL_VERTEX, EP_SL_EDGE, EP_SL_BORDER, EP_SL_FACE, EP_SL_ELEMENT.

TimeValue t

The time at which to apply the rotate operation.

Matrix3& partm

The parent transformation matrix.

Matrix3& tmAxis

The transformation axis.

Point3& val

The scaling value.

BOOL localOrigin

TRUE to scale based on the local origin, otherwise FALSE.

Default Implementation:

{ }

Prototype:

virtual void ApplyDelta(Tab<Point3> & delta, EPoly *epol, TimeValue t);

Remarks:

This method applies a geometric "delta" vector to the current mesh at the specified time. (Note: if t!=0 and the system's animate feature is on, this will set keys.)

Parameters:

Tab<Point3> & delta

The table of geometry delta vectors.

EPoly *epol

A pointer to the editable poly object to apply to.

TimeValue t

The time at which to apply the geometric delta.

Default Implementation:

{ }

 

Slice plane accessors

Prototype:

virtual void EpResetSlicePlane();

Remarks:

This method resets the slice plane.

Default Implementation:

{ }

Prototype:

virtual void EpGetSlicePlane(Point3 & planeNormal, Point3 & planeCenter, float *planeSize=NULL);

Remarks:

This method returns the slice plane, as defined by its normal, center, and size. (Size is irrelevant for slicing, but defines the size of the slice gizmo the user sees.)

Parameters:

Point3 & planeNormal

The plane normal vector.

Point3 & planeCenter

The plane center.

float *planeSize=NULL

The size of the plane.

Default Implementation:

{ }

Prototype:

virtual void EpSetSlicePlane(Point3 & planeNormal, Point3 & planeCenter, float planeSize);

Remarks:

This method sets the slice plane to have the specified normal, center, and size. (Unlike in EpGetSlicePlane(), size is not an optional argument here.)

Parameters:

Point3 & planeNormal

The plane normal vector.

Point3 & planeCenter

The plane center.

float planeSize

The size of the plane.

Default Implementation:

{ }

 

Component data access methods

Prototype:

virtual Color GetVertexColor(bool *uniform=NULL, int *num=NULL, int mp=0, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method obtains the vertex color for the flagged vertices in the indicated map channel.

Parameters:

bool *uniform=NULL

If non-NULL, the bool this pointer points to is set to true if all flagged vertices have the identical color, and false otherwise. (It's set to true if there are 0 vertices.)

int *num=NULL

If non-NULL, the number of vertices currently flagged is computed and stored here.

int mp=0

The map channel we're using. Most vertex color applications use the standard vertex color channel, 0. However, you can also use this method with the Illumination channel (MAP_SHADING = -1) or the alpha channel (MAP_ALPHA = -2) - or even with a regular UVW map channel (1-99).

DWORD flag=MN_SEL

This indicates the vertices we look at. If left at the default, selected vertices' colors are analyzed. If flag were to equal MN_WHATEVER, then vertices with the MN_WHATEVER flag would have their colors analyzed.

TimeValue t=0

This is not currently used.

Return Value:

The color of the flagged vertices, or black (0,0,0) if the vertices' colors are not the same.

Default Implementation:

{ return Color(1,1,1); }

Prototype:

virtual void SetVertexColor(Color clr, int mp=0, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method sets the vertex color for the flagged vertices in the indicated map channel.

Parameters:

Color clr

The color to set the vertices to.

int mp=0

The map channel we're using. Most vertex color applications use the standard vertex color channel, 0. However, you can also use this method with the Illumination channel (MAP_SHADING = -1) or the alpha channel (MAP_ALPHA = -2) - or even with a regular UVW map channel (1-99).

DWORD flag=MN_SEL

This indicates which vertices we set. If left at the default, selected vertices' colors are set. If flag were to equal MN_WHATEVER, then vertices with the MN_WHATEVER flag would have their colors set.

TimeValue t=0

This is not currently used.

Default Implementation:

{ }

Prototype:

virtual Color GetFaceColor(bool *uniform=NULL, int *num=NULL, int mp=0, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method obtains the face color for the flagged faces in the indicated map channel.

Parameters:

bool *uniform=NULL

If non-NULL, the bool this pointer points to is set to true if all flagged faces have the identical color, and false otherwise. (It's set to true if there are 0 flagged faces.)

int *num=NULL

If non-NULL, the number of faces currently flagged is computed and stored here.

int mp=0

The map channel we're using. Most vertex color applications use the standard vertex color channel, 0. However, you can also use this method with the Illumination channel (MAP_SHADING = -1) or the alpha channel (MAP_ALPHA = -2) - or even with a regular UVW map channel (1-99).

DWORD flag=MN_SEL

This indicates which vertices we set. If left at the default, selected vertices' colors are set. If flag were to equal MN_WHATEVER, then vertices with the MN_WHATEVER flag would have their colors set.

TimeValue t=0

This is not currently used.

Return Value:

The color of the flagged faces, or black (0,0,0) if the faces' colors are not the same.

Default Implementation:

{ return Color(1,1,1); }

Prototype:

virtual void SetFaceColor(Color clr, int mp=0, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method sets the vertex color for the flagged faces in the indicated map channel.

Parameters:

Color clr

The color to set the faces to.

int mp=0

The map channel we're using. Most vertex color applications use the standard vertex color channel, 0. However, you can also use this method with the Illumination channel (MAP_SHADING = -1) or the alpha channel (MAP_ALPHA = -2) - or even with a regular UVW map channel (1-99).

DWORD flag=MN_SEL

This indicates which vertices we set. If left at the default, selected vertices' colors are set. If flag were to equal MN_WHATEVER, then vertices with the MN_WHATEVER flag would have their colors set.

TimeValue t=0

This is not currently used.

Default Implementation:

{ }

Prototype:

virtual float GetVertexDataValue(int channel, int *numSel, bool *uniform, DWORD vertexFlags, TimeValue t);

Remarks:

This method obtains floating-point vertex data from the flagged vertices in the specified vertex data channel.

Parameters:

int channel

The vertex data channel we're querying. See the List of Vertex Data Channels (which are defined in mesh.h).

int *numSel

If non-NULL, this is filled in with the current number of flagged vertices.

bool *uniform

If non-NULL, this is set to indicate whether the currently flagged vertices have uniform values or not.

DWORD vertexFlags

Indicates which vertices to evaluate. (Use MN_SEL to get vertex data from selected vertices.)

TimeValue t

This is not currently used.

Return Value:

The vertex data value for the flagged vertices. If the vertices' values vary, the first value found is returned.

Default Implementation:

{ return 1.0f; }

Prototype:

virtual float GetEdgeDataValue(int channel, int *numSel, bool *uniform, DWORD edgeFlags, TimeValue t);

Remarks:

This method obtains floating-point edge data from the flagged edges in the specified edge data channel.

Parameters:

int channel

The edge data channel we're querying. See the List of Edge Data Channels (which are defined in mnmesh.h).

int *numSel

If non-NULL, this is filled in with the current number of flagged edges.

bool *uniform

If non-NULL, this is set to indicate whether the currently flagged edges have uniform values or not.

DWORD edgeFlags

Indicates which edges to evaluate. (Use MN_SEL to get vertex data from selected vertices.)

TimeValue t

This is not currently used.

Return Value:

The edge data value for the flagged edges. If the edges' values vary, the first value found is returned.

Default Implementation:

{ return 1.0f; }

Prototype:

virtual void SetVertexDataValue(int channel, float w, DWORD vertexFlags, TimeValue t);

Remarks:

This method sets floating-point vertex data for the flagged vertices in the specified vertex data channel.

Parameters:

int channel

The vertex data channel we're modifying. See the List of Vertex Data Channels (which are defined in mesh.h).

float w

The value to set the flagged vertices to.

DWORD vertexFlags

Indicates which vertices to modify. (Use MN_SEL to set vertex data in selected vertices.)

TimeValue t

This is not currently used.

Default Implementation:

{ }

Prototype:

virtual void SetEdgeDataValue(int channel, float w, DWORD edgeFlags, TimeValue t);

Remarks:

This method sets floating-point edge data for the flagged edges in the specified edge data channel.

Parameters:

int channel

The edge data channel we're modifying. See the List of Edge Data Channels (which are defined in mnmesh.h).

float w

The value to set the flagged edges to.

DWORD edgeFlags

Indicates which edges to modify. (Use MN_SEL to set edge data in selected edges.)

TimeValue t

This is not currently used.

Default Implementation:

{ }

Prototype:

virtual void ResetVertexData(int channel);

Remarks:

This method resets all vertex data in the specified channel. For instance, ResetEdgeData (VDATA_WEIGHT) would reset all vertex weights to 1.

Parameters:

int channel

The vertex data. See the List of Vertex Data Channels

Default Implementation:

{ }

Prototype:

virtual void ResetEdgeData(int channel);

Remarks:

This method resets all edge data in the specified channel. For instance, ResetEdgeData (EDATA_CREASE) would reset all edge crease values to 0.

Parameters:

int channel

The edge data channel. See the List of Edge Data Channels

Return Value:

 

Default Implementation:

{ }

Prototype:

virtual void BeginPerDataModify(int mnSelLevel, int channel);

Remarks:

This method is used in combination with EndPerDataModify to store undo information for any vertex or edge data modification.

Parameters:

int mnSelLevel

Set to one of MNM_SL_VERTEX or MNM_SL_EDGE for vertex or edge data respectively.

int channel

Indicates the channel of vertex or edge data we're modifying. For instance, BeginPerDataModify (MNM_SL_EDGE, EDATA_CREASE) would be used before modifying edge crease information.

Default Implementation:

{ }

Prototype:

virtual bool InPerDataModify();

Remarks:

This method returns true if we're between BeginPerDataModify and EndPerDataModify calls.

Default Implementation:

{ return false; }

Prototype:

virtual void EndPerDataModify(bool success);

Remarks:

This method completes the undo object corresponding to the vertex or edge data modifications made since the related BeginPerDataModify call.

Parameters:

bool success

If FALSE, the system restores the original vertex colors and throws away the undo object.

Default Implementation:

{ }

Prototype:

virtual void BeginVertexColorModify(int mp=0);

Remarks:

This method is used in combination with EndVertexColorModify to store undo information for any vertex or edge data modification.

Parameters:

int mp=0

The map channel we're using. Most vertex color applications use the standard vertex color channel, 0. However, you can also use this method with the Illumination channel (MAP_SHADING = -1) or the alpha channel (MAP_ALPHA = -2) - or even with a regular UVW map channel (1-99).

Default Implementation:

{ }

Prototype:

virtual bool InVertexColorModify();

Remarks:

This method returns true if we're between BeginVertexColorModify and EndVertexColorModify calls.

Default Implementation:

{ return false; }

Prototype:

virtual void EndVertexColorModify(bool success);

Remarks:

This method completes the undo object corresponding to the vertex color modifications made since the related BeginVertexColorModify call.

Parameters:

bool success

If FALSE, the system restores the original vertex colors and throws away the undo object.

Default Implementation:

{ }

Prototype:

virtual int GetMatIndex(bool *determined, DWORD flag=MN_SEL);

Remarks:

This method obtains the material index for the selected faces.

Parameters:

bool *determined

The bool this points to (which should not be NULL) is filled with:

FALSE if there are no selected faces or if selected faces have different material indices

TRUE if at least one face is selected and all selected faces have the same material ID.

DWORD flag=MN_SEL

Indicates which faces should have their material IDs set.

Return Value:

The material index of the selected faces, cast as an int.

Default Implementation:

{ determined=false; return 0; }

Prototype:

virtual void SetMatIndex(int index, DWORD flag=MN_SEL);

Remarks:

This method sets the material index for the flagged faces.

Parameters:

int index

The material index to set flagged faces to.

DWORD flag=MN_SEL

Indicates which faces should have their material IDs set.

Default Implementation:

{ }

Prototype:

virtual void GetSmoothingGroups(DWORD faceFlag, DWORD *anyFaces, DWORD *allFaces=NULL);

Remarks:

This method obtains smoothing group information for the specified faces.

Parameters:

DWORD faceFlag

Indicates which faces to read smoothing group information from. If this value is 0, all faces are read.

DWORD *anyFaces

DWORD *allFaces=NULL

These two parameters are where the output is stored. "anyFaces" has bits set that are present in any of the faces' smoothing groups. "allFaces", if non-NULL, has bits set that are present in all of the faces' smoothing groups. In other words, anyFaces or's together the faces' groups, while allFaces and's them together.

Default Implementation:

{ if (anyFaces) *anyFaces = 0; if (allFaces) *allFaces = 0; }

Prototype:

virtual void SetSmoothBits(DWORD bits, DWORD bitmask, DWORD flag);

Remarks:

This method sets (or clears) smoothing group bits in the specified faces.

Parameters:

DWORD bits

The smoothing group bits to set in flagged faces.

DWORD bitmask

The smoothing group bits to clear in flagged faces

DWORD flag

Indicates which faces to set smoothing group information in. If this value is 0, all faces are modified.

Default Implementation:

{ }

 

Displacement approximation methods

Prototype:

virtual void SetDisplacementParams();

Remarks:

This method copies displacement parameters from pblock to polyobject.

Default Implementation:

{ }

Prototype:

virtual void UpdateDisplacementParams();

Remarks:

This method copies displacement parameters from polyobject to pblock.

Default Implementation:

{ }

Prototype:

virtual void UseDisplacementPreset(int presetNumber);

Remarks:

This method engages a displacement approximation preset.

Parameters:

int presetNumber

The presetNumber values are either 0 (low), 1 (medium), or 2 (high).

Default Implementation:

{ }

 

Drag operations

Prototype:

virtual void EpfnBeginExtrude(int msl, DWORD flag, TimeValue t);

Remarks:

This method is called at the beginning of an interactive extrusion operation. Performs the topological extrusion.

Parameters:

int msl

Indicates the MNMesh-based selection level we're extruding. (Currently, this must be MNM_SL_FACE.)

DWORD flag

Indicates the faces we're extruding.

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnEndExtrude(bool accept, TimeValue t);

Remarks:

This method is called at the end of an interactive extrusion operation. Completes the RestoreObjects and finalizes the geometric edit.

Parameters:

bool accept

If TRUE, end extrude normally. If FALSE, cancel the extrusion completely (undoing the original topological extrusion).

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnDragExtrude(float amount, TimeValue t);

Remarks:

This method is used to drag the current extrusion to the amount specified. May be called multiple times in one session between EpfnBeginExtrude and EpfnEndExtrude.

Parameters:

float amount

The (absolute) amount of the extrusion

TimeValue t

The current time

Default Implementation:

{ }

Prototype:

virtual void EpfnBeginBevel(int msl, DWORD flag, bool doExtrude, TimeValue t);

Remarks:

This method is called at the beginning of an interactive bevel or outline operation. Performs the topological extrusion if necessary, and prepares certain cached data.

Parameters:

int msl

Indicates the MNMesh-based selection level we're beveling. (Currently, this must be MNM_SL_FACE.)

DWORD flag

Indicates the faces we're extruding.

bool doExtrude

Indicates whether or not a topological extrusion should be done for this bevel. (For instance, leaving this at false you to do "outlining", or to adjust a previous bevel.)

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnEndBevel(bool accept, TimeValue t);

Remarks:

This method is called at the end of an interactive bevel. Completes the RestoreObjects and finalizes the geometric edit.

Parameters:

bool accept

If TRUE, end bevel normally. If FALSE, cancel the bevel completely (undoing any earlier topological extrusion).

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnDragBevel(float outline, float height, TimeValue t);

Remarks:

This method is used to drag the current bevel to the outline and height specified. May be called multiple times in one session between EpfnBeginBevel and EpfnEndBevel.

Parameters:

float outline

The (positive or negative) outline amount for the bevel.

float height

The (positive or negative) height of the bevel.

TimeValue t

The current time

Default Implementation:

{ }

Prototype:

virtual void EpfnBeginChamfer(int msl, TimeValue t);

Remarks:

This method is called at the beginning of an interactive chamfer operation. Performs the topological changes and prepares certain cached data.

Parameters:

int msl

Indicates the MNMesh-based selection level we're chamfering. (Either MNM_SL_VERTEX or MNM_SL_EDGE.)

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnEndChamfer(bool accept, TimeValue t);

Remarks:

This method is called at the end of an interactive chamfer. Completes the RestoreObjects and finalizes the geometric edits.

Parameters:

bool accept

If TRUE, end chamfer normally. If FALSE, cancel the chamfer completely (undoing the earlier topological changes).

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnDragChamfer(float amount, TimeValue t);

Remarks:

This method is used to drag the current chamfer to the amount specified. May be called multiple times in one session between EpfnBeginChamfer and EpfnEndChamfer.

Parameters:

float amount

The amount of the chamfer.

TimeValue t

The current time

Default Implementation:

{ }

 

Regular operations

Prototype:

virtual bool EpfnHide(int msl, DWORD flags);

Remarks:

This method Hides flagged components.

Parameters:

int msl

MNMesh selection level - should be either MNM_SL_VERTEX or MNM_SL_FACE.

DWORD flags

Indicates which components to hide. For instance, MN_SEL would cause it to hide selected vertices or faces.

Return Value:

TRUE if components were hidden, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnUnhideAll(int msl);

Remarks:

This method unhides all components at the specified level.

Parameters:

int msl

MNMesh selection level - should be either MNM_SL_VERTEX or MNM_SL_FACE.

Return Value:

TRUE if components were unhidden, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual void EpfnNamedSelectionCopy(TSTR setName);

Remarks:

This method copies the named selection specified to the named selection copy/paste buffer.

Parameters:

TSTR setName

The name of the selection set.

Default Implementation:

{ }

Prototype:

virtual void EpfnNamedSelectionPaste(bool useDlgToRename);

Remarks:

This method pastes selection from named selection copy/paste buffer.

Parameters:

bool useDlgToRename

Only matters if there is a name conflict with an existing named selection. If true, the system should throw up an interactive dialog for the user to rename the selection. If false, 3ds max should use string techniques to rename the selection (by adding or increasing a number, etc.)

Default Implementation:

{ }

Prototype:

virtual int EpfnCreateVertex(Point3 pt, bool pt_local=false, bool select=true);

Remarks:

This method creates a new vertex in the mesh.

Parameters:

Point3 pt

The location of the new vertex in object or world space.

bool pt_local=false

If true, the point passed is assumed to be in object space. If false, the point is assumed to represent world space, and the object space location must be computed by the method.

bool select=true

Indicates if the new vertex should be selected (have its MN_SEL flag set).

Return Value:

The index of the new vertex, or -1 to indicate failure to create the vertex.

Default Implementation:

{ return -1; }

Prototype:

virtual int EpfnCreateEdge(int v1, int v2, bool select=true);

Remarks:

This method creates a new edge, dividing a polygon into two smaller polygons.

Parameters:

int v1, v2

The endpoint vertices for this edge. These vertices must have at least one face in common, or the creation will fail.

bool select=true

Indicates if the new edge should be selected (have its MN_SEL flag set).

Return Value:

The index of the edge created.

Default Implementation:

{ return -1; }

Prototype:

virtual int EpfnCreateFace(int *v, int deg, bool select=true);

Remarks:

This method creates a new face on a set of vertices.

Parameters:

int *v

An array of vertices for this new face. Note that each vertex must be an "open" vertex - it either must be on no edges or faces, or it must be part of a border (i.e. it's on more edges than faces).

int deg

The degree of the new face - and the size of the "v" array.

bool select=true

Indicates if the new face should be selected (have its MN_SEL flag set).

Return Value:

The index of the face created.

Default Implementation:

{ return -1; }

Prototype:

virtual bool EpfnCapHoles(int msl=MNM_SL_EDGE, DWORD targetFlags=MN_SEL);

Remarks:

This method caps the indicated holes.

Parameters:

int msl=MNM_SL_EDGE

MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE. The holes are border loops which can be identified by containing selected edges, using selected vertices, or being touched by selected faces.

DWORD targetFlags=MN_SEL

The flags we're looking for (in the vertex, edge, or face levels, according to msl) to identify the holes we should cap.

Return Value:

TRUE if any hole was successfully capped, otherwise FALSE

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnDelete(int msl, DWORD delFlag=MN_SEL, bool delIsoVerts=false);

Remarks:

This method deletes the specified components (and any other components dependent on them).

Parameters:

int msl

MNMesh-based selection level for deletion to occur on; one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE. Note that edge deletion joins, rather than removes, the neighboring faces. Border edges cannot be deleted. Deleting an edge between two quads makes a hexagon. Etc.

DWORD delFlag=MN_SEL

The flag indicating components to delete.

bool delIsoVerts=false

If deleting faces, this indicates whether vertices that are left isolated by the face deletion should also be deleted. (Note that in the reverse situation, faces dependent on deleted vertices are always deleted.)

Return Value:

TRUE if components were deleted, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual void EpfnAttach(INode *node, INode *myNode, TimeValue t);

Remarks:

This method attaches the specified object to this mesh. The object given is first converted to a polymesh (if needed), then attached as an element in the Editable Poly, then the original is deleted.

Parameters:

INode *node

A pointer to the node we want to attach.

INode *myNode

A pointer to this Editable Poly's node (used to match the attached object to our object space).

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnMultiAttach(INodeTab &nodeTab, INode *myNode, TimeValue t);

Remarks:

This method attaches a bunch of nodes to this mesh. The objects in the nodes are converted to polymeshes if needed, then attached as elements in this Editable Poly. (Then the originals are deleted.)

Parameters:

INodeTab &nodeTab

A table of nodes we want to attach.

INode *myNode

A pointer to this Editable Poly's node (used to match the attached objects to our object space).

TimeValue t

The current time.

Default Implementation:

{}

Prototype:

virtual bool EpfnDetachToElement(int msl, DWORD flag, bool keepOriginal);

Remarks:

This method detaches part of PolyMesh to a separate element.

Parameters:

int msl

Indicates the MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag

Flag indicates which components should be detached. For instance, MNM_SL_VERTEX and MN_SEL means selected vertices.

bool keepOriginal

If TRUE, the original components are left intact and a new element is cloned instead.

Return Value:

TRUE if elements are detached, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnDetachToObject(TSTR name, int msl, DWORD flag, bool keepOriginal, INode *myNode, TimeValue t);

Remarks:

This method detaches part of PolyMesh to a separate object.

Parameters:

TSTR name

The desired name for the new node.

int msl

Indicates the MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag

Flag indicates which components should be detached. For instance, MNM_SL_VERTEX and MN_SEL means selected vertices.

bool keepOriginal

If TRUE, the original components are left intact and the new object is cloned from them.

INode *myNode

A pointer to this EPoly's node (for transform and other node property access).

TimeValue t

The current time.

Return Value:

TRUE if parts were detached, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnSplitEdges(DWORD flag=MN_SEL);

Remarks:

This method "splits" edges by breaking vertices on two or more flagged edges into as many copies as needed. In this way, any path of flagged edges becomes two open seams.

Parameters:

DWORD flag=MN_SEL

Indicates which edges should be split. (Left at the default, selected edges are split.)

Return Value:

TRUE if any topological changes happened, FALSE if nothing happened.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnBreakVerts(DWORD flag=MN_SEL);

Remarks:

This method breaks vertices into separate copies for each face using them. For example, breaking one corner of a box polymesh turns it into 3 vertices, one for each side that met at that vertex.

Parameters:

DWORD flag=MN_SEL

Indicates which vertices should be broken. (Left at the default, selected vertices are broken.)

Return Value:

TRUE if any topological changes happened, FALSE if nothing happened.

Default Implementation:

{ return false; }

Prototype:

virtual int EpfnDivideFace(int face, Tab<float> &bary, bool select=true);

Remarks:

This method divides the face into triangles meeting at a point described by generalized barycentric coordinates on the face. An n-sided polygon will become n triangles using this technique.

Parameters:

int face

The face to divide.

Tab<float> &bary

A table of floats, of the same size as the face's degree, indicating the contribution of each of the face's vertices to the division point. They should all sum to 1, indicating that the division point is a linear combination of the vertices. If they are all equal (1/n), the center of the face will be used.

bool select=true

Indicates whether the new triangles should have the MN_SEL flag set or not.

Return Value:

The index of the new vertex, or -1 for failure.

Default Implementation:

{ return -1; }

Prototype:

virtual int EpfnDivideEdge(int edge, float prop, bool select=true);

Remarks:

This method divides an edge in two, creating a new vertex.

Parameters:

int edge

The edge to divide.

float prop

The proportion along the edge for the new vertex, going from 0 at the v1 end to 1 at the v2 end. For instance, a prop of .35 means that the new point will be located at;

.65*(v[e[edge].v1].p) + .35*(v[e[edge].v2].p)

bool select=true

Indicates if the new vertex should be selected. (The new edge picks up its selection flag from the old edge.)

Return Value:

The index of the new vertex, or -1 for failure.

Default Implementation:

{ return -1; }

Prototype:

virtual bool EpfnCollapse(int msl, DWORD flag);

Remarks:

This method will collapse the current selection, turning each cluster (in edge or face level) or all selected points into a single point. Some restrictions inherent in a 3ds max polygon-based mesh may prevent a complete collapse, if the result would have an illegal geometry.

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag

The flag on the components we wish to collapse.

Return Value:

TRUE if any changes occurred, FALSE if nothing happened.

Default Implementation:

{ return false; }

Prototype:

virtual void EpfnExtrudeFaces(float amount, DWORD flag, TimeValue t);

Remarks:

This method extrudes the flagged faces by the specified amount. Note that this method uses the parameter block value for ep_extrusion_type. Values can be:

0: Extrude by group (cluster)

1: Extrude by local normals

2: Extrude by polygon - each polygon extrudes separately.

Parameters:

float amount

The height of the extrusion. Can be positive or negative.

DWORD flag

Indicates which faces should be beveled.

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnBevelFaces(float height, float outline, DWORD flag, TimeValue t);

Remarks:

This method bevels the flagged faces by the specified height and outline. Note that this method uses the parameter block value for ep_extrusion_type in making the extrusion component. Values can be:

0: Extrude by group (cluster)

1: Extrude by local normals

2: Extrude by polygon - each polygon extrudes separately.

Parameters:

float height

The height of the desired bevel. Can be positive or negative.

float outline

The amount of the outlining in the bevel. Positive amounts make the selected region larger; negative amounts make it smaller.

DWORD flag

Indicates which faces should be beveled.

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnChamferVertices(float amount, TimeValue t);

Remarks:

This method chamfers the flagged vertices by the specified amount.

Parameters:

float amount

The amount of the chamfer.

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnChamferEdges(float amount, TimeValue t);

Remarks:

This method chamfers the flagged edges by the specified amount.

Parameters:

float amount

The amount of the chamfer.

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual bool EpfnSlice(Point3 planeNormal, Point3 planeCenter, bool flaggedFacesOnly=false, DWORD faceFlags=MN_SEL);

Remarks:

This method slices the mesh with the specified plane.

Parameters:

Point3 planeNormal

Point3 planeCenter

The definition of the plane, by the normal and the "center" (which can be any point in the plane).

bool flaggedFacesOnly=false

If set, only the flagged faces should be sliced. If false, all faces should be sliced.

DWORD faceFlags=MN_SEL

Indicates which faces should be sliced, if flaggedFacesOnly is TRUE.

Return Value:

TRUE if something has been sliced, or FALSE if nothing happened.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnInSlicePlaneMode();

Remarks:

This method indicates whether the Editable Poly is currently in Slice Plane mode.

Default Implementation:

{ return false; }

Prototype:

virtual int EpfnCutVertex(int startv, Point3 destination, Point3 projDir);

Remarks:

This method cuts from one vertex to another. Note that this algorithm uses the parameter block value for ep_split, which controls whether the cut algorithm splits the mesh open.

Parameters:

int startv

The starting vertex for the cut

Point3 destination

The location of the ending vertex for the cut.

Point3 projDir

The direction of the "view". (projDir and the vector between the two vertices define the plane that the cut occurs in.)

Return Value:

The destination vertex, or -1 if the cut was unable to be completed for some reason.

Default Implementation:

{ return -1; }

Prototype:

virtual int EpfnCutEdge(int e1, float prop1, int e2, float prop2, Point3 projDir);

Remarks:

This method cuts from one edge to another. Note that this algorithm uses the parameter block value for ep_split, which controls whether the cut algorithm splits the mesh open.

Parameters:

int el

The edge index along that edge for the start of the cut.

float propl

The edge proportion along that edge for the start of the cut.

int e2

The edge index along that edge for the end of the cut.

float prop2

The edge proportion along that edge for the end of the cut.

Point3 projDir

The direction of the "view". (projDir and the vector between the two endpoints define the plane that the cut occurs in.)

Return Value:

The vertex created at the end of the cut, or -1 if the cut was unable to be completed for some reason.

Default Implementation:

{ return -1; }

Prototype:

virtual int EpfnCutFace(int f1, Point3 p1, Point3 p2, Point3 projDir);

Remarks:

This method cuts from one face to another, subdividing the start and end faces as needed for precisely matching the given start and end points. Note that this algorithm uses the parameter block value for ep_split, which controls whether the cut algorithm splits the mesh open.

Parameters:

int f1

The face we should start on.

Point3 p1

The point (on face f1) for the start of the cut.

Point3 p2

The point at the end of the cut.

Point3 projDir

The direction of the "view". (projDir and the vector between the two endpoints define the plane that the cut occurs in.)

Return Value:

The vertex created at the end of the cut, or -1 if the cut was unable to be completed for some reason.

Default Implementation:

{ return -1; }

Prototype:

virtual bool EpfnWeldVerts(int vert1, int vert2, Point3 destination);

Remarks:

This method welds the specified vertices together (if possible), and puts the result at the location specified.

Parameters:

int vert1, vert2

The two vertices we wish to weld. Note that these vertices must be "border" vertices, that is, they must be used by some open (one-sided) edges.

Point3 destination

The desired location for the result. Usually this is v[vert1].p, v[vert2].p, or the average of the two.

Return Value:

Indicates if any welding successfully occurred. If FALSE, nothing happened.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnWeldEdges(int edge1, int edge2);

Remarks:

This method welds the first edge to the second edge, leaving the result at the location of the second edge.

Parameters:

int edge1, edge2

The two edges we wish to weld. Note that these must be open (one-sided) edges.

Return Value:

Indicates if any welding successfully occurred. (If false, nothing happened.)

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnWeldFlaggedVerts(DWORD flag);

Remarks:

This method welds all flagged vertices together to their average location.

Parameters:

DWORD flag

Indicates which vertices should be welded. Note that these vertices must be "border" vertices, that is, they must be used by some open (one-sided) edges.

Return Value:

Indicates if any welding successfully occurred. If FALSE, nothing happened.)

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnWeldFlaggedEdges(DWORD flag);

Remarks:

This method welds flagged edges together.

Parameters:

DWORD flag

Indicates which edges should be welded. Note that these edges must be open (one-sided).

Return Value:

Indicates if any welding successfully occurred. (If false, nothing happened.)

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnCreateShape(TSTR name, bool smooth, INode *myNode, DWORD edgeFlag=MN_SEL);

Remarks:

This method creates a new shape object from flagged edges in the polymesh.

Parameters:

TSTR name

The desired name for the new node containing the shape.

bool smooth

If TRUE, the new shape should be a smooth curve. If FALSE, it should be a linear shape which exactly follows the edges.

INode *myNode

A pointer to the node of the PolyMesh (used to obtain transform and other node level information for the new shape node).

DWORD edgeFlag=MN_SEL

Indicates which faces should be used in creating this shape.

Return Value:

TRUE if successful, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnMakePlanar(int msl, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method moves the flagged area into its "average plane". (Plane computed using average vertex positions and normals.)

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to align. Ignored if msl is set to MNM_SL_OBJECT.

TimeValue t=0

The current time. (This action can be used to set a key for animation.)

Return Value:

Indicates whether anything was moved.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnMoveToPlane(Point3 planeNormal, float planeOffset, int msl, DWORD flag=MN_SEL, TimeValue t=0);

Remarks:

This method moved flagged region to the plane given (by orthogonal projection into the plane).

Parameters:

Point3 planeNormal

float planeOffset

The definition of the plane. The plane is that region of points X for which DotProd (planeNormal, X) = planeOffset.

int msl

MNMesh-based selection level, one of MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to align. Ignored if msl is set to MNM_SL_OBJECT.

TimeValue t=0

The current time. (This action can be used to set a key for animation.)

Return Value:

Indicates whether anything was moved.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnAlignToGrid(int msl, DWORD flag=MN_SEL);

Remarks:

This method aligns flagged parts to be on the current construction plane (in the current viewport).

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to align. Ignored if msl is set to MNM_SL_OBJECT.

Return Value:

Indicates whether anything was aligned.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnAlignToView(int msl, DWORD flag=MN_SEL);

Remarks:

This method aligns flagged parts to be at right angles to the current view (through the active viewport).

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to align. Ignored if msl is set to MNM_SL_OBJECT.

Return Value:

Indicates whether anything was aligned.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnDeleteIsoVerts();

Remarks:

This method deletes isolated vertices, those that aren't used by any faces.

Return Value:

Indicates whether any vertices were deleted.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnMeshSmooth(int msl, DWORD flag=MN_SEL);

Remarks:

This method applies the NURMS style MeshSmooth algorithm to the flagged area of the mesh. Uses parameter block parameters:

ep_ms_smoothness: Smoothness value for MeshSmooth type subdivision (float spinner, range 0-1)

ep_ms_smooth: Currently unused.

ep_ms_sep_smooth: Separate by smoothing groups for MeshSmooth type subdivision (checkbox)

ep_ms_sep_mat: Separate by material IDs for MeshSmooth type subdivision (checkbox)

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to meshsmooth. Ignored if msl is set to MNM_SL_OBJECT.

Return Value:

TRUE if applied, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnTessellate (int msl, DWORD flag=MN_SEL);

Remarks:

This method tessellates flagged area of the mesh. Uses ep_tess_type and ep_tess_tension from the param block.

Parameters:

int msl

MNMesh-based selection level, one of MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.

DWORD flag=MN_SEL

The flag that indicates which components to tessellate. Ignored if msl is set to MNM_SL_OBJECT.

Return Value:

TRUE is tessellated, otherwise FALSE.

Default Implementation:

{ return false; }

Prototype:

virtual void EpfnForceSubdivision();

Remarks:

This method will cue an update of the subdivision surface based on this Editable Poly. (See the Editable Poly documentation on the Object-level Surface Properties dialog for information on this surface.) Equivalent to the user pressing the "Update" button.

Default Implementation:

{ }

Prototype:

virtual void EpfnSelectVertByColor(BOOL add, BOOL sub, int mp=0, TimeValue t=0);

Remarks:

This method selects (or deselects) vertices based on their color. Note that the color to compare to is part of the parameter block - see ep_vert_sel_color and related parameters for details.

Parameters:

BOOL add

If TRUE, this selection should be in addition to the current selection. If FALSE, only the vertices within the color range should be selected.

BOOL sub

If TRUE, then instead of the options under "add" above, the vertices within the specified color range are deselected (while other selections are unmodified).

int mp=0

The map channel used for vertex colors. Use 0 for the traditional vertex color channel, 1-99 for a texture map channel, MAP_SHADING for the vertex illumination channel, or MAP_ALPHA for the vertex alpha channel.

TimeValue t=0

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnSetDiagonal(int face, int corner1, int corner2);

Remarks:

This method modifies a polygon's triangulation so that the specified diagonal is part of it.

Parameters:

int face

The face whose triangulation we want to modify

int corner1, corner2

The endpoints of the new diagonal. They should be indices into the vertex list. So for instance corner values of (0,3) would refer to vertices f[face].vtx[0] and f[face].vtx[3]. Note that if (corner1+1)%deg == corner2 (or vice versa), or if corner1==corner2, nothing will happen.

Default Implementation:

{ }

Prototype:

virtual bool EpfnRetriangulate(DWORD flag=MN_SEL);

Remarks:

This method will automatically re-triangulate flagged faces, using the standard polygon triangulation algorithm. Note that this algorithm is designed to work well on a single face, but not necessarily to produce the best results on groups of faces.

Parameters:

DWORD flag=MN_SEL

Indicates which faces should be affected.

Return Value:

Indicates whether anything happened. (If nothing was in fact flagged, it returns false.)

Default Implementation:

{ return false; }

Prototype:

virtual bool EpfnFlipNormals(DWORD flag=MN_SEL);

Remarks:

This method flips the normals in selected elements. (Note that because of topological rules for the PolyMesh, there is no way to flip a single face - whole elements must be flipped at once.)

Parameters:

DWORD flag=MN_SEL

Indicates which elements should be flipped. An element is considered flagged if any of its faces have that flag set.

Return Value:

Indicates which elements should be flipped. An element is considered flagged if any of its faces have that flag set.

Default Implementation:

{ return false; }

Prototype:

virtual void EpfnSelectByMat(int index, bool clear, TimeValue t);

Remarks:

This method selects or deselects faces by material ID.

Parameters:

int index

The material ID that indicates a face should be affected.

bool clear

If TRUE, these faces should have their selection cleared. (If FALSE, their selection is set.)

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnSelectBySmoothGroup(DWORD bits, BOOL clear, TimeValue t);

Remarks:

This method selects or deselects faces by smoothing group.

Parameters:

DWORD bits

The smoothing group bits that indicate a face should be affected.

BOOL clear

If TRUE, these faces should have their selection cleared. (If FALSE, the selection is set.)

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void EpfnAutoSmooth(TimeValue t);

Remarks:

This method autosmooths the current face selection, using the autosmooth threshold set in the parameter block.

Parameters:

TimeValue t

The current time.

Default Implementation:

{ }

Prototype:

virtual void CollapseDeadStructs();

Remarks:

This method deletes all the components in all the levels that have the MN_DEAD flag set. Note that this causes a renumbering of affected component levels. If you're deleting faces in the middle of a complex operation, it's usually best to just set their MN_DEAD flags, then call CollapseDeadStructs at the end, so that you don't have to worry about other faces' indices changing before you're done.

Default Implementation:

{ }

Prototype:

virtual int EpfnPropagateComponentFlags(int slTo, DWORD flTo, int slFrom, DWORD flFrom, bool ampersand=FALSE, bool set=TRUE, bool undoable=FALSE);

Remarks:

This method is used for setting flags in the MNMesh components based on flags of other components that they touch. This is very versatile. For instance, to hide all faces that use selected vertices, you would call EpfnPropegateComponentFlags (MNM_SL_FACE, MN_HIDE, MNM_SL_VERTEX, MN_SEL, false, true, true). (Hiding faces should be undoable.) To set the MN_WHATEVER flag on all vertices that are used only by selected edges, you'd call EpfnPropegateComponentFlags (MNM_SL_VERTEX, MN_WHATEVER, MNM_SL_EDGE, MN_SEL, true);

Parameters:

int slTo

The selection level we wish to modify. (One of MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, or MNM_SL_FACE.)

DWORD flTo

The flags we wish to change in that selection level.

int slFromt

The selection level we wish to base the changes on.

DWORD flFrom

The flags that indicate a change should happen.

bool ampersand=FALSE

When slFrom and slTo are different, this indicates whether the flags of the nearby components should be "or'd" or "and'd". If it's false, then any flagged components in the "from" level will cause the component in the "to" level to be affected. If true, then all the components in the "from" level that touch a component in the "to" level must be flagged in order for the "to" level component to be affected. (i.e., if from is faces and to is vertices, a vertex would only be modified if all faces that use it have the flFrom flag set.)

bool set=TRUE

If TRUE, this parameter indicates that the flTo flags should be set on targeted components. If false, it indicates that the flags should be cleared. For instance, to clear MN_HIDE flags on vertices that are used by selected edges, you'd call EpfnPropegateComponentFlags (MNM_SL_VERTEX, MN_HIDE, MNM_SL_EDGE, MN_SEL, false, false, true);

bool undoable=FALSE

Indicates if this action should create an entry for the undo system. Changes to MN_SEL, MN_HIDE, and MN_DEAD flags should generally be undoable, but changes to more minor flags like MN_WHATEVER that are used to set up for other operations generally don't have to be.

Return Value:

The number of components in the slTo level that were affected by the call. (If 0, nothing happened.)

Default Implementation:

{ return 0; }