class MohoDoc

The MohoDoc class represents the current Moho document object.

Member Functions

int CountLayers()

Returns the number of top-level layers in the document.

Return value (int): the number of top-level layers in the document

MohoLayer Layer(id)

Access an individual layer in the document.

Return value (MohoLayer): a layer in the document
id (int): id number of the layer (0 is the lowest layer in the document)

void PrepUndo(layer)

Mark a point in editing that the user can "undo" to return to. Pass nil as the argument to mark a forthcoming operation as "not undoable".

Return value: none
layer (MohoLayer): the layer that is about to be modified

void SetDirty()

Marks the document as "dirty" or modified, prompting the user to save if they try to quit.

Return value: none

int AnimDuration()

Returns the duration of the document's animation. This is basically the frame number of the last keyframe in the entire document. Depending on the animation, this can be much less or much more than the document's official end frame.

Return value (int): the duration of the document's animation

int Width()

Returns the pixel width of the final rendered output.

Return value (int): pixel width of the final rendered output

int Height()

Returns the pixel height of the final rendered output.

Return value (int): pixel height of the final rendered output

void SetShape(w, h)

Set's the pixel width and height of the final rendered output.

Return value: none
w (int): width
h (int): height

float AspectRatio()

Returns the aspect ratio of the final rendered output.

Return value (float): aspect ratio of the final rendered output

int StartFrame()

Returns the document's start frame (typically 1).

Return value (int): document start frame

void SetStartFrame(frame)

Sets the document's start frame.

Return value: none
frame (int): document start frame

int EndFrame()

Return's the document's end frame.

Return value (int): document end frame

void SetEndFrame(frame)

Sets the document's start frame.

Return value: none
frame (int): document end frame

float Fps()

Returns the frame rate of the document (frames per second).

Return value (float): document fps

bool IsOutsideViewEnabled()

Returns true if the user is orbiting the workspace, and not viewing the scene through the camera.

Return value (bool): true if orbiting, false if viewing through the camera

void GetOutsideViewMatrix(m)

Returns the transformation matrix for viewing the scene from the "orbit" view.

Return value: none
m (LM_Matrix): orbit transform matrix

void DepthSort()

Performs a depth sort on all layers in the document.

Return value: none

Member Variables

fCameraTrack (AnimVec3)

the camera tracking animation channel


fCameraZoom (AnimVal)

the camera zoom animation channel


fCameraRoll (AnimVal)

the camera roll animation channel


fCameraPanTilt (AnimVec2)

the camera pan/tilt animation channel

class MohoDoc {
  int32 CountLayers();
  MohoLayer *Layer(int id);
  MohoLayer *LayerByName(const char *name);
  bool IsLayerValid(MohoLayer *layer);
  bool IsLayerValid(const char *uuid);
  void ClearSecondarySelection(GroupLayer *group = NULL);
  int32 CountSelectedLayers(GroupLayer *group = NULL);
  MohoLayer *GetSelectedLayer(int32 id);
  int32 LayerID(MohoLayer *layer);
  int32 LayerAbsoluteID(MohoLayer *layer);
  MohoLayer *LayerByAbsoluteID(int32 id);
  MohoLayer *DuplicateLayer(MohoLayer *origLayer);
 
  char *Path();
  char *Name();
 
  void PrepUndo(MohoLayer *layer);
  void PrepMultiUndo();
  void Undo();
  void Redo();
  bool IsUndoable();
  bool IsRedoable();
  void SetDirty();
 
  int32 AnimDuration();
  void ClearAnimation(int32 fromFrame, bool before);
  void DeleteKeysAtFrame(int32 frame);
 
  int32 Width();
  int32 Height();
  void SetShape(int32 w, int32 h);
  real AspectRatio();
 
  int32 StartFrame();
  void SetStartFrame(int32 frame);
  int32 EndFrame();
  void SetEndFrame(int32 frame);
 
  real Fps();
  void SetFps(real fps);
 
  rgb_color BackCol();
  void SetBackCol(rgb_color col);
 
  int32 NoiseGrain();
  void SetNoiseGrain(int32 ng);
 
  bool Allow3D();
  void SetAllow3D(bool b);
 
  real StereoSeparation();
  void SetStereoSeparation(real ss);
 
  MohoRenderStyle *GlobalRenderStyle();
 
  bool IsOutsideViewEnabled();
  void GetOutsideViewMatrix(LM_Matrix *m);
  void GetCameraMatrix(int32 frame, LM_Matrix *m);
  LM_Vector3 GetCameraDirection();
 
  int32 CountStyles();
  M_Style *Style(int32 id);
  M_Style *Style(const char *styleName);
  void AddStyle(M_Style *style);
  void RemoveStyle(M_Style *style, MohoLayer *layer = NULL);
  void RelinkStyles(MohoLayer *layer = NULL);
  void RenameStyle(const char *oldName, const char *newName, MohoLayer *layer = NULL);
  bool IsStyleUsed(M_Style *style, MohoLayer *layer = NULL);
 
  void DepthSort();
 
  // camera
  AnimVec3    fCameraTrack;
  AnimVal      fCameraZoom;
  AnimVal      fCameraRoll;
  AnimVec2    fCameraPanTilt;
};