mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-01 22:09:55 +00:00
[API] Remove deprecated: getAncestors (#919)
Removes unused and deprecated API: LGraph.getAncestors
This commit is contained in:
@@ -601,40 +601,6 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
return L
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Will be removed in 0.9
|
||||
* Returns all the nodes that could affect this one (ancestors) by crawling all the inputs recursively.
|
||||
* It doesn't include the node itself
|
||||
* @returns an array with all the LGraphNodes that affect this node, in order of execution
|
||||
*/
|
||||
getAncestors(node: LGraphNode): LGraphNode[] {
|
||||
const ancestors: LGraphNode[] = []
|
||||
const pending = [node]
|
||||
const visited: Dictionary<boolean> = {}
|
||||
|
||||
while (pending.length) {
|
||||
const current = pending.shift()
|
||||
if (!current?.inputs) continue
|
||||
|
||||
if (!visited[current.id] && current != node) {
|
||||
visited[current.id] = true
|
||||
ancestors.push(current)
|
||||
}
|
||||
|
||||
for (let i = 0; i < current.inputs.length; ++i) {
|
||||
const input = current.getInputNode(i)
|
||||
if (input && !ancestors.includes(input)) {
|
||||
pending.push(input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ancestors.sort(function (a, b) {
|
||||
return a.order - b.order
|
||||
})
|
||||
return ancestors
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions every node in a more readable manner
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user