class MohoView
The MohoView class is a script's interface to the Moho editing view.
Member Functions
void Refresh()
Causes the view to refresh, but not perform a full redraw. Not used very often.
Return value: none
void DrawMe()
Causes the view to completely redraw the current scene. Moho scripts use this a lot after making changes to the contents of the document.
Return value: none
LM_Vector2 Point2Vec(where, layerM)
Converts a pixel location to a 2D vector location, given a specific transformation matrix. This is used to convert between mouse coordinates and 2D layer coordinates.
Return value (LM_Vector2): 2D vector point in a layer's coordinate system where (LM_Point): pixel location on the screen layerM (LM_Matrix): the transformation matrix for the layer in question
int PickPoint(where)
Picks a point near the given pixel location.
Return value (int): id of an M_Point object in the current vector layer where (LM_Point): pixel location on the screen
void PickEdge(where, curveID, segID)
Picks an edge near the given pixel location.
Return value: none where (LM_Point): pixel location on the screen curveID (int): id of an M_Curve object in the current vector layer, returned by this function segID (int): which segment on the curve was picked, returned by this function
int PickShape(where, noHigherThan=-1)
Picks a shape near the given pixel location.
Return value (int): id of an M_Shape in the current vector layer where (LM_Point): pixel location on the screen noHigherThan (int): id of the highest shape to pick (to allow picking lower, hidden shapes), -1 to ignore this option
int PickBone(where, clickVec, layer, exact)
Picks a bone near the given pixel location.
Return value (int): id of the picked bone where (LM_Point): pixel location on the screen clickVec (LM_Vector2): vector location of the click layer (MohoLayer): the bone layer you wish to pick from exact (bool): true if only exact picks are accepted, false if the closest bone can be clicked even if not exact
XGraphics Graphics()
Returns a graphics object to use for custom drawing in the view.
Return value (XGraphics): a graphics drawing object
void ResetView(mode)
Reset or zoom in on the view.
Return value: none mode (int): 0:zoom in on all the points in the layer, 1:zoom in on all the selected points in the layer, 2:zoom out to default view
void PanDown(where)
Return value: none where (LM_Point):
void PanMoved(where)
Return value: none where (LM_Point):
void PanUp(where)
Return value: none where (LM_Point):
void ZoomDown(where)
Return value: none where (LM_Point):
void ZoomMoved(where)
Return value: none where (LM_Point):
void ZoomUp(where)
Return value: none where (LM_Point):
void RotateDown(where)
Return value: none where (LM_Point):
void RotateMoved(where)
Return value: none where (LM_Point):
void RotateUp(where)
Return value: none where (LM_Point):
void OrbitDown(where)
Return value: none where (LM_Point):
void OrbitMoved(where)
Return value: none where (LM_Point):
void OrbitUp(where)
Return value: none where (LM_Point):
void DrawPreviewShape()
Draws a "preview" shape by evaluating the selected points in the current vector layer as a shape, and drawing it in a highlighted mode. This is used by the Create Shape tool to preview a shape before the user hits the spacebar to finalize the shape.
Return value: none
class MohoView : public LM_View { void RefreshView(); void DrawMe(); int32 QualityFlags(); void SetQualityFlags(int32 qualityFlags); void SetTracingImage(const char *path); bool IsTracingEnabled(); void TurnTracingOn(bool b); bool IsTracingOn(); bool IsStereoEnabled(); void TurnStereoOn(bool b); bool IsStereoOn(); int32 PickPoint(LM_Point where, int32 pickWidth = 3); void PickEdge(LM_Point where, int32 *curveID, int32 *segID, int32 pickWidth = 3); LM_Point PickEdgeAlongLine(LM_Point lineEnd1, LM_Point lineEnd2, int32 *curveID, int32 *segID, int32 skipMinSegID, int32 skipMaxSegID); MohoLayer *PickGlobalEdge(LM_Point where, int32 *curveID, int32 *segID, int32 pickWidth = 3); int32 PickShape(LM_Point where, int32 noHigherThan = -1, int32 pickWidth = 3); int32 PickBone(LM_Point where, LM_Vector2 clickVec, MohoLayer *layer, bool exact, int32 pickWidth = 3); void FloodSelect(LM_Point where, int32 tolerance); M_Shape *PickGlobalShape(LM_Point where, int32 noHigherThan = -1, int32 pickWidth = 3); int32 PickFace(LM_Point where, int32 pickWidth = 3); MohoLayer *PickGlobalLayer(LM_Point where, int32 pickWidth = 3); LM_Vector2 Point2Vec(LM_Point where, LM_Matrix *layerM = NULL); XGraphics *Graphics(); void ResetView(int32 mode = 2); // These may seem weird, but the purpose is to get exactly the same behavior as the right-drag versions void PanDown(LM_Point where); void PanMoved(LM_Point where); void PanUp(LM_Point where); void ZoomDown(LM_Point where); void ZoomMoved(LM_Point where); void ZoomUp(LM_Point where); void RotateDown(LM_Point where); void RotateMoved(LM_Point where); void RotateUp(LM_Point where); void OrbitDown(LM_Point where); void OrbitMoved(LM_Point where); void OrbitUp(LM_Point where); void DrawPreviewShape(); };