Fix T102965: Crash when compiling shader tree with undefined mix nodes

node_set_typeinfo leaves the bNode::type value as-is for nodes with undefined types.
This commit is contained in:
Miguel Pozo 2022-12-06 16:39:21 +01:00
parent 212b054bb3
commit 37b02b0432
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #102965, Regression: Blender 3.4 release candidate crashes upon loading blend file
1 changed files with 2 additions and 2 deletions

View File

@ -1038,10 +1038,10 @@ static void shader_node_disconnect_inactive_mix_branch(bNodeTree *ntree,
static void ntree_shader_disconnect_inactive_mix_branches(bNodeTree *ntree)
{
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == SH_NODE_MIX_SHADER) {
if (node->typeinfo->type == SH_NODE_MIX_SHADER) {
shader_node_disconnect_inactive_mix_branch(ntree, node, 0, 1, 2, true);
}
else if (node->type == SH_NODE_MIX) {
else if (node->typeinfo->type == SH_NODE_MIX) {
const NodeShaderMix *storage = static_cast<NodeShaderMix *>(node->storage);
if (storage->data_type == SOCK_FLOAT) {
shader_node_disconnect_inactive_mix_branch(ntree, node, 0, 2, 3, storage->clamp_factor);