Skip to content
Snippets Groups Projects
Commit 21f19224 authored by Brecht Van Lommel's avatar Brecht Van Lommel
Browse files

Fix part of T53080: don't use current scene world for icon previews.

This can be very slow if it contains a big texture, and it's not
necessarily setup in a useful way anyway, and materials can be used
in multiple scenes.
parent f6abf9d0
No related branches found
No related tags found
No related merge requests found
...@@ -382,10 +382,19 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty ...@@ -382,10 +382,19 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
} }
} }
else { else {
/* use current scene world to light sphere */ if (mat->pr_type == MA_SPHERE_A && sp->pr_method == PR_BUTS_RENDER) {
if (mat->pr_type == MA_SPHERE_A) /* Use current scene world to light sphere. */
sce->world = scene->world; sce->world = scene->world;
} }
else if (sce->world) {
/* Use a default world color. Using the current
* scene world can be slow if it has big textures. */
sce->world->use_nodes = false;
sce->world->horr = 0.5f;
sce->world->horg = 0.5f;
sce->world->horb = 0.5f;
}
}
if (sp->pr_method == PR_ICON_RENDER) { if (sp->pr_method == PR_ICON_RENDER) {
if (mat->material_type == MA_TYPE_HALO) { if (mat->material_type == MA_TYPE_HALO) {
...@@ -393,10 +402,6 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty ...@@ -393,10 +402,6 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
} }
else { else {
sce->lay = 1 << MA_SPHERE_A; sce->lay = 1 << MA_SPHERE_A;
/* same as above, use current scene world to light sphere */
if (BKE_scene_use_new_shading_nodes(scene))
sce->world = scene->world;
} }
} }
else { else {
...@@ -494,6 +499,15 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty ...@@ -494,6 +499,15 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2); sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2);
} }
} }
else {
if (sce->world) {
/* Only use lighting from the lamp. */
sce->world->use_nodes = false;
sce->world->horr = 0.0f;
sce->world->horg = 0.0f;
sce->world->horb = 0.0f;
}
}
for (base = sce->base.first; base; base = base->next) { for (base = sce->base.first; base; base = base->next) {
if (base->object->id.name[2] == 'p') { if (base->object->id.name[2] == 'p') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment