Added support for $MAIN_DIR in model-path
This commit is contained in:
parent
70d5e7c549
commit
4be8e217f7
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue