Cleanup: Use ID_IS_LINKED instead of id.lib

This commit is contained in:
Dalai Felinto 2019-02-09 18:41:52 -02:00
parent 69f50e6ea9
commit 66c23ea2b4
Notes: blender-bot 2023-02-14 03:42:19 +01:00
Referenced by issue #61603, Drivers Run Without Asking Permission 2.8
Referenced by issue #61613, Entire computer locks up requiring hard reset whenever Cycles rendering is enabled (Linux Mint 19.1, 64 bit)
3 changed files with 10 additions and 10 deletions

View File

@ -1005,7 +1005,7 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl
bool depsgraph_need_update = false;
LayerCollection *lc_master = view_layer->layer_collections.first;
if (lc->collection->id.lib == NULL) {
if (!ID_IS_LINKED(lc->collection)) {
if (lc->collection->flag & COLLECTION_RESTRICT_VIEW) {
lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
depsgraph_need_update = true;
@ -1029,7 +1029,7 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl
}
while (lc_parent != lc) {
if (lc_parent->collection->id.lib == NULL) {
if (!ID_IS_LINKED(lc_parent->collection)) {
if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) {
lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
depsgraph_need_update = true;
@ -1089,7 +1089,7 @@ bool BKE_layer_collection_set_visible(ViewLayer *view_layer, LayerCollection *lc
bool depsgraph_changed = false;
if (visible &&
(lc->collection->id.lib == NULL) &&
(!ID_IS_LINKED(lc->collection)) &&
((lc->collection->flag & COLLECTION_RESTRICT_VIEW) != 0))
{
lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;

View File

@ -1065,7 +1065,7 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
Collection *collection = layer_collection->collection;
if (collection->id.lib != NULL) {
if (ID_IS_LINKED(collection)) {
continue;
}
if (clear) {

View File

@ -276,16 +276,16 @@ static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
bool extend = (win->eventstate->shift != 0);
bool depsgraph_changed = false;
const bool is_library = (ob->id.lib != NULL);
const bool is_linked = ID_IS_LINKED(ob);
if (do_disable) {
if (!is_library) {
if (!is_linked) {
ob->restrictflag |= OB_RESTRICT_VIEW;
depsgraph_changed = true;
}
}
else if (do_isolate) {
depsgraph_changed = (!is_library) && ((ob->restrictflag & OB_RESTRICT_VIEW) != 0);
depsgraph_changed = (!is_linked) && ((ob->restrictflag & OB_RESTRICT_VIEW) != 0);
if (!extend) {
/* Make only one base visible. */
@ -300,12 +300,12 @@ static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
base->flag ^= BASE_HIDDEN;
}
if (!is_library) {
if (!is_linked) {
ob->restrictflag &= ~OB_RESTRICT_VIEW;
}
}
else if (ob->restrictflag & OB_RESTRICT_VIEW) {
if (!is_library) {
if (!is_linked) {
ob->restrictflag &= ~OB_RESTRICT_VIEW;
base->flag &= ~BASE_HIDDEN;
}
@ -342,7 +342,7 @@ static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *p
bool depsgraph_changed = false;
if (do_disable) {
if (collection->id.lib == NULL) {
if (!ID_IS_LINKED(collection)) {
collection->flag |= COLLECTION_RESTRICT_VIEW;
depsgraph_changed = true;
}