Fix T75539: Cycles missing geometry update when switching displacement method

The shaders were not tagged for a needed geometry update when the displacement method was modified, neither were the Geometry and Object managers.

Reviewed By: kevindietrich

Maniphest Tasks: T75539

Differential Revision: https://developer.blender.org/D8896
This commit is contained in:
Joan Bonet Orantos 2020-12-14 13:42:34 +01:00 committed by Kévin Dietrich
parent 4b0396695c
commit 68d5ad9983
Notes: blender-bot 2023-02-13 22:55:50 +01:00
Referenced by issue #75539, Cycles: switching from Displacement to Bump Only does not update geometry
1 changed files with 9 additions and 2 deletions

View File

@ -347,8 +347,15 @@ void Shader::tag_update(Scene *scene)
foreach (ShaderNode *node, graph->nodes)
node->attributes(this, &attributes);
if (has_displacement && displacement_method == DISPLACE_BOTH) {
attributes.add(ATTR_STD_POSITION_UNDISPLACED);
if (has_displacement) {
if (displacement_method == DISPLACE_BOTH) {
attributes.add(ATTR_STD_POSITION_UNDISPLACED);
}
if (displacement_method_is_modified()) {
need_update_geometry = true;
scene->geometry_manager->need_update = true;
scene->object_manager->need_flags_update = true;
}
}
/* compare if the attributes changed, mesh manager will check