Fix #139022: Cycles: Mix Color Node using socket values when constant folded
If Mix Color node clamps the result, we do not bypass the node, but disconnect other inputs. However, for the case where both inputs were the same, the disconnected one would use the stored socket value instead, so set the factor to 0 to only use the intended input. Pull Request: https://projects.blender.org/blender/blender/pulls/139098
This commit is contained in:
committed by
Weizhen Huang
parent
ecfd9ec2d7
commit
54e748852a
@@ -330,7 +330,10 @@ void ConstantFolder::fold_mix_color(NodeMix type, bool clamp_factor, bool clamp)
|
||||
/* remove useless mix colors nodes */
|
||||
if (color1_in->link && color2_in->link) {
|
||||
if (color1_in->link == color2_in->link) {
|
||||
try_bypass_or_make_constant(color1_in, clamp);
|
||||
if (!try_bypass_or_make_constant(color1_in, clamp)) {
|
||||
/* If can't bypass, set `fac` to 0 to only use `color1_in`. */
|
||||
fac_in->set(0.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user