mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
solve some texture resolving issues
This commit is contained in:
parent
2318cb3646
commit
ec3352ec82
@ -533,14 +533,15 @@ class Packager:
|
|||||||
# Any other file.
|
# Any other file.
|
||||||
self.addComponent(file)
|
self.addComponent(file)
|
||||||
|
|
||||||
# Finally, now add the model files. It's important to add
|
# Now add the model files. It's important to add these
|
||||||
# these after we have added all of the texture files, so
|
# after we have added all of the texture files, so we can
|
||||||
# we can determine which textures need to be implicitly
|
# determine which textures need to be implicitly pulled
|
||||||
# pulled in.
|
# in.
|
||||||
|
|
||||||
# We walk through the list as we modify it. That's OK,
|
# We walk through a copy of the files list, since we might
|
||||||
# because we may add new files that we want to process.
|
# be adding more files (textures) to this list as we
|
||||||
for file in self.files:
|
# discover them in model files referenced in this list.
|
||||||
|
for file in self.files[:]:
|
||||||
if file.isExcluded(self):
|
if file.isExcluded(self):
|
||||||
# Skip this file.
|
# Skip this file.
|
||||||
continue
|
continue
|
||||||
@ -700,29 +701,31 @@ class Packager:
|
|||||||
file.filename.unlink()
|
file.filename.unlink()
|
||||||
|
|
||||||
def addFile(self, *args, **kw):
|
def addFile(self, *args, **kw):
|
||||||
""" Adds the named file to the package. """
|
""" Adds the named file to the package. Returns the file
|
||||||
|
object, or None if it was not added by this call. """
|
||||||
|
|
||||||
file = Packager.PackFile(self, *args, **kw)
|
file = Packager.PackFile(self, *args, **kw)
|
||||||
if file.filename in self.sourceFilenames:
|
if file.filename in self.sourceFilenames:
|
||||||
# Don't bother, it's already here.
|
# Don't bother, it's already here.
|
||||||
return
|
return None
|
||||||
|
|
||||||
if file.newName in self.targetFilenames:
|
if file.newName in self.targetFilenames:
|
||||||
# Another file is already in the same place.
|
# Another file is already in the same place.
|
||||||
file2 = self.targetFilenames[file.newName]
|
file2 = self.targetFilenames[file.newName]
|
||||||
self.packager.notify.warning(
|
self.packager.notify.warning(
|
||||||
"%s is shadowing %s" % (file2.filename, file.filename))
|
"%s is shadowing %s" % (file2.filename, file.filename))
|
||||||
return
|
return None
|
||||||
|
|
||||||
self.sourceFilenames[file.filename] = file
|
self.sourceFilenames[file.filename] = file
|
||||||
|
|
||||||
if file.text is None and not file.filename.exists():
|
if file.text is None and not file.filename.exists():
|
||||||
if not file.isExcluded(self):
|
if not file.isExcluded(self):
|
||||||
self.packager.notify.warning("No such file: %s" % (file.filename))
|
self.packager.notify.warning("No such file: %s" % (file.filename))
|
||||||
return
|
return None
|
||||||
|
|
||||||
self.files.append(file)
|
self.files.append(file)
|
||||||
self.targetFilenames[file.newName] = file
|
self.targetFilenames[file.newName] = file
|
||||||
|
return file
|
||||||
|
|
||||||
def excludeFile(self, filename):
|
def excludeFile(self, filename):
|
||||||
""" Excludes the named file (or glob pattern) from the
|
""" Excludes the named file (or glob pattern) from the
|
||||||
@ -1387,8 +1390,16 @@ class Packager:
|
|||||||
self.importedMapsDir, filename.getBasenameWoExtension(),
|
self.importedMapsDir, filename.getBasenameWoExtension(),
|
||||||
uniqueId, filename.getExtension())
|
uniqueId, filename.getExtension())
|
||||||
|
|
||||||
self.addFile(filename, newName = newName, explicit = False,
|
file = self.addFile(
|
||||||
compress = False)
|
filename, newName = newName, explicit = False,
|
||||||
|
compress = False)
|
||||||
|
|
||||||
|
if file:
|
||||||
|
# If we added the file in this pass, then also
|
||||||
|
# immediately add it to the multifile (because we
|
||||||
|
# won't be visiting the files list again).
|
||||||
|
self.addComponent(file)
|
||||||
|
|
||||||
return newName
|
return newName
|
||||||
|
|
||||||
def addDcFile(self, file):
|
def addDcFile(self, file):
|
||||||
|
@ -143,9 +143,14 @@ def makePackedApp(args):
|
|||||||
mainModule = mainModule.cStr().replace('/', '.')
|
mainModule = mainModule.cStr().replace('/', '.')
|
||||||
|
|
||||||
packager.installDir = appDir
|
packager.installDir = appDir
|
||||||
getModelPath().appendDirectory(root)
|
|
||||||
packager.allowPythonDev = allowPythonDev
|
packager.allowPythonDev = allowPythonDev
|
||||||
|
|
||||||
|
# Put the root directory on the front of the model-path, so that
|
||||||
|
# any texture references in egg or bam files that reference
|
||||||
|
# textures from the top of the root directory will be properly
|
||||||
|
# resolved.
|
||||||
|
getModelPath().prependDirectory(root)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
packager.setup()
|
packager.setup()
|
||||||
packager.beginPackage(appBase, p3dApplication = True)
|
packager.beginPackage(appBase, p3dApplication = True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user