Skip to content

Commit

Permalink
remove owning node from comment node on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
IlgarLunin committed Nov 10, 2019
1 parent c55554f commit 2e5940e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions PyFlow/Packages/PyFlowBase/UI/UICommentNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ def mouseReleaseEvent(self, event):
super(UICommentNode, self).mouseReleaseEvent(event)
if not self.collapsed:
collidingNodes = self.getCollidedNodes()

for owningNode in set(self.owningNodes):
if owningNode not in collidingNodes:
self.owningNodes.remove(owningNode)

for node in collidingNodes:
node.updateOwningCommentNode()

Expand Down
2 changes: 1 addition & 1 deletion PyFlow/UI/Canvas/UINodeBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def getCollidedNodes(self, bFullyCollided=True, classNameFilters=set()):
if node.__class__.__name__ not in classNameFilters:
continue
if node._rawNode.graph() != self.canvasRef().graphManager.activeGraph():
continue
continue
collidingNodes.add(node)
return collidingNodes

Expand Down
3 changes: 1 addition & 2 deletions PyFlow/UI/Widgets/BlueprintCanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ def validateCommentNodesOwnership(self, graph, bExpandComments=True):
self.state = CanvasState.COMMENT_OWNERSHIP_VALIDATION
comments = {}
defaultNodes = set()

# expand all comment nodes and reset owning nodes info
for node in graph.getNodesList():
uiNode = node.getWrapper()
Expand Down Expand Up @@ -837,7 +838,6 @@ def mousePressEvent(self, event):
modifiers = event.modifiers()
self.mousePressPose = event.pos()
expandComments = False
# self.validateCommentNodesOwnership(self.graphManager.activeGraph(), expandComments)
currentInputAction = InputAction("temp", "temp", InputActionType.Mouse, event.button(), modifiers=modifiers)
if any([not self.pressed_item,
isinstance(self.pressed_item, UIConnection) and modifiers != QtCore.Qt.AltModifier,
Expand Down Expand Up @@ -1311,7 +1311,6 @@ def mouseReleaseEvent(self, event):
self.requestClearProperties.emit()
self.resizing = False
self.updateReroutes(event, False)
# self.validateCommentNodesOwnership(self.graphManager.activeGraph(), False)

def removeItemByName(self, name):
[self.scene().removeItem(i) for i in self.scene().items() if hasattr(i, 'name') and i.name == name]
Expand Down

0 comments on commit 2e5940e

Please sign in to comment.