Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_edit.c
| Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | bScreen *screen_add(Main *bmain, const char *name, const rcti *rect) | ||||
| /* dummy type, no spacedata */ | /* dummy type, no spacedata */ | ||||
| screen_addarea(screen, sv1, sv2, sv3, sv4, SPACE_EMPTY); | screen_addarea(screen, sv1, sv2, sv3, sv4, SPACE_EMPTY); | ||||
| return screen; | return screen; | ||||
| } | } | ||||
| void screen_data_copy(bScreen *to, bScreen *from) | void screen_data_copy(bScreen *to, bScreen *from) | ||||
| { | { | ||||
| ScrVert *s1, *s2; | ScrVert *s2; | ||||
| ScrEdge *se; | |||||
| ScrArea *area, *saf; | ScrArea *area, *saf; | ||||
| /* free contents of 'to', is from blenkernel screen.c */ | /* free contents of 'to', is from blenkernel screen.c */ | ||||
| BKE_screen_free(to); | BKE_screen_free(to); | ||||
| to->flag = from->flag; | to->flag = from->flag; | ||||
| BLI_duplicatelist(&to->vertbase, &from->vertbase); | BLI_duplicatelist(&to->vertbase, &from->vertbase); | ||||
| BLI_duplicatelist(&to->edgebase, &from->edgebase); | BLI_duplicatelist(&to->edgebase, &from->edgebase); | ||||
| BLI_duplicatelist(&to->areabase, &from->areabase); | BLI_duplicatelist(&to->areabase, &from->areabase); | ||||
| BLI_listbase_clear(&to->regionbase); | BLI_listbase_clear(&to->regionbase); | ||||
| s2 = to->vertbase.first; | s2 = to->vertbase.first; | ||||
| for (s1 = from->vertbase.first; s1; s1 = s1->next, s2 = s2->next) { | LISTBASE_FOREACH (ScrVert *, s1, &from->vertbase) { | ||||
| s1->newv = s2; | s1->newv = s2; | ||||
| } | } | ||||
| for (se = to->edgebase.first; se; se = se->next) { | LISTBASE_FOREACH (ScrEdge *, se, &to->edgebase) { | ||||
| se->v1 = se->v1->newv; | se->v1 = se->v1->newv; | ||||
| se->v2 = se->v2->newv; | se->v2 = se->v2->newv; | ||||
| BKE_screen_sort_scrvert(&(se->v1), &(se->v2)); | BKE_screen_sort_scrvert(&(se->v1), &(se->v2)); | ||||
| } | } | ||||
| saf = from->areabase.first; | saf = from->areabase.first; | ||||
| for (area = to->areabase.first; area; area = area->next, saf = saf->next) { | for (area = to->areabase.first; area; area = area->next, saf = saf->next) { | ||||
| area->v1 = area->v1->newv; | area->v1 = area->v1->newv; | ||||
| area->v2 = area->v2->newv; | area->v2 = area->v2->newv; | ||||
| area->v3 = area->v3->newv; | area->v3 = area->v3->newv; | ||||
| area->v4 = area->v4->newv; | area->v4 = area->v4->newv; | ||||
| BLI_listbase_clear(&area->spacedata); | BLI_listbase_clear(&area->spacedata); | ||||
| BLI_listbase_clear(&area->regionbase); | BLI_listbase_clear(&area->regionbase); | ||||
| BLI_listbase_clear(&area->actionzones); | BLI_listbase_clear(&area->actionzones); | ||||
| BLI_listbase_clear(&area->handlers); | BLI_listbase_clear(&area->handlers); | ||||
| ED_area_data_copy(area, saf, true); | ED_area_data_copy(area, saf, true); | ||||
| } | } | ||||
| /* put at zero (needed?) */ | /* put at zero (needed?) */ | ||||
| for (s1 = from->vertbase.first; s1; s1 = s1->next) { | LISTBASE_FOREACH (ScrVert *, s1, &from->vertbase) { | ||||
| s1->newv = NULL; | s1->newv = NULL; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Prepare a newly created screen for initializing it as active screen. | * Prepare a newly created screen for initializing it as active screen. | ||||
| */ | */ | ||||
| void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new) | void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new) | ||||
| ▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) | ||||
| screen->winid = win->winid; | screen->winid = win->winid; | ||||
| screen->context = ed_screen_context; | screen->context = ed_screen_context; | ||||
| } | } | ||||
| /* file read, set all screens, ... */ | /* file read, set all screens, ... */ | ||||
| void ED_screens_init(Main *bmain, wmWindowManager *wm) | void ED_screens_init(Main *bmain, wmWindowManager *wm) | ||||
| { | { | ||||
| wmWindow *win; | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| for (win = wm->windows.first; win; win = win->next) { | |||||
| if (BKE_workspace_active_get(win->workspace_hook) == NULL) { | if (BKE_workspace_active_get(win->workspace_hook) == NULL) { | ||||
| BKE_workspace_active_set(win->workspace_hook, bmain->workspaces.first); | BKE_workspace_active_set(win->workspace_hook, bmain->workspaces.first); | ||||
| } | } | ||||
| ED_screen_refresh(wm, win); | ED_screen_refresh(wm, win); | ||||
| if (win->eventstate) { | if (win->eventstate) { | ||||
| ED_screen_set_active_region(NULL, win, &win->eventstate->x); | ED_screen_set_active_region(NULL, win, &win->eventstate->x); | ||||
| } | } | ||||
| } | } | ||||
| if (U.uiflag & USER_HEADER_FROM_PREF) { | if (U.uiflag & USER_HEADER_FROM_PREF) { | ||||
| for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { | LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { | ||||
| BKE_screen_header_alignment_reset(screen); | BKE_screen_header_alignment_reset(screen); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *screen) | void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *screen) | ||||
| { | { | ||||
| if (screen->do_refresh) { | if (screen->do_refresh) { | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | void ED_region_exit(bContext *C, ARegion *region) | ||||
| CTX_wm_region_set(C, prevar); | CTX_wm_region_set(C, prevar); | ||||
| } | } | ||||
| void ED_area_exit(bContext *C, ScrArea *area) | void ED_area_exit(bContext *C, ScrArea *area) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| ScrArea *prevsa = CTX_wm_area(C); | ScrArea *prevsa = CTX_wm_area(C); | ||||
| ARegion *region; | |||||
| if (area->type && area->type->exit) { | if (area->type && area->type->exit) { | ||||
| area->type->exit(wm, area); | area->type->exit(wm, area); | ||||
| } | } | ||||
| CTX_wm_area_set(C, area); | CTX_wm_area_set(C, area); | ||||
| for (region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| ED_region_exit(C, region); | ED_region_exit(C, region); | ||||
| } | } | ||||
| WM_event_remove_handlers(C, &area->handlers); | WM_event_remove_handlers(C, &area->handlers); | ||||
| WM_event_modal_handler_area_replace(win, area, NULL); | WM_event_modal_handler_area_replace(win, area, NULL); | ||||
| CTX_wm_area_set(C, prevsa); | CTX_wm_area_set(C, prevsa); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| /* *********************************** */ | /* *********************************** */ | ||||
| /* case when on area-edge or in azones, or outside window */ | /* case when on area-edge or in azones, or outside window */ | ||||
| static void screen_cursor_set(wmWindow *win, const int xy[2]) | static void screen_cursor_set(wmWindow *win, const int xy[2]) | ||||
| { | { | ||||
| const bScreen *screen = WM_window_get_active_screen(win); | const bScreen *screen = WM_window_get_active_screen(win); | ||||
| AZone *az = NULL; | AZone *az = NULL; | ||||
| ScrArea *area; | ScrArea *area = NULL; | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) { | ||||
| if ((az = ED_area_actionzone_find_xy(area, xy))) { | if ((az = ED_area_actionzone_find_xy(area, xy))) { | ||||
| area = area_iter; | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (area) { | if (area) { | ||||
| if (az->type == AZONE_AREA) { | if (az->type == AZONE_AREA) { | ||||
| WM_cursor_set(win, WM_CURSOR_EDIT); | WM_cursor_set(win, WM_CURSOR_EDIT); | ||||
| } | } | ||||
| Show All 30 Lines | |||||
| void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) | void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) | ||||
| { | { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| if (screen == NULL) { | if (screen == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| ScrArea *area = NULL; | ScrArea *area = NULL; | ||||
| ARegion *region; | |||||
| ARegion *region_prev = screen->active_region; | ARegion *region_prev = screen->active_region; | ||||
| ED_screen_areas_iter (win, screen, area_iter) { | ED_screen_areas_iter (win, screen, area_iter) { | ||||
| if (xy[0] > (area_iter->totrct.xmin + BORDERPADDING) && | if (xy[0] > (area_iter->totrct.xmin + BORDERPADDING) && | ||||
| xy[0] < (area_iter->totrct.xmax - BORDERPADDING)) { | xy[0] < (area_iter->totrct.xmax - BORDERPADDING)) { | ||||
| if (xy[1] > (area_iter->totrct.ymin + BORDERPADDING) && | if (xy[1] > (area_iter->totrct.ymin + BORDERPADDING) && | ||||
| xy[1] < (area_iter->totrct.ymax - BORDERPADDING)) { | xy[1] < (area_iter->totrct.ymax - BORDERPADDING)) { | ||||
| if (ED_area_azones_update(area_iter, xy) == NULL) { | if (ED_area_azones_update(area_iter, xy) == NULL) { | ||||
| area = area_iter; | area = area_iter; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (area) { | if (area) { | ||||
| /* Make overlap active when mouse over. */ | /* Make overlap active when mouse over. */ | ||||
| for (region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (ED_region_contains_xy(region, xy)) { | if (ED_region_contains_xy(region, xy)) { | ||||
| screen->active_region = region; | screen->active_region = region; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| screen->active_region = NULL; | screen->active_region = NULL; | ||||
| } | } | ||||
| /* Check for redraw headers. */ | /* Check for redraw headers. */ | ||||
| if (region_prev != screen->active_region) { | if (region_prev != screen->active_region) { | ||||
| ED_screen_areas_iter (win, screen, area_iter) { | ED_screen_areas_iter (win, screen, area_iter) { | ||||
| bool do_draw = false; | bool do_draw = false; | ||||
| for (region = area_iter->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area_iter->regionbase) { | ||||
| /* Call old area's deactivate if assigned. */ | /* Call old area's deactivate if assigned. */ | ||||
| if (region == region_prev && area_iter->type->deactivate) { | if (region == region_prev && area_iter->type->deactivate) { | ||||
| area_iter->type->deactivate(area_iter); | area_iter->type->deactivate(area_iter); | ||||
| } | } | ||||
| if (region == region_prev && region != screen->active_region) { | if (region == region_prev && region != screen->active_region) { | ||||
| wmGizmoMap *gzmap = region_prev->gizmo_map; | wmGizmoMap *gzmap = region_prev->gizmo_map; | ||||
| if (gzmap) { | if (gzmap) { | ||||
| if (WM_gizmo_highlight_set(gzmap, NULL)) { | if (WM_gizmo_highlight_set(gzmap, NULL)) { | ||||
| ED_region_tag_redraw_no_rebuild(region_prev); | ED_region_tag_redraw_no_rebuild(region_prev); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (region == region_prev || region == screen->active_region) { | if (region == region_prev || region == screen->active_region) { | ||||
| do_draw = true; | do_draw = true; | ||||
| } | } | ||||
| } | } | ||||
| if (do_draw) { | if (do_draw) { | ||||
| for (region = area_iter->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area_iter->regionbase) { | ||||
| if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { | if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { | ||||
| ED_region_tag_redraw_no_rebuild(region); | ED_region_tag_redraw_no_rebuild(region); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 20 Lines | |||||
| int ED_screen_area_active(const bContext *C) | int ED_screen_area_active(const bContext *C) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| if (win && screen && area) { | if (win && screen && area) { | ||||
| AZone *az = ED_area_actionzone_find_xy(area, &win->eventstate->x); | AZone *az = ED_area_actionzone_find_xy(area, &win->eventstate->x); | ||||
| ARegion *region; | |||||
| if (az && az->type == AZONE_REGION) { | if (az && az->type == AZONE_REGION) { | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| for (region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region == screen->active_region) { | if (region == screen->active_region) { | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| Show All 34 Lines | static void screen_global_area_refresh(wmWindow *win, | ||||
| bScreen *screen, | bScreen *screen, | ||||
| eSpace_Type space_type, | eSpace_Type space_type, | ||||
| GlobalAreaAlign align, | GlobalAreaAlign align, | ||||
| const rcti *rect, | const rcti *rect, | ||||
| const short height_cur, | const short height_cur, | ||||
| const short height_min, | const short height_min, | ||||
| const short height_max) | const short height_max) | ||||
| { | { | ||||
| ScrArea *area; | ScrArea *area = NULL; | ||||
| LISTBASE_FOREACH (ScrArea *, area_iter, &win->global_areas.areabase) { | |||||
| for (area = win->global_areas.areabase.first; area; area = area->next) { | |||||
| if (area->spacetype == space_type) { | if (area->spacetype == space_type) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (area) { | if (area) { | ||||
| screen_area_set_geometry_rect(area, rect); | screen_area_set_geometry_rect(area, rect); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* fix any cameras that are used in the 3d view but not in the scene */ | /* fix any cameras that are used in the 3d view but not in the scene */ | ||||
| BKE_screen_view3d_sync(v3d, scene); | BKE_screen_view3d_sync(v3d, scene); | ||||
| if (!v3d->camera || !BKE_view_layer_base_find(view_layer, v3d->camera)) { | if (!v3d->camera || !BKE_view_layer_base_find(view_layer, v3d->camera)) { | ||||
| v3d->camera = BKE_view_layer_camera_find(view_layer); | v3d->camera = BKE_view_layer_camera_find(view_layer); | ||||
| // XXX if (screen == curscreen) handle_view3d_lock(); | // XXX if (screen == curscreen) handle_view3d_lock(); | ||||
| if (!v3d->camera) { | if (!v3d->camera) { | ||||
| ARegion *region; | |||||
| ListBase *regionbase; | ListBase *regionbase; | ||||
| /* regionbase is in different place depending if space is active */ | /* regionbase is in different place depending if space is active */ | ||||
| if (v3d == area->spacedata.first) { | if (v3d == area->spacedata.first) { | ||||
| regionbase = &area->regionbase; | regionbase = &area->regionbase; | ||||
| } | } | ||||
| else { | else { | ||||
| regionbase = &v3d->regionbase; | regionbase = &v3d->regionbase; | ||||
| } | } | ||||
| for (region = regionbase->first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, regionbase) { | ||||
| if (region->regiontype == RGN_TYPE_WINDOW) { | if (region->regiontype == RGN_TYPE_WINDOW) { | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = region->regiondata; | ||||
| if (rv3d->persp == RV3D_CAMOB) { | if (rv3d->persp == RV3D_CAMOB) { | ||||
| rv3d->persp = RV3D_PERSP; | rv3d->persp = RV3D_PERSP; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
| * \warning \a area may be freed. | * \warning \a area may be freed. | ||||
| */ | */ | ||||
| ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const short state) | ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const short state) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| WorkSpace *workspace = WM_window_get_active_workspace(win); | WorkSpace *workspace = WM_window_get_active_workspace(win); | ||||
| bScreen *screen, *oldscreen; | bScreen *screen, *oldscreen; | ||||
| ARegion *region; | |||||
| if (area) { | if (area) { | ||||
| /* ensure we don't have a button active anymore, can crash when | /* ensure we don't have a button active anymore, can crash when | ||||
| * switching screens with tooltip open because region and tooltip | * switching screens with tooltip open because region and tooltip | ||||
| * are no longer in the same screen */ | * are no longer in the same screen */ | ||||
| for (region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| UI_blocklist_free(C, ®ion->uiblocks); | UI_blocklist_free(C, ®ion->uiblocks); | ||||
| if (region->regiontimer) { | if (region->regiontimer) { | ||||
| WM_event_remove_timer(wm, NULL, region->regiontimer); | WM_event_remove_timer(wm, NULL, region->regiontimer); | ||||
| region->regiontimer = NULL; | region->regiontimer = NULL; | ||||
| } | } | ||||
| } | } | ||||
| Show All 36 Lines | if (area && area->full) { | ||||
| } | } | ||||
| if (state == SCREENFULL) { | if (state == SCREENFULL) { | ||||
| /* unhide global areas */ | /* unhide global areas */ | ||||
| LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | ||||
| glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN; | glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN; | ||||
| } | } | ||||
| /* restore the old side panels/header visibility */ | /* restore the old side panels/header visibility */ | ||||
| for (region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| region->flag = region->flagfullscreen; | region->flag = region->flagfullscreen; | ||||
| } | } | ||||
| } | } | ||||
| ED_area_data_swap(fullsa, area); | ED_area_data_swap(fullsa, area); | ||||
| /* animtimer back */ | /* animtimer back */ | ||||
| screen->animtimer = oldscreen->animtimer; | screen->animtimer = oldscreen->animtimer; | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | else { | ||||
| newa->flag = area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ | newa->flag = area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */ | ||||
| if (state == SCREENFULL) { | if (state == SCREENFULL) { | ||||
| /* temporarily hide global areas */ | /* temporarily hide global areas */ | ||||
| LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) { | ||||
| glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN; | glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN; | ||||
| } | } | ||||
| /* temporarily hide the side panels/header */ | /* temporarily hide the side panels/header */ | ||||
| for (region = newa->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &newa->regionbase) { | ||||
| region->flagfullscreen = region->flag; | region->flagfullscreen = region->flag; | ||||
| if (ELEM(region->regiontype, | if (ELEM(region->regiontype, | ||||
| RGN_TYPE_UI, | RGN_TYPE_UI, | ||||
| RGN_TYPE_HEADER, | RGN_TYPE_HEADER, | ||||
| RGN_TYPE_TOOL_HEADER, | RGN_TYPE_TOOL_HEADER, | ||||
| RGN_TYPE_FOOTER, | RGN_TYPE_FOOTER, | ||||
| RGN_TYPE_TOOLS, | RGN_TYPE_TOOLS, | ||||
| ▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) | ||||
| /* notifier catched by top header, for button */ | /* notifier catched by top header, for button */ | ||||
| WM_event_add_notifier(C, NC_SCREEN | ND_ANIMPLAY, NULL); | WM_event_add_notifier(C, NC_SCREEN | ND_ANIMPLAY, NULL); | ||||
| } | } | ||||
| /* helper for screen_animation_play() - only to be used for TimeLine */ | /* helper for screen_animation_play() - only to be used for TimeLine */ | ||||
| static ARegion *time_top_left_3dwindow(bScreen *screen) | static ARegion *time_top_left_3dwindow(bScreen *screen) | ||||
| { | { | ||||
| ARegion *aret = NULL; | ARegion *aret = NULL; | ||||
| ScrArea *area; | |||||
| int min = 10000; | int min = 10000; | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| if (area->spacetype == SPACE_VIEW3D) { | if (area->spacetype == SPACE_VIEW3D) { | ||||
| ARegion *region; | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| for (region = area->regionbase.first; region; region = region->next) { | |||||
| if (region->regiontype == RGN_TYPE_WINDOW) { | if (region->regiontype == RGN_TYPE_WINDOW) { | ||||
| if (region->winrct.xmin - region->winrct.ymin < min) { | if (region->winrct.xmin - region->winrct.ymin < min) { | ||||
| aret = region; | aret = region; | ||||
| min = region->winrct.xmin - region->winrct.ymin; | min = region->winrct.xmin - region->winrct.ymin; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 21 Lines | |||||
| { | { | ||||
| Scene *scene = DEG_get_input_scene(depsgraph); | Scene *scene = DEG_get_input_scene(depsgraph); | ||||
| DEG_id_tag_update_ex(bmain, &scene->id, ID_RECALC_TIME); | DEG_id_tag_update_ex(bmain, &scene->id, ID_RECALC_TIME); | ||||
| #ifdef DURIAN_CAMERA_SWITCH | #ifdef DURIAN_CAMERA_SWITCH | ||||
| void *camera = BKE_scene_camera_switch_find(scene); | void *camera = BKE_scene_camera_switch_find(scene); | ||||
| if (camera && scene->camera != camera) { | if (camera && scene->camera != camera) { | ||||
| bScreen *screen; | |||||
| scene->camera = camera; | scene->camera = camera; | ||||
| /* are there cameras in the views that are not in the scene? */ | /* are there cameras in the views that are not in the scene? */ | ||||
| for (screen = bmain->screens.first; screen; screen = screen->id.next) { | LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { | ||||
| BKE_screen_view3d_scene_sync(screen, scene); | BKE_screen_view3d_scene_sync(screen, scene); | ||||
| } | } | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); | DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); | ||||
| } | } | ||||
| #endif | #endif | ||||
| ED_clip_update_frame(bmain, scene->r.cfra); | ED_clip_update_frame(bmain, scene->r.cfra); | ||||
| /* this function applies the changes too */ | /* this function applies the changes too */ | ||||
| BKE_scene_graph_update_for_newframe(depsgraph); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| } | } | ||||
| /* | /* | ||||
| * return true if any active area requires to see in 3D | * return true if any active area requires to see in 3D | ||||
| */ | */ | ||||
| bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) | bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) | ||||
| { | { | ||||
| ScrArea *area; | |||||
| const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; | const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; | ||||
| for (area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| switch (area->spacetype) { | switch (area->spacetype) { | ||||
| case SPACE_VIEW3D: { | case SPACE_VIEW3D: { | ||||
| View3D *v3d; | View3D *v3d; | ||||
| if (!is_multiview) { | if (!is_multiview) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| v3d = area->spacedata.first; | v3d = area->spacedata.first; | ||||
| if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) { | if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) { | ||||
| ARegion *region; | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| for (region = area->regionbase.first; region; region = region->next) { | |||||
| if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) { | if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) { | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = region->regiondata; | ||||
| if (rv3d->persp == RV3D_CAMOB) { | if (rv3d->persp == RV3D_CAMOB) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines | |||||