Patch
Extends:
Example:
CABLES.patch=new CABLES.Patch(
{
patch:pStr,
glCanvasId:'glcanvas',
glCanvasResizeToWindow:true,
canvas:{powerPreference:"high-performance"},
prefixAssetPath:'/assets/',
prefixJsPath:'/js/',
onError:function(e){console.log(e);}
glslPrecision:'highp'
});
Static Member Summary
| Static Public Members | ||
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
| public static |
|
|
Static Method Summary
| Static Public Methods | ||
| public static |
|
|
| public static |
getOpClass(objName: string): * |
|
| public static |
replaceOpIds(json: Object, options: Object): * |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(cfg: PatchConfig) |
|
Member Summary
| Public Members | ||
| public |
|
|
| public |
aborted: boolean |
|
| public |
animFrameOps: *[] |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public get |
|
|
| public |
|
|
| public |
gui: boolean |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
namedTriggers: {} |
|
| public |
|
|
| public |
ops: Array<Op> |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
storeObjNames: boolean |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
vars: {} |
|
| Private Members | ||
| private |
|
|
| private |
_crashedOps: *[] |
|
| private |
|
|
| private |
_opIdCache: {} |
|
| private |
|
|
| private |
_subpatchOpCache: {} |
|
| private |
_triggerStack: *[] |
|
| private |
_variables: Object<string, PatchVariable> |
|
| private |
|
|
| private |
|
|
Method Summary
| Public Methods | ||
| public |
addOnAnimFrame(op: Op) |
|
| public |
addOnAnimFrameCallback(cb: function) |
|
| public |
addOp(opIdentifier: string, uiAttribs: OpUiAttribs, id: string, fromDeserialize: boolean, opName: string): * create a new op in patch |
|
| public |
clear() |
|
| public |
createOp(identifier: string, id: string, opName: string): Op |
|
| public |
deSerialize(obj: Object, options: DeserializeOptions): any Description |
|
| public |
deleteOp(opid: string, tryRelink: boolean, reloadingOp: boolean) |
|
| public |
deleteVar(name: string) |
|
| public |
dispose() |
|
| public |
getAssetPath(patchId: undefined): string get asset path |
|
| public |
getDocument(): Object returns document object of the patch could be != global document object when opening canvas ina popout window |
|
| public |
getFilePath(filename: String): String get url/filepath for a filename this uses prefixAssetpath in exported patches |
|
| public |
getFirstSubPatchOpByName(patchId: string, objName: string): Op |
|
| public |
getFrameNum(): * |
|
| public |
getJsPath(): string get js path |
|
| public |
getOpById(opid: String): T |
|
| public |
getOpsByObjName(name: String): * |
|
| public |
getOpsByOpId(opid: String): * |
|
| public |
getOpsByRefId(refId: *): * |
|
| public |
getSubPatchOp(patchId: *, objName: *): * |
|
| public |
getSubPatchOpsByName(patchId: *, objName: *): * |
|
| public |
getVar(name: String): PatchVariable |
|
| public |
getVarValue(name: *, val: *): * |
|
| public |
getVars(t: number): PatchVariable[] |
|
| public |
has variable |
|
| public |
isEditorMode(): Boolean returns true if patch is opened in editor/gui mode |
|
| public |
isPlaying(): boolean |
|
| public |
link(op1: Op, port1Name: String, op2: Op, port2Name: String, lowerCase: boolean, fromDeserialize: boolean): * link two ops/ports |
|
| public |
logStartup(s: String) |
|
| public |
pause() pauses patch execution |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
profile(enable: boolean) |
|
| public |
pushTriggerStack(p: Port) |
|
| public |
removeOnAnimCallback(cb: function) |
|
| public |
removeOnAnimFrame(op: Op) |
|
| public |
this method was deprecated.
|
|
| public |
resume() resumes patch execution |
|
| public |
serialize(options: Object): Object | String |
|
| public |
setVarValue(name: string, val: string | number, type: number): * |
|
| public |
setVariable(name: String, val: Number | String | Boolean) set variable value |
|
| public |
setVolume(v: Number) set volume [0-1] |
|
| public |
|
|
| public |
|
|
| public |
updateAnims(time: number, delta: number, timestamp: number) |
|
| Private Methods | ||
| private |
|
|
| private |
|
|
Static Public Members
Static Public Methods
Public Constructors
public constructor(cfg: PatchConfig) source
Params:
| Name | Type | Attribute | Description |
| cfg | PatchConfig |
Public Members
public : boolean source
public aborted: boolean source
public config: PatchConfig source
public gui: boolean source
public loading: LoadingStatus source
public namedTriggers: {} source
public ops: Array<Op> source
public renderloop: RenderLoop source
public storeObjNames: boolean source
public vars: {} source
Private Members
private _opIdCache: {} source
private _subpatchOpCache: {} source
private _variables: Object<string, PatchVariable> source
Public Methods
public addOnAnimFrame(op: Op) source
Params:
| Name | Type | Attribute | Description |
| op | Op |
public addOnAnimFrameCallback(cb: function) source
Params:
| Name | Type | Attribute | Description |
| cb | function |
public addOp(opIdentifier: string, uiAttribs: OpUiAttribs, id: string, fromDeserialize: boolean, opName: string): * source
create a new op in patch
Params:
| Name | Type | Attribute | Description |
| opIdentifier | string | uuid or name, e.g. Ops.Math.Sum |
|
| uiAttribs | OpUiAttribs | Attributes |
|
| id | string |
|
|
| fromDeserialize | boolean |
|
|
| opName | string |
|
e.g. Ops.Math.Sum |
Example:
// add invisible op
patch.addOp('Ops.Math.Sum', { showUiAttribs: false });
public clear() source
public createOp(identifier: string, id: string, opName: string): Op source
Params:
| Name | Type | Attribute | Description |
| identifier | string | ||
| id | string | ||
| opName | string |
|
Return:
| Op |
public deSerialize(obj: Object, options: DeserializeOptions): any source
Description
Params:
| Name | Type | Attribute | Description |
| obj | Object | ||
| options | DeserializeOptions |
Return:
| any |
public deleteOp(opid: string, tryRelink: boolean, reloadingOp: boolean) source
Params:
| Name | Type | Attribute | Description |
| opid | string | ||
| tryRelink | boolean |
|
|
| reloadingOp | boolean |
|
public deleteVar(name: string) source
Params:
| Name | Type | Attribute | Description |
| name | string |
public dispose() source
public getAssetPath(patchId: undefined): string source
get asset path
Params:
| Name | Type | Attribute | Description |
| patchId | undefined |
|
Return:
| string |
public getDocument(): Object source
returns document object of the patch could be != global document object when opening canvas ina popout window
Return:
| Object | document |
public getFilePath(filename: String): String source
get url/filepath for a filename this uses prefixAssetpath in exported patches
Params:
| Name | Type | Attribute | Description |
| filename | String |
Return:
| String | url |
public getFirstSubPatchOpByName(patchId: string, objName: string): Op source
Params:
| Name | Type | Attribute | Description |
| patchId | string | ||
| objName | string |
Return:
| Op |
public getVar(name: String): PatchVariable source
Params:
| Name | Type | Attribute | Description |
| name | String |
public getVars(t: number): PatchVariable[] source
Params:
| Name | Type | Attribute | Description |
| t | number |
public hasVar(name: String): * source
has variable
Params:
| Name | Type | Attribute | Description |
| name | String | of variable |
public isEditorMode(): Boolean source
returns true if patch is opened in editor/gui mode
Return:
| Boolean | editor mode |
public link(op1: Op, port1Name: String, op2: Op, port2Name: String, lowerCase: boolean, fromDeserialize: boolean): * source
link two ops/ports
Params:
| Name | Type | Attribute | Description |
| op1 | Op | ||
| port1Name | String | ||
| op2 | Op | ||
| port2Name | String | ||
| lowerCase | boolean | ||
| fromDeserialize | boolean |
public logStartup(s: String) source
Params:
| Name | Type | Attribute | Description |
| s | String |
public popTriggerStack() source
public preRenderOps() source
public printTriggerStack() source
public profile(enable: boolean) source
Params:
| Name | Type | Attribute | Description |
| enable | boolean |
public removeOnAnimCallback(cb: function) source
Params:
| Name | Type | Attribute | Description |
| cb | function |
public removeOnAnimFrame(op: Op) source
Params:
| Name | Type | Attribute | Description |
| op | Op |
public serialize(options: Object): Object | String source
Params:
| Name | Type | Attribute | Description |
| options | Object |
Return:
| Object | String |
public setVarValue(name: string, val: string | number, type: number): * source
Params:
| Name | Type | Attribute | Description |
| name | string | ||
| val | string | number | ||
| type | number |
|
public setVariable(name: String, val: Number | String | Boolean) source
set variable value
Params:
| Name | Type | Attribute | Description |
| name | String | of variable |
|
| val | Number | String | Boolean | value |
public setVolume(v: Number) source
set volume [0-1]
Params:
| Name | Type | Attribute | Description |
| v | Number | volume |
public updateAnimMaxTime() source
public updateAnimMaxTimeSoon() source
public updateAnims(time: number, delta: number, timestamp: number) source
Params:
| Name | Type | Attribute | Description |
| time | number | ||
| delta | number | ||
| timestamp | number |