Worker: check BLENDER_CMD environment variable (for multi-GPU Eevee rendering) #104193

Open
MKRelax wants to merge 9 commits from MKRelax/flamenco:worker-use-blender-from-env into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 9d77497e51 - Show all commits

View File

@ -52,12 +52,26 @@ func FileAssociation() (string, error) {
return fileAssociation()
}
// EnvironmentVariable returns the full path of a Blender executable, if given as environment variable
// EnvironmentVariable returns the full path of a Blender executable, by checking the environment.
MKRelax marked this conversation as resolved Outdated

I think the name of this variable should be in a constant. Can be in the same file. That way the string literal doesn't get repeated everywhere.

I think the name of this variable should be in a constant. Can be in the same file. That way the string literal doesn't get repeated everywhere.
func EnvironmentVariable() string {
return os.Getenv(BlenderPathEnvVariable)
}
func CheckBlender(ctx context.Context, exename string) (CheckBlenderResult, error) {
// First check the exename, if given some form of path
if crosspath.Dir(exename) != "." {
// exename is some form of path, see if it works for us.
return checkBlenderAtPath(ctx, exename)
}
// Check the environment for a full path
envFullPath := EnvironmentVariable()
if envFullPath != "" {
// The full path was found in the environment, report the Blender version.
return getResultWithVersion(ctx, exename, envFullPath, api.BlenderPathSourceInputPath)
}
if exename == "" {
// exename is not given, see if we can use .blend file association.
fullPath, err := fileAssociation()
@ -74,11 +88,6 @@ func CheckBlender(ctx context.Context, exename string) (CheckBlenderResult, erro
}
}
if crosspath.Dir(exename) != "." {
// exename is some form of path, see if it works for us.
return checkBlenderAtPath(ctx, exename)
}
// Try to find exename on $PATH
fullPath, err := exec.LookPath(exename)
if err != nil {