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.
This commit is contained in:
@@ -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 */
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user