Worker: blender-render
command, make the blendfile
parameter optional
Only include the `blendfile` parameter if it is not empty. This makes it possible to pass a Python script that loads/constructs the blend file, instead of loading one directly.
This commit is contained in:
parent
72d5cfa07c
commit
81968610ed
@ -8,6 +8,7 @@ bugs in actually-released versions.
|
|||||||
|
|
||||||
- Add MQTT support. Flamenco Manager can now send internal events to an MQTT broker.
|
- Add MQTT support. Flamenco Manager can now send internal events to an MQTT broker.
|
||||||
- Simplify the preview video filename when a complex set of frames rendered ([#104285](https://projects.blender.org/studio/flamenco/issues/104285)). Instead of `video-1, 4, 10.mp4` it is now simply `video-1-10.mp4`.
|
- Simplify the preview video filename when a complex set of frames rendered ([#104285](https://projects.blender.org/studio/flamenco/issues/104285)). Instead of `video-1, 4, 10.mp4` it is now simply `video-1-10.mp4`.
|
||||||
|
- Make the `blendfile` parameter of a `blender-render` command optional. This makes it possible to pass, for example, a Python file that loads/constructs the blend file, instead of loading one straight from disk.
|
||||||
|
|
||||||
## 3.4 - released 2024-01-12
|
## 3.4 - released 2024-01-12
|
||||||
|
|
||||||
|
@ -101,7 +101,12 @@ func (ce *CommandExecutor) cmdBlenderRenderCommand(
|
|||||||
|
|
||||||
cliArgs := make([]string, 0)
|
cliArgs := make([]string, 0)
|
||||||
cliArgs = append(cliArgs, parameters.argsBefore...)
|
cliArgs = append(cliArgs, parameters.argsBefore...)
|
||||||
cliArgs = append(cliArgs, parameters.blendfile)
|
if parameters.blendfile != "" {
|
||||||
|
// Only include the blendfile if the parameter is not empty. This makes it
|
||||||
|
// possible to pass a Python script that loads/constructs the blend file,
|
||||||
|
// instead of loading one explicitly here.
|
||||||
|
cliArgs = append(cliArgs, parameters.blendfile)
|
||||||
|
}
|
||||||
cliArgs = append(cliArgs, parameters.args...)
|
cliArgs = append(cliArgs, parameters.args...)
|
||||||
execCmd := ce.cli.CommandContext(ctx, parameters.exe, cliArgs...)
|
execCmd := ce.cli.CommandContext(ctx, parameters.exe, cliArgs...)
|
||||||
if execCmd == nil {
|
if execCmd == nil {
|
||||||
@ -132,9 +137,9 @@ func cmdBlenderRenderParams(logger zerolog.Logger, cmd api.Command) (BlenderPara
|
|||||||
logger.Warn().Interface("command", cmd).Msg("invalid 'argsBefore' parameter")
|
logger.Warn().Interface("command", cmd).Msg("invalid 'argsBefore' parameter")
|
||||||
return parameters, NewParameterInvalidError("argsBefore", cmd, "cannot convert to list of strings")
|
return parameters, NewParameterInvalidError("argsBefore", cmd, "cannot convert to list of strings")
|
||||||
}
|
}
|
||||||
if parameters.blendfile, ok = cmdParameter[string](cmd, "blendfile"); !ok || parameters.blendfile == "" {
|
if parameters.blendfile, ok = cmdParameter[string](cmd, "blendfile"); !ok {
|
||||||
logger.Warn().Interface("command", cmd).Msg("missing 'blendfile' parameter")
|
logger.Warn().Interface("command", cmd).Msg("invalid 'blendfile' parameter")
|
||||||
return parameters, NewParameterMissingError("blendfile", cmd)
|
return parameters, NewParameterInvalidError("blendfile", cmd, "cannot convert to string")
|
||||||
}
|
}
|
||||||
if parameters.args, ok = cmdParameterAsStrings(cmd, "args"); !ok {
|
if parameters.args, ok = cmdParameterAsStrings(cmd, "args"); !ok {
|
||||||
logger.Warn().Interface("command", cmd).Msg("invalid 'args' parameter")
|
logger.Warn().Interface("command", cmd).Msg("invalid 'args' parameter")
|
||||||
|
@ -79,6 +79,30 @@ func TestCmdBlenderCliArgsInExeParameter(t *testing.T) {
|
|||||||
assert.Equal(t, ErrNoExecCmd, err, "nil *exec.Cmd should result in ErrNoExecCmd")
|
assert.Equal(t, ErrNoExecCmd, err, "nil *exec.Cmd should result in ErrNoExecCmd")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCmdBlenderNoBlendfile(t *testing.T) {
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
defer mockCtrl.Finish()
|
||||||
|
|
||||||
|
ce, mocks := testCommandExecutor(t, mockCtrl)
|
||||||
|
|
||||||
|
taskID := "1d54c6fe-1242-4c8f-bd63-5a09e358d7b6"
|
||||||
|
cmd := api.Command{
|
||||||
|
Name: "blender",
|
||||||
|
Parameters: map[string]interface{}{
|
||||||
|
"exe": "/path/to/blender",
|
||||||
|
"argsBefore": []string{"--background"},
|
||||||
|
"blendfile": "", // Empty blendfile should be skipped.
|
||||||
|
"args": []string{"--render-output", "/frames"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cliArgs := []string{"--background", "--render-output", "/frames"}
|
||||||
|
mocks.cli.EXPECT().CommandContext(gomock.Any(), "/path/to/blender", cliArgs).Return(nil)
|
||||||
|
|
||||||
|
err := ce.cmdBlenderRender(context.Background(), zerolog.Nop(), taskID, cmd)
|
||||||
|
assert.Equal(t, ErrNoExecCmd, err, "nil *exec.Cmd should result in ErrNoExecCmd")
|
||||||
|
}
|
||||||
|
|
||||||
func TestProcessLineBlender(t *testing.T) {
|
func TestProcessLineBlender(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
mockCtrl := gomock.NewController(t)
|
mockCtrl := gomock.NewController(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user