LightWrap++
AC++wrapperfortheLightWave3DSDK
lwpp::MeshEditOperator Class Reference

#include <mod_command.h>

+ Inheritance diagram for lwpp::MeshEditOperator:

List of all members.

Public Member Functions

 MeshEditOperator (const MeshEditOp *_me=0)
 MeshEditOperator (const MeshEditOp &_me)
LWPolID AddCurve (const char *surf, int numPnt, const LWPntID *pnts, int flags)
EDError AddDiscoVMap (LWPntID point, LWPolID pol, LWID type, const char *name, int dim, float *val)
 Add a discontinuous vmap vector to a polygon vertex.
LWPolID AddFace (const char *surf, int numPnt, const LWPntID *pnts)
LWPntID AddIPoint (double *xyz, int numPnt, const LWPntID *ids, const double *wt=0)
 Create an "interpolated" point.
LWPntID AddIPoint (int numPnt, const LWPntID *ids, const double *wt=0)
EDError AddPatch (int nr, int nc, int lr, int lc, EDBoundCv *r0, EDBoundCv *r1, EDBoundCv *c0, EDBoundCv *c1)
LWPntID AddPoint (double *xyz)
LWPolID AddPoly (LWID type, int numPnt, const LWPntID *pnt, LWPolID tmpl=0, const char *surf=0)
 Create a polygon.
EDError AddQuad (LWPntID p1, LWPntID p2, LWPntID p3, LWPntID p4)
EDError AddTri (LWPntID p1, LWPntID p2, LWPntID p3)
int AdvanceLayer ()
void Done (EDError err, int selm)
 Call this when the edit is complete.
int EdgeNew (LWEdgeID edg)
bool EvaluateVMap (LWPntID point, LWPolID pol, float *val)
 Read the vmap vector for a point, accounting for both continuous and discontinuous values.
void FlipEdge (LWEdgeID edge)
void * GetData (LWPntID pnt)
void * GetData (LWEdgeID edg)
void * GetData (LWPolID pol)
LWEdgeID GetEdge (LWPntID p1, LWPntID p2)
 Returns the edge between p1 and p2 if such an edge exists.
int GetEdgeCount (EltOpLayer lyr, int mode)
LWPntID GetEdgePoint1 (LWEdgeID edge)
LWPntID GetEdgePoint2 (LWEdgeID edge)
int GetEdgePolys (LWEdgeID edge, const LWPolID **pols)
int GetFlags (LWPntID pnt)
int GetFlags (LWEdgeID edg)
int GetFlags (LWPolID pol)
EDPointInfo * GetInfo (LWPntID id)
EDPolygonInfo * GetInfo (LWPolID id)
EDEdgeInfo * GetInfo (LWEdgeID id)
int getLayer ()
int GetLayer (LWPntID pnt)
int GetLayer (LWEdgeID edg)
int GetLayer (LWPolID pol)
int GetPointCount (EltOpLayer lyr, int mode)
int GetPointEdges (LWPntID pnt, const LWEdgeID **edges)
 Returns the edges surrounding the specified point.
void GetPointPosition (LWPntID pnt, double pos[3])
 Copies the position of the specified point into pos.
int GetPolyCount (EltOpLayer lyr, int mode)
bool GetPolyNormal (LWPolID id, double n[3])
int GetPolyPoints (LWPolID pol, const LWPntID **pnts)
const char * GetPolyTag (LWPolID polygon, LWID tagtype)
 Returns a tag string associated with the polygon.
unsigned int GetPolyType (LWPolID pol)
EDError InitUV (float *uv)
 Set the texture UV for a point or polygon you're about to create.
EDError Move (LWPntID id, const double *delta)
MeshEditOperatoroperator= (const MeshEditOperator &from)
int PointNew (LWPntID pnt)
int PolyNew (LWPolID pol)
bool ReadVMap (LWPntID point, float *val)
 Read the vmap vector for a point.
bool ReadVMap (LWPntID point, LWPolID pol, float *val)
 Read the vmap vector for a polygon vertex.
EDError Remove (LWPntID id)
EDError Remove (LWPolID id)
EDError ReplacePolyPoints (LWPolID id, int n, const LWPntID *p)
 Replace the point list of a polygon.
EDError Scan (PointScanner &scanner, EltOpLayer lyr)
EDError Scan (FastPointScanner &scanner, EltOpLayer lyr, bool selOnly)
EDError Scan (PolyScanner &scanner, EltOpLayer lyr)
EDError Scan (FastPolyScanner &scanner, EltOpLayer lyr, bool selOnly)
EDError Scan (EdgeScanner &scanner, EltOpLayer lyr)
EDError Scan (FastEdgeScanner &scanner, EltOpLayer lyr, bool selOnly)
void * Select (void *vmapID, LWID vmaptype, const char *vmapname)
 Select a vmap for reading vectors.
void * Select (LWID vmaptype, const char *vmapname)
EDError Select (LWPntID pnt, bool sel)
 Set the selection state of a point.
EDError Select (LWPolID pol, bool sel)
 Set the selection state of a polygon.
EDError Select (LWEdgeID edge, bool sel)
 Set the selection state of an edge.
int SetLayer (int lyr)
void SetMeshEditOp (const MeshEditOp *_me)
EDError SetPolTag (LWPolID id, LWID type, const char *name=0)
 Add a polygon tag to a polygon, or change an existing tag.
EDError SetPolyFlags (LWPolID id, int mask, int value)
 Set polygon flags.
EDError SetSurface (LWPolID id, const char *name)
 Change the surface assigned to a polygon.
EDError SetVMap (LWPntID id, LWID vmap, const char *c=0, int i=0, float *f=0)
 Add a vmap vector to a point.

Protected Attributes

const MeshEditOp * me

Constructor & Destructor Documentation

lwpp::MeshEditOperator::MeshEditOperator ( const MeshEditOp *  _me = 0)
inline
lwpp::MeshEditOperator::MeshEditOperator ( const MeshEditOp &  _me)
inline

Member Function Documentation

LWPolID lwpp::MeshEditOperator::AddCurve ( const char *  surf,
int  numPnt,
const LWPntID *  pnts,
int  flags 
)
inline
EDError lwpp::MeshEditOperator::AddDiscoVMap ( LWPntID  point,
LWPolID  pol,
LWID  type,
const char *  name,
int  dim,
float *  val 
)
inline

Add a discontinuous vmap vector to a polygon vertex.

This is the vector returned by ReadVMap (LWPntID point, LWPolID pol, float *val). See pntVMap for a partial list of vmap types.

LWPolID lwpp::MeshEditOperator::AddFace ( const char *  surf,
int  numPnt,
const LWPntID *  pnts 
)
inline
LWPntID lwpp::MeshEditOperator::AddIPoint ( double *  xyz,
int  numPnt,
const LWPntID *  ids,
const double *  wt = 0 
)
inline

Create an "interpolated" point.

The new point's vmap values are calculated as a weighted average of the vmaps of the points in the points array. If pos is NULL, the position is also computed as a weighted average. If the weight array is NULL, the averaging over the point list is uniform. The weights are renormalized to sum to 1.0.

LWPntID lwpp::MeshEditOperator::AddIPoint ( int  numPnt,
const LWPntID *  ids,
const double *  wt = 0 
)
inline
EDError lwpp::MeshEditOperator::AddPatch ( int  nr,
int  nc,
int  lr,
int  lc,
EDBoundCv *  r0,
EDBoundCv *  r1,
EDBoundCv *  c0,
EDBoundCv *  c1 
)
inline
LWPntID lwpp::MeshEditOperator::AddPoint ( double *  xyz)
inline
LWPolID lwpp::MeshEditOperator::AddPoly ( LWID  type,
int  numPnt,
const LWPntID *  pnt,
LWPolID  tmpl = 0,
const char *  surf = 0 
)
inline

Create a polygon.

If a template polygon is supplied, Modeler copies the polygon tags for the new polygon from the template.

If the surface name is NULL, the surface will be that of the template, or the current default surface if the template is NULL. The vertices of the new polygon are listed in clockwise order, and the normal will be inferred from the first, second and last vertex.

EDError lwpp::MeshEditOperator::AddQuad ( LWPntID  p1,
LWPntID  p2,
LWPntID  p3,
LWPntID  p4 
)
inline
EDError lwpp::MeshEditOperator::AddTri ( LWPntID  p1,
LWPntID  p2,
LWPntID  p3 
)
inline
int lwpp::MeshEditOperator::AdvanceLayer ( )
inline
void lwpp::MeshEditOperator::Done ( EDError  err,
int  selm 
)
inline

Call this when the edit is complete.

As changes are made during an edit, they are buffered through Modeler's undo mechanism, so they are not reflected in the data until done is called, and not at all if done sets the error argument.

In general, if one of the edit functions returns an error, you'll pass that error to done. If you just want the edit to stop or be discarded, possibly because the user pressed the Cancel button in a progress monitor, you'll pass EDERR_USERABORT. If an error occurs in your plug-in, you'll pass EDERR_NOMEMORY (for memory allocation errors) or EDERR_BADARGS (for everything else). And if the edit was successful, you'll use EDERR_NONE.

The selset argument tells Modeler how you want the selection to appear to the user after the edit has been applied. It contains flags combined using bitwise-or, and can include the following.

  • EDSELM_CLEARCURRENT Deselect elements that were selected when the edit began.
  • EDSELM_SELECTNEW Select elements created by the edit.
  • EDSELM_FORCEVRTS Force selection of newly created vertices.
  • EDSELM_FORCEPOLS Force selection of newly created polygons.

A value of 0 leaves all directly selected elements selected after the edit. The CLEARCURRENT and SELECTNEW flags are polite hints; they won't override selection settings made by the user. The force flags will always force direct selection of the points or polygons created by the edit.

int lwpp::MeshEditOperator::EdgeNew ( LWEdgeID  edg)
inline
bool lwpp::MeshEditOperator::EvaluateVMap ( LWPntID  point,
LWPolID  pol,
float *  val 
)
inline

Read the vmap vector for a point, accounting for both continuous and discontinuous values.

Generally, if a discontinuous value exists for the point, that value will be returned. Otherwise the continuous value is used.

void lwpp::MeshEditOperator::FlipEdge ( LWEdgeID  edge)
inline
void* lwpp::MeshEditOperator::GetData ( LWPntID  pnt)
inline
void* lwpp::MeshEditOperator::GetData ( LWEdgeID  edg)
inline
void* lwpp::MeshEditOperator::GetData ( LWPolID  pol)
inline
LWEdgeID lwpp::MeshEditOperator::GetEdge ( LWPntID  p1,
LWPntID  p2 
)
inline

Returns the edge between p1 and p2 if such an edge exists.

Otherwise, the function returns NULL.

int lwpp::MeshEditOperator::GetEdgeCount ( EltOpLayer  lyr,
int  mode 
)
inline
LWPntID lwpp::MeshEditOperator::GetEdgePoint1 ( LWEdgeID  edge)
inline
LWPntID lwpp::MeshEditOperator::GetEdgePoint2 ( LWEdgeID  edge)
inline
int lwpp::MeshEditOperator::GetEdgePolys ( LWEdgeID  edge,
const LWPolID **  pols 
)
inline
int lwpp::MeshEditOperator::GetFlags ( LWPntID  pnt)
inline
int lwpp::MeshEditOperator::GetFlags ( LWEdgeID  edg)
inline
int lwpp::MeshEditOperator::GetFlags ( LWPolID  pol)
inline
EDPointInfo* lwpp::MeshEditOperator::GetInfo ( LWPntID  id)
inline
EDPolygonInfo* lwpp::MeshEditOperator::GetInfo ( LWPolID  id)
inline
EDEdgeInfo* lwpp::MeshEditOperator::GetInfo ( LWEdgeID  id)
inline
int lwpp::MeshEditOperator::getLayer ( )
inline
int lwpp::MeshEditOperator::GetLayer ( LWPntID  pnt)
inline
int lwpp::MeshEditOperator::GetLayer ( LWEdgeID  edg)
inline
int lwpp::MeshEditOperator::GetLayer ( LWPolID  pol)
inline
int lwpp::MeshEditOperator::GetPointCount ( EltOpLayer  lyr,
int  mode 
)
inline
int lwpp::MeshEditOperator::GetPointEdges ( LWPntID  pnt,
const LWEdgeID **  edges 
)
inline

Returns the edges surrounding the specified point.

void lwpp::MeshEditOperator::GetPointPosition ( LWPntID  pnt,
double  pos[3] 
)
inline

Copies the position of the specified point into pos.

int lwpp::MeshEditOperator::GetPolyCount ( EltOpLayer  lyr,
int  mode 
)
inline
bool lwpp::MeshEditOperator::GetPolyNormal ( LWPolID  id,
double  n[3] 
)
inline
int lwpp::MeshEditOperator::GetPolyPoints ( LWPolID  pol,
const LWPntID **  pnts 
)
inline
const char* lwpp::MeshEditOperator::GetPolyTag ( LWPolID  polygon,
LWID  tagtype 
)
inline

Returns a tag string associated with the polygon.

For the LWPTAG_SURF tag type, the surface name is returned.

unsigned int lwpp::MeshEditOperator::GetPolyType ( LWPolID  pol)
inline
EDError lwpp::MeshEditOperator::InitUV ( float *  uv)
inline

Set the texture UV for a point or polygon you're about to create.

If a texture map is selected in Modeler's interface, the UVs will be assigned to that map as points or polygons are created. You'll typically want to give the user the option of whether or not to create UVs for new points and polygons.

When creating points, pass initUV an array of two floats and then call any of the functions that create a point. The two floats will be used as the U and V for the point, after which the initUV state will be cleared so that subsequent points have no UV unless the function is called again.

To initialize per-polygon, or discontinuous, UVs, call initUV with a pointer to 2n floats before creating a polygon with n vertices. For each vertex, if the point's continuous UV value is different from the UV in the array, then a polygon-specific UV is set for the vertex. If the point has no continuous UV, then the continuous value for the point is set to the polygon UV.

Any combination of these two methods can be used to assign UVs to new data. If only polygon UVs are specified, continuous UVs will still be created where polygons share UV values. Alternately, plug-ins can assign UVs to points and only specify polygon UVs along seam polygons.

EDError lwpp::MeshEditOperator::Move ( LWPntID  id,
const double *  delta 
)
inline
MeshEditOperator& lwpp::MeshEditOperator::operator= ( const MeshEditOperator from)
inline
int lwpp::MeshEditOperator::PointNew ( LWPntID  pnt)
inline
int lwpp::MeshEditOperator::PolyNew ( LWPolID  pol)
inline
bool lwpp::MeshEditOperator::ReadVMap ( LWPntID  point,
float *  val 
)
inline

Read the vmap vector for a point.

The vector is read from the vmap selected by a previous call to pointVSet. If the point is mapped (has a vmap value in the selected vmap), the val array is filled with the vmap vector for the point, and pointVGet returns true. If you don't already know the dimension of the vmap (the number of values per point, and therefore the required size of the val array), you can use the scene objects global to find out.

See also pointVPGet and pointVEval. pointVGet is equivalent to reading values from a VMAP chunk in an object file. It returns the continuous, or per-point, vector. For the raw discontinuous, or per-polygon-vertex value, use pointVPGet, and for the combined value accounting for both sources, use pointVEval.

bool lwpp::MeshEditOperator::ReadVMap ( LWPntID  point,
LWPolID  pol,
float *  val 
)
inline

Read the vmap vector for a polygon vertex.

This is like pointVGet, but it returns the discontinuous vmap value, equivalent to reading entries in a VMAD chunk.

EDError lwpp::MeshEditOperator::Remove ( LWPntID  id)
inline
EDError lwpp::MeshEditOperator::Remove ( LWPolID  id)
inline
EDError lwpp::MeshEditOperator::ReplacePolyPoints ( LWPolID  id,
int  n,
const LWPntID *  p 
)
inline

Replace the point list of a polygon.

EDError lwpp::MeshEditOperator::Scan ( PointScanner scanner,
EltOpLayer  lyr 
)
inline
EDError lwpp::MeshEditOperator::Scan ( FastPointScanner scanner,
EltOpLayer  lyr,
bool  selOnly 
)
inline
EDError lwpp::MeshEditOperator::Scan ( PolyScanner scanner,
EltOpLayer  lyr 
)
inline
EDError lwpp::MeshEditOperator::Scan ( FastPolyScanner scanner,
EltOpLayer  lyr,
bool  selOnly 
)
inline
EDError lwpp::MeshEditOperator::Scan ( EdgeScanner scanner,
EltOpLayer  lyr 
)
inline
EDError lwpp::MeshEditOperator::Scan ( FastEdgeScanner scanner,
EltOpLayer  lyr,
bool  selOnly 
)
inline
void* lwpp::MeshEditOperator::Select ( void *  vmapID,
LWID  vmaptype,
const char *  vmapname 
)
inline

Select a vmap for reading vectors.

Returns an opaque pointer that can be used to select the same vmap in later calls to this function. The first time this is called for a given vmap, the pointer can be NULL, and Modeler will locate and select the vmap using the type and name arguments

void* lwpp::MeshEditOperator::Select ( LWID  vmaptype,
const char *  vmapname 
)
inline
EDError lwpp::MeshEditOperator::Select ( LWPntID  pnt,
bool  sel 
)
inline

Set the selection state of a point.

These can only be called during OPSEL_MODIFY mesh edits. The element is selected if setsel is true and deselected if it's false

EDError lwpp::MeshEditOperator::Select ( LWPolID  pol,
bool  sel 
)
inline

Set the selection state of a polygon.

These can only be called during OPSEL_MODIFY mesh edits. The element is selected if setsel is true and deselected if it's false

EDError lwpp::MeshEditOperator::Select ( LWEdgeID  edge,
bool  sel 
)
inline

Set the selection state of an edge.

These can only be called during OPSEL_MODIFY mesh edits. The element is selected if setsel is true and deselected if it's false

int lwpp::MeshEditOperator::SetLayer ( int  lyr)
inline
void lwpp::MeshEditOperator::SetMeshEditOp ( const MeshEditOp *  _me)
inline
EDError lwpp::MeshEditOperator::SetPolTag ( LWPolID  id,
LWID  type,
const char *  name = 0 
)
inline

Add a polygon tag to a polygon, or change an existing tag.

If the tag type is LWPTAG_SURF, the tag is the surface name.

If the tag type is LWPTAG_PART, the tag is the part (or group) name.

For anything other than surface tags, passing a NULL tag will remove an existing tag of the specified type.

EDError lwpp::MeshEditOperator::SetPolyFlags ( LWPolID  id,
int  mask,
int  value 
)
inline

Set polygon flags.

The mask contains 1 bits for each flag you want to change, and the value contains the new flag settings (0 or 1 for each 1 bit in the mask).

Currently, the flags that can be changed are the EDPF_START and EDPF_END flags for curves.

EDError lwpp::MeshEditOperator::SetSurface ( LWPolID  id,
const char *  name 
)
inline

Change the surface assigned to a polygon.

EDError lwpp::MeshEditOperator::SetVMap ( LWPntID  id,
LWID  vmap,
const char *  c = 0,
int  i = 0,
float *  f = 0 
)
inline

Add a vmap vector to a point.

The vmap type can be one of the following, or something else.

  • LWVMAP_PICK - selection set
  • LWVMAP_WGHT - weight map
  • LWVMAP_MNVW - subpatch weight map
  • LWVMAP_TXUV - texture UV coordinates
  • LWVMAP_MORF - relative vertex displacement (morph)
  • LWVMAP_SPOT - absolute vertex displacement (morph)
  • LWVMAP_RGB, LWVMAP_RGBA - vertex color

Pass a NULL val_array to remove a vmap vector from the point.


Member Data Documentation

const MeshEditOp* lwpp::MeshEditOperator::me
protected

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