Added support for $MAIN_DIR in model-path

This commit is contained in:
Josh Yelon 2007-02-13 19:05:40 +00:00
parent 70d5e7c549
commit 4be8e217f7
2 changed files with 10 additions and 5 deletions

View File

@ -27,8 +27,7 @@ from direct.showbase.BufferViewer import BufferViewer
from direct.task import Task
from direct.directutil import Verify
import EventManager
import math
import sys
import math,sys,os
import Loader
import time
from direct.fsm import ClassicFSM
@ -50,6 +49,12 @@ class ShowBase(DirectObject.DirectObject):
notify = directNotify.newCategory("ShowBase")
def __init__(self):
# Locate the directory containing the main program
maindir=os.path.abspath(sys.path[0])
self.mainDir = Filename.fromOsSpecific(maindir).getFullpath()
ExecutionEnvironment.setEnvironmentVariable("MAIN_DIR", self.mainDir)
# Get the dconfig object
#self.config = ConfigConfigureGetConfigConfigShowbase
self.config = config

View File

@ -39,13 +39,13 @@ default-directnotify-level warning
# a special variable that indicates the same directory as this
# particular Config.prc file.
model-path .
model-path $MAIN_DIR
model-path $THIS_PRC_DIR/..
model-path $THIS_PRC_DIR/../models
sound-path .
sound-path $MAIN_DIR
sound-path $THIS_PRC_DIR/..
sound-path $THIS_PRC_DIR/../models
texture-path .
texture-path $MAIN_DIR
texture-path $THIS_PRC_DIR/..
texture-path $THIS_PRC_DIR/../models