From 8c444958fcba92135b22893ae5da53bc31e96eb6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 15 Jan 2014 16:01:40 +0100 Subject: Fix T38234: changing smooth/flat shading on linked mesh data should not be allowed. --- source/blender/editors/object/object_edit.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index f7fb2a29cdb..b80d4dedc65 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1341,13 +1341,20 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot) static int shade_smooth_exec(bContext *C, wmOperator *op) { + ID *data; Curve *cu; Nurb *nu; int clear = (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0); - int done = FALSE; + bool done = false, linked_data = false; CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) { + data = ob->data; + + if (data && data->lib) { + linked_data = true; + continue; + } if (ob->type == OB_MESH) { BKE_mesh_smooth_flag_set(ob, !clear); @@ -1355,7 +1362,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - done = TRUE; + done = true; } else if (ELEM(ob->type, OB_SURF, OB_CURVE)) { cu = ob->data; @@ -1368,11 +1375,14 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - done = TRUE; + done = true; } } CTX_DATA_END; + if (linked_data) + BKE_report(op->reports, RPT_WARNING, "Can't edit linked mesh or curve data."); + return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -- cgit v1.2.3