Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Show First 20 Lines • Show All 686 Lines • ▼ Show 20 Lines | |||||
| /* quick poll to save operators to be created and handled */ | /* quick poll to save operators to be created and handled */ | ||||
| static bool actionzone_area_poll(bContext *C) | static bool actionzone_area_poll(bContext *C) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| if (screen && win && win->eventstate) { | if (screen && win && win->eventstate) { | ||||
| const int *xy = &win->eventstate->x; | const int *xy = &win->eventstate->x; | ||||
| AZone *az; | |||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| for (az = area->actionzones.first; az; az = az->next) { | LISTBASE_FOREACH (AZone *, az, &area->actionzones) { | ||||
| if (BLI_rcti_isect_pt_v(&az->rect, xy)) { | if (BLI_rcti_isect_pt_v(&az->rect, xy)) { | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,356 Lines • ▼ Show 20 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Jump to Marker Operator | /** \name Jump to Marker Operator | ||||
| * \{ */ | * \{ */ | ||||
| /* function to be called outside UI context, or for redo */ | /* function to be called outside UI context, or for redo */ | ||||
| static int marker_jump_exec(bContext *C, wmOperator *op) | static int marker_jump_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| TimeMarker *marker; | |||||
| int closest = CFRA; | int closest = CFRA; | ||||
| const bool next = RNA_boolean_get(op->ptr, "next"); | const bool next = RNA_boolean_get(op->ptr, "next"); | ||||
| bool found = false; | bool found = false; | ||||
| /* find matching marker in the right direction */ | /* find matching marker in the right direction */ | ||||
| for (marker = scene->markers.first; marker; marker = marker->next) { | LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) { | ||||
| if (next) { | if (next) { | ||||
| if ((marker->frame > CFRA) && (!found || closest > marker->frame)) { | if ((marker->frame > CFRA) && (!found || closest > marker->frame)) { | ||||
| closest = marker->frame; | closest = marker->frame; | ||||
| found = true; | found = true; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if ((marker->frame < CFRA) && (!found || closest < marker->frame)) { | if ((marker->frame < CFRA) && (!found || closest < marker->frame)) { | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
| static int screen_maximize_area_exec(bContext *C, wmOperator *op) | static int screen_maximize_area_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| ScrArea *area = NULL; | ScrArea *area = NULL; | ||||
| const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels"); | const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels"); | ||||
| /* search current screen for 'fullscreen' areas */ | /* search current screen for 'fullscreen' areas */ | ||||
| /* prevents restoring info header, when mouse is over it */ | /* prevents restoring info header, when mouse is over it */ | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) { | ||||
| if (area->full) { | if (area_iter->full) { | ||||
| area = area_iter; | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (area == NULL) { | if (area == NULL) { | ||||
| area = CTX_wm_area(C); | area = CTX_wm_area(C); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Space Data Cleanup Operator | /** \name Space Data Cleanup Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int spacedata_cleanup_exec(bContext *C, wmOperator *op) | static int spacedata_cleanup_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| bScreen *screen; | |||||
| ScrArea *area; | |||||
| int tot = 0; | int tot = 0; | ||||
| for (screen = bmain->screens.first; screen; screen = screen->id.next) { | LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| if (area->spacedata.first != area->spacedata.last) { | if (area->spacedata.first != area->spacedata.last) { | ||||
| SpaceLink *sl = area->spacedata.first; | SpaceLink *sl = area->spacedata.first; | ||||
| BLI_remlink(&area->spacedata, sl); | BLI_remlink(&area->spacedata, sl); | ||||
| tot += BLI_listbase_count(&area->spacedata); | tot += BLI_listbase_count(&area->spacedata); | ||||
| BKE_spacedata_freelist(&area->spacedata); | BKE_spacedata_freelist(&area->spacedata); | ||||
| BLI_addtail(&area->spacedata, sl); | BLI_addtail(&area->spacedata, sl); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | else if (region->alignment == RGN_ALIGN_QSPLIT) { | ||||
| /* Exit quad-view */ | /* Exit quad-view */ | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| ARegion *arn; | ARegion *arn; | ||||
| /* keep current region */ | /* keep current region */ | ||||
| region->alignment = 0; | region->alignment = 0; | ||||
| if (area->spacetype == SPACE_VIEW3D) { | if (area->spacetype == SPACE_VIEW3D) { | ||||
| ARegion *region_iter; | |||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = region->regiondata; | ||||
| /* if this is a locked view, use settings from 'User' view */ | /* if this is a locked view, use settings from 'User' view */ | ||||
| if (rv3d->viewlock) { | if (rv3d->viewlock) { | ||||
| View3D *v3d_user; | View3D *v3d_user; | ||||
| ARegion *region_user; | ARegion *region_user; | ||||
| if (ED_view3d_context_user_region(C, &v3d_user, ®ion_user)) { | if (ED_view3d_context_user_region(C, &v3d_user, ®ion_user)) { | ||||
| if (region != region_user) { | if (region != region_user) { | ||||
| SWAP(void *, region->regiondata, region_user->regiondata); | SWAP(void *, region->regiondata, region_user->regiondata); | ||||
| rv3d = region->regiondata; | rv3d = region->regiondata; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| rv3d->viewlock_quad = RV3D_VIEWLOCK_INIT; | rv3d->viewlock_quad = RV3D_VIEWLOCK_INIT; | ||||
| rv3d->viewlock = 0; | rv3d->viewlock = 0; | ||||
| /* FIXME: This fixes missing update to workbench TAA. (see T76216) | /* FIXME: This fixes missing update to workbench TAA. (see T76216) | ||||
| * However, it would be nice if the tagging should be done in a more conventional way. */ | * However, it would be nice if the tagging should be done in a more conventional way. */ | ||||
| rv3d->rflag |= RV3D_GPULIGHT_UPDATE; | rv3d->rflag |= RV3D_GPULIGHT_UPDATE; | ||||
| /* Accumulate locks, in case they're mixed. */ | /* Accumulate locks, in case they're mixed. */ | ||||
| for (region_iter = area->regionbase.first; region_iter; region_iter = region_iter->next) { | LISTBASE_FOREACH (ARegion *, region_iter, &area->regionbase) { | ||||
| if (region_iter->regiontype == RGN_TYPE_WINDOW) { | if (region_iter->regiontype == RGN_TYPE_WINDOW) { | ||||
| RegionView3D *rv3d_iter = region_iter->regiondata; | RegionView3D *rv3d_iter = region_iter->regiondata; | ||||
| rv3d->viewlock_quad |= rv3d_iter->viewlock; | rv3d->viewlock_quad |= rv3d_iter->viewlock; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| for (region = area->regionbase.first; region; region = arn) { | for (region = area->regionbase.first; region; region = arn) { | ||||
| ▲ Show 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | if (screen->animtimer && screen->animtimer == event->customdata) { | ||||
| 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 = WM_window_get_active_view_layer(win); | ViewLayer *view_layer = WM_window_get_active_view_layer(win); | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false); | ||||
| Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL; | Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL; | ||||
| wmTimer *wt = screen->animtimer; | wmTimer *wt = screen->animtimer; | ||||
| ScreenAnimData *sad = wt->customdata; | ScreenAnimData *sad = wt->customdata; | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmWindow *window; | |||||
| ScrArea *area; | |||||
| int sync; | int sync; | ||||
| double time; | double time; | ||||
| /* sync, don't sync, or follow scene setting */ | /* sync, don't sync, or follow scene setting */ | ||||
| if (sad->flag & ANIMPLAY_FLAG_SYNC) { | if (sad->flag & ANIMPLAY_FLAG_SYNC) { | ||||
| sync = 1; | sync = 1; | ||||
| } | } | ||||
| else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) { | else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) { | ||||
| ▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| } | } | ||||
| /* since we follow drawflags, we can't send notifier but tag regions ourselves */ | /* since we follow drawflags, we can't send notifier but tag regions ourselves */ | ||||
| if (depsgraph != NULL) { | if (depsgraph != NULL) { | ||||
| ED_update_for_newframe(bmain, depsgraph); | ED_update_for_newframe(bmain, depsgraph); | ||||
| } | } | ||||
| for (window = wm->windows.first; window; window = window->next) { | LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { | ||||
| const bScreen *win_screen = WM_window_get_active_screen(window); | const bScreen *win_screen = WM_window_get_active_screen(window); | ||||
| for (area = win_screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &win_screen->areabase) { | ||||
| ARegion *region; | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| for (region = area->regionbase.first; region; region = region->next) { | |||||
| bool redraw = false; | bool redraw = false; | ||||
| if (region == sad->region) { | if (region == sad->region) { | ||||
| redraw = true; | redraw = true; | ||||
| } | } | ||||
| else if (match_region_with_redraws( | else if (match_region_with_redraws( | ||||
| area, region->regiontype, sad->redraws, sad->from_anim_edit)) { | area, region->regiontype, sad->redraws, sad->from_anim_edit)) { | ||||
| redraw = true; | redraw = true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | |||||
| * \{ */ | * \{ */ | ||||
| static int fullscreen_back_exec(bContext *C, wmOperator *op) | static int fullscreen_back_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| ScrArea *area = NULL; | ScrArea *area = NULL; | ||||
| /* search current screen for 'fullscreen' areas */ | /* search current screen for 'fullscreen' areas */ | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) { | ||||
| if (area->full) { | if (area->full) { | ||||
| area = area_iter; | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (!area) { | if (!area) { | ||||
| BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found"); | BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 755 Lines • Show Last 20 Lines | |||||