API Docs for:
Show:

LS.Prefab Class

Module: LS

Prefab work in two ways:

  • It can contain a node structure and all the associated resources (textures, meshes, animations, etc)
  • When a node in the scene was created from a Prefab, the prefab is loaded so the associated resources are recovered, but the node structure is not modified.

Constructor

LS.Prefab

()

Methods

addResource

(
  • filename
)

Adds a resource to the prefab

Parameters:

  • filename String

    filename of the resource

configure

(
  • data
)

configure the prefab

Parameters:

  • data

createObject

()

Creates an instance of the object inside the prefab

Returns:

object contained

Prefab.createPrefab

(
  • filename
  • node_data
  • resource_names_list
)

to create a new prefab, it packs all the data an instantiates the resource

Parameters:

  • filename String

    a name for this prefab (if wbin is not appended, it will)

  • node_data Object

    an object containing all the node data to store

  • resource_names_list Array

    an array with the name of the resources to store

Returns:

object containing the prefab data ready to be converted to WBin (it also stores _original_data with the WBin)

removeResource

(
  • filename
)

Remove a resource to the prefab

Parameters:

  • filename String

    filename of the resource

setData

(
  • data
)

assign the json object

Parameters:

  • data Object | SceneNode