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-13 12:33:55 +0300 |
commit | 0307369211825afe1a5ae79a84b32a90da37868a (patch) | |
tree | bcf0d1f012bcb41248da60ae4651285c49ebb340 /source/blender/editors | |
parent | ecbfa31caaadb03c53c0fe1459718b99613c8804 (diff) |
Fix T49336: Outliner allows to edit restrict flags for linked objects
Diffstat (limited to 'source/blender/editors')
-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; |