Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| /* SPDX-License-Identifier: GPL-2.0-or-later | /* SPDX-License-Identifier: GPL-2.0-or-later | ||||
| * Copyright 2008 Blender Foundation. All rights reserved. */ | * Copyright 2008 Blender Foundation. All rights reserved. */ | ||||
| /** \file | /** \file | ||||
| * \ingroup edscr | * \ingroup edscr | ||||
| */ | */ | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "DNA_video_edit_types.h" | |||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_linklist_stack.h" | #include "BLI_linklist_stack.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_rand.h" | #include "BLI_rand.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| ▲ Show 20 Lines • Show All 583 Lines • ▼ Show 20 Lines | void ED_region_do_draw(bContext *C, ARegion *region) | ||||
| } | } | ||||
| /* We may want to detach message-subscriptions from drawing. */ | /* We may want to detach message-subscriptions from drawing. */ | ||||
| { | { | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | WorkSpace *workspace = CTX_wm_workspace(C); | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| VideoEdit *video_edit = CTX_data_video_edit(C); | |||||
| struct wmMsgBus *mbus = wm->message_bus; | struct wmMsgBus *mbus = wm->message_bus; | ||||
| WM_msgbus_clear_by_owner(mbus, region); | WM_msgbus_clear_by_owner(mbus, region); | ||||
| /* Cheat, always subscribe to this space type properties. | /* Cheat, always subscribe to this space type properties. | ||||
| * | * | ||||
| * This covers most cases and avoids copy-paste similar code for each space type. | * This covers most cases and avoids copy-paste similar code for each space type. | ||||
| */ | */ | ||||
| if (ELEM( | if (ELEM( | ||||
| Show All 12 Lines | if (ELEM( | ||||
| WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_region_tag_redraw, __func__); | WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_region_tag_redraw, __func__); | ||||
| } | } | ||||
| wmRegionMessageSubscribeParams message_subscribe_params = { | wmRegionMessageSubscribeParams message_subscribe_params = { | ||||
| .context = C, | .context = C, | ||||
| .message_bus = mbus, | .message_bus = mbus, | ||||
| .workspace = workspace, | .workspace = workspace, | ||||
| .scene = scene, | .scene = scene, | ||||
| .video_edit = video_edit, | |||||
| .screen = screen, | .screen = screen, | ||||
| .area = area, | .area = area, | ||||
| .region = region, | .region = region, | ||||
| }; | }; | ||||
| ED_region_message_subscribe(&message_subscribe_params); | ED_region_message_subscribe(&message_subscribe_params); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,343 Lines • ▼ Show 20 Lines | static void area_offscreen_init(ScrArea *area) | ||||
| } | } | ||||
| } | } | ||||
| ScrArea *ED_area_offscreen_create(wmWindow *win, eSpace_Type space_type) | ScrArea *ED_area_offscreen_create(wmWindow *win, eSpace_Type space_type) | ||||
| { | { | ||||
| ScrArea *area = MEM_callocN(sizeof(*area), __func__); | ScrArea *area = MEM_callocN(sizeof(*area), __func__); | ||||
| area->spacetype = space_type; | area->spacetype = space_type; | ||||
| screen_area_spacelink_add(WM_window_get_active_scene(win), area, space_type); | screen_area_spacelink_add(win, area, space_type); | ||||
| area_offscreen_init(area); | area_offscreen_init(area); | ||||
| return area; | return area; | ||||
| } | } | ||||
| static void area_offscreen_exit(wmWindowManager *wm, wmWindow *win, ScrArea *area) | static void area_offscreen_exit(wmWindowManager *wm, wmWindow *win, ScrArea *area) | ||||
| { | { | ||||
| if (area->type && area->type->exit) { | if (area->type && area->type->exit) { | ||||
| ▲ Show 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | if (sl) { | ||||
| /* put in front of list */ | /* put in front of list */ | ||||
| BLI_remlink(&area->spacedata, sl); | BLI_remlink(&area->spacedata, sl); | ||||
| BLI_addhead(&area->spacedata, sl); | BLI_addhead(&area->spacedata, sl); | ||||
| } | } | ||||
| else { | else { | ||||
| /* new space */ | /* new space */ | ||||
| if (st) { | if (st) { | ||||
| /* Don't get scene from context here which may depend on space-data. */ | sl = st->create(win, area); | ||||
| Scene *scene = WM_window_get_active_scene(win); | |||||
| sl = st->create(area, scene); | |||||
| BLI_addhead(&area->spacedata, sl); | BLI_addhead(&area->spacedata, sl); | ||||
| /* swap regions */ | /* swap regions */ | ||||
| if (slold) { | if (slold) { | ||||
| slold->regionbase = area->regionbase; | slold->regionbase = area->regionbase; | ||||
| } | } | ||||
| area->regionbase = sl->regionbase; | area->regionbase = sl->regionbase; | ||||
| BLI_listbase_clear(&sl->regionbase); | BLI_listbase_clear(&sl->regionbase); | ||||
| ▲ Show 20 Lines • Show All 1,372 Lines • Show Last 20 Lines | |||||