Cleanup: No longer require VSE Strip struct memory layout to never change
Previously code that was reading Strip data assumed that seqbasep and channels members would stay at fixed offsets within a struct, forever into the future. Fix this by inferring their offsets from the file SDNA data where needed. Actual Strip DNA layout is not changed in this commit yet. Co-authored-by: Sergey Sharybin <sergey@blender.org> Pull Request: https://projects.blender.org/blender/blender/pulls/142940
This commit is contained in:
committed by
Aras Pranckevicius
parent
d6573097eb
commit
bedf19f1ca
BIN
tests/files/sequence_editing/vse_load_meta_stack.blend
(Stored with Git LFS)
Normal file
BIN
tests/files/sequence_editing/vse_load_meta_stack.blend
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -1297,6 +1297,12 @@ if(TEST_SRC_DIR_EXISTS)
|
||||
--
|
||||
--testdir "${TEST_SRC_DIR}/sequence_editing"
|
||||
)
|
||||
|
||||
add_blender_test(
|
||||
sequencer_load_meta_stack
|
||||
${TEST_SRC_DIR}/sequence_editing/vse_load_meta_stack.blend
|
||||
--python ${TEST_PYTHON_DIR}/sequencer_load_meta_stack.py
|
||||
)
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
46
tests/python/sequencer_load_meta_stack.py
Normal file
46
tests/python/sequencer_load_meta_stack.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# SPDX-FileCopyrightText: 2020-2022 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# To run all tests, use
|
||||
# BLENDER_VERBOSE=1 ./bin/blender --background ../tests/files/sequence_editing/vse_load_meta_stack.blend --python ../blender/tests/python/sequencer_load_meta_stack.py
|
||||
# (that assumes the test is run from a build directory in the same directory as the source code)
|
||||
import bpy
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
|
||||
class SequencerLoadMetastaskTest(unittest.TestCase):
|
||||
def get_sequence_editor(self):
|
||||
return bpy.context.scene.sequence_editor
|
||||
|
||||
def test_meta_stack(self):
|
||||
sequence_editor = self.get_sequence_editor()
|
||||
|
||||
meta_stack = sequence_editor.meta_stack
|
||||
self.assertEqual(len(meta_stack), 1)
|
||||
self.assertEqual(meta_stack[0].name, "MetaStrip")
|
||||
|
||||
self.assertEqual(len(meta_stack[0].sequences), 1)
|
||||
self.assertEqual(meta_stack[0].sequences[0].name, "Color")
|
||||
|
||||
# accesses ed->seqbasep through screen_ctx_selected_editable_sequences
|
||||
bpy.context.copy()
|
||||
|
||||
|
||||
def main():
|
||||
argv = [sys.argv[0]]
|
||||
if '--' in sys.argv:
|
||||
argv += sys.argv[sys.argv.index('--') + 1:]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
args, remaining = parser.parse_known_args(argv)
|
||||
|
||||
unittest.main(argv=remaining)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user