Home Reference Source
public class | source

ToolOp

Extends:

scripts/path-controller/util/events.js~events.EventHandler → ToolOp

Static Method Summary

Static Public Methods
public static

Equals(a: *, b: *): *

public static

canRun(ctx: *, toolop: *): boolean

public static

inherit(slots: {}): *

public static

invoke(ctx: *, args: *): *

Creates a new instance of this toolop from args and a context.

public static

isRegistered(cls: *): *

public static

onTick()

public static

register(cls: *)

public static

searchBoxOk(ctx: *): *

public static

tooldef(): {}

ToolOp definition.

public static

unregister(cls: *)

Static Private Methods
private static
private static

_regWithNstructjs(cls: *, structName: *)

Constructor Summary

Public Constructor
public

Main ToolOp constructor.

Member Summary

Public Members
public

[k]: *

public

drawlines: *[]

public

flag: *

public

inputs: {}

public
public
public
public

outputs: {}

public
Private Members
private
private

_accept: *

private
private
private

_reject: *

private

Method Summary

Public Methods
public

calcMemSize(ctx: *): *

Used by undo system to limit memory

public

calcUndoMem(ctx: *): number

public

error(msg: *)

public

exec(ctx: *)

public

execPost(ctx: *)

public

execPre(ctx: *)

public

exec_pre(ctx: *)

public
public

getDefault(toolprop: *, key: *): *

public
public

hasDefault(toolprop: *, key: *): *

public

loadDefaults(force: boolean): *

public

loadSTRUCT(reader: *)

public

makeTempLine(v1: *, v2: *, style: *): *

for use in modal mode only

public

modalEnd(was_cancelled: *)

public

modalStart(ctx: *): *

returns promise to be executed on modalEnd

public

Called when the undo system needs to destroy this toolop to save memory

public

on_keydown(e: *)

default on_keydown implementation for modal tools, no need to call super() to execute this if you don't want to

public
public
public

pushModal(node: *)

public

redo(ctx: *)

public

for use in modal mode only

public
public
public

undo(ctx: *)

public

undoPre(ctx: *)

Private Methods
private
private

Static Public Methods

public static Equals(a: *, b: *): * source

Params:

NameTypeAttributeDescription
a *
b *

Return:

*

public static canRun(ctx: *, toolop: *): boolean source

Params:

NameTypeAttributeDescription
ctx *
toolop *
  • optional
  • default: undefined

Return:

boolean

public static inherit(slots: {}): * source

Params:

NameTypeAttributeDescription
slots {}
  • optional
  • default: {}

Return:

*

public static invoke(ctx: *, args: *): * source

Creates a new instance of this toolop from args and a context. This is often use to fill properties with default arguments stored somewhere in the context.

Params:

NameTypeAttributeDescription
ctx *
args *

Return:

*

public static isRegistered(cls: *): * source

Params:

NameTypeAttributeDescription
cls *

Return:

*

public static onTick() source

public static register(cls: *) source

Params:

NameTypeAttributeDescription
cls *

public static searchBoxOk(ctx: *): * source

Params:

NameTypeAttributeDescription
ctx *

Return:

*

public static tooldef(): {} source

ToolOp definition.

An example:

static tooldef() {
return {
uiname   : "Tool Name",
toolpath : "logical_module.tool", //logical_module need not match up to a real module
icon     : -1, //tool's icon, or -1 if there is none
description : "tooltip",
is_modal : false, //tool is interactive and takes control of events
hotkey   : undefined,
undoflag : 0, //see UndoFlags
flag     : 0,
inputs   : ToolOp.inherit({
f32val : new Float32Property(1.0),
path   : new StringProperty("./path");
}),
outputs  : {}
}
}

Return:

{}

public static unregister(cls: *) source

Params:

NameTypeAttributeDescription
cls *

Static Private Methods

private static _getFinalToolDef(): * source

Return:

*

private static _regWithNstructjs(cls: *, structName: *) source

Params:

NameTypeAttributeDescription
cls *
structName *
  • optional

Public Constructors

public constructor() source

Main ToolOp constructor. It reads the inputs/outputs properteis from this.constructor.tooldef() and copies them to build this.inputs and this.outputs. If inputs or outputs are wrapped in ToolOp.inherit(), it will walk up the class chain to fetch parent class properties.

Default input values are loaded from SavedToolDefaults. If initialized (buildToolSysAPI has been called) SavedToolDefaults will have a copy of all the default property values of all registered ToolOps.

Public Members

public [k]: * source

public drawlines: *[] source

public flag: * source

public inputs: {} source

public is_modal: boolean source

public modalRunning: boolean source

public modal_ctx: * source

public outputs: {} source

public undoflag: * source

Private Members

private __memsize: * source

private _accept: * source

private _overdraw: * source

private _promise: * source

private _reject: * source

private _was_redo: boolean source

Public Methods

public calcMemSize(ctx: *): * source

Used by undo system to limit memory

Params:

NameTypeAttributeDescription
ctx *

Return:

*

public calcUndoMem(ctx: *): number source

Params:

NameTypeAttributeDescription
ctx *

Return:

number

public error(msg: *) source

Params:

NameTypeAttributeDescription
msg *

public exec(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public execPost(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public execPre(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public exec_pre(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public genToolString(): * source

Return:

*

public getDefault(toolprop: *, key: *): * source

Params:

NameTypeAttributeDescription
toolprop *
key *
  • optional

Return:

*

public getOverdraw(): * source

Return:

*

public hasDefault(toolprop: *, key: *): * source

Params:

NameTypeAttributeDescription
toolprop *
key *
  • optional

Return:

*

public loadDefaults(force: boolean): * source

Params:

NameTypeAttributeDescription
force boolean
  • optional
  • default: true

Return:

*

public loadSTRUCT(reader: *) source

Params:

NameTypeAttributeDescription
reader *

public makeTempLine(v1: *, v2: *, style: *): * source

for use in modal mode only

Params:

NameTypeAttributeDescription
v1 *
v2 *
style *

Return:

*

public modalEnd(was_cancelled: *) source

Params:

NameTypeAttributeDescription
was_cancelled *

public modalStart(ctx: *): * source

returns promise to be executed on modalEnd

Params:

NameTypeAttributeDescription
ctx *

Return:

*

public onUndoDestroy() source

Called when the undo system needs to destroy this toolop to save memory

public on_keydown(e: *) source

default on_keydown implementation for modal tools, no need to call super() to execute this if you don't want to

Params:

NameTypeAttributeDescription
e *

public on_tick() source

public popModal() source

public pushModal(node: *) source

Params:

NameTypeAttributeDescription
node *

public redo(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public resetTempGeom() source

for use in modal mode only

public saveDefaultInputs(): * source

Return:

*

public toolCancel() source

public undo(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

public undoPre(ctx: *) source

Params:

NameTypeAttributeDescription
ctx *

Private Methods

private _save_inputs(): * source

Return:

*

private _save_outputs(): * source

Return:

*