3ds Max C++ API Reference
MNMapPreserveData Class Reference

This class is used to "preserve" mapping coordinates while moving vertices. More...

#include <mnmesh.h>

+ Inheritance diagram for MNMapPreserveData:

Public Member Functions

 MNMapPreserveData ()
 Constructor. Initializes to empty data. More...
 
 ~MNMapPreserveData ()
 Destructor. Frees allocated data. More...
 
DllExport void Clear ()
 Clears out all allocated data, and resets to empty. More...
 
DllExport void Initialize (MNMesh &mm, const MapBitArray &mapsToDo)
 Creates caches of data based on the mesh given and the set of maps to be preserved. More...
 
DllExport void Apply (MNMesh &mm, Point3 *pDelta, int numDeltas)
 Given a mesh and a set of offsets for vertices, manipulate map channels to preserve the initial UV mapping. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. 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 voidoperator 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 voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_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...
 

Detailed Description

This class is used to "preserve" mapping coordinates while moving vertices.

The "Preserve" name is actually a little confusing; what this class helps us do is modify map vertices such that the overall map on a surface looks about the same, even though the regular vertices have moved. For instance, if you start with a Plane object, and move the middle vertex to the right, the map is typically distorted even though all the original map vertices are unaffected. This class will help by adjusting the middle map vertex so that the overall regular texture pattern is preserved.


Example: See example usage in the Editable Poly object, in maxsdk/samples/mesh/EditablePoly

Constructor & Destructor Documentation

◆ MNMapPreserveData()

MNMapPreserveData ( )
inline

Constructor. Initializes to empty data.

6604 : mDegreeSum(0), mProtectVertexColors(true) { }

◆ ~MNMapPreserveData()

~MNMapPreserveData ( )
inline

Destructor. Frees allocated data.

6607 { Clear(); }
DllExport void Clear()
Clears out all allocated data, and resets to empty.

Member Function Documentation

◆ Clear()

DllExport void Clear ( )

Clears out all allocated data, and resets to empty.

◆ Initialize()

DllExport void Initialize ( MNMesh mm,
const MapBitArray mapsToDo 
)

Creates caches of data based on the mesh given and the set of maps to be preserved.

Sets the "initial state" which the maps should try to adhere to.

Parameters
mmThe mesh whose maps should be preserved
mapsToDoA MapBitArray indicating which map channels should be preserved. See class MapBitArray for more details.

◆ Apply()

DllExport void Apply ( MNMesh mm,
Point3 pDelta,
int  numDeltas 
)

Given a mesh and a set of offsets for vertices, manipulate map channels to preserve the initial UV mapping.

Parameters
mmThe mesh being affected. Note that this algorithm uses the face information in the mesh, and affects the maps in the mesh, but it doesn't use the vertex information at all. (All relevant vertex information was digested in Initialize.) So this method may be called before or after applying the offsets given in pDelta.
pDeltaThe set of offsets for the vertices.
numDeltasThe length of the pDelta array