Worker: check BLENDER_CMD environment variable (for multi-GPU Eevee rendering) #104193
@ -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
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user
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.