Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c2e7b26
[core] attribute: Refactoring: Rename link expression constant variable
gregoire-dl Aug 27, 2025
47189df
[core] attribute: Refactoring; Remove `description` property
gregoire-dl Aug 27, 2025
315edbe
[core] attribute: Refactoring; Rename `desc` member
gregoire-dl Aug 27, 2025
e2ff3e1
[core] attribute: Refactoring; Remove `uidIgnoreValue` property
gregoire-dl Aug 27, 2025
99d690f
[core] attribute: Refactoring; Remove `node` &`root` python properties
gregoire-dl Aug 27, 2025
5656381
[core] attribute: Fix: rename `desc` member
gregoire-dl Aug 27, 2025
d1a9232
[core] attribute: Refactoring: Remove `_isReadOnly` method
gregoire-dl Aug 27, 2025
75dfbc3
[core] attribute: Refactoring: Rename get/set value methods
gregoire-dl Aug 27, 2025
09d7858
[core] attribute: Refactoring: Rename get/set enabled methods
gregoire-dl Aug 27, 2025
d1fb786
[core] attribute: Refactoring: Rename get/set linked attributes methods
gregoire-dl Aug 27, 2025
05614d0
[core] attribute: Refactoring: Remove `getType` & `getBaseType` methods
gregoire-dl Aug 27, 2025
e5e1a3f
[core] attribute: Refactoring: Rename `hasValidValue` property
gregoire-dl Aug 27, 2025
a004d8e
[core] attribute: Refactoring: Remove `valueStr` property
gregoire-dl Aug 27, 2025
d27d5d6
[core] attribute: Refactoring: Fix isInput/isOutput properties
gregoire-dl Aug 27, 2025
b716059
[core] attribute: Refactoring: Fix isLink property
gregoire-dl Aug 27, 2025
3bd52fd
[core] attribute: Refactoring: Fix hasOutputConnections property
gregoire-dl Aug 27, 2025
ea84ac8
[core] attribute: Refactoring: Fix isLinkNested property
gregoire-dl Aug 27, 2025
fc6a678
[core] attribute: Refactoring: Rename evalValue method
gregoire-dl Aug 27, 2025
2b370e8
[core] attribute: Refactoring: Remove unused label properties
gregoire-dl Aug 27, 2025
fcdc8e5
[core] attribute: Refactoring: Remove unused fullnameToGraph property
gregoire-dl Aug 27, 2025
e6f6ee1
[core] attribute: Refactoring: Rename names properties
gregoire-dl Aug 27, 2025
97a2330
[core] attribute: Refactoring: Use private attribute desc instead of …
gregoire-dl Aug 27, 2025
7e4e1f4
[core] attribute: Refactoring: Remove get/set label methods
gregoire-dl Aug 28, 2025
ff51b67
[test] attribute: Fix: get linked attributes
gregoire-dl Aug 28, 2025
8a61287
[core] attribute: Refactoring: Rename names properties
gregoire-dl Aug 28, 2025
379ee18
[core] attribute: Refactoring: input / output connections
gregoire-dl Aug 28, 2025
1e10375
[core] attribute: Refactoring: Rename `isLinkNested` property
gregoire-dl Aug 28, 2025
e7be179
[core] attribute: Refactoring: Change properties order
gregoire-dl Aug 28, 2025
50cf366
[core] attribute: Refactoring: Rename `hasValidValue` property
gregoire-dl Aug 28, 2025
37f404b
[core] attribute: Refactoring: Reorganize all attribute link/connections
gregoire-dl Aug 29, 2025
a2c9bbf
[core] attribute: Refactoring: Rename `is2D` and `is3D` properties
gregoire-dl Aug 29, 2025
affe459
[core] attribute: Refactoring: Change methods order
gregoire-dl Aug 29, 2025
6556ed3
[core] attribute: Refactoring: Rename `getDefaultValue` method
gregoire-dl Aug 29, 2025
4535f4b
[core] attribute: Refactoring: Rename `_initValue` method
gregoire-dl Aug 29, 2025
9b400e3
[core] attribute: Refactoring: Use lambda for `isDefault` properties
gregoire-dl Aug 29, 2025
7a00791
[core] attribute: Refactoring: Add doc for signals/properties
gregoire-dl Aug 29, 2025
4438c70
[core] attribute: Refactoring: Change methods order for all `Attribute`
gregoire-dl Sep 1, 2025
72b54fa
[core] attribute: Refactoring: Rename method `getSerializedValue`
gregoire-dl Sep 3, 2025
f24d7ae
[core] attribute: Refactoring: Add documentation for the methods
gregoire-dl Sep 2, 2025
0e6aef4
[core] attribute: Refactoring: Remove multiple spaces after operator
gregoire-dl Sep 2, 2025
f71621e
[core] attribute: Fix wrong edge side in `_hasAnyInputLinks`
gregoire-dl Sep 3, 2025
aafa2de
[core] attribute: Refactoring: Fix remaining `outputConnections`
gregoire-dl Sep 3, 2025
0f79721
[core] attribute: Refactoring: Fix doc for `rootName`
gregoire-dl Sep 3, 2025
dd3ed99
[core] attribute: Refactoring: Rename `inputRootLink`
gregoire-dl Sep 3, 2025
32d069b
[core] attribute: Refactoring: Rename `inputLink`
gregoire-dl Sep 3, 2025
3b9d296
[core] attribute: Refactoring: Rename `outputLink`
gregoire-dl Sep 3, 2025
aa88841
[core] attribute: Refactoring: Rename method `_getInputLink`
gregoire-dl Sep 3, 2025
c460c29
[core] attribute: Refactoring: Rename method `_getOutputLinks`
gregoire-dl Sep 3, 2025
9760d65
[core] attribute: Refactoring: Fix documentation
gregoire-dl Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions meshroom/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,27 @@ def __init__(self, node, attributeDesc: desc.Attribute, isOutput: bool, root=Non
self._value = None
self.initValue()

def _getNameFromNode(self) -> str:
def _getFullName(self) -> str:
"""
Get the attribute name following the path from the node to the attribute.
Return: nodeName.groupName.subGroupName.name
"""
return f'{self._node.name}.{self._getNameFromRoot()}'
return f'{self.node.name}.{self._getRootName()}'

def _getNameFromRoot(self) -> str:
def _getRootName(self) -> str:
"""
Get the attribute name following the path from the node root to the attribute.
Return: groupName.subGroupName.name
"""
if isinstance(self.root, ListAttribute):
return f'{self.root.nameFromRoot}[{self.root.index(self)}]'
return f'{self.root.rootName}[{self.root.index(self)}]'
elif isinstance(self.root, GroupAttribute):
return f'{self.root.nameFromRoot}.{self._desc.name}'
return f'{self.root.rootName}.{self._desc.name}'
return self._desc.name

def asLinkExpr(self) -> str:
""" Return link expression for this Attribute """
return "{" + self._getNameFromNode() + "}"
return "{" + self._getFullName() + "}"

@Slot(str, result=bool)
def matchText(self, text: str) -> bool:
Expand Down Expand Up @@ -394,8 +394,8 @@ def _is2D(self) -> bool:
return next((imageSemantic for imageSemantic in Attribute.VALID_IMAGE_SEMANTICS
if self._desc.semantic == imageSemantic), None) is not None

nameFromNode = Property(str, _getNameFromNode, constant=True)
nameFromRoot = Property(str, _getNameFromRoot, constant=True)
fullName = Property(str, _getFullName, constant=True)
rootName = Property(str, _getRootName, constant=True)
name = Property(str, lambda self: self._desc._name, constant=True)
label = Property(str, lambda self: self._desc.label, constant=True)
type = Property(str, lambda self: self._desc.type, constant=True)
Expand Down
32 changes: 16 additions & 16 deletions meshroom/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def duplicateNodes(self, srcNodes):

# re-create edges taking into account what has been duplicated
for attr, linkExpression in duplicateEdges.items():
# logging.warning("attr={} linkExpression={}".format(attr.nameFromRoot, linkExpression))
# logging.warning("attr={} linkExpression={}".format(attr.rootName, linkExpression))
link = linkExpression[1:-1] # remove starting '{' and trailing '}'
# get source node and attribute name
edgeSrcNodeName, edgeSrcAttrName = link.split(".", 1)
Expand Down Expand Up @@ -594,12 +594,12 @@ def removeNode(self, nodeName):
Remove the node identified by 'nodeName' from the graph.
Returns:
- a dictionary containing the incoming edges removed by this operation:
{dstAttr.nameFromNode, srcAttr.nameFromNode}
{dstAttr.fullName, srcAttr.fullName}
- a dictionary containing the outgoing edges removed by this operation:
{dstAttr.nameFromNode, srcAttr.nameFromNode}
{dstAttr.fullName, srcAttr.fullName}
- a dictionary containing the values, indices and keys of attributes that were connected to a ListAttribute
prior to the removal of all edges:
{dstAttr.nameFromNode, (dstAttr.root.nameFromNode, dstAttr.index, dstAttr.value)}
{dstAttr.fullName, (dstAttr.root.fullName, dstAttr.index, dstAttr.value)}
"""
node = self.node(nodeName)
inEdges = {}
Expand All @@ -614,13 +614,13 @@ def removeNode(self, nodeName):
# - once we have collected all the information, the edges (and perhaps the entries in ListAttributes) can
# actually be removed
for edge in self.nodeOutEdges(node):
outEdges[edge.dst.nameFromNode] = edge.src.nameFromNode
outEdges[edge.dst.fullName] = edge.src.fullName

if isinstance(edge.dst.root, ListAttribute):
index = edge.dst.root.index(edge.dst)
outListAttributes[edge.dst.nameFromNode] = (edge.dst.root.nameFromNode,
index, edge.dst.value
if edge.dst.value else None)
outListAttributes[edge.dst.fullName] = (edge.dst.root.fullName,
index, edge.dst.value
if edge.dst.value else None)

for edge in self.nodeOutEdges(node):
self.removeEdge(edge.dst)
Expand All @@ -632,7 +632,7 @@ def removeNode(self, nodeName):

for edge in self.nodeInEdges(node):
self.removeEdge(edge.dst)
inEdges[edge.dst.nameFromNode] = edge.src.nameFromNode
inEdges[edge.dst.fullName] = edge.src.fullName

node.alive = False
self._nodes.remove(node)
Expand Down Expand Up @@ -698,12 +698,12 @@ def upgradeNode(self, nodeName) -> Node:
Returns:
- the upgraded (newly created) node
- a dictionary containing the incoming edges removed by this operation:
{dstAttr.nameFromNode, srcAttr.nameFromNode}
{dstAttr.fullName, srcAttr.fullName}
- a dictionary containing the outgoing edges removed by this operation:
{dstAttr.nameFromNode, srcAttr.nameFromNode}
{dstAttr.fullName, srcAttr.fullName}
- a dictionary containing the values, indices and keys of attributes that were connected to a ListAttribute
prior to the removal of all edges:
{dstAttr.nameFromNode, (dstAttr.root.nameFromNode, dstAttr.index, dstAttr.value)}
{dstAttr.fullName, (dstAttr.root.fullName, dstAttr.index, dstAttr.value)}
"""
node = self.node(nodeName)
if not isinstance(node, CompatibilityNode):
Expand All @@ -730,10 +730,10 @@ def _restoreOutEdges(self, outEdges: dict[str, str], outListAttributes):

Args:
outEdges: a dictionary containing the outgoing edges removed by a call to "removeNode".
{dstAttr.nameFromNode, srcAttr.nameFromNode}
{dstAttr.fullName, srcAttr.fullName}
outListAttributes: a dictionary containing the values, indices and keys of attributes that were connected
to a ListAttribute prior to the removal of all edges.
{dstAttr.nameFromNode, (dstAttr.root.nameFromNode, dstAttr.index, dstAttr.value)}
{dstAttr.fullName, (dstAttr.root.fullName, dstAttr.index, dstAttr.value)}
"""
def _recreateTargetListAttributeChildren(listAttrName: str, index: int, value: Any):
listAttr = self.attribute(listAttrName)
Expand Down Expand Up @@ -899,7 +899,7 @@ def addEdge(self, srcAttr, dstAttr):
if srcAttr.node.graph != self or dstAttr.node.graph != self:
raise RuntimeError('The attributes of the edge should be part of a common graph.')
if dstAttr in self.edges.keys():
raise RuntimeError(f'Destination attribute "{dstAttr.nameFromNode}" is already connected.')
raise RuntimeError(f'Destination attribute "{dstAttr.fullName}" is already connected.')
edge = Edge(srcAttr, dstAttr)
self.edges.add(edge)
self.markNodesDirty(dstAttr.node)
Expand All @@ -916,7 +916,7 @@ def addEdges(self, *edges):
@changeTopology
def removeEdge(self, dstAttr):
if dstAttr not in self.edges.keys():
raise RuntimeError(f'Attribute "{dstAttr.nameFromNode}" is not connected')
raise RuntimeError(f'Attribute "{dstAttr.fullName}" is not connected')
edge = self.edges.pop(dstAttr)
self.markNodesDirty(dstAttr.node)
dstAttr.valueChanged.emit()
Expand Down
18 changes: 9 additions & 9 deletions meshroom/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ def undoImpl(self):
class SetAttributeCommand(GraphCommand):
def __init__(self, graph, attribute, value, parent=None):
super().__init__(graph, parent)
self.attrName = attribute.nameFromNode
self.attrName = attribute.fullName
self.value = value
self.oldValue = attribute.getExportValue()
self.setText(f"Set Attribute '{attribute.nameFromNode}'")
self.setText(f"Set Attribute '{attribute.fullName}'")

def redoImpl(self):
if self.value == self.oldValue:
Expand All @@ -310,8 +310,8 @@ def undoImpl(self):
class AddEdgeCommand(GraphCommand):
def __init__(self, graph, src, dst, parent=None):
super().__init__(graph, parent)
self.srcAttr = src.nameFromNode
self.dstAttr = dst.nameFromNode
self.srcAttr = src.fullName
self.dstAttr = dst.fullName
self.setText(f"Connect '{self.srcAttr}'->'{self.dstAttr}'")

if src.baseType != dst.baseType:
Expand All @@ -328,8 +328,8 @@ def undoImpl(self):
class RemoveEdgeCommand(GraphCommand):
def __init__(self, graph, edge, parent=None):
super().__init__(graph, parent)
self.srcAttr = edge.src.nameFromNode
self.dstAttr = edge.dst.nameFromNode
self.srcAttr = edge.src.fullName
self.dstAttr = edge.dst.fullName
self.setText(f"Disconnect '{self.srcAttr}'->'{self.dstAttr}'")

def redoImpl(self):
Expand All @@ -345,7 +345,7 @@ class ListAttributeAppendCommand(GraphCommand):
def __init__(self, graph, listAttribute, value, parent=None):
super().__init__(graph, parent)
assert isinstance(listAttribute, ListAttribute)
self.attrName = listAttribute.nameFromNode
self.attrName = listAttribute.fullName
self.index = None
self.count = 1
self.value = value if value else None
Expand All @@ -371,10 +371,10 @@ def __init__(self, graph, attribute, parent=None):
super().__init__(graph, parent)
listAttribute = attribute.root
assert isinstance(listAttribute, ListAttribute)
self.listAttrName = listAttribute.nameFromNode
self.listAttrName = listAttribute.fullName
self.index = listAttribute.index(attribute)
self.value = attribute.getExportValue()
self.setText(f"Remove {attribute.nameFromNode}")
self.setText(f"Remove {attribute.fullName}")

def redoImpl(self):
listAttribute = self.graph.attribute(self.listAttrName)
Expand Down
8 changes: 4 additions & 4 deletions meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,22 +849,22 @@ def addEdge(self, src, dst):
if isinstance(src, ListAttribute) and not isinstance(dst, ListAttribute):
self._addEdge(src.at(0), dst)
elif isinstance(dst, ListAttribute) and not isinstance(src, ListAttribute):
with self.groupedGraphModification(f"Insert and Add Edge on {dst.nameFromNode}"):
with self.groupedGraphModification(f"Insert and Add Edge on {dst.fullName}"):
self.appendAttribute(dst)
self._addEdge(src, dst.at(-1))
else:
self._addEdge(src, dst)

def _addEdge(self, src, dst):
with self.groupedGraphModification(f"Connect '{src.nameFromNode}'->'{dst.nameFromNode}'"):
with self.groupedGraphModification(f"Connect '{src.fullName}'->'{dst.fullName}'"):
if dst in self._graph.edges.keys():
self.removeEdge(self._graph.edge(dst))
self.push(commands.AddEdgeCommand(self._graph, src, dst))

@Slot(Edge)
def removeEdge(self, edge):
if isinstance(edge.dst.root, ListAttribute):
with self.groupedGraphModification(f"Remove Edge and Delete {edge.dst.nameFromNode}"):
with self.groupedGraphModification(f"Remove Edge and Delete {edge.dst.fullName}"):
self.push(commands.RemoveEdgeCommand(self._graph, edge))
self.removeAttribute(edge.dst)
else:
Expand All @@ -891,7 +891,7 @@ def disconnectSelectedNodes(self):

@Slot(Edge, Attribute, Attribute, result=Edge)
def replaceEdge(self, edge, newSrc, newDst):
with self.groupedGraphModification(f"Replace Edge '{edge.src.nameFromNode}'->'{edge.dst.nameFromNode}' with '{newSrc.nameFromNode}'->'{newDst.nameFromNode}'"):
with self.groupedGraphModification(f"Replace Edge '{edge.src.fullName}'->'{edge.dst.fullName}' with '{newSrc.fullName}'->'{newDst.fullName}'"):
self.removeEdge(edge)
self.addEdge(newSrc, newDst)
return self._graph.edge(newDst)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_graphIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _buildNodesSet(graph: Graph):
return set([(node.name, node.nodeType, node.isCompatibilityNode) for node in graph.nodes])

def _buildEdgesSet(graph: Graph):
return set([(edge.src.nameFromRoot, edge.dst.nameFromRoot) for edge in graph.edges])
return set([(edge.src.rootName, edge.dst.rootName) for edge in graph.edges])

nodesSetA, edgesSetA = _buildNodesSet(graphA), _buildEdgesSet(graphA)
nodesSetB, edgesSetB = _buildNodesSet(graphB), _buildEdgesSet(graphB)
Expand Down