mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 08:48:40 +02:00
[core] move duplicateNode methods to core.graph
handle this low-level operation engine side * fix ListAttribute children links duplication * handle CompatibilityNode duplication * move corresponding unit test in test_graph.py * [ui] add DuplicateNodeCommand
This commit is contained in:
parent
1af3a16d81
commit
2952e11691
7 changed files with 164 additions and 103 deletions
|
@ -204,3 +204,33 @@ def test_graph_nodes_sorting():
|
|||
ls1 = graph.addNewNode('Ls', name='Ls_1')
|
||||
|
||||
assert graph.nodesByType('Ls', sortedByIndex=True) == [ls0, ls1, ls2]
|
||||
|
||||
|
||||
def test_duplicate_nodes():
|
||||
"""
|
||||
Test nodes duplication.
|
||||
"""
|
||||
|
||||
# n0 -- n1 -- n2
|
||||
# \ \
|
||||
# ---------- n3
|
||||
|
||||
g = Graph('')
|
||||
n0 = g.addNewNode('Ls', input='/tmp')
|
||||
n1 = g.addNewNode('Ls', input=n0.output)
|
||||
n2 = g.addNewNode('Ls', input=n1.output)
|
||||
n3 = g.addNewNode('AppendFiles', input=n1.output, input2=n2.output)
|
||||
|
||||
# duplicate from n1
|
||||
nMap = g.duplicateNodesFromNode(fromNode=n1)
|
||||
for s, d in nMap.items():
|
||||
assert s.nodeType == d.nodeType
|
||||
|
||||
# check number of duplicated nodes
|
||||
assert len(nMap) == 3
|
||||
|
||||
# check connections
|
||||
assert nMap[n1].input.getLinkParam() == n0.output
|
||||
assert nMap[n2].input.getLinkParam() == nMap[n1].output
|
||||
assert nMap[n3].input.getLinkParam() == nMap[n1].output
|
||||
assert nMap[n3].input2.getLinkParam() == nMap[n2].output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue