Constructor
new BlueprintComponent()
To load blueprint resource(s) and run them.
- Source:
Extends
Members
active :Boolean
Active or deactive component.
Type:
- Boolean
- Overrides:
- Source:
app :THING.App
Get application.
Type:
- Overrides:
- Source:
object :THING.BaseObject
Get object.
Type:
- Overrides:
- Source:
onActiveChange :OnActiveChangeComponentCallback
When active change callback function.
Type:
- Overrides:
- Source:
onAfterAdd :OnAfterAddComponentCallback
After add.
Type:
- Overrides:
- Source:
onAfterAddChild :OnAddChildComponentCallback
When after add child callback function.
Type:
- Overrides:
- Source:
onAfterRemove :OnAfterRemoveComponentCallback
After remove.
Type:
- Overrides:
- Source:
onAfterRemoveChild :OnRemoveChildComponentCallback
When after remove child callback function.
Type:
- Overrides:
- Source:
onBeforeAdd :OnBeforeAddComponentCallback
Before add.
Type:
- Overrides:
- Source:
onBeforeAddChild :OnAddChildComponentCallback
When before add child callback function.
Type:
- Overrides:
- Source:
onBeforeRemove :OnBeforeRemoveComponentCallback
Before remove.
Type:
- Overrides:
- Source:
onBeforeRemoveChild :OnRemoveChildComponentCallback
When before remove child callback function.
Type:
- Overrides:
- Source:
onCopy :OnCopyComponentCallback
When copy callback function.
Type:
- Overrides:
- Source:
onExport :OnExportComponentCallback
When export data.
Type:
- Overrides:
- Source:
onImport :OnImportComponentCallback
When import data.
Type:
- Overrides:
- Source:
onInit :OnInitComponentCallback
When initialize callback function.
Type:
- Overrides:
- Source:
onLoadResource :OnLoadResourceComponentCallback
When load resource callback function.
Type:
- Overrides:
- Source:
onParentChange :OnParentChangeComponentCallback
When change parent callback function.
Type:
- Overrides:
- Source:
onRefresh :OnRefreshComponentCallback
When refresh callback function.
Type:
- Overrides:
- Source:
onResize :OnResizeComponentCallback
When resize callback function.
Type:
- Overrides:
- Source:
onUnloadResource :OnUnloadResourceComponentCallback
When unload resource callback function.
Type:
- Overrides:
- Source:
onUpdate :OnUpdateComponentCallback
When update callback function.
Type:
- Overrides:
- Source:
onVisibleChange :OnVisibleChangeComponentCallback
When visible change callback function.
Type:
- Overrides:
- Source:
Methods
addEventListener(type, callback)
Register event.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The event type. |
callback |
function | The callback function. |
- Source:
clear()
clear all blueprints.
- Source:
load(options) → {THING.BlueprintComponent}
Load from URL or data.
Parameters:
Name | Type | Description |
---|---|---|
options |
BlueprintComponentLoadArgs | The options. |
- Source:
Returns:
Example
let object = new THING.Object3D();
let blueprints = await object.blueprint.load({ url: './blueprints/myBP.json' });
// @expect(blueprints.length == 1)
onAdd(object)
When add component.
Parameters:
Name | Type | Description |
---|---|---|
object |
THING.BaseObject | The object. |
- Overrides:
- Source:
onRemove()
When remove component.
- Overrides:
- Source:
removeEventListener(type, callback)
Unregister event.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The event type. |
callback |
function | The callback function. |
- Source:
run()
Run all blueprints.
- Source:
setVar(name, value)
Set variable by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The variable name. |
value |
* | The variable value. |
- Source:
setVars(value)
Set variables.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object | The variables. |
- Source:
stop()
Stop all blueprints.
- Source:
triggerEvent(type, event)
Trigger event.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The event type. |
event |
Object | The event info. |
- Source: