Fix T94582: Cycles mapping shader node incorrectly skipped in Normal mode

Even if no rotation or scale is specified, we must still always normalize
the output.
This commit is contained in:
Brecht Van Lommel 2022-01-20 19:08:19 +01:00
parent cc1a48e395
commit 2559d79d2f

@ -441,9 +441,13 @@ void ConstantFolder::fold_mapping(NodeMappingType type) const
if (is_zero(scale_in)) {
make_zero();
}
else if ((is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
type == NODE_MAPPING_TYPE_NORMAL) &&
is_zero(rotation_in) && is_one(scale_in)) {
else if (
/* Can't constant fold since we always need to normalize the output. */
(type != NODE_MAPPING_TYPE_NORMAL) &&
/* Check all use values are zero, note location is not used by vector and normal types. */
(is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
type == NODE_MAPPING_TYPE_NORMAL) &&
is_zero(rotation_in) && is_one(scale_in)) {
try_bypass_or_make_constant(vector_in);
}
}