Merge branch 'release/1.9.x'

This commit is contained in:
rdb 2015-05-07 22:39:53 +02:00
commit 4486fda042
3 changed files with 23 additions and 7 deletions

View File

@ -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];
}

View File

@ -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();

View File

@ -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);