diff options
author | Bastien Montagne <bastien@blender.org> | 2022-03-28 18:34:36 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-03-29 18:59:55 +0300 |
commit | 5596f79821caae3d4c1eb608ce77371904f74b80 (patch) | |
tree | 92dbb06728dd7bbecfa71d17dbe25cde49dfdeb5 /source/blender/editors/object/object_add.cc | |
parent | 354db59fb12a5ee595ae650ac3a736e3cc6df39d (diff) |
LibOverride: Massive edits to 'editable' IDs checks in editors code.
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes
previous check (simple `ID_IS_LINKED()` macro) for many editing cases.
This allows to also take into account 'system override' (aka
non-editable override) case.
Ref: {T95707}.
Diffstat (limited to 'source/blender/editors/object/object_add.cc')
-rw-r--r-- | source/blender/editors/object/object_add.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index b8ffaf87118..f681f49df90 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -1280,7 +1280,7 @@ static bool object_gpencil_add_poll(bContext *C) Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); - if ((scene == nullptr) || (ID_IS_LINKED(scene))) { + if ((scene == nullptr) || ID_IS_LINKED(scene) || ID_IS_OVERRIDE_LIBRARY(scene)) { return false; } @@ -2752,12 +2752,14 @@ static int object_convert_exec(bContext *C, wmOperator *op) * However, changing this is more design than bug-fix, not to mention convoluted code below, * so that will be for later. * But at the very least, do not do that with linked IDs! */ - if ((ID_IS_LINKED(ob) || (ob->data && ID_IS_LINKED(ob->data))) && !keep_original) { + if ((!BKE_id_is_editable(bmain, &ob->id) || + (ob->data && !BKE_id_is_editable(bmain, static_cast<ID *>(ob->data)))) && + !keep_original) { keep_original = true; - BKE_report( - op->reports, - RPT_INFO, - "Converting some linked object/object data, enforcing 'Keep Original' option to True"); + BKE_report(op->reports, + RPT_INFO, + "Converting some non-editable object/object data, enforcing 'Keep Original' " + "option to True"); } DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY); @@ -3631,7 +3633,7 @@ static int object_transform_to_mouse_exec(bContext *C, wmOperator *op) /* Don't transform a linked object. There's just nothing to do here in this case, so return * #OPERATOR_FINISHED. */ - if (ID_IS_LINKED(ob)) { + if (!BKE_id_is_editable(bmain, &ob->id)) { return OPERATOR_FINISHED; } |