MeshChange Class Reference

This reference page is linked to from the following overview topics: Mudbox 2013, Mesh and Topology.



Detailed Description

This class represents a change to a mesh, and is used when an operation which modifies mesh vertices should be undoable.

When you want to change the position of vertices in a mesh, and you want this change to be undoable, you should first call the function Mesh::StartChange to create a MeshChange object.

Definition at line 1177 of file mesh.h.

#include <mesh.h>

Inheritance diagram for MeshChange:
Inheritance graph
[legend]

List of all members.

Classes

struct   VertexChange
  This struct holds the change information about a single vertex. More...

Public Member Functions

float  Data (unsigned int iVertexIndex) const
  Returns the float data value stored in the vertex change.
const Vector OriginalPosition (unsigned int iVertexIndex) const
  This function returns the position of a vertex before this change.
Vector  OriginalNormal (unsigned int iVertexIndex) const
  This function returns the surface normal before the change for a specified vertex.
VertexChange Add (unsigned int iVertexIndex, unsigned int iFaceIndex, bool bPrecalculateLayerIndex=false)
  Register a vertex for the change, and returns the corresponding VertexChange structure.
void  Finish (bool bUndo=true, bool bMerge=false)
  This function must be called when no more vertices will be changed within the operation.

Friends

class  Mesh

Member Function Documentation

float Data ( unsigned int  iVertexIndex ) const [inline]

Returns the float data value stored in the vertex change.

Parameters:
[in] iVertexIndex Index of the vertex

Definition at line 1206 of file mesh.h.

    {
        Vertex &v = m_pMesh->VertexData( iVertexIndex );
        if ( v.m_iStrokeID < m_iVertexCount && m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
            return m_pArray[v.m_iStrokeID].m_fData;
        else
            return 0.0f;
    };
const Vector& OriginalPosition ( unsigned int  iVertexIndex ) const [inline]

This function returns the position of a vertex before this change.

Parameters:
[in] iVertexIndex Index of the vertex

Definition at line 1218 of file mesh.h.

    {
        Vertex &v = m_pMesh->VertexData( iVertexIndex );
        if ( v.m_iStrokeID < m_iVertexCount && m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
            return m_pArray[v.m_iStrokeID].m_vPosition;
        else
            return v.m_vPos;
    };
Vector OriginalNormal ( unsigned int  iVertexIndex ) const [inline]

This function returns the surface normal before the change for a specified vertex.

Parameters:
[in] iVertexIndex Index of the vertex

Definition at line 1230 of file mesh.h.

    {
        Vertex &v = m_pMesh->VertexData( iVertexIndex );
        if ( v.m_iStrokeID < m_iVertexCount && m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
            return m_pArray[v.m_iStrokeID].m_vNormal;
        else
            //return v.m_vNormal;
            return m_pMesh->VertexNormal(iVertexIndex);
    };
VertexChange& Add ( unsigned int  iVertexIndex,
unsigned int  iFaceIndex,
bool  bPrecalculateLayerIndex = false 
) [inline]

Register a vertex for the change, and returns the corresponding VertexChange structure.

This function must be called before modifying the position of a vertex.

Parameters:
[in] iVertexIndex Index of the vertex
[in] iFaceIndex Index of any face which uses the vertex
[in] bPrecalculateLayerIndex When this parameter is true, the function will precalculate the layer index of the vertex.

Definition at line 1255 of file mesh.h.

    {
        Vertex &v = m_pMesh->VertexData( iVertexIndex );
        if ( v.m_iStrokeID < m_iVertexCount && 
             m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
            return m_pArray[v.m_iStrokeID]; // 80% of the time it hits this...
        else 
            return Add_uncached(iVertexIndex, iFaceIndex, v, bPrecalculateLayerIndex);
    };
void Finish ( bool  bUndo = true,
bool  bMerge = false 
)

This function must be called when no more vertices will be changed within the operation.

Parameters:
[in] bUndo When this parameter is true, the changes made to the vertex positions are automatically stored
bMerge in the undo buffer, and becomes undoable [in] If this is true the undo operation is merged into the previous one causing one single undo

Friends And Related Function Documentation

friend class Mesh [friend]

Definition at line 1283 of file mesh.h.


The documentation for this class was generated from the following file:

MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange
MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange MeshChange