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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-01-26 19:01:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-01-26 19:01:37 +0300
commitfd69ba225540cde5e4c1fa651fb02df21ea0a143 (patch)
tree06282dbaf9a5b847c37cb99ed9a1699a08906ec1
parentc441eb27ea2798019a6eba6ae6ed3f7e10bff66b (diff)
Depsgraph: Link from material to object shading
This is a ground work for the upcoming changes in Blender 2.8 branch where we need to do special actions to reconstruct shaders when material changes.
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc15
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc9
2 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 173d5c32212..9d78b99341b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -824,11 +824,18 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
}
/* materials */
- for (int a = 1; a <= ob->totcol; a++) {
- Material *ma = give_current_material(ob, a);
- if (ma != NULL) {
- build_material(ma);
+ if (ob->totcol != 0) {
+ for (int a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
+ if (ma != NULL) {
+ build_material(ma);
+ }
}
+ add_operation_node(&ob->id,
+ DEPSNODE_TYPE_SHADING,
+ DEPSOP_TYPE_EXEC,
+ NULL,
+ DEG_OPCODE_PLACEHOLDER, "Material Update");
}
/* geometry collision */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 82d502dcc19..ba7818c21ad 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1418,11 +1418,18 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
}
/* materials */
- if (ob->totcol) {
+ if (ob->totcol != 0) {
+ ComponentKey object_shading_key(&ob->id, DEPSNODE_TYPE_SHADING);
for (int a = 1; a <= ob->totcol; a++) {
Material *ma = give_current_material(ob, a);
if (ma != NULL) {
build_material(ma);
+ ComponentKey material_shading_key(&ma->id,
+ DEPSNODE_TYPE_SHADING);
+ add_relation(material_shading_key,
+ object_shading_key,
+ DEPSREL_TYPE_UPDATE,
+ "Object Shading");
}
}
}