diff --git a/panda/src/gobj/shader.I b/panda/src/gobj/shader.I index e101a07dfc..1c00d40197 100644 --- a/panda/src/gobj/shader.I +++ b/panda/src/gobj/shader.I @@ -865,7 +865,7 @@ get_filename_from_index(int index, ShaderType type) const { if (!fn.empty()) { return fn; } - } else if (glsl_preprocess && index > 2048 && + } else if (glsl_preprocess && index >= 2048 && (index - 2048) < (int)_included_files.size()) { return _included_files[index - 2048]; } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 13137221f0..118689c78c 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3080,10 +3080,16 @@ do_read_one(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpa if (alpha_file_channel == 4 || (alpha_file_channel == 2 && alpha_image.get_num_channels() == 2)) { - // Use the alpha channel. - for (int x = 0; x < image.get_x_size(); x++) { - for (int y = 0; y < image.get_y_size(); y++) { - image.set_alpha(x, y, alpha_image.get_alpha(x, y)); + + if (!alpha_image.has_alpha()) { + gobj_cat.error() + << alpha_fullpath.get_basename() << " has no channel " << alpha_file_channel << ".\n"; + } else { + // Use the alpha channel. + for (int x = 0; x < image.get_x_size(); x++) { + for (int y = 0; y < image.get_y_size(); y++) { + image.set_alpha(x, y, alpha_image.get_alpha(x, y)); + } } } cdata->_alpha_file_channel = alpha_image.get_num_channels(); diff --git a/panda/src/rocket/rocketFileInterface.cxx b/panda/src/rocket/rocketFileInterface.cxx index f7d91ee76f..ba519760f9 100644 --- a/panda/src/rocket/rocketFileInterface.cxx +++ b/panda/src/rocket/rocketFileInterface.cxx @@ -41,8 +41,18 @@ Open(const Rocket::Core::String& path) { PT(VirtualFile) file = _vfs->get_file(fn); if (file == NULL) { - rocket_cat.error() << "Failed to find " << fn << "\n"; - return (Rocket::Core::FileHandle) NULL; + // failed? Try model-path as a Panda-friendly fallback. + if (!_vfs->resolve_filename(fn, get_model_path())) { + rocket_cat.error() << "Could not resolve " << fn + << " along the model-path (currently: " << get_model_path() << ")\n"; + return (Rocket::Core::FileHandle) NULL; + } + + file = _vfs->get_file(fn); + if (file == NULL) { + rocket_cat.error() << "Failed to get " << fn << ", found on model-path\n"; + return (Rocket::Core::FileHandle) NULL; + } } istream *str = file->open_read_file(true);