Client Scripting API - MovieManager

From Multiverse

Jump to: navigation, search

The Movie Manager handles keeping track of all the codecs, and serves as a base class for shared functionality, like generating a plane for the scene.

For general information on playing video, see Displaying In-World Video and Web Pages.

Contents

Constructor

None. Use the ClientAPI.MovieManager.Instance field to get the singleton MovieManager object.

Methods

FindCodec

myCodec = FindCodec(name)

Find a codec object using the name of the codec. Currently supported codecs are "DirectShow" and "Browser".

Returns

The specified MovieCodec object, or null if one could not be found.


Parameters

Parameter Datatype Default Value Description
name string None The codec name, which was used to register itself to the codec array.

FindMovie

mymovie = FindMovie(name)

Find a movie file by its name.

Returns

Movie object representing the movie file, or null if one could not be found.

Parameters

Parameter Datatype Default Value Description
name string None The name of the movie to find.

GetNewIdentifier

GetNewIdentifier()

Get a new unique identifier for a movie.

Parameters

None.

Returns

An integer ID, which should be returned by Movie.ID().

HideAltImage

textRemoved = HideAltImage(name)

Unload a previously loaded alternate texture for a movie.

Returns

True if the texture was removed, false if it wasn't.

Parameters

Parameter Datatype Default Value Description
name string None The name of the texture to hide.

MaterialName

This method has two signatures:

  • One that takes a Movie object as its parameter.
  • One that takes the name of the codec and ID of the movie.
name = MaterialName(movie)

Return the generated name for the material created for the movie, if any.

Returns

String name of the material.

Parameters

Parameter Datatype Default Value Description
movie Movie None The movie to create a material name for.
name = MaterialName(codec, id)

Return the generated name for the material created for the movie, if any.

Returns

String name of the material.

Parameters

Parameter Datatype Default Value Description
codec string None The name of the codec playing the video.
id int None The integer ID of the movie.

MeshName

name = MeshName(movie)

Return the generated name for the mesh created for the movie, if any.

Returns

String name of the mesh.

Parameters

Parameter Datatype Default Value Description
movie Movie None The movie to create a mesh name for.

ReplaceWorldObject

objReplaced = ReplaceWorldObject(movie, name)

Replace a world object with a width by height textured plane that plays the movie. Keeps the original Entity object but replaces its mesh, material, and texture.

Returns

True if the object was replaced, false if it wasn't.

Parameters

Parameter Datatype Default Value Description
movie Movie None The Movie object to use.
name string None The name of the world object to replace.

SetTextureCoordinates

conditionsChanged = SetTextureCoordinates(movie, material)

Reset the texture coordinates in the given material for all instances of the movie texture to fit the actual size of the movie. Since movies often are not sized to a power of two, texture coordinates need to remap the image to fill the texture correctly. Sets a texture matrix to adjust the existing coordinates.

Returns

True if coordinates were changed, false if not.

Parameters

Parameter Datatype Default Value Description
movie Movie None The movie for which to get the size and texture name.
material string None The name of the material to search.

ShowAltImage

texCreated = ShowAltImage(name, file)

Load an alternate image into the scene for the given texture name. Future movies that play should look for this texture and unload it if it exists.

Returns

True if the texture was created, false if it wasn't.

Parameters

Parameter Datatype Default Value Description
name string None The name of the texture to create or replace.
file string None The name of the file in the Textures directory to display.

TextureName

This method has two signatures:

  • One that takes a Movie object as its parameter.
  • One that takes the name of the codec and the video's ID.
name = TextureName(movie)

Return the generated name for the texture created for the movie, if any.

Returns

String name of the texture.

Parameters

Parameter Datatype Default Value Description
movie Movie None The movie to create a texture name for.
name = TextureName(codec, id)

Return the generated name for the texture created for the movie, if any.

Returns

String name of the texture.

Parameters

Parameter Datatype Default Value Description
codec string None The codec that's playing the video.
id int None The int ID of the video.
Personal tools