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

#include <mod_command.h>

+ Inheritance diagram for lwpp::ModelerCommand:
+ Collaboration diagram for lwpp::ModelerCommand:

List of all members.

Public Member Functions

 ModelerCommand (int _version, LWModCommand *_mc)
virtual int Activate (void *p)=0
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)
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 Member Functions

void BeginUndoGroup ()
void EditBegin (int pntBuf, int polBuf, EltOpSelect opsel)
void EditBegin (int pntBuf, int edgeBuf, int polBuf, EltOpSelect opsel)
void EndUndoGroup ()
int Evaluate (const char *command)
int Execute (LWCommandCode cmd, int argc, const DynaValue *argv, EltOpSelect op, DynaValue *result)
const char * GetArgument ()
LWCommandCode Lookup (const char *cmdName)

Protected Attributes

const MeshEditOp * me
int version

Constructor & Destructor Documentation

lwpp::ModelerCommand::ModelerCommand ( int  _version,
LWModCommand *  _mc 
)
inline

Member Function Documentation

virtual int lwpp::ModelerCommand::Activate ( void *  p)
pure virtual
LWPolID lwpp::MeshEditOperator::AddCurve ( const char *  surf,
int  numPnt,
const LWPntID *  pnts,
int  flags 
)
inlineinherited
EDError lwpp::MeshEditOperator::AddDiscoVMap ( LWPntID  point,
LWPolID  pol,
LWID  type,
const char *  name,
int  dim,
float *  val 
)
inlineinherited

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 
)
inlineinherited
LWPntID lwpp::MeshEditOperator::AddIPoint ( double *  xyz,
int  numPnt,
const LWPntID *  ids,
const double *  wt = 0 
)
inlineinherited

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 
)
inlineinherited
EDError lwpp::MeshEditOperator::AddPatch ( int  nr,
int  nc,
int  lr,
int  lc,
EDBoundCv *  r0,
EDBoundCv *  r1,
EDBoundCv *  c0,
EDBoundCv *  c1 
)
inlineinherited
LWPntID lwpp::MeshEditOperator::AddPoint ( double *  xyz)
inlineinherited
LWPolID lwpp::MeshEditOperator::AddPoly ( LWID  type,
int  numPnt,
const LWPntID *  pnt,
LWPolID  tmpl = 0,
const char *  surf = 0 
)
inlineinherited

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 
)
inlineinherited
EDError lwpp::MeshEditOperator::AddTri ( LWPntID  p1,
LWPntID  p2,
LWPntID  p3 
)
inlineinherited
int lwpp::MeshEditOperator::AdvanceLayer ( )
inlineinherited
void lwpp::ModelerCommand::BeginUndoGroup ( )
inlineprotected
void lwpp::MeshEditOperator::Done ( EDError  err,
int  selm 
)
inlineinherited

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)
inlineinherited
void lwpp::ModelerCommand::EditBegin ( int  pntBuf,
int  polBuf,
EltOpSelect  opsel 
)
inlineprotected
void lwpp::ModelerCommand::EditBegin ( int  pntBuf,
int  edgeBuf,
int  polBuf,
EltOpSelect  opsel 
)
inlineprotected
void lwpp::ModelerCommand::EndUndoGroup ( )
inlineprotected
int lwpp::ModelerCommand::Evaluate ( const char *  command)
inlineprotected
bool lwpp::MeshEditOperator::EvaluateVMap ( LWPntID  point,
LWPolID  pol,
float *  val 
)
inlineinherited

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.

int lwpp::ModelerCommand::Execute ( LWCommandCode  cmd,
int  argc,
const DynaValue *  argv,
EltOpSelect  op,
DynaValue *  result 
)
inlineprotected
void lwpp::MeshEditOperator::FlipEdge ( LWEdgeID  edge)
inlineinherited
const char* lwpp::ModelerCommand::GetArgument ( )
inlineprotected
void* lwpp::MeshEditOperator::GetData ( LWPntID  pnt)
inlineinherited
void* lwpp::MeshEditOperator::GetData ( LWEdgeID  edg)
inlineinherited
void* lwpp::MeshEditOperator::GetData ( LWPolID  pol)
inlineinherited
LWEdgeID lwpp::MeshEditOperator::GetEdge ( LWPntID  p1,
LWPntID  p2 
)
inlineinherited

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 
)
inlineinherited
LWPntID lwpp::MeshEditOperator::GetEdgePoint1 ( LWEdgeID  edge)
inlineinherited
LWPntID lwpp::MeshEditOperator::GetEdgePoint2 ( LWEdgeID  edge)
inlineinherited
int lwpp::MeshEditOperator::GetEdgePolys ( LWEdgeID  edge,
const LWPolID **  pols 
)
inlineinherited
int lwpp::MeshEditOperator::GetFlags ( LWPntID  pnt)
inlineinherited
int lwpp::MeshEditOperator::GetFlags ( LWEdgeID  edg)
inlineinherited
int lwpp::MeshEditOperator::GetFlags ( LWPolID  pol)
inlineinherited
EDPointInfo* lwpp::MeshEditOperator::GetInfo ( LWPntID  id)
inlineinherited
EDPolygonInfo* lwpp::MeshEditOperator::GetInfo ( LWPolID  id)
inlineinherited
EDEdgeInfo* lwpp::MeshEditOperator::GetInfo ( LWEdgeID  id)
inlineinherited
int lwpp::MeshEditOperator::getLayer ( )
inlineinherited
int lwpp::MeshEditOperator::GetLayer ( LWPntID  pnt)
inlineinherited
int lwpp::MeshEditOperator::GetLayer ( LWEdgeID  edg)
inlineinherited
int lwpp::MeshEditOperator::GetLayer ( LWPolID  pol)
inlineinherited
int lwpp::MeshEditOperator::GetPointCount ( EltOpLayer  lyr,
int  mode 
)
inlineinherited
int lwpp::MeshEditOperator::GetPointEdges ( LWPntID  pnt,
const LWEdgeID **  edges 
)
inlineinherited

Returns the edges surrounding the specified point.

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

Copies the position of the specified point into pos.

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

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)
inlineinherited
EDError lwpp::MeshEditOperator::InitUV ( float *  uv)
inlineinherited

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.

LWCommandCode lwpp::ModelerCommand::Lookup ( const char *  cmdName)
inlineprotected
EDError lwpp::MeshEditOperator::Move ( LWPntID  id,
const double *  delta 
)
inlineinherited
int lwpp::MeshEditOperator::PointNew ( LWPntID  pnt)
inlineinherited
int lwpp::MeshEditOperator::PolyNew ( LWPolID  pol)
inlineinherited
bool lwpp::MeshEditOperator::ReadVMap ( LWPntID  point,
float *  val 
)
inlineinherited

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 
)
inlineinherited

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)
inlineinherited
EDError lwpp::MeshEditOperator::Remove ( LWPolID  id)
inlineinherited
EDError lwpp::MeshEditOperator::ReplacePolyPoints ( LWPolID  id,
int  n,
const LWPntID *  p 
)
inlineinherited

Replace the point list of a polygon.

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

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 
)
inlineinherited
EDError lwpp::MeshEditOperator::Select ( LWPntID  pnt,
bool  sel 
)
inlineinherited

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 
)
inlineinherited

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 
)
inlineinherited

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)
inlineinherited
void lwpp::MeshEditOperator::SetMeshEditOp ( const MeshEditOp *  _me)
inlineinherited
EDError lwpp::MeshEditOperator::SetPolTag ( LWPolID  id,
LWID  type,
const char *  name = 0 
)
inlineinherited

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 
)
inlineinherited

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 
)
inlineinherited

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 
)
inlineinherited

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
protectedinherited
int lwpp::ModelerCommand::version
protected

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