Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2022-04-05 20:59:20 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2022-04-05 20:59:20 +0300
commitfc8bcd26c0be15cb9ace6f6289f0275547d73c94 (patch)
treecce531e417a7c2dd2a7f8cbb1125e1a8669b44af /source/blender/blenkernel/intern
parent4de704a6df773035e651efdc4ca379295741724f (diff)
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
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/object.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index 6f1c8f09a76..a54e2910b79 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -1897,6 +1897,8 @@ bool BKE_object_is_in_editmode(const Object *ob)
case OB_GPENCIL:
/* Grease Pencil object has no edit mode data. */
return GPENCIL_EDIT_MODE((bGPdata *)ob->data);
+ case OB_CURVES:
+ return ob->mode == OB_MODE_EDIT;
default:
return false;
}
@@ -1907,7 +1909,7 @@ bool BKE_object_is_in_editmode_vgroup(const Object *ob)
return (OB_TYPE_SUPPORT_VGROUP(ob->type) && BKE_object_is_in_editmode(ob));
}
-bool BKE_object_data_is_in_editmode(const ID *id)
+bool BKE_object_data_is_in_editmode(const Object *ob, const ID *id)
{
const short type = GS(id->name);
BLI_assert(OB_DATA_SUPPORT_EDITMODE(type));
@@ -1923,6 +1925,11 @@ bool BKE_object_data_is_in_editmode(const ID *id)
return ((const Lattice *)id)->editlatt != nullptr;
case ID_AR:
return ((const bArmature *)id)->edbo != nullptr;
+ case ID_CV:
+ if (ob) {
+ return BKE_object_is_in_editmode(ob);
+ }
+ return false;
default:
BLI_assert_unreachable();
return false;
@@ -1970,6 +1977,10 @@ char *BKE_object_data_editmode_flush_ptr_get(struct ID *id)
bArmature *arm = (bArmature *)id;
return &arm->needs_flush_to_id;
}
+ case ID_CV: {
+ /* Curves have no edit mode data. */
+ return nullptr;
+ }
default:
BLI_assert_unreachable();
return nullptr;