Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_300.c
| Show First 20 Lines • Show All 589 Lines • ▼ Show 20 Lines | static bNodeTree *add_realize_node_tree(Main *bmain) | ||||
| LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) { | LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) { | ||||
| nodeSetSelected(node, false); | nodeSetSelected(node, false); | ||||
| } | } | ||||
| version_socket_update_is_used(node_tree); | version_socket_update_is_used(node_tree); | ||||
| return node_tree; | return node_tree; | ||||
| } | } | ||||
| void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) | void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) | ||||
| { | { | ||||
| if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) { | if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) { | ||||
| /* Set zero user text objects to have a fake user. */ | /* Set zero user text objects to have a fake user. */ | ||||
| LISTBASE_FOREACH (Text *, text, &bmain->texts) { | LISTBASE_FOREACH (Text *, text, &bmain->texts) { | ||||
| if (text->id.us == 0) { | if (text->id.us == 0) { | ||||
| id_fake_user_set(&text->id); | id_fake_user_set(&text->id); | ||||
| } | } | ||||
| } | } | ||||
campbellbarton: Since this is generally useful, I'd rather this be moved into a BKE utility function. e.g. | |||||
| } | } | ||||
| if (!MAIN_VERSION_ATLEAST(bmain, 300, 3)) { | if (!MAIN_VERSION_ATLEAST(bmain, 300, 3)) { | ||||
| sort_linked_ids(bmain); | sort_linked_ids(bmain); | ||||
| assert_sorted_ids(bmain); | assert_sorted_ids(bmain); | ||||
| } | } | ||||
| if (MAIN_VERSION_ATLEAST(bmain, 300, 3)) { | if (MAIN_VERSION_ATLEAST(bmain, 300, 3)) { | ||||
| ▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | if (!MAIN_VERSION_ATLEAST(bmain, 302, 14)) { | ||||
| /* Sequencer channels region. */ | /* Sequencer channels region. */ | ||||
| for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { | for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { | ||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { | LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { | ||||
| if (sl->spacetype != SPACE_SEQ) { | if (sl->spacetype != SPACE_SEQ) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SpaceSeq *sseq = (SpaceSeq *)sl; | SpaceSeq *sseq = (SpaceSeq *)sl; | ||||
| ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : | |||||
| &sl->regionbase; | |||||
| sseq->flag |= SEQ_CLAMP_VIEW; | sseq->flag |= SEQ_CLAMP_VIEW; | ||||
| if (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { | if (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ARegion *timeline_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase, | ||||
| RGN_TYPE_WINDOW); | |||||
| if (timeline_region == NULL) { | if (timeline_region == NULL) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| timeline_region->v2d.cur.ymax = 8.5f; | timeline_region->v2d.cur.ymax = 8.5f; | ||||
| timeline_region->v2d.align &= ~V2D_ALIGN_NO_NEG_Y; | timeline_region->v2d.align &= ~V2D_ALIGN_NO_NEG_Y; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,048 Lines • ▼ Show 20 Lines | for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (ELEM(((SpaceSeq *)sl)->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { | if (ELEM(((SpaceSeq *)sl)->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : | ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : | ||||
| &sl->regionbase; | &sl->regionbase; | ||||
| ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_CHANNELS); | ARegion *region = BKE_region_find_in_listbase_by_type(regionbase, RGN_TYPE_CHANNELS); | ||||
| if (!region) { | if (!region) { | ||||
| ARegion *tools_region = BKE_area_find_region_type(area, RGN_TYPE_TOOLS); | /* Find sequencer tools region. */ | ||||
| ARegion *tools_region = BKE_region_find_in_listbase_by_type(regionbase, | |||||
| RGN_TYPE_TOOLS); | |||||
| region = do_versions_add_region(RGN_TYPE_CHANNELS, "channels region"); | region = do_versions_add_region(RGN_TYPE_CHANNELS, "channels region"); | ||||
| BLI_insertlinkafter(regionbase, tools_region, region); | BLI_insertlinkafter(regionbase, tools_region, region); | ||||
| region->alignment = RGN_ALIGN_LEFT; | region->alignment = RGN_ALIGN_LEFT; | ||||
| region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; | region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; | ||||
| } | } | ||||
| ARegion *timeline_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase, | ||||
| RGN_TYPE_WINDOW); | |||||
| if (timeline_region != NULL) { | if (timeline_region != NULL) { | ||||
| timeline_region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; | timeline_region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Initialize channels. */ | /* Initialize channels. */ | ||||
| ▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | |||||
| * \note Be sure to check when bumping the version: | * \note Be sure to check when bumping the version: | ||||
| * - "versioning_userdef.c", #blo_do_versions_userdef | * - "versioning_userdef.c", #blo_do_versions_userdef | ||||
| * - "versioning_userdef.c", #do_versions_theme | * - "versioning_userdef.c", #do_versions_theme | ||||
| * | * | ||||
| * \note Keep this message at the bottom of the function. | * \note Keep this message at the bottom of the function. | ||||
| */ | */ | ||||
| { | { | ||||
| /* Keep this block, even when empty. */ | /* Keep this block, even when empty. */ | ||||
| /* Fix for T98925 - remove channels region, that was initialized in incorrect editor types. */ | |||||
| for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { | |||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | |||||
| LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { | |||||
| if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ)) { | |||||
| continue; | |||||
| } | |||||
| ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : | |||||
| &sl->regionbase; | |||||
| ARegion *channels_region = BKE_region_find_in_listbase_by_type(regionbase, | |||||
| RGN_TYPE_CHANNELS); | |||||
| if (channels_region) { | |||||
| BLI_freelinkN(regionbase, channels_region); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
Since this is generally useful, I'd rather this be moved into a BKE utility function. e.g. BKE_region_find_in_listbase_by_type(...) the functions doc-string can note that this is useful for versioning where either the Area or SpaceLink's regionbase are typical inputs.