Skip to content

Add DynamicAttribute feature#3090

Draft
Copilot wants to merge 2 commits into
developfrom
copilot/add-dynamic-attribute-feature
Draft

Add DynamicAttribute feature#3090
Copilot wants to merge 2 commits into
developfrom
copilot/add-dynamic-attribute-feature

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

Summary

Adds a DynamicAttribute to Meshroom. A DynamicAttribute is a special input attribute that appears as an empty connection pin (no label, highlighted) in the graph editor. When an output attribute is connected to it, a new sibling input attribute of the same type as the source is automatically created on the node and linked. The DynamicAttribute itself stays empty and accepts further connections.

Changes

Core

File Change
meshroom/core/desc/attribute.py New DynamicAttribute descriptor class
meshroom/core/desc/__init__.py Export DynamicAttribute
meshroom/core/attribute.py DynamicAttribute instance – _validateIncomingConnection always returns True
meshroom/common/core.py insert(i, obj) method on CoreDictModel (enables ordered insertion in standalone mode)
meshroom/core/node.py Node extended with _dynamicInputs tracking, addDynamicInput(), removeDynamicInput(), _insertDynamicInput() and serialization in toDict()
meshroom/core/nodeFactory.py Compatibility checks updated to allow dynamically-created inputs

UI

File Change
meshroom/ui/commands.py AddDynamicInputCommand and RemoveDynamicInputCommand (full undo/redo support)
meshroom/ui/graph.py addEdge dispatches to AddDynamicInputCommand for DynamicAttribute targets; removeEdge auto-removes the dynamic input when its edge is deleted
meshroom/ui/qml/GraphEditor/AttributePin.qml isDynamic property, hidden label, highlighted pin colour

Tests

File Change
tests/nodes/test/DynamicInputsNode.py Test node with a DynamicAttribute
tests/test_dynamic_attribute.py 8 unit tests covering descriptor type, instance creation, connection validation, add/remove, serialization, and load/save round-trip

How it works

  1. A node description declares desc.DynamicAttribute(name="dynInputs", ...).
  2. In the graph editor the pin appears as a small highlighted circle with no label.
  3. Dragging any output onto it triggers UIGraph.addEdge, which pushes an AddDynamicInputCommand.
  4. The command clones the source's descriptor, generates a unique name (dynInputs_0, dynInputs_1, …), inserts the new attribute before the DynamicAttribute in the node, and connects the edge.
  5. Removing the edge also removes the generated attribute (via RemoveDynamicInputCommand).
  6. The generated attributes are serialised in a dynamicInputs field of the node's JSON and reconstructed on load.

Copilot AI and others added 2 commits May 5, 2026 10:15
…L, commands, serialization

Agent-Logs-Url: https://github.com/alicevision/Meshroom/sessions/77256082-c0d2-4ca8-b477-4d17b3e4cf98

Co-authored-by: nicolas-lambert-tc <210010084+nicolas-lambert-tc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/alicevision/Meshroom/sessions/77256082-c0d2-4ca8-b477-4d17b3e4cf98

Co-authored-by: nicolas-lambert-tc <210010084+nicolas-lambert-tc@users.noreply.github.com>
Comment thread meshroom/ui/commands.py
node = self.graph.node(self.nodeName)
if not self.dynAttrName or not node.hasAttribute(self.dynAttrName):
return True
dynAttr = node.attribute(self.dynAttrName)
dynAttr = dstNode.attribute("dynInputs")
srcDesc = srcNode.attribute("output")._desc

newAttr = dstNode.addDynamicInput("dynInputs_0", srcDesc, dynAttr)
@@ -0,0 +1,144 @@
"""Tests for the DynamicAttribute feature."""
import pytest
"""Tests for the DynamicAttribute feature."""
import pytest

from meshroom.core import desc
Comment thread meshroom/core/node.py
attr = self.attribute(k)
attr.value = v

def _insertDynamicInput(self, attrName, typeName, dynAttrName, value=None):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants