Movie: Server basics

From The Foundry MODO SDK wiki
Jump to: navigation, search

A Movie is a plug-in server that can write a series of frames as a file in movie format.

Overview

When rendering animations in modo the user has the option to save as a movie. The dialog presents some of these servers for the choices, and as images are produced they are sent to the server to be saved.

Headers

Tags

  • LXsMOVIE_SAVESTEREO -- if set, this server acutally saves pairs of images as stereo pairs.
  • LXsSAV_DOSTYPE -- the three-character file extension to be used by default (e.g. MP4).

Sample Methods

The plug-in server class derives from CLxImpl_Movie, and exports the ILxMovie interface.

Movie::BeginMovie()

The BeginMovie() method is called to initiate saving. The path and size of the frame are given.

        LxResult
mov_BeginMovie (
        const char              *fname,
        int                      w,
        int                      h,
        int                      flags)      LXx_OVERRIDE
{
        if (open_output_file (fname, w, h))
                return LXe_OK;
        else
                return LXe_FAILED;
}
Movie::SetFramerate()

Default framerate is defined to be 15 FPS. That can be overridden with this method.

        LxResult
mov_SetFramerate (
        int                      fps)
{
        rate = fps;
        return LXe_OK;
}
Movie::AddImage()

The AddImage() method is called sequentially to append frames to the growing movie.

        LxResult
mov_AddImage (
        ILxUnknownID             frame)
{
        CLxUser_Image            image (frame);

        add_frame_at_end (image);
        return LXe_OK;
}
Movie::EndMovie()

When complete, or aborted, the movie file is closed.

        LxResult
mov_EndMovie (void)
{
        close_file ();
}