From 398442ee18f70b88ff630d9adf048101c8aa7075 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 4 Apr 2003 16:23:33 +0000 Subject: [PATCH] deal with textures from bam files without filenames properly --- panda/src/gobj/texture.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index d811cce29f..69dca125a8 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -693,10 +693,19 @@ make_Texture(const FactoryParams ¶ms) { PT(Texture) me; - if (alpha_filename.empty()) { - me = TexturePool::load_texture(filename); + if (filename.empty()) { + // This texture has no filename; since we don't have an image to + // load, we can't actually create the texture. + gobj_cat.info() + << "Cannot create texture '" << name << "' with no filename.\n"; + } else { - me = TexturePool::load_texture(filename, alpha_filename); + // This texture does have a filename, so try to load it from disk. + if (alpha_filename.empty()) { + me = TexturePool::load_texture(filename); + } else { + me = TexturePool::load_texture(filename, alpha_filename); + } } if (me == (Texture *)NULL) {