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