Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_edit.c
| Show First 20 Lines • Show All 586 Lines • ▼ Show 20 Lines | for (path = path->prev; path; path = path->prev) { | ||||
| ngroup = path->nodetree; | ngroup = path->nodetree; | ||||
| } | } | ||||
| } | } | ||||
| if (node) | if (node) | ||||
| nodeUpdate(snode->edittree, node); | nodeUpdate(snode->edittree, node); | ||||
| } | } | ||||
| void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) | void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node, RenderEngineType *re_type) | ||||
| { | { | ||||
| const bool was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE) != 0; | const bool was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE) != 0; | ||||
| nodeSetActive(ntree, node); | nodeSetActive(ntree, node); | ||||
| if (node->type != NODE_GROUP) { | if (node->type != NODE_GROUP) { | ||||
| const bool was_output = (node->flag & NODE_DO_OUTPUT) != 0; | const bool was_output = (node->flag & NODE_DO_OUTPUT) != 0; | ||||
| bool do_update = false; | bool do_update = false; | ||||
| Show All 16 Lines | if (ntree->type == NTREE_SHADER) { | ||||
| if (node->id && ELEM(GS(node->id->name), ID_MA, ID_LA, ID_WO)) | if (node->id && ELEM(GS(node->id->name), ID_MA, ID_LA, ID_WO)) | ||||
| nodeClearActiveID(ntree, ID_TE); | nodeClearActiveID(ntree, ID_TE); | ||||
| if (ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, | if (ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, | ||||
| SH_NODE_OUTPUT_WORLD, SH_NODE_OUTPUT_LIGHT, SH_NODE_OUTPUT_LINESTYLE)) | SH_NODE_OUTPUT_WORLD, SH_NODE_OUTPUT_LIGHT, SH_NODE_OUTPUT_LINESTYLE)) | ||||
| { | { | ||||
| bNode *tnode; | bNode *tnode; | ||||
| bool ok = true; | |||||
| if (!re_type) { | |||||
| ok = true; | |||||
| } | |||||
| else if (STREQ(re_type->name, "Eevee") && !ELEM(node->custom1, SHD_OUTPUT_ALL, SHD_OUTPUT_EEVEE)) { | |||||
| ok = false; | |||||
| } | |||||
| else if (STREQ(re_type->name, "Cycles") && !ELEM(node->custom1, SHD_OUTPUT_ALL, SHD_OUTPUT_CYCLES)) { | |||||
| ok = false; | |||||
| } | |||||
| if (ok) { | |||||
| for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) | for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) | ||||
| if (tnode->type == node->type) | if (tnode->type == node->type) | ||||
| tnode->flag &= ~NODE_DO_OUTPUT; | tnode->flag &= ~NODE_DO_OUTPUT; | ||||
| node->flag |= NODE_DO_OUTPUT; | node->flag |= NODE_DO_OUTPUT; | ||||
| if (was_output == 0) | if (was_output == 0) | ||||
| ED_node_tag_update_nodetree(bmain, ntree, node); | ED_node_tag_update_nodetree(bmain, ntree, node); | ||||
| } | } | ||||
| } | |||||
| else if (do_update) | else if (do_update) | ||||
| ED_node_tag_update_nodetree(bmain, ntree, node); | ED_node_tag_update_nodetree(bmain, ntree, node); | ||||
| /* if active texture changed, free glsl materials */ | /* if active texture changed, free glsl materials */ | ||||
| if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) { | if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) { | ||||
| Material *ma; | Material *ma; | ||||
| World *wo; | World *wo; | ||||
| ▲ Show 20 Lines • Show All 2,004 Lines • Show Last 20 Lines | |||||