diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-13 12:33:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-14 11:26:21 +0300 |
commit | 4271c1cc7133da1f065fa212a911d3747e2d8b33 (patch) | |
tree | 37aadbcc6a5348f545cc5191bbb67d262d008430 | |
parent | 290e6505904592d4e64b490e2c4d3d3822dbea6b (diff) |
Fix T49336: Outliner allows to edit restrict flags for linked objects
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 3c47f542dae..f2a0ddcf486 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -788,12 +788,17 @@ int common_restrict_check(bContext *C, Object *ob) /* Toggle Visibility ---------------------------------------- */ void object_toggle_visibility_cb( - bContext *C, ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + bContext *C, ReportList *reports, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; Object *ob = (Object *)tselem->id; - + + if (ID_IS_LINKED_DATABLOCK(tselem->id)) { + BKE_report(reports, RPT_WARNING, "Cannot edit external libdata"); + return; + } + /* add check for edit mode */ if (!common_restrict_check(C, ob)) return; @@ -845,11 +850,16 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* Toggle Selectability ---------------------------------------- */ void object_toggle_selectability_cb( - bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + bContext *UNUSED(C), ReportList *reports, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; - + + if (ID_IS_LINKED_DATABLOCK(tselem->id)) { + BKE_report(reports, RPT_WARNING, "Cannot edit external libdata"); + return; + } + if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { base->object->restrictflag ^= OB_RESTRICT_SELECT; @@ -895,11 +905,16 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) /* Toggle Renderability ---------------------------------------- */ void object_toggle_renderability_cb( - bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + bContext *UNUSED(C), ReportList *reports, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; - + + if (ID_IS_LINKED_DATABLOCK(tselem->id)) { + BKE_report(reports, RPT_WARNING, "Cannot edit external libdata"); + return; + } + if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { base->object->restrictflag ^= OB_RESTRICT_RENDER; |