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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-15 19:01:40 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-15 19:02:48 +0400
commit8c444958fcba92135b22893ae5da53bc31e96eb6 (patch)
tree061ba87489b34449d5565c8fcf38a17fb3b46463 /source/blender/editors/object/object_edit.c
parentd9e52ac98b74e2be3186f448177c84772f928871 (diff)
Fix T38234: changing smooth/flat shading on linked mesh data should not be allowed.
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r--source/blender/editors/object/object_edit.c16
1 files changed, 13 insertions, 3 deletions
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;
}