Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-13 20:24:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-13 20:26:52 +0300
commit711a50c5ea4de65be1512a1dbfa82b83ef993f56 (patch)
treec068e22657942f7a9cb8777e74a46ff54a111f5d /intern
parenta3c630aebb34e88de3a4820a0bb0f4359e13570d (diff)
parent4d58fac1b4ddcf424d78ee96b404445e8ccc6527 (diff)
Merge branch 'master' into blender2.8
This includes making Eevee match Cycles behavior of inserting an emission node when linking colors to closures.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/graph.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 59e1a12c3a1..dca168824d9 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -232,8 +232,8 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
}
if(from->type() != to->type()) {
- /* for closures we can't do automatic conversion */
- if(from->type() == SocketType::CLOSURE || to->type() == SocketType::CLOSURE) {
+ /* can't do automatic conversion from closure */
+ if(from->type() == SocketType::CLOSURE) {
fprintf(stderr, "Cycles shader graph connect: can only connect closure to closure "
"(%s.%s to %s.%s).\n",
from->parent->name.c_str(), from->name().c_str(),
@@ -242,7 +242,17 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
}
/* add automatic conversion node in case of type mismatch */
- ShaderNode *convert = add(new ConvertNode(from->type(), to->type(), true));
+ ShaderNode *convert;
+
+ if (to->type() == SocketType::CLOSURE) {
+ EmissionNode *emission = new EmissionNode();
+ emission->color = make_float3(1.0f, 1.0f, 1.0f);
+ emission->strength = 1.0f;
+ convert = add(emission);
+ }
+ else {
+ convert = add(new ConvertNode(from->type(), to->type(), true));
+ }
connect(from, convert->inputs[0]);
connect(convert->outputs[0], to);