LS.LS Class
LS is the global scope for the global functions and containers of LiteScene
Item Index
Methods
Properties
Methods
clearUIds
-
root
Clears all the uids inside this object and children (it also works with serialized object)
Parameters:
-
rootObjectcould be a node or an object from a node serialization
cloneObject
-
object -
target=null
Clones an object (no matter where the object came from)
- It skip attributes starting with "_" or "jQuery" or functions
- it tryes to see which is the best copy to perform
- to the rest it applies JSON.parse( JSON.stringify ( obj ) )
- use it carefully
Parameters:
-
objectObjectthe object to clone
-
target=nullObjectoptional, the destination object
Returns:
returns the cloned object (target if it is specified)
extendClass
-
target -
origin
copy the properties (methods and properties) of origin class into target class
Parameters:
-
targetClass -
originClass
generateUId
()
String
Generates a UUID based in the user-agent, time, random and sequencial number. Used for Nodes and Components.
Returns:
uuid
getClassName
-
class
Returns an string with the class name
Parameters:
-
classObjectobject
Returns:
returns the string with the name
getObjectClassName
-
the
Returns an object class name (uses the constructor toString)
Parameters:
-
theObjectobject to see the class name
Returns:
returns the string with the name
getObjectProperties
-
object
Returns the public properties of one object and the type (not the values)
Parameters:
-
objectObject
Returns:
returns object with attribute name and its type
getScript
-
name
Returns an script context using the script name (not the node name), usefull to pass data between scripts.
Parameters:
-
nameStringthe name of the script according to the Script component.
Returns:
the context of the script.
isClassComponent
-
comp
Tells you if one class is a registered component class
Parameters:
-
compComponentClasscomponent class to evaluate
Returns:
true if the component class is registered
registerComponent
-
c
Register a component (or several) so it is listed when searching for new components to attach
Parameters:
-
cComponentClasscomponent class to register
registerMaterialClass
-
comp
Register a Material class so it is listed when searching for new materials to attach
Parameters:
-
compComponentClasscomponent class to register
registerResourceClass
-
c
Register a resource class so we know which classes could be use as resources
Parameters:
-
cComponentClasscomponent class to register
replaceComponentClass
-
scene -
old_class_name -
new_class_name
Replaces all components of one class in the scene with components of another class
Parameters:
-
sceneSceneTreewhere to apply the replace
-
old_class_nameStringname of the class to be replaced
-
new_class_nameStringname of the class that will be used instead
reset
()
clears the global scene and the resources manager
safeCall
-
callback -
params -
instance
Is a wrapper for callbacks that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callbackFunction -
paramsArray -
instanceObject
setInterval
-
callback -
time -
timer_id
Is a wrapper for setInterval that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callbackFunction -
timeNumberin ms
-
timer_idNumber
setTimeout
-
callback -
time -
timer_id
Is a wrapper for setTimeout that throws an LS "code_error" in case something goes wrong (needed to catch the error from the system)
Parameters:
-
callbackFunction -
timeNumberin ms
-
timer_idNumber
validateName
-
name
validates name string to ensure there is no forbidden characters valid characters are letters, numbers, spaces, dash, underscore and dot
Parameters:
-
nameString
Returns:
Properties
Components
Object
Contains all the registered components
Default: {}
MaterialClasses
Object
Contains all the registered material classes
Default: {}
