Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_tools.c
| Show First 20 Lines • Show All 828 Lines • ▼ Show 20 Lines | else if (event == OL_MODIFIER_OP_DELETE) { | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_REMOVED, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_REMOVED, ob); | ||||
| te->store_elem->flag &= ~TSE_SELECTED; | te->store_elem->flag &= ~TSE_SELECTED; | ||||
| } | } | ||||
| } | } | ||||
| static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *Carg) | static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *Carg) | ||||
| { | { | ||||
| bContext *C = (bContext *)Carg; | bContext *C = (bContext *)Carg; | ||||
| Main *bmain = CTX_data_main(C); | |||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| LayerCollection *lc = te->directdata; | LayerCollection *lc = te->directdata; | ||||
| ID *id = te->store_elem->id; | ID *id = te->store_elem->id; | ||||
| SceneCollection *sc = lc->scene_collection; | SceneCollection *sc = lc->scene_collection; | ||||
| if (event == OL_COLLECTION_OP_OBJECTS_ADD) { | if (event == OL_COLLECTION_OP_OBJECTS_ADD) { | ||||
| CTX_DATA_BEGIN (C, Object *, ob, selected_objects) | CTX_DATA_BEGIN (C, Object *, ob, selected_objects) | ||||
| { | { | ||||
| BKE_collection_object_add(id, sc, ob); | BKE_collection_object_add(id, sc, ob); | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | ||||
| } | } | ||||
| else if (event == OL_COLLECTION_OP_OBJECTS_REMOVE) { | else if (event == OL_COLLECTION_OP_OBJECTS_REMOVE) { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| CTX_DATA_BEGIN (C, Object *, ob, selected_objects) | CTX_DATA_BEGIN (C, Object *, ob, selected_objects) | ||||
| { | { | ||||
| BKE_collection_object_remove(bmain, id, sc, ob, true); | BKE_collection_object_remove(bmain, id, sc, ob, true); | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | ||||
| te->store_elem->flag &= ~TSE_SELECTED; | te->store_elem->flag &= ~TSE_SELECTED; | ||||
| Show All 11 Lines | static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *Carg) | ||||
| else if (event == OL_COLLECTION_OP_COLLECTION_UNLINK) { | else if (event == OL_COLLECTION_OP_COLLECTION_UNLINK) { | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| if (BLI_findindex(&view_layer->layer_collections, lc) == -1) { | if (BLI_findindex(&view_layer->layer_collections, lc) == -1) { | ||||
| /* we can't unlink if the layer collection wasn't directly linked */ | /* we can't unlink if the layer collection wasn't directly linked */ | ||||
| TODO_LAYER_OPERATORS; /* this shouldn't be in the menu in those cases */ | TODO_LAYER_OPERATORS; /* this shouldn't be in the menu in those cases */ | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_collection_unlink(view_layer, lc); | BKE_collection_unlink(view_layer, lc, bmain); | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(bmain); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | ||||
| } | } | ||||
| } | } | ||||
| else if (event == OL_COLLECTION_OP_COLLECTION_DEL) { | else if (event == OL_COLLECTION_OP_COLLECTION_DEL) { | ||||
| if (BKE_collection_remove(id, sc)) { | if (BKE_collection_remove(id, sc, bmain)) { | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(bmain); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | ||||
| } | } | ||||
| else { | else { | ||||
| /* we can't remove the master collection */ | /* we can't remove the master collection */ | ||||
| TODO_LAYER_OPERATORS; /* this shouldn't be in the menu in those cases */ | TODO_LAYER_OPERATORS; /* this shouldn't be in the menu in those cases */ | ||||
| } | } | ||||
| } | } | ||||
| else if (event == OL_COLLECTION_OP_GROUP_CREATE) { | else if (event == OL_COLLECTION_OP_GROUP_CREATE) { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| BKE_collection_group_create(bmain, scene, lc); | BKE_collection_group_create(bmain, scene, lc); | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| /* TODO(sergey): Use proper flag for tagging here. */ | /* TODO(sergey): Use proper flag for tagging here. */ | ||||
| DEG_id_tag_update(&scene->id, 0); | DEG_id_tag_update(&scene->id, 0); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_assert(!"Collection operation not fully implemented!"); | BLI_assert(!"Collection operation not fully implemented!"); | ||||
| ▲ Show 20 Lines • Show All 1,244 Lines • Show Last 20 Lines | |||||