mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[core] remove links when clearing ListAttribute
This commit is contained in:
parent
4d8a177ae3
commit
3ad2146e06
1 changed files with 9 additions and 7 deletions
|
@ -313,8 +313,8 @@ class ListAttribute(Attribute):
|
||||||
self._value = ListModel(parent=self)
|
self._value = ListModel(parent=self)
|
||||||
|
|
||||||
def _set_value(self, value):
|
def _set_value(self, value):
|
||||||
self.desc.validateValue(value)
|
if self.node.graph:
|
||||||
self._value.clear()
|
self.remove(0, len(self))
|
||||||
# Link to another attribute
|
# Link to another attribute
|
||||||
if isinstance(value, ListAttribute) or isLinkExpression(value):
|
if isinstance(value, ListAttribute) or isLinkExpression(value):
|
||||||
self._value = value
|
self._value = value
|
||||||
|
@ -343,12 +343,14 @@ class ListAttribute(Attribute):
|
||||||
|
|
||||||
@raiseIfLink
|
@raiseIfLink
|
||||||
def remove(self, index, count=1):
|
def remove(self, index, count=1):
|
||||||
assert not self.isLink
|
|
||||||
if self.node.graph:
|
if self.node.graph:
|
||||||
|
# remove potential links
|
||||||
|
with GraphModification(self.node.graph):
|
||||||
for i in range(index, index + count):
|
for i in range(index, index + count):
|
||||||
attr = self._value.at(i)
|
attr = self._value.at(i)
|
||||||
if attr.isLink:
|
if attr.isLink:
|
||||||
self.node.graph.removeEdge(attr) # delete edge if the attribute is linked
|
# delete edge if the attribute is linked
|
||||||
|
self.node.graph.removeEdge(attr)
|
||||||
self._value.removeAt(index, count)
|
self._value.removeAt(index, count)
|
||||||
self.requestGraphUpdate()
|
self.requestGraphUpdate()
|
||||||
self.valueChanged.emit()
|
self.valueChanged.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue