From fc8bcd26c0be15cb9ace6f6289f0275547d73c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Tue, 5 Apr 2022 19:59:20 +0200 Subject: Curves: fix edit mode detection This adds missing cases to detect edit mode for Curves objects. Unlike other object types, Curves do not have specific edit data, rather we edit the original data directly, and rely on `Object.mode`. For this, `BKE_object_data_is_in_editmode` had to be modified to take a pointer to the object. This affects two places: the outliner and the dependency graph. For the former place, the object pointer is readily available, and we can use it. For the latter, the object pointer is not available, however since it is used to update edit mode pointers, and since Curves do not have such data, we can safely pass null to the function here. This also fixes the assertion failure that happens when closing a file in edit mode. Differential Revision: https://developer.blender.org/D14330 --- source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 91170abed0b..c38393e9284 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -872,7 +872,9 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, const IDNode * TODO: Investigate modes besides edit-mode. */ if (check_datablock_expanded(id_cow) && !id_node->is_cow_explicitly_tagged) { const ID_Type id_type = GS(id_orig->name); - if (OB_DATA_SUPPORT_EDITMODE(id_type) && BKE_object_data_is_in_editmode(id_orig)) { + /* Pass nullptr as the object is only needed for Curves which do not have edit mode pointers. + */ + if (OB_DATA_SUPPORT_EDITMODE(id_type) && BKE_object_data_is_in_editmode(nullptr, id_orig)) { /* Make sure pointers in the edit mode data are updated in the copy. * This allows depsgraph to pick up changes made in another context after it has been * evaluated. Consider the following scenario: -- cgit v1.2.3