Fix: Workbench assert on non-image texture node

This was not report, but it would happen if you open the sample file
from T61858 and changed to solid view with texture.
This commit is contained in:
Dalai Felinto 2019-02-22 18:00:45 -03:00
parent e9f738754d
commit 655faca105
1 changed files with 18 additions and 4 deletions

View File

@ -225,10 +225,24 @@ void workbench_material_get_image_and_mat(Object *ob, int mat_nr, Image **r_imag
bNode *node;
*r_mat = give_current_material(ob, mat_nr);
ED_object_get_active_image(ob, mat_nr, r_image, NULL, &node, NULL);
if (node) {
BLI_assert(node->type == SH_NODE_TEX_IMAGE);
NodeTexImage *storage = node->storage;
*r_interp = storage->interpolation;
if (node && *r_image) {
switch (node->type) {
case SH_NODE_TEX_IMAGE:
{
NodeTexImage *storage = node->storage;
*r_interp = storage->interpolation;
break;
}
case SH_NODE_TEX_ENVIRONMENT:
{
NodeTexEnvironment *storage = node->storage;
*r_interp = storage->interpolation;
break;
}
default:
BLI_assert(!"Node type not supported by workbench");
*r_interp = 0;
}
}
else {
*r_interp = 0;