Skip to content

Commit c69e855

Browse files
authored
Ignore other node children when fetching IO containers. Fixes #2000 (#2001)
1 parent dd529f2 commit c69e855

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

src/common/plugin/ExecutionHelpers.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,8 @@ define([
4141
await setPointers;
4242

4343
// Copy the data I/O
44-
const metaTypeComparator = (a, b) => {
45-
const aId = this.core.getPath(this.core.getMetaType(a));
46-
const bId = this.core.getPath(this.core.getMetaType(b));
47-
48-
return aId < bId ? -1 : 1;
49-
};
50-
51-
const srcCntrs = (await this.core.loadChildren(node))
52-
.sort(metaTypeComparator);
53-
const [dstInput, dstOutput] = (await this.core.loadChildren(snapshot))
54-
.sort(metaTypeComparator);
44+
const srcCntrs = await this.getInputOutputContainers(node);
45+
const [dstInput, dstOutput] = await this.getInputOutputContainers(snapshot);
5546

5647
const [srcInputs, srcOutputs] = (await Promise.all(srcCntrs.map(ctr => this.core.loadChildren(ctr))));
5748

@@ -70,6 +61,22 @@ define([
7061
return {snapshot, pairs: oldNewPairs};
7162
}
7263

64+
async getInputOutputContainers (node) {
65+
const nodePriority = node => {
66+
const metaName = this.core.getAttribute(this.core.getMetaType(node), 'name').toLowerCase();
67+
if (metaName === 'inputs') {
68+
return 1;
69+
} else if (metaName === 'outputs') {
70+
return 2;
71+
}
72+
return 3;
73+
};
74+
const metaTypeComparator = (node1, node2) => nodePriority(node1) < nodePriority(node2) ? -1 : 1;
75+
76+
return (await this.core.loadChildren(node))
77+
.sort(metaTypeComparator);
78+
}
79+
7380
getInheritedAncestors (node) {
7481
const path = [];
7582
while (node) {

0 commit comments

Comments
 (0)