3ds Max C++ API Reference
|
Used for caching face and edge clusters, vertex normals, and other derived data about an MNMesh. More...
#include <mnmesh.h>
Public Member Functions | |
void | SetMesh (MNMesh *m) |
Sets the internal mesh pointer to m. More... | |
DllExport Tab< Point3 > * | VertexNormals () |
Returns a table of local average normals for vertices. More... | |
DllExport Tab< float > * | VSWeight (BOOL useEdgeDist, int edgeIts, BOOL ignoreBack, float falloff, float pinch, float bubble, DWORD selFlags=MN_SEL) |
Returns Vertex Selection weights (for soft selection). More... | |
DllExport Tab< float > * | SelectionDist (BOOL useEdgeDist, int edgeIts, DWORD selFlags=MN_SEL, float falloffLimit=-1.0f) |
Computes the distances of the unselected vertices from the current selection within a falloff. More... | |
DllExport Tab< Point3 > * | OutlineDir (int extrusionType, DWORD clusterFlags=MN_SEL) |
Produces the "Outline" direction of all vertices, based on the current face selection. More... | |
DllExport MNChamferData * | ChamferData () |
Rreturns the cache of a ChamferData for use in the MNMesh Chamfer methods. More... | |
DllExport void | Invalidate (ChannelMask channels) |
This method invalidates all data based on the specified part of the mesh. More... | |
DllExport void | InvalidateDistances () |
Uncaches (frees) the distance dependent data returned by VSWeight, SelectionDist, and ClusterDist. More... | |
DllExport void | InvalidateSoftSelection () |
This method frees the VSWeight data (but not the underlying distance-from-selection info). More... | |
DllExport void | freeClusterDist () |
This method is mainly for internal use, this frees just the cluster distance data. More... | |
DllExport void | freeBevelInfo () |
This method frees only the outlining data. More... | |
DllExport void | freeChamferData () |
This method frees only the chamfer data structure. More... | |
DllExport void | freeAll () |
This method frees all cached data of any kind. More... | |
DllExport BaseInterface * | GetInterface (Interface_ID id) |
Returns an interfaces. More... | |
Constructors and Destructors | |
DllExport | MNTempData () |
Constructor. More... | |
DllExport | MNTempData (MNMesh *m) |
Constructor. More... | |
DllExport | ~MNTempData () |
Destructor. More... | |
Cluster Methods | |
DllExport MNFaceClusters * | FaceClusters (DWORD clusterFlags=MN_SEL) |
This method returns a face cluster list, which groups selected faces into "clusters" for transformation. More... | |
DllExport MNEdgeClusters * | EdgeClusters (DWORD clusterFlags=MN_SEL) |
Returns an edge cluster list, which groups selected edges into "clusters" for applying transforms. More... | |
DllExport Tab< int > * | VertexClusters (int sl, DWORD clusterFlags=MN_SEL) |
This method returns an index of which cluster, if any, each vertex is in. More... | |
DllExport Tab< Point3 > * | ClusterNormals (int sl, DWORD clusterFlags=MN_SEL) |
Returns average normals for each cluster. More... | |
DllExport Tab< Point3 > * | ClusterCenters (int sl, DWORD clusterFlags=MN_SEL) |
Returns mean centers for each cluster. More... | |
DllExport Matrix3 | ClusterTM (int clust) |
Uses the current cluster center and normal caches to return the "objectspace to clusterspace" transform. More... | |
DllExport Tab< float > * | ClusterDist (int sl, DWORD clusterFlags, int clustId, BOOL useEdgeDist, int edgeIts) |
Computes the current distance of each vertex from the specified cluster. More... | |
Public Member Functions inherited from BaseInterfaceServer | |
virtual UtilExport int | NumInterfaces () const |
virtual UtilExport BaseInterface * | GetInterfaceAt (int i) const |
virtual UtilExport | ~BaseInterfaceServer () |
Public Member Functions inherited from InterfaceServer | |
virtual UtilExport | ~InterfaceServer () |
Destructor. More... | |
template<class InterfaceType > | |
InterfaceType * | GetTypedInterface () |
Additional Inherited Members | |
Static Public Member Functions inherited from MaxHeapOperators | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e) |
Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void | operator delete (void *ptr) |
Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, void *placement_ptr) |
Placement new operator. More... | |
static UtilExport void | operator delete (void *ptr, void *placement_ptr) |
Placement delete operator. More... | |
static UtilExport void * | aligned_malloc (size_t size, size_t alignment) |
Allocates memory on a specified alignment boundary. More... | |
static UtilExport void * | aligned_realloc (void *ptr, size_t size, size_t alignment) |
Reallocates memory on a specified alignment boundary. More... | |
static UtilExport void | aligned_free (void *ptr) |
Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More... | |
Protected Attributes inherited from BaseInterfaceServer | |
Tab< BaseInterface * > | interfaces |
Used for caching face and edge clusters, vertex normals, and other derived data about an MNMesh.
There is a SetMesh() method to set the current mesh that the TempData is based on, then there's a series of methods to update the cache and return some sort of derived data. All of these methods follow the form:
DerivedData is the container for the derived data requested (often a simple table, though there are some specialized classes returned from some methods). If the data has already been computed, the parameters are ignored and the cached data is returned. Otherwise, the data is computed from the parameters and the current mesh.
There are no procedures in place to detect changes in parameters or the mesh since the last time a method was called, so it's the calling routine's responsibility to free invalid structures. If you know that only certain pipeline channels, such as GEOM_CHANNEL have changed, you can use the Invalidate(ChannelMask channels) method. (GEOM_CHANNEL would free the distances-to-selected-vertices, for example, but not the Edge Clusters.)
In particular, there is no way for the MNTempData to know when its mesh pointer is no longer valid, so it's vital that the calling routine clear the mesh (with SetMesh(NULL)) or stop using the MNTempData when this happens.
All data members are private. They basically consist of a series of pointers which are initialized to NULL and then filled with allocated derived data as requested. There is also a NULL-initialized, private mesh pointer which is set with SetMesh(). Editable Poly uses this class to hold all the varieties of temporary, cached data it creates – examples are vertex normals and face clusters.
To use MNTempData, just set it to your mesh and start querying the member functions.
DllExport MNTempData | ( | ) |
Constructor.
Sets all data members to NULL.
DllExport MNTempData | ( | MNMesh * | m | ) |
Constructor.
Sets the internal mesh pointer to the mesh passed. (Sets all other data members to NULL.)
DllExport ~MNTempData | ( | ) |
Destructor.
Sets the internal mesh pointer to m.
DllExport MNFaceClusters* FaceClusters | ( | DWORD | clusterFlags = MN_SEL | ) |
This method returns a face cluster list, which groups selected faces into "clusters" for transformation.
See Class MNFaceClusters for more information. If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh.
DllExport MNEdgeClusters* EdgeClusters | ( | DWORD | clusterFlags = MN_SEL | ) |
Returns an edge cluster list, which groups selected edges into "clusters" for applying transforms.
See Class MNEdgeClusters for more information. If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh.
This method returns an index of which cluster, if any, each vertex is in.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameter.
Returns average normals for each cluster.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameter. Note that cluster centers and normals are computed and cached at the same time, when you call either method.
Returns mean centers for each cluster.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameter. Note that cluster centers and normals are computed and cached at the same time, when you call either method.
Uses the current cluster center and normal caches to return the "objectspace to clusterspace" transform.
This is the transform of the "local" axis in moving edge or face clusters in Editable Poly. If the cluster centers and normals have not been cached, the identity matrix is returned; thus the control over whether this is an edge or face cluster is handled by the last call to ClusterCenters or ClusterNormals.
DllExport Tab<float>* ClusterDist | ( | int | sl, |
DWORD | clusterFlags, | ||
int | clustId, | ||
BOOL | useEdgeDist, | ||
int | edgeIts | ||
) |
Computes the current distance of each vertex from the specified cluster.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters.
NOTE: If useEdgeDist is FALSE, this is an n-log-n algorithm: it compares every vertex not in the cluster with every vertex in it. If useEdgeDist is TRUE, the time it takes is proportional to the number of verts in the cluster times edgeIts.
Returns a table of local average normals for vertices.
These normals are computed using the MNMesh::GetVertexNormal() method, wherein each face's contribution to the vertex normal is weighted by the face angle at the vertex.
DllExport Tab<float>* VSWeight | ( | BOOL | useEdgeDist, |
int | edgeIts, | ||
BOOL | ignoreBack, | ||
float | falloff, | ||
float | pinch, | ||
float | bubble, | ||
DWORD | selFlags = MN_SEL |
||
) |
Returns Vertex Selection weights (for soft selection).
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters. Weights are based on the standard soft selection falloff from the currently selected vertices.
Note: If useEdgeDist is FALSE, this is an n-log-n algorithm: it compares every vertex not in the cluster with every vertex in it. If useEdgeDist is TRUE, the time it takes is proportional to the number of verts in the cluster times edgeIts.
DllExport Tab<float>* SelectionDist | ( | BOOL | useEdgeDist, |
int | edgeIts, | ||
DWORD | selFlags = MN_SEL , |
||
float | falloffLimit = -1.0f |
||
) |
Computes the distances of the unselected vertices from the current selection within a falloff.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mnmesh and the parameters. The term "Selected verts" below refers to the vertices that are selected in the mesh's current selection level. (See the MNMesh method GetTempSel for details.)
useEdgeDist | If TRUE, the distance between vertices is computed along edges. If FALSE, it's computed directly through space. |
edgeIts | This indicates the maximum number of edges the algorithm may travel along in finding the distance between vertices. (Maximum path length.). WARNING: If useEdgeDist is FALSE, this is an n-squared algorithm: it compares every nonselected vertex with every selected one within the falloffLimit. If useEdgeDist is TRUE, the time it takes is proportional to the number of selected vertices times edgeIts. |
selFlags | The flags used to dertermine what edges are considered selected. |
falloffLimit | = -1.0f this limits the number of unselected vertices to check against Only vertices that fall within the selected vertices bounding box + this limit will be computed. If this value is -1.0 all vertices will be computed. Any vertex outside this limit will be set to a distance of the limit. |
Produces the "Outline" direction of all vertices, based on the current face selection.
"Outlining" is the direction vertices move to move edges of the current face selection outward at a constant rate. They are not set to length 1, but rather to whatever "rate" best makes the outline edges move most consistently, without changing their angles.
DllExport MNChamferData* ChamferData | ( | ) |
Rreturns the cache of a ChamferData for use in the MNMesh Chamfer methods.
Unlike other MeshTempData methods, this method makes no calculations based on the current mesh, but merely supplies a memory cache. (Computing this information is left to the MNMesh methods GetExtrudeDirection, ChamferVertices, and ChamferEdges.)
DllExport void Invalidate | ( | ChannelMask | channels | ) |
This method invalidates all data based on the specified part of the mesh.
In the following chart, the columns represent the channels GEOM_CHANNEL (G), TOPO_CHANNEL (T), SELECT_CHANNEL (S), and SUBSEL_TYPE_CHANNEL (U). X's indicate dependency of the specified data cache on the given channel.
Method to get cache | G | T | S | U |
FaceClusters | X | X | ||
EdgeClusters | X | X | ||
VertexClusters | X | X | X | |
ClusterCenters | X | X | X | X |
ClusterNormals | X | X | X | X |
VertexNormals | X | X | ||
SelectionDist | X | X | X | X |
ClusterDist | X | X | X | X |
VSWeight | X | X | X | X |
NOTE: ChamferData and the Outline direction info are handled separately in freeChamferData and freeBevelInfo.
Uncaches (frees) the distance dependent data returned by VSWeight, SelectionDist, and ClusterDist.
This method frees the VSWeight data (but not the underlying distance-from-selection info).
This is useful, e.g., if the mesh has not changed, but you wish to change the falloff, pinch, or bubble parameters to get new vertex selection weights.
This method is mainly for internal use, this frees just the cluster distance data.
|
virtual |
Returns an interfaces.
Reimplemented from BaseInterfaceServer.