Files
test/source/blender/sequencer/SEQ_channels.hh
Hans Goudey ae53dc3a60 Sequencer: Avoid storing un-tracked pointers in blend files
Currently, sequencer structs contain several pointers to data within
other structs. These pointers need to be remapped as the structs are
reallocated when reading from blend files. That has worked so far
because the pointers are exactly the values from the Blender session
that saved the file. With the implementation of #127706, the pointers
in the file aren't "real" anymore, and we can't offset them to get the
struct that contained the data. I'm working on the pointer stability
solution now to address a memfile undo performance regression
in 5.0 due to the `AttributeStorage` read/write design.

This commit replaces these 4 mid-struct pointers to point to the
containing strips instead, and uses some trivial logic to access the
fallback root sequence channels and strips. This makes the pointer
remapping on file load possible again.

This change is backward compatible but not forward compatible.

Second try after #144626

Pull Request: https://projects.blender.org/blender/blender/pulls/144878
2025-08-29 16:58:08 +02:00

38 lines
1.2 KiB
C++

/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup sequencer
*/
struct Editing;
struct ListBase;
struct SeqTimelineChannel;
struct Strip;
namespace blender::seq {
/** The active displayed channels list, either from the root sequence or from a meta-strip. */
ListBase *channels_displayed_get(const Editing *ed);
void channels_ensure(ListBase *channels);
void channels_duplicate(ListBase *channels_dst, ListBase *channels_src);
void channels_free(ListBase *channels);
/**
* Returns SeqTimelineChannel by index
* Note: `Strip::channel` and `SeqTimelineChannel::index` are both counted from 0, but index of 0
* is never used. Therefore, it is valid to call `SeqTimelineChannel(channels, strip->channel)` to
* get channel corresponding to strip position.
*/
SeqTimelineChannel *channel_get_by_index(const ListBase *channels, int channel_index);
char *channel_name_get(ListBase *channels, int channel_index);
bool channel_is_locked(const SeqTimelineChannel *channel);
bool channel_is_muted(const SeqTimelineChannel *channel);
int channel_index_get(const SeqTimelineChannel *channel);
ListBase *get_channels_by_strip(Editing *ed, const Strip *strip);
} // namespace blender::seq