forked from mitsuba-renderer/mitsuba3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetpath.sh
68 lines (59 loc) · 1.95 KB
/
setpath.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This script adds Mitsuba and the Python bindings to the shell's search
# path. It must be executed via the 'source' command so that it can modify
# the relevant environment variables.
MI_DIR=""
MI_VARIANTS="@MI_VARIANT_NAMES_STR@"
if [ "$BASH_VERSION" ]; then
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
MI_DIR=$(dirname "$BASH_SOURCE")
MI_DIR=$(builtin cd "$MI_DIR"; builtin pwd)
fi
elif [ "$ZSH_VERSION" ]; then
if [[ -n ${(M)zsh_eval_context:#file} ]]; then
MI_DIR=$(dirname "$0:A")
fi
fi
if [ -z "$MI_DIR" ]; then
echo "This script must be executed via the 'source' command, i.e.:"
echo "$ source ${0}"
exit 0
fi
export PYTHONPATH="$MI_DIR/python:$PYTHONPATH"
export PATH="$MI_DIR:$PATH"
if [ "$BASH_VERSION" ]; then
_mitsuba() {
local FLAGS
FLAGS="-a -h -m -o -s -t -u -v -D"
if [[ $2 == -* ]]; then
COMPREPLY=( $(compgen -W "${FLAGS}" -- $2) )
elif [[ $3 == -m ]]; then
COMPREPLY=( $(compgen -W "${MI_VARIANTS}" -- $2) )
else
COMPREPLY=()
fi
return 0
}
complete -F _mitsuba -o default mitsuba
elif [ "$ZSH_VERSION" ]; then
_mitsuba() {
_arguments \
'-a[Add an entry to the search path]' \
'-h[Help]' \
'-m[Select the variant/mode (e.g. "llvm_rgb")]' \
'-o[Specify the output filename]' \
'-s[Sensor/camera index to use for rendering]' \
'-t[Override the number of threads]' \
'-u[Update the scene description to the latest version]' \
'-v[Be more verbose. Can be specified multiple times]' \
'-D[Define a constant that can be referenced in the scene]' \
'*: :->file'
if [[ $state == '-' ]]; then
:
elif [[ $words[CURRENT-1] == '-m' ]]; then
compadd "$@" ${=MI_VARIANTS}
else
_files
fi
}
compdef _mitsuba mitsuba
fi