forked from bartvdbraak/blender
Replace old Timelines and Logic Editors with new Dopesheet (Timeline mode)
Timelines and Logic Editors are gone. So far they were simply replaced by broken Info Editors, now they are replaced by Dopesheets in the new Timeline mode. We reuse ScrArea.butspacetype to temporarily store the space-type identifier of the deprecated editor (see 9db492de6dd07). That way we can identify it in versioning code and replace it nicely. Action editor creation needs a scene to set the scrolling based on frame range. Active screen-layouts use the active scene of the window they are displayed in. Inactive screens simply use the first scene in the main data base. Note that inactive editors don't need version patching, readfile.c converts them to SPACE_EMPTY already, so users can't activate them. Files saved since the editors were removed will still be broken. Workspace config files saved before this will also crash (will update default one in followup commit).
This commit is contained in:
parent
9db492de6d
commit
d8c719d8d8
@ -6402,6 +6402,7 @@ static void direct_link_area(FileData *fd, ScrArea *area)
|
|||||||
/* if we do not have the spacetype registered we cannot
|
/* if we do not have the spacetype registered we cannot
|
||||||
* free it, so don't allocate any new memory for such spacetypes. */
|
* free it, so don't allocate any new memory for such spacetypes. */
|
||||||
if (!BKE_spacetype_exists(area->spacetype)) {
|
if (!BKE_spacetype_exists(area->spacetype)) {
|
||||||
|
area->butspacetype = area->spacetype; /* Hint for versioning code to replace deprecated space types. */
|
||||||
area->spacetype = SPACE_EMPTY;
|
area->spacetype = SPACE_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,31 @@ static void do_version_workspaces_create_from_screens(Main *bmain)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void do_version_area_change_space_to_space_action(ScrArea *area, const Scene *scene)
|
||||||
|
{
|
||||||
|
SpaceType *stype = BKE_spacetype_from_id(SPACE_ACTION);
|
||||||
|
SpaceAction *saction = (SpaceAction *)stype->new(area, scene);
|
||||||
|
ARegion *region_channels;
|
||||||
|
|
||||||
|
/* Properly free current regions */
|
||||||
|
for (ARegion *region = area->regionbase.first; region; region = region->next) {
|
||||||
|
BKE_area_region_free(area->type, region);
|
||||||
|
}
|
||||||
|
BLI_freelistN(&area->regionbase);
|
||||||
|
|
||||||
|
area->type = stype;
|
||||||
|
area->spacetype = stype->spaceid;
|
||||||
|
|
||||||
|
BLI_addhead(&area->spacedata, saction);
|
||||||
|
area->regionbase = saction->regionbase;
|
||||||
|
BLI_listbase_clear(&saction->regionbase);
|
||||||
|
|
||||||
|
/* Different defaults for timeline */
|
||||||
|
region_channels = BKE_area_find_region_type(area, RGN_TYPE_CHANNELS);
|
||||||
|
region_channels->flag |= RGN_FLAG_HIDDEN;
|
||||||
|
saction->mode = SACTCONT_TIMELINE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief After lib-link versioning for new workspace design.
|
* \brief After lib-link versioning for new workspace design.
|
||||||
*
|
*
|
||||||
@ -625,6 +650,40 @@ void do_versions_after_linking_280(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SpaceTime & SpaceLogic removal/replacing */
|
||||||
|
if (!MAIN_VERSION_ATLEAST(main, 280, 9)) {
|
||||||
|
const wmWindowManager *wm = main->wm.first;
|
||||||
|
const Scene *scene = main->scene.first;
|
||||||
|
|
||||||
|
/* Action editors need a scene for creation. First, update active
|
||||||
|
* screens using the active scene of the window they're displayed in.
|
||||||
|
* Next, update remaining screens using first scene in main listbase. */
|
||||||
|
|
||||||
|
for (wmWindow *win = wm->windows.first; win; win = win->next) {
|
||||||
|
const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
|
||||||
|
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
|
||||||
|
if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) {
|
||||||
|
do_version_area_change_space_to_space_action(area, win->scene);
|
||||||
|
|
||||||
|
/* Don't forget to unset! */
|
||||||
|
area->butspacetype = SPACE_EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||||
|
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
|
||||||
|
if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) {
|
||||||
|
/* Areas that were already handled won't be handled again */
|
||||||
|
do_version_area_change_space_to_space_action(area, scene);
|
||||||
|
|
||||||
|
/* Don't forget to unset! */
|
||||||
|
area->butspacetype = SPACE_EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_version_layer_collections_idproperties(ListBase *lb)
|
static void do_version_layer_collections_idproperties(ListBase *lb)
|
||||||
|
@ -253,7 +253,8 @@ typedef struct ScrArea {
|
|||||||
|
|
||||||
char spacetype; /* eSpace_Type (SPACE_FOO) */
|
char spacetype; /* eSpace_Type (SPACE_FOO) */
|
||||||
/* Temporarily used while switching area type, otherwise this should be
|
/* Temporarily used while switching area type, otherwise this should be
|
||||||
* SPACE_EMPTY. It's been there for ages, name doesn't fit any more. */
|
* SPACE_EMPTY. Also, versioning uses it to nicely replace deprecated
|
||||||
|
* editors. It's been there for ages, name doesn't fit any more... */
|
||||||
char butspacetype; /* eSpace_Type (SPACE_FOO) */
|
char butspacetype; /* eSpace_Type (SPACE_FOO) */
|
||||||
|
|
||||||
short winx, winy; /* size */
|
short winx, winy; /* size */
|
||||||
|
Loading…
Reference in New Issue
Block a user