LS.SceneNode Class
The SceneNode class represents and object in the scene Is the base class for all objects in the scene as meshes, lights, cameras, and so
Constructor
LS.SceneNode
-
name
Parameters:
-
name
Stringthe name for this node (otherwise a random one is computed)
Item Index
Methods
Properties
Events
Methods
clone
()
Object
remember clones this node and returns the new copy (you need to add it to the scene to see it)
Returns:
returns a cloned version of this node
configure
-
info
Configure this node from an object containing the info
Parameters:
-
info
Objectthe object with all the info (comes from the serialize method)
destroy
()
Destroys this node
getLocator
-
property_name
Returns the locator string of this node
Parameters:
-
property_name
String[optional] you can pass the name of a property in this node to get the locator of that one
Returns:
the locator string of this node
getPropertyInfo
-
locator
Returns and object with info about a property given a locator
Parameters:
-
locator
String
Returns:
object with { node, target, name, value and type }
getPropertyInfoFromPath
-
path
Returns and object with info about a property given a locator in path format
Parameters:
-
path
Arraya locator in path format (split by /)
Returns:
object with { node, target, name, value and type }
getPropertyValue
-
locaator
Returns the value of a property given a locator in string format
Parameters:
-
locaator
String
Returns:
the value of that property
getPropertyValueFromPath
-
locator
Returns the value of a property given a locator in path format
Parameters:
-
locator
Arrayin path format (array)
Returns:
the value of that property
getResources
-
res
-
include_children
Returns all the resources used by this node and its components (you can include the resources from the children too)
Parameters:
-
res
Objectobject where to store the resources used (in "res_name":LS.TYPE format)
-
include_children
Booleanif you want to add also the resources used by the children nodes
Returns:
the same object passed is returned
insidePrefab
()
Object
Returns the root node of the prefab incase it is inside a prefab, otherwise null
Returns:
returns the node where the prefab starts
isInLayer
-
num
checks if this node is in the given layer
Parameters:
-
num
Numberlayer number
Returns:
true if belongs to this layer
reloadFromPrefab
()
Apply prefab info (skipping the root components) to node, so all children will be removed and components lost and overwritten It is called from prefab.applyToNodes when a prefab is loaded in memory
serialize
-
ignore_prefab
Serializes this node by creating an object with all the info it contains info about the components too
Parameters:
-
ignore_prefab
Boolserializing wont returns children if it is a prefab, if you set this to ignore_prefab it will return all the info
Returns:
returns the object with the info
setLayer
-
num
-
value
Assigns this node to one layer
Parameters:
-
num
Numberlayer number
-
value
Boolean
setMesh
-
mesh_name
-
submesh_id
Simple way to assign a mesh to a node, it created a MeshRenderer component or reuses and existing one and assigns the mesh
Parameters:
-
mesh_name
Stringthe name of the mesh (path to the file)
-
submesh_id
Numberif you want to assign a submesh
setName
-
new_name
changes the node name
Parameters:
-
new_name
Stringthe new name
Returns:
returns true if the name changed
setPropertyValue
-
locator
-
value
assigns a value to a property given the locator for that property
Parameters:
-
locator
String -
value
setPropertyValueFromPath
-
path
-
value
-
[optional]
given a locator in path mode (array) and a value, it searches for the corresponding value and applies it
Parameters:
-
path
Array -
value
-
[optional]
Number optionaloffset used to skip the firsst positions in the array
Properties
className
String
Events
name_changed
Node changed name
Event Payload:
-
new_name
String