Fix #112916: crash when changing active repeat item

It seems like the cause for the crash was that the maps in
`AnonymousAttributeInferencingResult` use node indices as keys.
However, the order of nodes changes when changing node selection.
Generally, we don't want to trigger a more expensive update just
because we changed the selection, therefore things got out of sync
when building the lazy-function graph.

The solution here is not a full fix. Other things that cause a depsgraph
update but don't cause a tree-update could still cause the same kind
of crash. A better solution would be to address the root cause which
is that trivial operations like selection changes node order which is
used in many places. Also see `BKE_ntree_update_tag_node_reordered`.

Disabling depsgraph updates when changing the active simulation
or repeat item is correct as well though, and it solves this specific crash.
This commit is contained in:
Jacques Lucke 2023-09-27 01:34:09 +02:00
parent 3d39abc5e6
commit 46ade1c2df
1 changed files with 4 additions and 2 deletions

View File

@ -8970,6 +8970,7 @@ static void def_geo_simulation_output(StructRNA *srna)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, nullptr, "active_index");
RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE, nullptr);
@ -8980,7 +8981,7 @@ static void def_geo_simulation_output(StructRNA *srna)
"rna_NodeGeometrySimulationOutput_active_item_set",
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NO_DEG_UPDATE);
RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
RNA_def_property_update(prop, NC_NODE, nullptr);
}
@ -9077,6 +9078,7 @@ static void def_geo_repeat_output(StructRNA *srna)
RNA_def_property_int_sdna(prop, nullptr, "active_index");
RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_update(prop, NC_NODE, nullptr);
prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
@ -9086,7 +9088,7 @@ static void def_geo_repeat_output(StructRNA *srna)
"rna_NodeGeometryRepeatOutput_active_item_set",
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NO_DEG_UPDATE);
RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
RNA_def_property_update(prop, NC_NODE, nullptr);
}