~widelands-media-dev/widelands-media/widelands-media

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This script loads the scipts from the graphics/tools directory of the
# widelands-media repository, so it needs to have the /tools directory
# with the menu_b25.py somewhere in the .blend file's tree. The point is
# that to change the menu in all files, we should only have to change
# the menu_b25.py file.
import bpy
import os.path as ph
import sys

nowpath = bpy.data.filepath
while(not ph.isdir(ph.join(nowpath, "tools")) and nowpath != ph.dirname(nowpath)):
    nowpath = ph.dirname(nowpath)

if(ph.isdir(ph.join(nowpath, "tools"))):
    sys.path.append(ph.join(nowpath, "tools"))

try:
    import menu_b25
    menu_b25.register_standard_menu()
except ImportError:
    raise ImportError("Menu file not found. Look at comment at the beginning "
                      "of the innerWorker.py text.")