AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX

Add API calls to group and ungroup nodes

Open
#1,587 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
451
Avg merge
6d 6h
Merged PRs (30d)
5

Description

## Issue
There is no mechanism to easily group or ungroup sets of nodes. The only interface available is flattenSubGraphs() but this
converts node instances into their nodegraph implementation equivalents which isn't the same.

## Proposal

It would be useful to have a formal API which allows for grouping nodes into a `nodegraph` and ungrouping nodes in a `nodegraph`.

The criteria would include:

1. Preserving input and output connections
2. Removing any unnecessary interface connections on ungrouping.
3. Allow for disconnected grouping (make copy)
4. Preserve any nodegraph attributes which are used to resolve identifiers (such as `fileprefix`).

### Implementation

Add API to `GraphElement`.

Example something like this:
```c++
// Ungroup this nodegraph and return a list of nodes / nodegraph children extracted.
// - inplace means to replace the existing nodegraph
std::vector GraphElement::ungroup(bool inplace=true);

// Group a set of elements (nodes, nodegraph) under a new nodegraph
// - elements : Elements to group
// - graphName : Name of new nodegraph
GraphElement::group(std::vector elements, const std::string& graphName)
```

Contributor guide

Open the contributing guide

Research direction

Start by locating GraphElement and the existing flattenSubGraphs() implementation. Trace how node and nodegraph connections, interfaces, and identifier-resolving attributes are represented; done means adding a formal group/ungroup API that preserves required connections and attributes, supports disconnected grouping, and removes unnecessary interfaces when ungrouping.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.