Skip to content

Commit 0a4bf9f

Browse files
committed
[ui] GraphEditor: Updated Resizing behaviour for Backdrop
Updating Selection behaviour for Backdrop based Nodes
1 parent 03e6d98 commit 0a4bf9f

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

meshroom/core/desc/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
from .node import (
2323
AVCommandLineNode,
24+
Backdrop,
2425
CommandLineNode,
2526
InitNode,
2627
InputNode,
@@ -49,6 +50,7 @@
4950
"StaticNodeSize",
5051
# node
5152
"AVCommandLineNode",
53+
"Backdrop",
5254
"CommandLineNode",
5355
"InitNode",
5456
"InputNode",

meshroom/core/desc/node.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import shlex
44

55
from .computation import Level, StaticNodeSize
6-
from .attribute import StringParam, ColorParam
6+
from .attribute import StringParam, ColorParam, FloatParam, IntParam
77

88
from meshroom.core import cgroup
99

@@ -122,6 +122,68 @@ def __init__(self):
122122
def processChunk(self, chunk):
123123
pass
124124

125+
def stopProcess(self, chunk):
126+
pass
127+
128+
129+
class Backdrop(InputNode):
130+
""" A Backdrop for other nodes.
131+
"""
132+
133+
# The internal inputs' of Backdrop Node needs a Integer Field to determine the font size for the comment
134+
internalInputs = [
135+
StringParam(
136+
name="invalidation",
137+
label="Invalidation Message",
138+
description="A message that will invalidate the node's output folder.\n"
139+
"This is useful for development, we can invalidate the output of the node when we modify the code.\n"
140+
"It is displayed in bold font in the invalidation/comment messages tooltip.",
141+
value="",
142+
semantic="multiline",
143+
advanced=True,
144+
uidIgnoreValue="", # If the invalidation string is empty, it does not participate to the node's UID
145+
),
146+
StringParam(
147+
name="comment",
148+
label="Comments",
149+
description="User comments describing this specific node instance.\n"
150+
"It is displayed in regular font in the invalidation/comment messages tooltip.",
151+
value="",
152+
semantic="multiline",
153+
invalidate=False,
154+
),
155+
IntParam(
156+
name="fontSize",
157+
label="Font Size",
158+
description="The Font size for the User Comment on the Backdrop.",
159+
value=12,
160+
range=(6, 100, 1),
161+
),
162+
FloatParam(
163+
name="nodeWidth",
164+
label="Node Width",
165+
description="The Backdrop Node's Width.",
166+
value=600,
167+
range=None,
168+
enabled=False # Hidden always
169+
),
170+
FloatParam(
171+
name="nodeHeight",
172+
label="Node Height",
173+
description="The Backdrop Node's Height.",
174+
value=400,
175+
range=None,
176+
enabled=False # Hidden always
177+
),
178+
ColorParam(
179+
name="color",
180+
label="Color",
181+
description="Custom color for the node (SVG name or hexadecimal code).",
182+
value="",
183+
invalidate=False,
184+
)
185+
]
186+
125187

126188
class CommandLineNode(Node):
127189
"""

meshroom/ui/graph.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,19 @@ def selectNodesByIndices(
10331033
self._graph.nodes.index(index), self._graph.nodes.index(index)
10341034
)
10351035

1036+
# {{{ Backdrop Selection Logic
1037+
# Get the node corresponding to the index
1038+
node = self._graph.nodes[index]
1039+
1040+
if node.isBackdrop:
1041+
for node in self.getBackdropNodes(node):
1042+
index = self._graph.nodes.indexOf(node)
1043+
1044+
itemSelection.select(
1045+
self._graph.nodes.index(index), self._graph.nodes.index(index)
1046+
)
1047+
# }}}
1048+
10361049
self._nodeSelection.select(itemSelection, command)
10371050

10381051
if self.selectedNode and not self.isSelected(self.selectedNode):

meshroom/ui/qml/GraphEditor/GraphEditor.qml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,9 @@ Item {
912912
onDoubleClicked: function(mouse) { root.nodeDoubleClicked(mouse, node) }
913913

914914
// Update the Node size
915-
onResized: uigraph.resizeNode(node, width, height)
915+
onResized: function(width, height) {
916+
uigraph.resizeNode(node, width, height);
917+
}
916918

917919
onEntered: uigraph.hoveredNode = node
918920
onExited: uigraph.hoveredNode = null
@@ -963,7 +965,7 @@ Item {
963965
}
964966

965967
Behavior on x {
966-
enabled: !nodeRepeater.ongoingDrag
968+
enabled: !nodeRepeater.ongoingDrag && !resizing
967969
NumberAnimation { duration: 100 }
968970
}
969971
Behavior on y {

meshroom/ui/qml/GraphEditor/Node.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Item {
2525
property bool mainSelected: false
2626
property bool selected: false
2727
property bool hovered: false
28-
property bool dragging: mouseArea.drag.active || leftDragger.drag.active
28+
property bool dragging: mouseArea.drag.active
29+
property bool resizing: leftDragger.drag.active
2930
/// Combined x and y
3031
property point position: Qt.point(x, y)
3132
/// Styling

0 commit comments

Comments
 (0)