Merge branch 'master' into blender2.8
[blender.git] / source / blender / makesrna / intern / rna_object.c
index 9c16f53b0c73c3c20ebf4951cd04baf1bb6a2abc..e8efb2025318de9e391b9707318cb55ad7b37412 100644 (file)
@@ -395,7 +395,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
                id_us_plus(id);
 
                ob->data = id;
-               test_object_materials(G.main, id);
+               test_object_materials(ob, id);
 
                if (GS(id->name) == ID_CU)
                        BKE_curve_type_test(ob);
@@ -715,10 +715,10 @@ static int rna_Object_active_material_editable(PointerRNA *ptr)
        bool is_editable;
 
        if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
-               is_editable = (ob->id.lib == NULL);
+               is_editable = !ID_IS_LINKED_DATABLOCK(ob);
        }
        else {
-               is_editable = ob->data ? (((ID *)ob->data)->lib == NULL) : false;
+               is_editable = ob->data ? !ID_IS_LINKED_DATABLOCK(ob->data) : false;
        }
 
        return is_editable ? PROP_EDITABLE : 0;