Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 2,565 Lines • ▼ Show 20 Lines | else { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return data; | return data; | ||||
| } | } | ||||
| static void exclude_children(LayerCollection *layer_collection) | |||||
| { | |||||
| LISTBASE_FOREACH (LayerCollection *, child, &layer_collection->layer_collections) { | |||||
| child->flag |= LAYER_COLLECTION_EXCLUDE; | |||||
| exclude_children(child); | |||||
| } | |||||
| } | |||||
| static void include_children(LayerCollection *layer_collection) | |||||
| { | |||||
| LISTBASE_FOREACH (LayerCollection *, child, &layer_collection->layer_collections) { | |||||
| child->flag &= ~LAYER_COLLECTION_EXCLUDE; | |||||
| include_children(child); | |||||
| } | |||||
| } | |||||
| static void include_parents(LayerCollection *top_layer_collection, LayerCollection *layer) | |||||
| { | |||||
| LayerCollection *parent_layer = top_layer_collection; | |||||
| while (parent_layer != layer) { | |||||
| parent_layer->flag &= ~LAYER_COLLECTION_EXCLUDE; | |||||
| LISTBASE_FOREACH (LayerCollection *, child, &parent_layer->layer_collections) { | |||||
| if (BKE_layer_collection_has_layer_collection(child, layer)) { | |||||
| parent_layer = child; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| static void view_layer__layer_collection_set_exclude_recursive_cb(bContext *C, | |||||
| void *poin, | |||||
| void *UNUSED(poin2)) | |||||
| { | |||||
| LayerCollection *layer = poin; | |||||
| wmWindow *win = CTX_wm_window(C); | |||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | |||||
| LayerCollection *top_layer_collection = view_layer->layer_collections.first; | |||||
| bool do_isolate = win->eventstate->ctrl != 0; | |||||
| if (!do_isolate) { | |||||
| return; | |||||
| } | |||||
| exclude_children(top_layer_collection); | |||||
| include_children(layer); | |||||
| include_parents(top_layer_collection, layer); | |||||
| layer->flag &= ~LAYER_COLLECTION_EXCLUDE; | |||||
| Main *bmain = CTX_data_main(C); | |||||
| BKE_main_collection_sync_remap(bmain); | |||||
| DEG_relations_tag_update(bmain); | |||||
| } | |||||
| static void tselem_draw_layer_collection_enable_icon( | static void tselem_draw_layer_collection_enable_icon( | ||||
| Scene *scene, uiBlock *block, int xmax, float x, float y, TreeElement *te, float alpha) | Scene *scene, uiBlock *block, int xmax, float x, float y, TreeElement *te, float alpha) | ||||
| { | { | ||||
| /* Get RNA property (once for speed). */ | /* Get RNA property (once for speed). */ | ||||
| static PropertyRNA *exclude_prop = NULL; | static PropertyRNA *exclude_prop = NULL; | ||||
| if (exclude_prop == NULL) { | if (exclude_prop == NULL) { | ||||
| exclude_prop = RNA_struct_type_find_property(&RNA_LayerCollection, "exclude"); | exclude_prop = RNA_struct_type_find_property(&RNA_LayerCollection, "exclude"); | ||||
| } | } | ||||
| Show All 33 Lines | uiBut *bt = uiDefIconButR_prop(block, | ||||
| &layer_collection_ptr, | &layer_collection_ptr, | ||||
| exclude_prop, | exclude_prop, | ||||
| -1, | -1, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| NULL); | NULL); | ||||
| UI_but_func_set( | |||||
| bt, view_layer__layer_collection_set_exclude_recursive_cb, layer_collection, NULL); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| UI_block_emboss_set(block, emboss); | UI_block_emboss_set(block, emboss); | ||||
| } | } | ||||
| } | } | ||||
| static void tselem_draw_icon(uiBlock *block, | static void tselem_draw_icon(uiBlock *block, | ||||
| int xmax, | int xmax, | ||||
| float x, | float x, | ||||
| ▲ Show 20 Lines • Show All 1,071 Lines • Show Last 20 Lines | |||||