mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
load prc's explicitly
This commit is contained in:
parent
4542477442
commit
803f5e0d37
@ -13,13 +13,20 @@ Also see MakeAppMF.py.
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from direct.showbase import VFSImporter
|
from direct.showbase import VFSImporter
|
||||||
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, ConfigPageManager, getModelPath
|
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, getModelPath
|
||||||
from direct.stdpy import file
|
from direct.stdpy import file
|
||||||
import os
|
import os
|
||||||
import __builtin__
|
import __builtin__
|
||||||
|
|
||||||
MultifileRoot = '/mf'
|
MultifileRoot = '/mf'
|
||||||
|
|
||||||
|
# This defines the default prc file that is implicitly loaded with an
|
||||||
|
# application.
|
||||||
|
AppPrcFilename = 'App.prc'
|
||||||
|
AppPrc = """
|
||||||
|
default-model-extension .bam
|
||||||
|
"""
|
||||||
|
|
||||||
class ArgumentError(AttributeError):
|
class ArgumentError(AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -67,9 +74,16 @@ def runPackedApp(args):
|
|||||||
# Put our root directory on the model-path and prc-path, too.
|
# Put our root directory on the model-path and prc-path, too.
|
||||||
getModelPath().prependDirectory(MultifileRoot)
|
getModelPath().prependDirectory(MultifileRoot)
|
||||||
|
|
||||||
cpMgr = ConfigPageManager.getGlobalPtr()
|
# Load the implicit App.prc file.
|
||||||
cpMgr.getSearchPath().prependDirectory(MultifileRoot)
|
loadPrcFileData(AppPrcFilename, AppPrc)
|
||||||
cpMgr.reloadImplicitPages()
|
|
||||||
|
# Load any prc files in the root. We have to load them
|
||||||
|
# explicitly, since the ConfigPageManager can't directly look
|
||||||
|
# inside the vfs.
|
||||||
|
for f in vfs.scanDirectory(MultifileRoot):
|
||||||
|
if f.getFilename().getExtension() == 'prc':
|
||||||
|
data = f.readFile(True)
|
||||||
|
loadPrcFileData(f.getFilename().cStr(), data)
|
||||||
|
|
||||||
# Replace the builtin open and file symbols so user code will get
|
# Replace the builtin open and file symbols so user code will get
|
||||||
# our versions by default, which can open and read files out of
|
# our versions by default, which can open and read files out of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user