Commit: 49e7b77b1952c6ea4ab5064d0d31b54052301ffd
Author: Sergey Sharybin
Date:   Mon Aug 28 11:00:42 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB49e7b77b1952c6ea4ab5064d0d31b54052301ffd

Depsgraph: Pass copy-on-write pointer to material update

Unfortunately, there is something else wrong going on here, which makes objects
black after tweaking material settings.

===================================================================

M       source/blender/depsgraph/intern/builder/deg_builder_nodes.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 659b7cefacb..e8f3b6bd61c 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1144,30 +1144,27 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree 
*ntree)
 }
 
 /* Recursively build graph for material */
-void DepsgraphNodeBuilder::build_material(Material *ma)
+void DepsgraphNodeBuilder::build_material(Material *material)
 {
-       ID *ma_id = &ma->id;
-       if (ma_id->tag & LIB_TAG_DOIT) {
+       ID *material_id = &material->id;
+       if (material_id->tag & LIB_TAG_DOIT) {
                return;
        }
-
-       /* material itself */
-       add_id_node(ma_id);
-
+       material_id->tag |= LIB_TAG_DOIT;
+       /* Material itself. */
+       add_id_node(material_id);
+       Material *material_cow = get_cow_datablock(material);
        /* Shading update. */
-       add_operation_node(ma_id,
+       add_operation_node(material_id,
                           DEG_NODE_TYPE_SHADING,
-                          function_bind(BKE_material_eval, _1, ma),
+                          function_bind(BKE_material_eval, _1, material_cow),
                           DEG_OPCODE_MATERIAL_UPDATE);
-
-       /* material animation */
-       build_animdata(ma_id);
-
-       /* textures */
-       build_texture_stack(ma->mtex);
-
-       /* material's nodetree */
-       build_nodetree(ma->nodetree);
+       /* Material animation. */
+       build_animdata(material_id);
+       /* Textures. */
+       build_texture_stack(material->mtex);
+       /* Material's nodetree. */
+       build_nodetree(material->nodetree);
 }
 
 /* Texture-stack attached to some shading datablock */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to