Skip to content

Commit

Permalink
Fixed Drop On wire, from this fork: pedroCabrera@fe1418e
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroCabrera committed Sep 15, 2022
1 parent 1bfce6b commit c95ee31
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions PyFlow/UI/Widgets/BlueprintCanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ def dragMoveEvent(self, event):
event.setDropAction(QtCore.Qt.MoveAction)
event.accept()
if self.tempnode:
self.tempnode.setPos((self.tempnode.w / -2) + scenePos.x(), scenePos.y())
self.tempnode.setPos((self.tempnode.w / -2) + scenePos.x()+5, scenePos.y()+5)
mouseRect = QtCore.QRect(QtCore.QPoint(scenePos.x() - 1, scenePos.y() - 1),
QtCore.QPoint(scenePos.x() + 1, scenePos.y() + 1))
hoverItems = self.scene().items(mouseRect)
Expand Down Expand Up @@ -1484,7 +1484,19 @@ def varSetterCreator():
libName = jsonData['lib']
name = nodeType
dropItem = self.nodeFromInstance(self.itemAt(scenePos.toPoint()))
if not dropItem or (isinstance(dropItem, UINodeBase) and dropItem.isCommentNode or dropItem.isTemp) or isinstance(dropItem, UIPinBase) or isinstance(dropItem, UIConnection):
#if not dropItem or (isinstance(dropItem, UINodeBase) and dropItem.isCommentNode or dropItem.isTemp) or isinstance(dropItem, UIPinBase) or isinstance(dropItem, UIConnection):
#######################################################
# Drop from nodebox by R. Scharf-Wildenhain, 2022-07-22
# dropItem = self.nodeFromInstance(self.itemAt(scenePos.toPoint()))
dropNode = self.nodeFromInstance(self.itemAt(event.pos()))
dropItem = self.itemAt(event.pos())

# if not dropItem or (isinstance(dropItem, UINodeBase) and dropItem.isCommentNode or dropItem.isTemp) or isinstance(dropItem, UIPinBase) or isinstance(dropItem, UIConnection):
if dropNode or not dropNode or \
(isinstance(dropItem, UINodeBase) and (dropItem.isCommentNode or dropItem.isTemp)) or \
isinstance(dropItem, UIPinBase) or \
isinstance(dropItem, UIConnection):
#######################################################
nodeTemplate = NodeBase.jsonTemplate()
nodeTemplate['package'] = packageName
nodeTemplate['lib'] = libName
Expand Down

0 comments on commit c95ee31

Please sign in to comment.