UNPKG

polygonjs-engine

Version:

node-based webgl 3D engine https://polygonjs.com

77 lines (76 loc) 1.93 kB
import {DirtyController as DirtyController2} from "./DirtyController"; export class CoreGraphNode { constructor(_scene, _name) { this._scene = _scene; this._name = _name; this._dirty_controller = new DirtyController2(this); this._graph_node_id = _scene.graph.next_id(); _scene.graph.add_node(this); this._graph = _scene.graph; } dispose() { this._dirty_controller.dispose(); this.graphRemove(); } name() { return this._name; } setName(name) { this._name = name; } scene() { return this._scene; } graphNodeId() { return this._graph_node_id; } get dirtyController() { return this._dirty_controller; } setDirty(trigger) { trigger = trigger || this; this._dirty_controller.set_dirty(trigger); } setSuccessorsDirty(trigger) { this._dirty_controller.set_successors_dirty(trigger); } removeDirtyState() { this._dirty_controller.removeDirtyState(); } isDirty() { return this._dirty_controller.isDirty(); } addPostDirtyHook(name, callback) { this._dirty_controller.addPostDirtyHook(name, callback); } graphRemove() { this._graph.remove_node(this); } addGraphInput(src, check_if_graph_has_cycle = true) { return this._graph.connect(src, this, check_if_graph_has_cycle); } removeGraphInput(src) { this._graph.disconnect(src, this); } graphDisconnectPredecessors() { this._graph.disconnect_predecessors(this); } graphDisconnectSuccessors() { this._graph.disconnect_successors(this); } graphPredecessorIds() { return this._graph.predecessor_ids(this._graph_node_id) || []; } graphPredecessors() { return this._graph.predecessors(this); } graphSuccessors() { return this._graph.successors(this); } graphAllPredecessors() { return this._graph.all_predecessors(this); } graphAllSuccessors() { return this._graph.all_successors(this); } }