[ui] Attribute becomes grey in graph editor and attribute editor when connected but disabled

If attribute is disabled but has output connections, it becomes grey.
If the connection is removed while being disabled, it hides itself.

Both is working in GraphEditor on the nodes and in the AttributeEditor.
This commit is contained in:
Aurore LAFAURIE 2024-03-25 17:58:56 +01:00 committed by Candice Bentéjac
parent 6f1ac9a06e
commit 1b55dc8649
5 changed files with 13 additions and 5 deletions

View file

@ -251,7 +251,7 @@ class Attribute(BaseObject):
@property @property
def isLink(self): def isLink(self):
""" Whether the attribute is a link to another attribute. """ """ Whether the input attribute is a link to another attribute. """
# note: directly use self.node.graph._edges to avoid using the property that may become invalid at some point # note: directly use self.node.graph._edges to avoid using the property that may become invalid at some point
return self.node.graph and self.isInput and self.node.graph._edges and self in self.node.graph._edges.keys() return self.node.graph and self.isInput and self.node.graph._edges and self in self.node.graph._edges.keys()

View file

@ -25,7 +25,7 @@ ListView {
ScrollBar.vertical: ScrollBar { id: scrollBar } ScrollBar.vertical: ScrollBar { id: scrollBar }
delegate: Loader { delegate: Loader {
active: object.enabled && ( active: (object.enabled || object.hasOutputConnections) && (
!objectsHideable !objectsHideable
|| ((!object.desc.advanced || GraphEditorSettings.showAdvancedAttributes) || ((!object.desc.advanced || GraphEditorSettings.showAdvancedAttributes)
&& (object.isDefault && GraphEditorSettings.showDefaultAttributes || !object.isDefault && GraphEditorSettings.showModifiedAttributes) && (object.isDefault && GraphEditorSettings.showDefaultAttributes || !object.isDefault && GraphEditorSettings.showModifiedAttributes)

View file

@ -65,6 +65,11 @@ RowLayout {
text: object.label text: object.label
color: {
if (object.hasOutputConnections && !object.enabled) return "grey"
else return "white"
}
// Tooltip hint with attribute's description // Tooltip hint with attribute's description
ToolTip { ToolTip {
id: parameterTooltip id: parameterTooltip

View file

@ -200,7 +200,10 @@ RowLayout {
horizontalAlignment: attribute && attribute.isOutput ? Text.AlignRight : Text.AlignLeft horizontalAlignment: attribute && attribute.isOutput ? Text.AlignRight : Text.AlignLeft
anchors.right: attribute && attribute.isOutput ? parent.right : undefined anchors.right: attribute && attribute.isOutput ? parent.right : undefined
rightPadding: 0 rightPadding: 0
color: hovered ? palette.highlight : palette.text color: {
if (object.hasOutputConnections && !object.enabled) return "grey"
return hovered ? palette.highlight : palette.text
}
} }
} }
@ -226,7 +229,7 @@ RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: 2 anchors.margins: 2
color: { color: {
if (outputConnectMA.containsMouse || outputConnectMA.drag.active || (outputDropArea.containsDrag && outputDropArea.acceptableDrop)) if ((!object.hasOutputConnections && object.enabled) && outputConnectMA.containsMouse || outputConnectMA.drag.active || (outputDropArea.containsDrag && outputDropArea.acceptableDrop))
return Colors.sysPalette.highlight return Colors.sysPalette.highlight
return Colors.sysPalette.text return Colors.sysPalette.text
} }

View file

@ -394,7 +394,7 @@ Item {
delegate: Loader { delegate: Loader {
id: outputLoader id: outputLoader
active: object.isOutput && isFileAttributeBaseType(object) active: object.isOutput && isFileAttributeBaseType(object)
visible: object.enabled visible: object.enabled || object.hasOutputConnections
anchors.right: parent.right anchors.right: parent.right
width: outputs.width width: outputs.width