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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-03 16:15:56 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-03 16:15:56 +0300
commit5884c9f1ba45b8285930508b8ee04279a7b0b387 (patch)
tree11a71aea12aa2e4bf6121f21c041d0da7296928d /intern
parent3b6eaf8d96bce59756f669e0c5105ae3bb31bef8 (diff)
parentcc93a66e71a9de09cb41d4433be86e0f056d2b6f (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_shader.cpp32
-rw-r--r--intern/cycles/blender/blender_sync.h1
-rw-r--r--intern/cycles/render/graph.cpp3
3 files changed, 27 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 0cd4b90340b..df21e2640bd 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -1158,6 +1158,13 @@ static void add_nodes(Scene *scene,
/* Sync Materials */
+void BlenderSync::sync_materials_simpligy(Shader *shader)
+{
+ ShaderGraph *graph = shader->graph;
+ graph->simplify(scene);
+ shader->tag_update(scene);
+}
+
void BlenderSync::sync_materials(bool update_all)
{
shader_map.set_default(scene->default_surface);
@@ -1203,17 +1210,26 @@ void BlenderSync::sync_materials(bool update_all)
shader->set_graph(graph);
- /* By simplifying the shader graph as soon as possible, some redundant shader nodes
- * might be removed which prevents loading unneccessary attributes later.
+ /* By simplifying the shader graph as soon as possible, some
+ * redundant shader nodes might be removed which prevents loading
+ * unnecessary attributes later.
*
- * However, since graph simplification also accounts for e.g. mix weight, this would
- * cause frequent expensive resyncs in interactive sessions, so for those sessions
- * optimization is only performed right before compiling. */
+ * However, since graph simplification also accounts for e.g. mix
+ * weight, this would cause frequent expensive resyncs in interactive
+ * sessions, so for those sessions optimization is only performed
+ * right before compiling.
+ */
if(!preview) {
- pool.push(function_bind(&ShaderGraph::simplify, shader->graph, scene));
+ pool.push(function_bind(&BlenderSync::sync_materials_simpligy,
+ this,
+ shader));
+ }
+ else {
+ /* NOTE: Update tagging can access links which are being
+ * optimized out.
+ */
+ shader->tag_update(scene);
}
-
- shader->tag_update(scene);
}
}
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 36bedc505af..62e2f8f563a 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -96,6 +96,7 @@ public:
private:
/* sync */
void sync_lamps(bool update_all);
+ void sync_materials_simpligy(Shader *shader);
void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D& b_v3d, float motion_time = 0.0f);
void sync_motion(BL::RenderSettings& b_render,
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 0362e8f834a..12fff8e5587 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -238,6 +238,8 @@ ShaderGraph *ShaderGraph::copy()
foreach(ShaderNode *node, nodes)
newgraph->add(nodes_copy[node]);
+ newgraph->simplified = simplified;
+
return newgraph;
}
@@ -245,7 +247,6 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
{
assert(!finalized);
assert(from && to);
- simplified = false;
if(to->link) {
fprintf(stderr, "Cycles shader graph connect: input already connected.\n");