Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | ||||
| if (id->flag & LIB_FAKEUSER) { | if (id->flag & LIB_FAKEUSER) { | ||||
| id_us_plus(id); | id_us_plus(id); | ||||
| } | } | ||||
| else { | else { | ||||
| id_us_min(id); | id_us_min(id); | ||||
| } | } | ||||
| } | } | ||||
| static int base_pushed_state_cb(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | |||||
| { | |||||
| Base *base = poin; | |||||
| Object *ob = base->object; | |||||
| const bool is_visible = ((base->flag & BASE_HIDDEN) == 0) && | |||||
| ((ob->restrictflag & OB_RESTRICT_VIEW) == 0); | |||||
| return !is_visible; | |||||
| } | |||||
| static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2) | static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = poin; | ViewLayer *view_layer = poin; | ||||
| Base *base = poin2; | Base *base = poin2; | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2) | ||||
| if (!do_disable) { | if (!do_disable) { | ||||
| BKE_layer_collection_sync(scene, view_layer); | BKE_layer_collection_sync(scene, view_layer); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); | DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| } | } | ||||
| } | } | ||||
| static int layer_collection_pushed_state_cb(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | |||||
| { | |||||
| LayerCollection *lc = poin; | |||||
| Collection *collection = lc->collection; | |||||
| const bool is_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) == 0) && | |||||
| ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0); | |||||
| return !is_visible; | |||||
| } | |||||
| static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2) | static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = poin; | ViewLayer *view_layer = poin; | ||||
| LayerCollection *lc = poin2; | LayerCollection *lc = poin2; | ||||
| Collection *collection = lc->collection; | Collection *collection = lc->collection; | ||||
| bool do_disable = (win->eventstate->alt != 0); | bool do_disable = (win->eventstate->alt != 0); | ||||
| ▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| bt = uiDefIconBut( | bt = uiDefIconBut( | ||||
| block, UI_BTYPE_ICON_TOGGLE, 0, icon, | block, UI_BTYPE_ICON_TOGGLE, 0, icon, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0, 0, 0, 0, | NULL, 0, 0, 0, 0, | ||||
| TIP_("Hide object in viewport\n" | TIP_("Hide object in viewport\n" | ||||
| "* Alt to disable for all viewports\n" | "* Alt to disable for all viewports\n" | ||||
| "* Ctrl to isolate visibility")); | "* Ctrl to isolate visibility")); | ||||
| UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base); | UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base); | ||||
| UI_but_func_pushed_state_set(bt, base_pushed_state_cb, base); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| else { | else { | ||||
| bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0, | bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL); | &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| block, UI_BTYPE_TOGGLE, 0, icon, | block, UI_BTYPE_TOGGLE, 0, icon, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0, 0, 0, 0, | NULL, 0, 0, 0, 0, | ||||
| TIP_("Hide collection in viewport\n" | TIP_("Hide collection in viewport\n" | ||||
| "* Alt to disable for all viewports\n" | "* Alt to disable for all viewports\n" | ||||
| "* Ctrl to isolate visibility\n" | "* Ctrl to isolate visibility\n" | ||||
| "* Shift to hide inside objects and collections")); | "* Shift to hide inside objects and collections")); | ||||
| UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc); | UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc); | ||||
| UI_but_func_pushed_state_set(bt, layer_collection_pushed_state_cb, lc); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| else { | else { | ||||
| bt = uiDefIconButR_prop( | bt = uiDefIconButR_prop( | ||||
| block, UI_BTYPE_ICON_TOGGLE, 0, 0, | block, UI_BTYPE_ICON_TOGGLE, 0, 0, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL); | UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| ▲ Show 20 Lines • Show All 1,581 Lines • Show Last 20 Lines | |||||