aboutsummaryrefslogtreecommitdiff
path: root/arnold/getMayaConfig.sh
blob: 37f90b9a482d59ec64f621a5f904f4ccce6b3539 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962

#  Returns the value of an Arnold build configuration variable for a given version of Maya
#
#	getMayaConfig <mayaVersion> <variable>
#
#  The available config variables are:
#
#	versionDB	- path to the file containing the list of Arnold versions that Shave
#			  supports for each version of Maya.
#			  e.g. arnold/supportedArnoldVersions.txt
#
#	versionRanges	- list of mtoa version ranges supported by this version of Maya
#			  e.g. '1.3.0.0/1.3.0.9 2.1.0.0/3.0.9.9'
#
#	versions	- same as 'versionRanges' but only giving the starting versions of the
#			  ranges
#			  e.g. '31000 36000'
#
#   TODO:   For Arnold we need to know the version numbers for both mtoa and Arnold itself. So 'versionDB'
#           is the only useful variable at the moment.
#
mayaVersion=$1
variable=$2
versionDB=`dirname $0`/supportedMtoAVersions.txt

if [ "$2" == "" ]; then
    echo "Usage: $0 <mayaVersion> <variable>" >&2
    exit 1
fi

case ${variable} in
    versionDB)
	echo ${versionDB}
	;;

    versionRanges)
	grep "^${mayaVersion}:" ${versionDB} | sed 's/^[^:]*:[ \t]*//'
	;;

    versions)
	grep "^${mayaVersion}:" ${versionDB} | sed -e 's?^[^:]*:[ \t]*??' -e 's?/[^ \t]*??g'
	;;

    *)	echo "$0: Unknown configuration variable '${variable}'."
	exit 2
esac