WIP: Add option to write metadata to output #104284
@ -8,6 +8,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/shlex"
|
"github.com/google/shlex"
|
||||||
@ -20,6 +21,8 @@ import (
|
|||||||
|
|
||||||
var regexpFileSaved = regexp.MustCompile("Saved: '(.*)'")
|
var regexpFileSaved = regexp.MustCompile("Saved: '(.*)'")
|
||||||
|
|
||||||
|
var writeMetadataToOutput = false
|
||||||
|
|
||||||
type BlenderParameters struct {
|
type BlenderParameters struct {
|
||||||
exe string // Expansion of `{blender}`: the executable path defined by the Manager.
|
exe string // Expansion of `{blender}`: the executable path defined by the Manager.
|
||||||
exeArgs string // Expansion of `{blenderargs}`: its CLI parameters defined by the Manager.
|
exeArgs string // Expansion of `{blenderargs}`: its CLI parameters defined by the Manager.
|
||||||
@ -51,6 +54,10 @@ func (ce *CommandExecutor) cmdBlenderRender(ctx context.Context, logger zerolog.
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if writeMetadataToOutput {
|
||||||
|
lineChannel <- "Task ID: " + taskID
|
||||||
|
}
|
||||||
|
|
||||||
// Run the subprocess.
|
// Run the subprocess.
|
||||||
subprocessErr := ce.cli.RunWithTextOutput(ctx,
|
subprocessErr := ce.cli.RunWithTextOutput(ctx,
|
||||||
logger,
|
logger,
|
||||||
@ -141,6 +148,10 @@ func cmdBlenderRenderParams(logger zerolog.Logger, cmd api.Command) (BlenderPara
|
|||||||
return parameters, NewParameterInvalidError("args", cmd, "cannot convert to list of strings")
|
return parameters, NewParameterInvalidError("args", cmd, "cannot convert to list of strings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if slices.Contains(parameters.args, "--write-metadata-to-output") {
|
||||||
|
writeMetadataToOutput = true
|
||||||
|
}
|
||||||
|
|
||||||
// Split the exeArgs string into separate parts, and prepend them to `argsBefore`.
|
// Split the exeArgs string into separate parts, and prepend them to `argsBefore`.
|
||||||
exeArgs, err := shlex.Split(parameters.exeArgs)
|
exeArgs, err := shlex.Split(parameters.exeArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user