* Removes all nodes from this graph
()
| 259 | * Removes all nodes from this graph |
| 260 | */ |
| 261 | clear(): void { |
| 262 | this.stop() |
| 263 | this.status = LGraph.STATUS_STOPPED |
| 264 | |
| 265 | this.id = zeroUuid |
| 266 | this.revision = 0 |
| 267 | |
| 268 | this.state = { |
| 269 | lastGroupId: 0, |
| 270 | lastNodeId: 0, |
| 271 | lastLinkId: 0, |
| 272 | lastRerouteId: 0, |
| 273 | } |
| 274 | |
| 275 | // used to detect changes |
| 276 | this._version = -1 |
| 277 | this._subgraphs.clear() |
| 278 | |
| 279 | // safe clear |
| 280 | if (this._nodes) { |
| 281 | for (const _node of this._nodes) { |
| 282 | _node.onRemoved?.() |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | // nodes |
| 287 | this._nodes = [] |
| 288 | this._nodes_by_id = {} |
| 289 | // nodes sorted in execution order |
| 290 | this._nodes_in_order = [] |
| 291 | // nodes that contain onExecute sorted in execution order |
| 292 | this._nodes_executable = null |
| 293 | |
| 294 | this._links.clear() |
| 295 | this.reroutes.clear() |
| 296 | this.#floatingLinks.clear() |
| 297 | |
| 298 | this.#lastFloatingLinkId = 0 |
| 299 | |
| 300 | // other scene stuff |
| 301 | this._groups = [] |
| 302 | |
| 303 | // iterations |
| 304 | this.iteration = 0 |
| 305 | |
| 306 | // custom data |
| 307 | this.config = {} |
| 308 | this.vars = {} |
| 309 | // to store custom data |
| 310 | this.extra = {} |
| 311 | |
| 312 | // timing |
| 313 | this.globaltime = 0 |
| 314 | this.runningtime = 0 |
| 315 | this.fixedtime = 0 |
| 316 | this.fixedtime_lapse = 0.01 |
| 317 | this.elapsed_time = 0.01 |
| 318 | this.last_update_time = 0 |
no test coverage detected