Fix T66356: runtime assert disabling a collection

This commit is contained in:
2019-07-05 16:25:54 +10:00
parent 66684bdff3
commit 31d762c3a8
3 changed files with 23 additions and 8 deletions

View File

@@ -121,6 +121,9 @@ void ED_object_parent_clear(struct Object *ob, const int type);
void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode);
void ED_object_base_activate(struct bContext *C, struct Base *base);
void ED_object_base_active_refresh(struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob);
bool ED_object_base_deselect_all_ex(struct ViewLayer *view_layer,
struct View3D *v3d,

View File

@@ -118,19 +118,28 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
}
}
/**
* Call when the active base has changed.
*/
void ED_object_base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_layer)
{
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
struct wmMsgBus *mbus = ((wmWindowManager *)bmain->wm.first)->message_bus;
if (mbus != NULL) {
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
}
/**
* Change active base, it includes the notifier
*/
void ED_object_base_activate(bContext *C, Base *base)
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
view_layer->basact = base;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
ED_object_base_active_refresh(CTX_data_main(C), scene, view_layer);
}
bool ED_object_base_deselect_all_ex(ViewLayer *view_layer,

View File

@@ -278,15 +278,18 @@ static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene)
LayerCollection *lc = (LayerCollection *)ptr->data;
ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
/* Set/Unset it recursively to match the behaviour of excluding via the menu or shortcuts. */
rna_LayerCollection_exclude_update_recursive(&lc->layer_collections,
(lc->flag & LAYER_COLLECTION_EXCLUDE) != 0);
/* Set/Unset it recursively to match the behavior of excluding via the menu or shortcuts. */
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
rna_LayerCollection_exclude_update_recursive(&lc->layer_collections, exclude);
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
if (exclude) {
ED_object_base_active_refresh(bmain, scene, view_layer);
}
}
static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)