VideoRecorderAppDev

description: 在游戏中录制流媒体视频: 支持AVI,WMV, Xvid, Divx, 3D立体Stereo输出等。

Contents:

VideoRecorder app for Paraworld

Title VideoRecorder app for Paraworld
Author(s) WangTian? , original template by LiXizhi
Date 2008/1/7
File script/kids/3DMapSystemUI/Movie/app_main.lua

Description

MovieScript?

example
   -- load a movie script, so that when movie pages are shown, they present this loaded movie script. 
   Map3DSystem.App.Commands.Call("File.MovieScript", "temp/moviescript/mymoviescript.xml");

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/app_main.lua");

Member Functions

MyCompany.Apps.VideoRecorder.OnConnection

requires

create class commonlib.setfield("MyCompany.Apps.VideoRecorder", {});


event handlers

OnConnection? method is the obvious point to place your UI (menus, mainbars, tool buttons) through which the user will communicate to the app. This method is also the place to put your validation code if you are licensing the add-in. You would normally do this before putting up the UI. If the user is not a valid user, you would not want to put the UI into the IDE.

  • param app : the object representing the current application in the IDE.
  • param connectMode : type of Map3DSystem? .App.ConnectMode.

syntax

function MyCompany.Apps.VideoRecorder.OnConnection(app, connectMode)

parameters

app the object representing the current application in the IDE.
connectMode  

MyCompany.Apps.VideoRecorder.OnDisconnection

Receives notification that the Add-in is being unloaded.

syntax

function MyCompany.Apps.VideoRecorder.OnDisconnection(app, disconnectMode)

parameters

app  
disconnectMode  

MyCompany.Apps.VideoRecorder.OnQueryStatus

This is called when the command's availability is updated When the user clicks a command (menu or mainbar button), the QueryStatus? event is fired. The QueryStatus? event returns the current status of the specified named command, whether it is enabled, disabled, or hidden in the CommandStatus? parameter, which is passed to the msg by reference (or returned in the event handler).

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
  • param statusWanted : what status of the command is queried. it is of type Map3DSystem? .App.CommandStatusWanted
  • return __ : returns according to statusWanted. it may return an integer by adding values in Map3DSystem? .App.CommandStatus.

syntax

function MyCompany.Apps.VideoRecorder.OnQueryStatus(app, commandName, statusWanted)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
statusWanted  
return returns according to statusWanted. it may return an integer by adding values in Map3DSystem? .App.CommandStatus.

MyCompany.Apps.VideoRecorder.OnExec

This is called when the command is invoked.The Exec is fired after the QueryStatus? event is fired, assuming that the return to the statusOption parameter of QueryStatus? is supported and enabled. This is the event where you place the actual code for handling the response to the user click on the command.

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".

syntax

function MyCompany.Apps.VideoRecorder.OnExec(app, commandName, params)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
params  

MyCompany.Apps.VideoRecorder.OnRenderBox

Change and render the 3D world with mcml data that is usually retrieved from the current user's profile page for this application.

syntax

function MyCompany.Apps.VideoRecorder.OnRenderBox(mcmlData)

parameters

mcmlData  

MyCompany.Apps.VideoRecorder.Navigate

called when the user wants to nagivate to the 3D world location relavent to this application

syntax

function MyCompany.Apps.VideoRecorder.Navigate()

MyCompany.Apps.VideoRecorder.GotoHomepage

called when user clicks to check out the homepage of this application. Homepage usually includes: developer info, support, developer worlds information, app global news, app updates, all community user rating, active users, trade, currency transfer, etc.

syntax

function MyCompany.Apps.VideoRecorder.GotoHomepage()

MyCompany.Apps.VideoRecorder.DoQuickAction

called when user clicks the quick action for this application.

syntax

function MyCompany.Apps.VideoRecorder.DoQuickAction()

MyCompany.Apps.VideoRecorder.MSGProc


client world database function helpers.


all related messages

APPS can be invoked in many ways: Through app Manager mainbar or menu command or buttons Command Line 3D World installed apps

syntax

function MyCompany.Apps.VideoRecorder.MSGProc(window, msg)

parameters

window  
msg  

An AI template for a character to play time series sequences from file.

Title An AI template for a character to play time series sequences from file.
Author(s) LiXizhi
Date 2007/11/11
File script/kids/3DMapSystemUI/Movie/AI_MovieActor.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/AI_MovieActor.lua");

Camera EditPage?

Title Camera EditPage?
Author(s) Leio Zhang
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/CameraEditPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CameraEditPage.lua");

Camera Manager

Title Camera Manager
Author(s) LiXizhi
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/CameraManager.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CameraManager.lua");
local CameraManager = Map3DSystem.Movie.CameraManager;
CameraManager:Load();

Member Functions

CameraManager:new

 the mcml page to present the movie manager. 
 note: this is optional.
local CameraManager = {
   name =  "movieasset_cameras_treeview",
   moviescript = nil, 
   -- tree nodes for view and control of the moviescript/assets/cameras
   cameras = CommonCtrl.TreeNode:new({Text = "cameras", Name = "cameras", Type="cameras",  Expanded = true, }),
}
; commonlib.setfield("Map3DSystem.Movie.CameraManager",CameraManager);

syntax

function CameraManager:new(o)

parameters

o  

CameraManager.StartRecord

start/stop recording

syntax

function CameraManager.StartRecord()

CameraManager:CreateViewWnd


for viewing the asset in asset view

create the treeview control to display all events.

syntax

function CameraManager:CreateViewWnd(_parent)

parameters

parent  

CameraManager:RefreshViewWnd

refresht he view

syntax

function CameraManager:RefreshViewWnd()

CameraManager.DrawViewNodeHandler

event node draw handler

syntax

function CameraManager.DrawViewNodeHandler(_parent,treeNode)

parameters

parent  
treeNode  

CameraManager.OnClickEditAsset

edit the currently selected asset

syntax

function CameraManager.OnClickEditAsset(trackMcmlNode,moviescript)

parameters

trackMcmlNode  
moviescript  

Camera EditPage?

Title Camera EditPage?
Author(s) Leio Zhang
Date 2008/9/28
File script/kids/3DMapSystemUI/Movie/CaptionEditPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CaptionEditPage.lua");

caption tracks editor

Title caption tracks editor
Author(s) Leio Zhang
Date 2008/9/28
File script/kids/3DMapSystemUI/Movie/CaptionTracksEditor.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CaptionTracksEditor.lua");

CaptionTracksEditorPage?

Title CaptionTracksEditorPage?
Author(s) Leio Zhang
Date 2008/9/28
File script/kids/3DMapSystemUI/Movie/CaptionTracksEditorPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CaptionTracksEditorPage.lua");

Camera EditPage?

Title Camera EditPage?
Author(s) Leio Zhang
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/ClipEditPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/ClipEditPage.lua");

Clip Manager

Title Clip Manager
Author(s) LiXizhi
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/ClipManager.lua

Description

View and controller class for the clips in a movie script.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/ClipManager.lua");
local ClipManager = Map3DSystem.Movie.ClipManager;
ClipManager:Load();

Member Functions

ClipManager:new

 the mcml page to present the movie manager. 
 note: this is optional.
local ClipManager = {
   name =  "movieasset_clips_treeview",
   moviescript = nil, 
   -- tree nodes for view and control of the moviescript/assets/clips
   clips = CommonCtrl.TreeNode:new({Text = "clips", Name = "clips", Type="clips",  Expanded = true, }),
}
; commonlib.setfield("Map3DSystem.Movie.ClipManager",ClipManager);

syntax

function ClipManager:new(o)

parameters

o  

ClipManager:CreateViewWnd


for viewing the asset in asset view

create the treeview control to display all events.

syntax

function ClipManager:CreateViewWnd(_parent)

parameters

parent  

ClipManager:RefreshViewWnd

refresht he view

syntax

function ClipManager:RefreshViewWnd()

ClipManager.DrawEventViewNodeHandler

event node draw handler

syntax

function ClipManager.DrawEventViewNodeHandler(_parent,treeNode)

parameters

parent  
treeNode  

Camera EditPage?

Title Camera EditPage?
Author(s) Leio Zhang
Date 2008/10/9
File script/kids/3DMapSystemUI/Movie/EventEditPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/EventEditPage.lua");

Event Manager

Title Event Manager
Author(s) LiXizhi
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/EventManager.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/EventManager.lua");
local EventManager = Map3DSystem.Movie.EventManager;
EventManager:Load();

Member Functions

EventManager:new

 the mcml page to present the movie manager. 
 note: this is optional.
local EventManager = {
   name =  "movieasset_events_treeview",
   moviescript = nil, 
   -- tree nodes for view and control of the moviescript/assets/events
   events = CommonCtrl.TreeNode:new({Text = "events", Name = "events", Type="events",  Expanded = true, }),
}
; commonlib.setfield("Map3DSystem.Movie.EventManager",EventManager);

syntax

function EventManager:new(o)

parameters

o  

EventManager:CreateViewWnd


for viewing the asset in asset view

create the treeview control to display all events.

syntax

function EventManager:CreateViewWnd(_parent)

parameters

parent  

EventManager:RefreshViewWnd

refresht he view

syntax

function EventManager:RefreshViewWnd()

EventManager.DrawEventViewNodeHandler

event node draw handler

syntax

function EventManager.DrawEventViewNodeHandler(_parent,treeNode)

parameters

parent  
treeNode  

EventManager:OnClickNewAsset

create a new asset and show its editor window.

syntax

function EventManager:OnClickNewAsset()

EventManager:OnClickEditAsset

edit the currently selected asset

syntax

function EventManager:OnClickEditAsset(trackMcmlNode,moviescript)

parameters

trackMcmlNode  
moviescript  

EventManager.OnClickSave

save

syntax

function EventManager.OnClickSave()

EventManager.OnClickAddActor

add an actor

syntax

function EventManager.OnClickAddActor()

EventManager.OnClickClose

close the recorder window

syntax

function EventManager.OnClickClose()

movie actor

Title movie actor
Author(s) Leio Zhang
Date 2008/9/9
File script/kids/3DMapSystemUI/Movie/MovieActor.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieActor.lua");

MovieActorTracksEditorPage?

Title MovieActorTracksEditorPage?
Author(s) Leio Zhang
Date 2008/10/8
File script/kids/3DMapSystemUI/Movie/MovieActorTracksEditorPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieActorTracksEditorPage.lua");

Author(s): LiXizhi

Title Author(s): LiXizhi
Author(s) LiXizhi
Date 2008/8/19
File script/kids/3DMapSystemUI/Movie/MovieAssetsManager.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieAssetsManager.lua");

Member Functions

MovieAssetsManager:new

 requires the movie manager. 
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieScript.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/CameraManager.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/EventManager.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/SoundManager.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/ClipManager.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieEditPage.lua");

local MovieAssetsManager = {
   name = "MovieAssetsManager_instance",
   moviescript = nil, 
   defaultmovie = "default.xml",
}
; commonlib.setfield("Map3DSystem.Movie.MovieAssetsManager",MovieAssetsManager);

syntax

function MovieAssetsManager:new(o)

parameters

o  

MovieAssetsManager:CreateViewWnd

create the treeview control to display a movie.

syntax

function MovieAssetsManager:CreateViewWnd(_parent)

parameters

parent  

MovieAssetsManager:OnInit

load default values.

syntax

function MovieAssetsManager:OnInit()

MovieAssetsManager:ShowAssetView

create or show/hide a specific view window.

  • param tabName : the view window name to show. It can be "cameras", "events", "sounds", "clips"
  • param params : position info. It can be nil, if one just wants to switch views

syntax

function MovieAssetsManager:ShowAssetView(tabName, params)

parameters

tabName the view window name to show. It can be "cameras", "events", "sounds", "clips"
params  

MovieAssetsManager:RefreshView

refresh the tree view

  • param tabName : the view window name to show. It can be "cameras", "events", "sounds", "clips". If nil, it will refresh all.

syntax

function MovieAssetsManager:RefreshView(tabName)

parameters

tabName the view window name to show. It can be "cameras", "events", "sounds", "clips". If nil, it will refresh all.

MovieAssetsManager:OnClickAddSave

save all assets to movie script.

syntax

function MovieAssetsManager:OnClickAddSave()

MovieAssetsManager:OnClickShowNewAssetPage


NewAssetPage? .html page handlers

display the new asset dialog.

syntax

function MovieAssetsManager:OnClickShowNewAssetPage()

MovieAssetsManager:OnClickCloseNewAssetPage

closes the new asset page

syntax

function MovieAssetsManager:OnClickCloseNewAssetPage()

MovieAssetsManager:OnClickNewAsset

create or show/hide a specific view window.

  • param assetType : It can be "cameras", "events", "sounds", "clips"

syntax

function MovieAssetsManager:OnClickNewAsset(assetType)

parameters

assetType It can be "cameras", "events", "sounds", "clips"

MovieAssetsManager:OnSelectMovie

user selects a new movie to view its assets.

  • param filename : file name of the movie script.

syntax

function MovieAssetsManager:OnSelectMovie(name, filename)

parameters

name  
filename file name of the movie script.

code behind page for MovieEditPage? .html

Title code behind page for MovieEditPage? .html
Author(s) LiXizhi
Date 2008/8/19
File script/kids/3DMapSystemUI/Movie/MovieEditPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieEditPage.lua");

Member Functions

MovieEditPage.OnInit

load default values.

syntax

function MovieEditPage.OnInit()

MovieEditPage.MovieAssets_OnInit

load default values.

syntax

function MovieEditPage.MovieAssets_OnInit()

MovieEditPage.MovieAssets_RefreshView

refresh the tree view

  • param tabName : the view window name to show. It can be "cameras", "events", "sounds", "clips". If nil, it will refresh all.

syntax

function MovieEditPage.MovieAssets_RefreshView(tabName)

parameters

tabName the view window name to show. It can be "cameras", "events", "sounds", "clips". If nil, it will refresh all.

MovieEditPage.MovieAssets_OnClickAddSave

save all assets to movie script.

syntax

function MovieEditPage.MovieAssets_OnClickAddSave()

MovieEditPage.MovieAssets_OnClickShowNewAssetPage


NewAssetPage? .html page handlers

display the new asset dialog.

syntax

function MovieEditPage.MovieAssets_OnClickShowNewAssetPage()

MovieEditPage.MovieAssets_OnClickCloseNewAssetPage

closes the new asset page

syntax

function MovieEditPage.MovieAssets_OnClickCloseNewAssetPage()

MovieEditPage.MovieAssets_OnClickNewAsset

create or show/hide a specific view window.

  • param assetType : It can be "cameras", "events", "sounds", "clips"

syntax

function MovieEditPage.MovieAssets_OnClickNewAsset(assetType)

parameters

assetType It can be "cameras", "events", "sounds", "clips"

MovieEditPage.MovieAssets_OnSelectMovie

user selects a new movie to view its assets.

  • param filename : file name of the movie script.

syntax

function MovieEditPage.MovieAssets_OnSelectMovie(name, filename)

parameters

name  
filename file name of the movie script.

code behind page for MovieListPage? .html

Title code behind page for MovieListPage? .html
Author(s) LiXizhi
Date 2008/8/19
File script/kids/3DMapSystemUI/Movie/MovieListPage.lua

Description

It displays a list of movies that are associated with the current world. all movie scripts are stored at world_dir/movies/*.xml files.

One can get a movie list programmatically, by calling

   local movielist = Map3DSystem.Movie.MovieListPage.GetMovieList();

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieListPage.lua");

Member Functions

MovieListPage.DS_Func


page event handlers
singleton page object local page;

template db table MovieListPage? .dsMovies = nil;

datasource function for pe:gridview

syntax

function MovieListPage.DS_Func(index)

parameters

index  

MovieListPage.SearchFiles

only return the sub folders of the current folder

  • param rootfolder : the folder which will be searched.
  • param nMaxFilesNum : one can limit the total number of files in the search result. Default value is 50. the search will stop at this value even there are more matching files.
  • param filter : if nil, it defaults to "*."
  • return a : table array containing relative to rootfolder file name.

syntax

function MovieListPage.SearchFiles(output, rootfolder,nMaxFilesNum, filter)

parameters

output  
rootfolder the folder which will be searched.
nMaxFilesNum  
filter if nil, it defaults to "*."

MovieListPage.AddMovieScriptToDS

add a given movie script to datasource

syntax

function MovieListPage.AddMovieScriptToDS(movieInfo)

parameters

movieInfo  

MovieListPage.GetMovieList

  • param bForceRefresh : if true, it will refresh the movie list.
  • return __ : return an array of {filename, Title, writedate, }

syntax

function MovieListPage.GetMovieList(bForceRefresh)

parameters

bForceRefresh if true, it will refresh the movie list.

MovieListPage.OnInit

load default values.

syntax

function MovieListPage.OnInit()

MovieListPage.OnClickClose

close the movie list page

syntax

function MovieListPage.OnClickClose()

MovieListPage.OnClickNewMovie

create a new movie, display create new movie dialog

syntax

function MovieListPage.OnClickNewMovie()

MovieListPage.OnClickPlayMovie

  • param filename : play the movie script.

syntax

function MovieListPage.OnClickPlayMovie(filename)

parameters

filename play the movie script.

MovieListPage.OnClickEditMovie

  • param filename : edit the movie script.

syntax

function MovieListPage.OnClickEditMovie(filename)

parameters

filename edit the movie script.

MovieListPage.OnClickDeleteMovie

  • param filename : delete the movie script.

syntax

function MovieListPage.OnClickDeleteMovie(filename)

parameters

filename delete the movie script.

Movie Manager

Title Movie Manager
Author(s) LiXizhi
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/MovieManager.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieManager.lua");
local MovieManager = Map3DSystem.Movie.MovieManager;
MovieManager:Load();

code behind page for MoviePlayerPage? .html

Title code behind page for MoviePlayerPage? .html
Author(s) LiXizhi
Date 2008/8/19
File script/kids/3DMapSystemUI/Movie/MoviePlayerPage.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MoviePlayerPage.lua");

Member Functions

MoviePlayerPage.OnInit

load default values.

syntax

function MoviePlayerPage.OnInit()

movie script

Title movie script
Author(s) LiXizhi
Date 2008/8/19
File script/kids/3DMapSystemUI/Movie/MovieScript.lua

Description

movie script is a tree-like hierachy, containing a number of movies, clips, camera shots, and tracks(assets) for cameras, events and sounds, each clip contains a number of camera shots that belongs to the same scene. each camera shot references tracks in the assets and movie is defined as the playback of all camera shots in sequence. movie script can be serialized to and from xml (mcml). movie script <===> xml(mcml) file

To load a movie script manually

   NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieScript.lua");
   local MovieScript = Map3DSystem.Movie.MovieScript:new("script/kids/3DMapSystemUI/Movie/test/test_moviescript.xml");
   MovieScript:SaveAs();

To create/get movie script using the manager class, it ensures that a given script is loaded only once.

   NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieScript.lua");
   local MovieScript = Map3DSystem.Movie.MovieScriptManager.GetScript("script/kids/3DMapSystemUI/Movie/test/test_moviescript.xml");
   local node = MovieScript:GetMoviesNode();
   local node = MovieScript:GetCamerasNode();
   local node = MovieScript:GetClipsNode();
   local node = MovieScript:GetEventsNode();
   local node = MovieScript:GetSoundsNode();

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieScript.lua");

Member Functions

MovieScript:new

load from a movie script.

  • param filename : the movie script file name.

syntax

function MovieScript:new(filename)

parameters

filename the movie script file name.

MovieScript:GetRootNode

get movies node

syntax

function MovieScript:GetRootNode()

MovieScript:GetMoviesNode

get movies node

syntax

function MovieScript:GetMoviesNode()

MovieScript:GetClipsNode

get clips node

syntax

function MovieScript:GetClipsNode()

MovieScript:GetAssetsNode

get assets node

syntax

function MovieScript:GetAssetsNode()

MovieScript:GetCamerasNode

get cameras node

syntax

function MovieScript:GetCamerasNode()

MovieScript:GetEventsNode

get events node

syntax

function MovieScript:GetEventsNode()

MovieScript:GetSoundsNode

get sounds node

syntax

function MovieScript:GetSoundsNode()

MovieScript:GetActorEntryTracks

get actor entry tracks

syntax

function MovieScript:GetActorEntryTracks()

MovieScript:GetActorDialogTracks

get actor dialog tracks

syntax

function MovieScript:GetActorDialogTracks()

MovieScript:GetActorAnimsTracks

get actor anims tracks

syntax

function MovieScript:GetActorAnimsTracks()

MovieScript:GetSoundTracks

get sound tracks

syntax

function MovieScript:GetSoundTracks()

MovieScript:GetCaptionTracks

get caption tracks

syntax

function MovieScript:GetCaptionTracks()

MovieScript:GetMusicTracks

get music tracks

syntax

function MovieScript:GetMusicTracks()

MovieScript:UpdateMapping

update mapping

syntax

function MovieScript:UpdateMapping(outMapping, node, sIDName)

parameters

outMapping  
node  
sIDName  

MovieScriptManager.GetScript

name value pairs of all loaded movie script local scripts = {};

a moviescript Manager class that keeps all loaded movie script. local MovieScriptManager? = { }; Map3DSystem? .Movie.MovieScriptManager = MovieScriptManager? ;

create / get a movie script object

  • param filename : the movie script file path

syntax

function MovieScriptManager.GetScript(filename,forceUpdate)

parameters

filename the movie script file path
forceUpdate  

MovieScriptManager.AddScript

add a new script

syntax

function MovieScriptManager.AddScript(filename, movie)

parameters

filename  
movie  

movie tracks

Title movie tracks
Author(s) Leio Zhang
Date 2008/9/2
File script/kids/3DMapSystemUI/Movie/MovieTracks.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/MovieTracks.lua");

Member Functions

pe_cameraTrack.create


pe:cameraTrack control
local pe_cameraTrack = {}; Map3DSystem? .Movie.mcml_controls.pe_cameraTrack = pe_cameraTrack;

syntax

function pe_cameraTrack.create(mcmlNode)

parameters

mcmlNode  

pe_storyboard.create


pe:Storyboard control
local pe_storyboard = {}; Map3DSystem? .Movie.mcml_controls.pe_storyboard = pe_storyboard;

syntax

function pe_storyboard.create(mcmlNode)

parameters

mcmlNode  

data provider for the movie lib

Title data provider for the movie lib
Author(s) LiXizhi
Date 2007/11/11
File script/kids/3DMapSystemUI/Movie/movie_db.lua

Description

Member Functions

Map3DSystem.Movie.movie_db.EnableTimer

[[ enable Movie lib. it will start a timer once enabled.

  • param bEnable : true to start the lib, false to disable it.
]]

syntax

function Map3DSystem.Movie.movie_db.EnableTimer(bEnable)

parameters

| bEnable | true to start the lib, false to disable it. ]] |

architecture design

Title architecture design
Author(s) LiXizhi, leio
Date 2008/8/18
File script/kids/3DMapSystemUI/Movie/readme.lua

Description

The implementation is the traditional model, view and controller pattern.
  • model: MovieScript? is the model (data) class, which can be serialized to/from xml (mcml) file.
  • view, controller: MovieManager? , SoundManager? , EventManager? , CameraManager? , ClipManager? are the view and controller class. they have bindings to the model class. users interacts with the view and controller classes to play or edit the model file. The view and controller class are implemented via treenode and mcml controls
  • MovieAssetsPage? , ClipManagerPage? , MovieAssetsPage? are mcml window classes that hosts the above view/control managers.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Movie/readme.lua");

if(not Map3DSystem? .Movie.MovieManager) then Map3DSystem? .Movie.MovieManager={}; end


-- movie script is a tree-like hierachy, containing a number of movies, clips, camera shots, and tracks(assets) for cameras, events and sounds, -- each clip contains a number of camera shots that belongs to the same scene. each camera shot references tracks in the assets and movie is defined as the playback of all camera shots in sequence. -- movie script can be serialized to and from xml (mcml). -- movie script <===> xml(mcml) file

local MovieScript? = { -- a movie contains a number of clips(from this movie script or from other script). -- this movies section is automatically added and for future use and is not mendatory in movie script. movies = { -- a movie instance contains a sequence of clips. [1] = { name = "movie name", desc = "Movie clip description", author = nil, -- a sequence of movie clips. clips = { [1] = { -- the file path of the containing movie script file.if nil, it is this one. it can be relative path to this file. moviescript = nil -- the referenced clip id in the above movie script. clip_id = 1, -- some fade in effect in_effect = nil, -- some fade out effect out_effect = nil, }, }, -- out of screen white text. -- UI_position, text, duration, etc. white_text = {track_data}, }, },

-- all movie clips defined in this movie script. -- each movie clip contains a number of camera shots that belongs to the same scene. clips = { -- the world path or world id of the 3d scene, in which all following clips resides. -- if nil, it can resides in any world. worldpath = "worlds/MyWorlds/scene00", world_id = nil, -- some movie clip instance [1] = { -- clip id id = 1, name = "Movie clip name", desc = "Movie clip description", -- some camera shots camera_shots = { [1] = { --camera track id camera_id = 1, name = "camera shot name", enabled = true, -- components of the shots components = { {type="event", id = 1, start_time=0, visible = true}, {type="event", id = 2, start_time=10, visible = true}, {type="sound", id = 1, start_time=0, visible = true}, }, }, [2] = { --camera track id camera_id = 2, name = "camera shot name", enabled = true, components = { {type="event", id = 3, start_time=2, visible = true}, {type="event", id = 4, start_time=0, visible = true}, {type="sound", id = 2, start_time=0, visible = true}, }, }, }, }, }, -- a mapping from id to clips clips_mapping = {}, -- next available id. clip_next_id = 2,

-- assets are tracks (time series) of camera, events and sounds. They are referenced by camera shots. assets = { -- -- an array of camera tracks -- cameras = { -- a camera asset contains following info, { id=1, start_time=0, end_time=30, isLooping=false, -- camera look at position(x,y,z), camera eye polar position (a,b, height) track={track_data}, }, { id=2, start_time=5, end_time=20, isLooping=false, track={track_data}, }, }, -- a mapping from id to cameras for finding a camera asset by id fast. cameras_mapping = {}, -- next available id. camera_next_id = 3,

-- -- an array of event tracks -- events = { [1] = { id=1, actors = { [1] = { -- event type: 1 for actor event, 2 for effect event. type=1, -- global character name actor_name = nil, -- currently it is always 0 start_time=0, -- if nil, it will be the longest non-looping time in action items. -- if -1, it will remain in the last frame. -- Otherwise, it can be a number in seconds, after which the character should dissappear, unless isLooping is true. end_time=nil, -- whether it is looping. isLooping = false, -- actions in this event: there are four action types, all of them can be nil except that entry -- entrance time entry = { start_time = 0, -- character information: name, primary asset, facing, position (vector3), ccs_info, etc. -- and/or object creations and modifications track, can be nil track = {track_data}, }, -- movement track, can be nil moves = { -- position track of the character. -- run/walk (a bit), target position, facing. track = {track_data}, }, -- dialog track, can be nil dialog = { -- chat track data of the character. -- dialog text track = {track_data}, }, -- animations track, can be nil anims = { -- animation track data of the character. -- anim_id/anim_string, track = {track_data}, }, }, }, }, }, -- a mapping from id to events events_mapping = {}, -- next available id. events_next_id = 2,

-- -- an array of sound tracks -- sounds = { {id=1, start_time=0, end_time=30, isLooping=false, track={track_data}, }, {id=2, start_time=5, end_time=20, isLooping=false, track={track_data}, }, }, -- a mapping from id to sounds sounds_mapping = {}, -- next available id. sounds_next_id = 3, } };

-- implementation use treenode as base class. -- to view and edit the tree node data defined above, we will data bind them to display treenodes


-- The view and controller of of all movies in a movie script -- Note: this is not defined in design doc. So postpone its implementation.

local MovieManager? = {

}


-- The view and controller of all clips in a movie script

local ClipManager? = { -- clips via treenode clips = TreeNode? :new({Text = "clips", Name = "clips"}) }

-- to data bind the clip manager to a given movie script model. -- @param moviescript: the movie script object (treenode) to bind to. function ClipManager? :DataBind(moviescript) self.clips:ClearAllChildren(); -- for each clip in moviescript.clips do -- create a view clip tree node and bind it to model treenode. -- end end


-- The view and controller of of all cameras in a movie script

local CameraManager? = {

}


-- The view and controller of of all events in a movie script
local EventManager? = {

}


-- The view and controller of of all sounds in a movie script
local SoundManager? = {

}


-- the mcml page to present the movie manager. -- note: this is optional.
local MovieManagerPage? = {}


-- the mcml page to present the clip manager.
local ClipManagerPage? = {}


-- the mcml page to present the camera, event and sound manager
local MovieAssetsPage? = {}


-- the node of movies
local MovieNode? = {canEdit = true,detailMode = true} function DrawEventViewNodeHandler? (_parent,treeNode) local state = treeNode.state; if(canEdit)then if(detailMode)then -- draw node use canedit and detail mode else -- other mode end else -- other mode end end local ClipNode? = {} local CameraNode