WIP: Add option to write metadata to output #104284
@ -8,6 +8,7 @@ import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"github.com/google/shlex"
|
||||
@ -20,6 +21,8 @@ import (
|
||||
|
||||
var regexpFileSaved = regexp.MustCompile("Saved: '(.*)'")
|
||||
|
||||
var writeMetadataToOutput = false
|
||||
|
||||
type BlenderParameters struct {
|
||||
exe string // Expansion of `{blender}`: the executable path 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.
|
||||
subprocessErr := ce.cli.RunWithTextOutput(ctx,
|
||||
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")
|
||||
}
|
||||
|
||||
if slices.Contains(parameters.args, "--write-metadata-to-output") {
|
||||
writeMetadataToOutput = true
|
||||
}
|
||||
|
||||
// Split the exeArgs string into separate parts, and prepend them to `argsBefore`.
|
||||
exeArgs, err := shlex.Split(parameters.exeArgs)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user