donmccurdy / donmccurdy/glTF-Transform

Serialization format for transforms

Open
#1,391 5 comments 1 reaction 0 assignees View on GitHub
feature needs investigation package:functions
Dominant language
TypeScript
Stars
2k
Forks
206
Avg merge
2d 2h
Merged PRs (30d)
16

Description

This is not a real "feature request", but rather some brainstorming.

The scripting API is nice and powerful. The CLI is nice and powerful. But I could imagine a layer hidden between both of them - namely, that of a serialization format for transforms.

As an experiment, I created a stupidly-simple function that just takes JSON like this....
```json
[
{
"name": "dedup"
},
{
"name": "center",
"options": {
"pivot": "center"
}
},
{
"name": "dequantize"
},
{
"name": "draco",
"options": {
"method": "edgebreaker"
}
}
]
```
and translates this into an array of `Transform[]` objects. This allows something like
```typescript
const pipeline = JSON.parse(fs.readFileSync("pipeline.json").toString());
const transforms = createTransforms(pipeline);
await document.transform(...transforms);
```

In general, the possibility to read/write certain configurations of transform sequences could be pretty useful. (And more structured and versatile than a `.BAT`/`.sh` file that contains the proper CLI calls...)

I know how complicated this can become. I know many of the caveats of such an approach. If this was supposed to be done 'right', it would involve some work. (I defined a bunch of JSON schemas for `dedup/center/...` transforms, and these could be trivially translated into TypeScript structures, allowing to safely assemble them programmatically and so on - but doing that _thoroughly_ is not something that can casually be jotted down on a boring afternoon). But I think that there might still be a few relatively low-hanging fruits with that approach.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by reviewing the scripting API, CLI transform handling, and the createTransforms/document.transform example; then define which transform sequences and options are in scope. Done would require an agreed serialization format and a clear implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.