Fix T38798: Can get stuck in world nodes when switching from Cycles to

BI.

The shaderfrom setting in the node editor only makes sense for "new"
shading nodes (cycles), otherwise it should be ignored and default to
SNODE_SHADER_OBJECT.
This commit is contained in:
2014-02-24 13:21:43 +01:00
parent 8d023c1ad0
commit b5aef37c27
2 changed files with 5 additions and 3 deletions

View File

@@ -42,6 +42,7 @@
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_node.h"
@@ -383,11 +384,12 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
}
static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
static void node_area_listener(bScreen *sc, ScrArea *sa, wmNotifier *wmn)
{
/* note, ED_area_tag_refresh will re-execute compositor */
SpaceNode *snode = sa->spacedata.first;
short shader_type = snode->shaderfrom;
/* shaderfrom is only used for new shading nodes, otherwise all shaders are from objects */
short shader_type = BKE_scene_use_new_shading_nodes(sc->scene) ? snode->shaderfrom : SNODE_SHADER_OBJECT;
/* preview renders */
switch (wmn->category) {

View File

@@ -79,7 +79,7 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre
Scene *scene = CTX_data_scene(C);
Object *ob = OBACT;
if (snode->shaderfrom == SNODE_SHADER_OBJECT) {
if (!BKE_scene_use_new_shading_nodes(scene) || snode->shaderfrom == SNODE_SHADER_OBJECT) {
if (ob) {
*r_from = &ob->id;
if (ob->type == OB_LAMP) {