feat(mesh): add unified mesh operations registry - #329
Open
DrHepa wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces the shared mesh-operations registry proposed in #295 and migrates the existing repair, decimation, and smoothing implementations into it.
The workflow nodes now act as thin adapters over the same operations exposed through the API, giving workflows, the Modly Agent, and future editing interfaces a single execution path without changing the current node behavior.
Included changes
Registry contract
Each operation declares:
{
"id",
"label",
"params_schema",
"fn",
"destructive",
"undoable",
"category",
}
The public registry description excludes the callable and returns serializable metadata suitable for the future edit panel and agent-tool generation.
The initial built-in operations are:
Schema defaults are resolved centrally by the registry, while callers may override individual parameters.
Decimator decision
This PR keeps the existing glTF Transform + "meshoptimizer" implementation as the single decimation backend.
Replacing it with a PyMeshLab-based decimator would require flattening the glTF scene through an intermediate mesh format such as PLY or OBJ. That can discard or damage document-level information such as:
The retained backend operates on the complete glTF document and preserves the behavior of the current "mesh-optimizer" node, including:
The JavaScript implementation is now invoked through a small NDJSON bridge owned by the shared Python operation. Its dependencies continue to be resolved from the built-in "mesh-optimizer" extension, avoiding a second copy of glTF Transform or "meshoptimizer".
Runtime and packaging
Built-in Python process nodes receive the paths required to import and execute the shared backend:
Packaged builds use Electron itself with "ELECTRON_RUN_AS_NODE=1" for the "meshoptimizer" backend, so they do not depend on a separately installed system Node.js runtime.
The dependency lookup supports both source and packaged layouts.
Backward compatibility
The existing workflow-node contracts are preserved:
Unknown operations return "404", invalid parameters or paths return "400", and unavailable runtime dependencies return "503".
Tests
Added regression tests covering:
Validation completed successfully:
Scope
This PR establishes the shared execution foundation only. It does not add the future edit panel, generate agent tools, dynamically register extension-provided tools, or introduce new mesh algorithms beyond those already available in Modly.
Happy to make any naming, schema, packaging, or runtime adjustments that better fit the intended v0.5 direction.
Closes #295