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:
Diffstat (limited to 'source/blender/editors/geometry/geometry_attributes.cc')
-rw-r--r--source/blender/editors/geometry/geometry_attributes.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index 37ec7a61bcb..c7e782b7b89 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -518,15 +518,18 @@ static int geometry_color_attribute_duplicate_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
ID *id = static_cast<ID *>(ob->data);
- CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
+ const CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
if (layer == nullptr) {
return OPERATOR_CANCELLED;
}
- CustomDataLayer *newLayer = BKE_id_attribute_duplicate(id, layer, op->reports);
+ CustomDataLayer *new_layer = BKE_id_attribute_duplicate(id, layer->name, op->reports);
+ if (new_layer == nullptr) {
+ return OPERATOR_CANCELLED;
+ }
- BKE_id_attributes_active_color_set(id, newLayer);
+ BKE_id_attributes_active_color_set(id, new_layer);
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
@@ -539,6 +542,10 @@ static bool geometry_color_attributes_duplicate_poll(bContext *C)
if (!geometry_attributes_poll(C)) {
return false;
}
+ if (CTX_data_edit_object(C) != nullptr) {
+ CTX_wm_operator_poll_msg_set(C, "Operation is not allowed in edit mode");
+ return false;
+ }
Object *ob = ED_object_context(C);
ID *data = ob ? static_cast<ID *>(ob->data) : nullptr;