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/sculpt_paint | |
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/sculpt_paint')
4 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index 0c73c2e1f43..572e5b78b74 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -272,7 +272,8 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) SpaceImage *sima = CTX_wm_space_image(C); if (sima) { - if (sima->image != nullptr && ID_IS_LINKED(sima->image)) { + if (sima->image != nullptr && + (ID_IS_LINKED(sima->image) || ID_IS_OVERRIDE_LIBRARY(sima->image))) { return false; } ARegion *region = CTX_wm_region(C); @@ -850,7 +851,7 @@ static bool texture_paint_toggle_poll(bContext *C) if (ob == nullptr || ob->type != OB_MESH) { return false; } - if (!ob->data || ID_IS_LINKED(ob->data)) { + if (ob->data == nullptr || ID_IS_LINKED(ob->data) || ID_IS_OVERRIDE_LIBRARY(ob->data)) { return false; } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 12215083eb6..233cfc3b33d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6332,7 +6332,7 @@ bool ED_paint_proj_mesh_data_check( for (int i = 1; i < ob->totcol + 1; i++) { Material *ma = BKE_object_material_get(ob, i); - if (ma && !ID_IS_LINKED(ma)) { + if (ma && !ID_IS_LINKED(ma) && !ID_IS_OVERRIDE_LIBRARY(ma)) { hasmat = true; if (ma->texpaintslot == NULL) { /* refresh here just in case */ @@ -6340,7 +6340,8 @@ bool ED_paint_proj_mesh_data_check( } if (ma->texpaintslot != NULL && (ma->texpaintslot[ma->paint_active_slot].ima == NULL || - !ID_IS_LINKED(ma->texpaintslot[ma->paint_active_slot].ima))) { + !ID_IS_LINKED(ma->texpaintslot[ma->paint_active_slot].ima) || + !ID_IS_OVERRIDE_LIBRARY(ma->texpaintslot[ma->paint_active_slot].ima))) { hastex = true; break; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index e2f8d81fe13..c4d80d38100 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1404,7 +1404,7 @@ static bool paint_mode_toggle_poll_test(bContext *C) if (ob == NULL || ob->type != OB_MESH) { return false; } - if (!ob->data || ID_IS_LINKED(ob->data)) { + if (!ob->data || ID_IS_LINKED(ob->data) || ID_IS_OVERRIDE_LIBRARY(ob->data)) { return false; } return true; diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index 53e8649585a..cd174681ccb 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -616,7 +616,7 @@ static int vertex_to_loop_colors_exec(bContext *C, wmOperator *UNUSED(op)) ID *data; data = ob->data; - if (data && ID_IS_LINKED(data)) { + if (data == NULL || ID_IS_LINKED(data) || ID_IS_OVERRIDE_LIBRARY(data)) { return OPERATOR_CANCELLED; } @@ -681,7 +681,7 @@ static int loop_to_vertex_colors_exec(bContext *C, wmOperator *UNUSED(op)) ID *data; data = ob->data; - if (data && ID_IS_LINKED(data)) { + if (data == NULL || ID_IS_LINKED(data) || ID_IS_OVERRIDE_LIBRARY(data)) { return OPERATOR_CANCELLED; } |