Commit: 0307369211825afe1a5ae79a84b32a90da37868a
Author: Sergey Sharybin
Date:   Tue Sep 13 11:33:55 2016 +0200
Branches: master
https://developer.blender.org/rB0307369211825afe1a5ae79a84b32a90da37868a

Fix T49336: Outliner allows to edit restrict flags for linked objects

===================================================================

M       source/blender/editors/space_outliner/outliner_edit.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_edit.c 
b/source/blender/editors/space_outliner/outliner_edit.c
index 3c47f54..f2a0ddc 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;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to