Fix #140885: Crash when deleting strip in python

This PR combines 9d3b2b51a7, 30dbb7820d, 64198971ea and baf9691959 in main branch and fixes
conflicts.

Co-authored-by: Aras Pranckevicius <aras@nesnausk.org>
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/141236
This commit is contained in:
Richard Antalik
2025-07-10 09:24:17 +02:00
committed by Philipp Oeser
parent 70591f3d47
commit dd6ef37be9
22 changed files with 557 additions and 296 deletions
+15 -6
View File
@@ -42,6 +42,7 @@
#include "BKE_callbacks.hh" #include "BKE_callbacks.hh"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_build_config.h"
#include "BLI_math_rotation.h" #include "BLI_math_rotation.h"
#include "BLI_string.h" #include "BLI_string.h"
#include "BLI_string_utils.hh" #include "BLI_string_utils.hh"
@@ -1317,14 +1318,22 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
/* link metastack, slight abuse of structs here, /* link metastack, slight abuse of structs here,
* have to restore pointer to internal part in struct */ * have to restore pointer to internal part in struct */
{ {
Sequence temp;
void *seqbase_poin; void *seqbase_poin;
void *channels_poin; void *channels_poin;
intptr_t seqbase_offset; /* This whole thing with seqbasep offsets is really not good
intptr_t channels_offset; * and prevents changes to the Sequence struct. A more correct approach
* would be to calculate offset using sDNA from the file (NOT from the
seqbase_offset = intptr_t(&(temp).seqbase) - intptr_t(&temp); * current Blender). Even better would be having some sort of dedicated
channels_offset = intptr_t(&(temp).channels) - intptr_t(&temp); * map of seqbase pointers to avoid this offset magic. */
constexpr intptr_t seqbase_offset = offsetof(Sequence, seqbase);
constexpr intptr_t channels_offset = offsetof(Sequence, channels);
#if ARCH_CPU_64_BITS
static_assert(seqbase_offset == 264, "Sequence seqbase member offset cannot be changed");
static_assert(channels_offset == 280, "Sequence channels member offset cannot be changed");
#else
static_assert(seqbase_offset == 204, "Sequence seqbase member offset cannot be changed");
static_assert(channels_offset == 212, "Sequence channels member offset cannot be changed");
#endif
/* seqbase root pointer */ /* seqbase root pointer */
if (ed->seqbasep == old_seqbasep) { if (ed->seqbasep == old_seqbasep) {
+411
View File
@@ -0,0 +1,411 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/**
* Based on Chromium's build_config.h, governed by a BSD-style license,
* with tweaks and extensions needed for the Blender project. */
/**
* Compile-time detection of compiler and hardware platform configuration.
* There are few categories of the defined symbols this header provides.
*
*
* Operating system detection
* ==========================
*
* An operating system is detected is defined as an `OS_<NAME>` symbols. For example, on Windows
* the `OS_WINDOWS` is defined to 1, and all the other symbols prefixed with `OS_` are defined to 0
* (except of the aggregates described above).
*
* There are aggregates which allows to access "family" of the operating system:
*
* - OS_BSD is defined for 1 for all BSD family of OS (FreeBSD, NextBSD, DragonFly...).
* - OS_POSIX is defined to 1 if the OS implements POSIX API.
*
*
* Compiler detection
* ==================
*
* The following compilers are detected: CLANG, GCC, MSVC, MINGW32, MINGW64.
*
* The COMPILER_<family> for the detected compiler is defined to 1, and all the rest of the
* compiler defines are set to 0.
*
* The aggregate COMPILER_MINGW is defined when the compiler is wither MINGW32 or MINGW64.
*
*
* CPU detection
* =============
*
* The commonly detected CPU capabilities are:
* - Family: `ARCH_CPU_<FAMILY>_FAMILY`
* - CPU bitness: `ARCH_CPU_<32|64>_BITS`
* - Endianess: `ARCH_CPU_<LITTLE|BIG>_ENDIAN`
*
* Supported CPU families: X86, S390, PPC, ARM, MIPS.
*/
#pragma once
/**
* All commonly used symbols (which are checked on a "top" level, from outside of any
* platform-specific ifdef block) are to be explicitly defined to 0 when they are not "active".
* Such an approach helps catching cases when one is attempted to access build configuration
* variable without including the header by simply using the -Wundef compiler attribute.
*/
/* -------------------------------------------------------------------- */
/** \name A set of macros to use for platform detection.
* \{ */
#if defined(__native_client__)
/* __native_client__ must be first, so that other OS_ defines are not set. */
# define OS_NACL 1
/* OS_NACL comes in two sandboxing technology flavors, SFI or Non-SFI. PNaCl toolchain defines
* __native_client_nonsfi__ macro in Non-SFI build mode, while it does not in SFI build mode. */
# if defined(__native_client_nonsfi__)
# define OS_NACL_NONSFI
# else
# define OS_NACL_SFI
# endif
#elif defined(_AIX)
# define OS_AIX 1
#elif defined(ANDROID)
# define OS_ANDROID 1
#elif defined(__APPLE__)
/* Only include TargetConditions after testing ANDROID as some android builds on mac don't have
* this header available and it's not needed unless the target is really mac/ios. */
# include <TargetConditionals.h>
# define OS_MAC 1
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
# define OS_IOS 1
# endif
#elif defined(__HAIKU__)
# define OS_HAIKU 1
#elif defined(__hpux)
# define OS_HPUX 1
#elif defined(__linux__)
# define OS_LINUX 1
/* Include a system header to pull in features.h for glibc/uclibc macros. */
# include <unistd.h>
# if defined(__GLIBC__) && !defined(__UCLIBC__)
/* We really are using glibc, not uClibc pretending to be glibc. */
# define LIBC_GLIBC 1
# endif
#elif defined(__sgi)
# define OS_IRIX 1
#elif defined(_WIN32)
# define OS_WINDOWS 1
#elif defined(__Fuchsia__)
# define OS_FUCHSIA 1
#elif defined(__DragonFly__)
# define OS_DRAGONFLYBSD 1
#elif defined(__FreeBSD__)
# define OS_FREEBSD 1
#elif defined(__NetBSD__)
# define OS_NETBSD 1
#elif defined(__OpenBSD__)
# define OS_OPENBSD 1
#elif defined(__sun)
# define OS_SOLARIS 1
#elif defined(__QNXNTO__)
# define OS_QNX 1
#elif defined(__asmjs__) || defined(__wasm__)
# define OS_ASMJS 1
#elif defined(__MVS__)
# define OS_ZOS 1
#else
# error Please add support for your platform in BLI_build_config.h
#endif
#if !defined(OS_AIX)
# define OS_AIX 0
#endif
#if !defined(OS_ASMJS)
# define OS_ASMJS 0
#endif
#if !defined(OS_NACL)
# define OS_NACL 0
#endif
#if !defined(OS_NACL_NONSFI)
# define OS_NACL_NONSFI 0
#endif
#if !defined(OS_NACL_SFI)
# define OS_NACL_SFI 0
#endif
#if !defined(OS_ANDROID)
# define OS_ANDROID 0
#endif
#if !defined(OS_MAC)
# define OS_MAC 0
#endif
#if !defined(OS_IOS)
# define OS_IOS 0
#endif
#if !defined(OS_HAIKU)
# define OS_HAIKU 0
#endif
#if !defined(OS_HPUX)
# define OS_HPUX 0
#endif
#if !defined(OS_IRIX)
# define OS_IRIX 0
#endif
#if !defined(OS_LINUX)
# define OS_LINUX 0
#endif
#if !defined(LIBC_GLIBC)
# define LIBC_GLIBC 0
#endif
#if !defined(OS_WINDOWS)
# define OS_WINDOWS 0
#endif
#if !defined(OS_FUCHSIA)
# define OS_FUCHSIA 0
#endif
#if !defined(OS_DRAGONFLYBSD)
# define OS_DRAGONFLYBSD 0
#endif
#if !defined(OS_FREEBSD)
# define OS_FREEBSD 0
#endif
#if !defined(OS_NETBSD)
# define OS_NETBSD 0
#endif
#if !defined(OS_OPENBSD)
# define OS_OPENBSD 0
#endif
#if !defined(OS_SOLARIS)
# define OS_SOLARIS 0
#endif
#if !defined(OS_QNX)
# define OS_QNX 0
#endif
#if !defined(OS_ZOS)
# define OS_ZOS 0
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name *BSD OS family detection.
* For access to standard BSD features, use OS_BSD instead of a more specific macro.
* \{ */
#if OS_DRAGONFLYBSD || OS_FREEBSD || OS_OPENBSD || OS_NETBSD
# define OS_BSD 1
#else
# define OS_BSD 0
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name POSIX system detection.
* For access to standard POSIXish features use OS_POSIX instead of a more specific macro.
* \{ */
#if OS_AIX || OS_ANDROID || OS_ASMJS || OS_FREEBSD || OS_LINUX || OS_MAC || OS_NACL || \
OS_NETBSD || OS_OPENBSD || OS_QNX || OS_SOLARIS
# define OS_POSIX 1
#else
# define OS_POSIX 0
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name Compiler detection, including its capabilities.
* \{ */
#if defined(__clang__)
# define COMPILER_CLANG 1
#elif defined(__GNUC__)
# define COMPILER_GCC 1
# define COMPILER_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#elif defined(_MSC_VER)
# define COMPILER_MSVC 1
# define COMPILER_MSVC_VERSION (_MSC_VER)
#elif defined(__MINGW32__)
# define COMPILER_MINGW32 1
#elif defined(__MINGW64__)
# define COMPILER_MINGW64 1
#else
# error Please add support for your compiler in BLI_build_config.h
#endif
#if !defined(COMPILER_CLANG)
# define COMPILER_CLANG 0
#endif
#if !defined(COMPILER_GCC)
# define COMPILER_GCC 0
#endif
#if !defined(COMPILER_MSVC)
# define COMPILER_MSVC 0
#endif
#if !defined(COMPILER_MINGW32)
# define COMPILER_MINGW32 0
#endif
#if !defined(COMPILER_MINGW64)
# define COMPILER_MINGW64 0
#endif
/* Compiler is any of MinGW family. */
#if COMPILER_MINGW32 || COMPILER_MINGW64
# define COMPILER_MINGW 1
#else
# define COMPILER_MINGW 0
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name Processor architecture detection.
* For more info on what's defined, see:
*
* http://msdn.microsoft.com/en-us/library/b0084kay.aspx
* http://www.agner.org/optimize/calling_conventions.pdf
*
* or with gcc, run: "echo | gcc -E -dM -"
* \{ */
#if defined(_M_X64) || defined(__x86_64__)
# define ARCH_CPU_X86_FAMILY 1
# define ARCH_CPU_X86_64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(_M_IX86) || defined(__i386__)
# define ARCH_CPU_X86_FAMILY 1
# define ARCH_CPU_X86 1
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__s390x__)
# define ARCH_CPU_S390_FAMILY 1
# define ARCH_CPU_S390X 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_BIG_ENDIAN 1
#elif defined(__s390__)
# define ARCH_CPU_S390_FAMILY 1
# define ARCH_CPU_S390 1
# define ARCH_CPU_31_BITS 1
# define ARCH_CPU_BIG_ENDIAN 1
#elif (defined(__PPC64__) || defined(__PPC__)) && defined(__BIG_ENDIAN__)
# define ARCH_CPU_PPC64_FAMILY 1
# define ARCH_CPU_PPC64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_BIG_ENDIAN 1
#elif defined(__PPC64__)
# define ARCH_CPU_PPC64_FAMILY 1
# define ARCH_CPU_PPC64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__ARMEL__)
# define ARCH_CPU_ARM_FAMILY 1
# define ARCH_CPU_ARMEL 1
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__aarch64__) || defined(_M_ARM64)
# define ARCH_CPU_ARM_FAMILY 1
# define ARCH_CPU_ARM64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__)
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__MIPSEL__)
# if defined(__LP64__)
# define ARCH_CPU_MIPS_FAMILY 1
# define ARCH_CPU_MIPS64EL 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
# else
# define ARCH_CPU_MIPS_FAMILY 1
# define ARCH_CPU_MIPSEL 1
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
# endif
#elif defined(__MIPSEB__)
# if defined(__LP64__)
# define ARCH_CPU_MIPS_FAMILY 1
# define ARCH_CPU_MIPS64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_BIG_ENDIAN 1
# else
# define ARCH_CPU_MIPS_FAMILY 1
# define ARCH_CPU_MIPS 1
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_BIG_ENDIAN 1
# endif
#else
# error Please add support for your architecture in BLI_build_config.h
#endif
#if !defined(ARCH_CPU_LITTLE_ENDIAN)
# define ARCH_CPU_LITTLE_ENDIAN 0
#endif
#if !defined(ARCH_CPU_BIG_ENDIAN)
# define ARCH_CPU_BIG_ENDIAN 0
#endif
#if !defined(ARCH_CPU_31_BITS)
# define ARCH_CPU_31_BITS 0
#endif
#if !defined(ARCH_CPU_32_BITS)
# define ARCH_CPU_32_BITS 0
#endif
#if !defined(ARCH_CPU_64_BITS)
# define ARCH_CPU_64_BITS 0
#endif
#if !defined(ARCH_CPU_X86_FAMILY)
# define ARCH_CPU_X86_FAMILY 0
#endif
#if !defined(ARCH_CPU_ARM_FAMILY)
# define ARCH_CPU_ARM_FAMILY 0
#endif
#if !defined(ARCH_CPU_MIPS_FAMILY)
# define ARCH_CPU_MIPS_FAMILY 0
#endif
#if !defined(ARCH_CPU_PPC64_FAMILY)
# define ARCH_CPU_PPC64_FAMILY 0
#endif
#if !defined(ARCH_CPU_S390_FAMILY)
# define ARCH_CPU_S390_FAMILY 0
#endif
#if !defined(ARCH_CPU_ARM64)
# define ARCH_CPU_ARM64 0
#endif
#if !defined(ARCH_CPU_ARMEL)
# define ARCH_CPU_ARMEL 0
#endif
#if !defined(ARCH_CPU_MIPS)
# define ARCH_CPU_MIPS 0
#endif
#if !defined(ARCH_CPU_MIPS64)
# define ARCH_CPU_MIPS64 0
#endif
#if !defined(ARCH_CPU_MIPS64EL)
# define ARCH_CPU_MIPS64EL 0
#endif
#if !defined(ARCH_CPU_MIPSEL)
# define ARCH_CPU_MIPSEL 0
#endif
#if !defined(ARCH_CPU_PPC64)
# define ARCH_CPU_PPC64 0
#endif
#if !defined(ARCH_CPU_S390)
# define ARCH_CPU_S390 0
#endif
#if !defined(ARCH_CPU_S390X)
# define ARCH_CPU_S390X 0
#endif
#if !defined(ARCH_CPU_X86)
# define ARCH_CPU_X86 0
#endif
#if !defined(ARCH_CPU_X86_64)
# define ARCH_CPU_X86_64 0
#endif
/** \} */
+2
View File
@@ -198,6 +198,7 @@ set(SRC
BLI_bounds.hh BLI_bounds.hh
BLI_bounds_types.hh BLI_bounds_types.hh
BLI_boxpack_2d.h BLI_boxpack_2d.h
BLI_build_config.h
BLI_buffer.h BLI_buffer.h
BLI_cache_mutex.hh BLI_cache_mutex.hh
BLI_color.hh BLI_color.hh
@@ -521,6 +522,7 @@ if(WITH_GTESTS)
tests/BLI_bit_ref_test.cc tests/BLI_bit_ref_test.cc
tests/BLI_bit_span_test.cc tests/BLI_bit_span_test.cc
tests/BLI_bit_vector_test.cc tests/BLI_bit_vector_test.cc
tests/BLI_build_config_test.cc
tests/BLI_bitmap_test.cc tests/BLI_bitmap_test.cc
tests/BLI_bounds_test.cc tests/BLI_bounds_test.cc
tests/BLI_color_test.cc tests/BLI_color_test.cc
@@ -0,0 +1,36 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "BLI_build_config.h"
#include "BLI_endian_defines.h"
namespace blender::tests {
/* Some basic tests to ensure simple code compiles, and that there are no obvious mistakes in the
* build_config implementation. */
TEST(BLI_build_config, Basic)
{
static_assert(ARCH_CPU_31_BITS || ARCH_CPU_32_BITS || ARCH_CPU_64_BITS);
}
TEST(BLI_build_config, Endian)
{
/* TODO: This could become more comprehensive test when C++20 is available: we can check that
* std::endian::native is aligned with the compile-time defines. */
static_assert(ARCH_CPU_LITTLE_ENDIAN || ARCH_CPU_BIG_ENDIAN);
/* Verify the build_config is aligned with the CMake configuration. */
#if defined(__BIG_ENDIAN__)
static_assert(ARCH_CPU_BIG_ENDIAN);
static_assert(!ARCH_CPU_LITTLE_ENDIAN);
#endif
#if defined(__LITTLE_ENDIAN__)
static_assert(!ARCH_CPU_BIG_ENDIAN);
static_assert(ARCH_CPU_LITTLE_ENDIAN);
#endif
}
} // namespace blender::tests
@@ -1425,10 +1425,8 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
load_data_init_from_operator(&load_data, C, op); load_data_init_from_operator(&load_data, C, op);
load_data.effect.type = RNA_enum_get(op->ptr, "type"); load_data.effect.type = RNA_enum_get(op->ptr, "type");
Sequence *seq1, *seq2, *seq3; Sequence *seq1, *seq2;
if (!seq_effect_find_selected( if (!seq_effect_find_selected(scene, nullptr, load_data.effect.type, &seq1, &seq2, &error_msg)) {
scene, nullptr, load_data.effect.type, &seq1, &seq2, &seq3, &error_msg))
{
BKE_report(op->reports, RPT_ERROR, error_msg); BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
@@ -1439,13 +1437,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
load_data.effect.seq1 = seq1; load_data.effect.seq1 = seq1;
load_data.effect.seq2 = seq2; load_data.effect.seq2 = seq2;
load_data.effect.seq3 = seq3;
/* Set channel. If unset, use lowest free one above strips. */ /* Set channel. If unset, use lowest free one above strips. */
if (!RNA_struct_property_is_set(op->ptr, "channel")) { if (!RNA_struct_property_is_set(op->ptr, "channel")) {
if (seq1 != nullptr) { if (seq1 != nullptr) {
int chan = max_iii( int chan = max_ii(seq1 ? seq1->machine : 0, seq2 ? seq2->machine : 0);
seq1 ? seq1->machine : 0, seq2 ? seq2->machine : 0, seq3 ? seq3->machine : 0);
if (chan < MAXSEQ) { if (chan < MAXSEQ) {
load_data.channel = chan; load_data.channel = chan;
} }
@@ -404,12 +404,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq))); scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
} }
} }
else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
if (!either_handle_selected) {
SEQ_offset_animdata(
scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
} }
} }
@@ -1087,11 +1081,10 @@ int seq_effect_find_selected(Scene *scene,
int type, int type,
Sequence **r_selseq1, Sequence **r_selseq1,
Sequence **r_selseq2, Sequence **r_selseq2,
Sequence **r_selseq3,
const char **r_error_str) const char **r_error_str)
{ {
Editing *ed = SEQ_editing_get(scene); Editing *ed = SEQ_editing_get(scene);
Sequence *seq1 = nullptr, *seq2 = nullptr, *seq3 = nullptr; Sequence *seq1 = nullptr, *seq2 = nullptr;
*r_error_str = nullptr; *r_error_str = nullptr;
@@ -1100,7 +1093,7 @@ int seq_effect_find_selected(Scene *scene,
} }
if (SEQ_effect_get_num_inputs(type) == 0) { if (SEQ_effect_get_num_inputs(type) == 0) {
*r_selseq1 = *r_selseq2 = *r_selseq3 = nullptr; *r_selseq1 = *r_selseq2 = nullptr;
return 1; return 1;
} }
@@ -1117,25 +1110,14 @@ int seq_effect_find_selected(Scene *scene,
else if (seq1 == nullptr) { else if (seq1 == nullptr) {
seq1 = seq; seq1 = seq;
} }
else if (seq3 == nullptr) {
seq3 = seq;
}
else { else {
*r_error_str = N_("Cannot apply effect to more than 3 sequence strips"); *r_error_str = N_("Cannot apply effect to more than 2 sequence strips");
return 0; return 0;
} }
} }
} }
} }
/* Make sequence selection a little bit more intuitive
* for 3 strips: the last-strip should be seq3. */
if (seq3 != nullptr && seq2 != nullptr) {
Sequence *tmp = seq2;
seq2 = seq3;
seq3 = tmp;
}
switch (SEQ_effect_get_num_inputs(type)) { switch (SEQ_effect_get_num_inputs(type)) {
case 1: case 1:
if (seq2 == nullptr) { if (seq2 == nullptr) {
@@ -1145,34 +1127,24 @@ int seq_effect_find_selected(Scene *scene,
if (seq1 == nullptr) { if (seq1 == nullptr) {
seq1 = seq2; seq1 = seq2;
} }
if (seq3 == nullptr) {
seq3 = seq2;
}
ATTR_FALLTHROUGH; ATTR_FALLTHROUGH;
case 2: case 2:
if (seq1 == nullptr || seq2 == nullptr) { if (seq1 == nullptr || seq2 == nullptr) {
*r_error_str = N_("2 selected sequence strips are needed"); *r_error_str = N_("2 selected sequence strips are needed");
return 0; return 0;
} }
if (seq3 == nullptr) {
seq3 = seq2;
}
break; break;
} }
if (seq1 == nullptr && seq2 == nullptr && seq3 == nullptr) { if (seq1 == nullptr && seq2 == nullptr) {
*r_error_str = N_("TODO: in what cases does this happen?"); *r_error_str = N_("TODO: in what cases does this happen?");
return 0; return 0;
} }
*r_selseq1 = seq1; *r_selseq1 = seq1;
*r_selseq2 = seq2; *r_selseq2 = seq2;
*r_selseq3 = seq3;
/* TODO(Richard): This function needs some refactoring, this is just quick hack for #73828. */ /* TODO(Richard): This function needs some refactoring, this is just quick hack for #73828. */
if (SEQ_effect_get_num_inputs(type) < 3) {
*r_selseq3 = nullptr;
}
if (SEQ_effect_get_num_inputs(type) < 2) { if (SEQ_effect_get_num_inputs(type) < 2) {
*r_selseq2 = nullptr; *r_selseq2 = nullptr;
} }
@@ -1183,7 +1155,7 @@ int seq_effect_find_selected(Scene *scene,
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
{ {
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
Sequence *seq1, *seq2, *seq3, *last_seq = SEQ_select_active_get(scene); Sequence *seq1, *seq2, *last_seq = SEQ_select_active_get(scene);
const char *error_msg; const char *error_msg;
if (SEQ_effect_get_num_inputs(last_seq->type) == 0) { if (SEQ_effect_get_num_inputs(last_seq->type) == 0) {
@@ -1191,8 +1163,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
if (!seq_effect_find_selected( if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &error_msg) ||
scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg) ||
SEQ_effect_get_num_inputs(last_seq->type) == 0) SEQ_effect_get_num_inputs(last_seq->type) == 0)
{ {
BKE_report(op->reports, RPT_ERROR, error_msg); BKE_report(op->reports, RPT_ERROR, error_msg);
@@ -1200,8 +1171,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
} }
/* Check if reassigning would create recursivity. */ /* Check if reassigning would create recursivity. */
if (SEQ_relations_render_loop_check(seq1, last_seq) || if (SEQ_relations_render_loop_check(seq1, last_seq) ||
SEQ_relations_render_loop_check(seq2, last_seq) || SEQ_relations_render_loop_check(seq2, last_seq))
SEQ_relations_render_loop_check(seq3, last_seq))
{ {
BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: recursion detected"); BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: recursion detected");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@@ -1209,7 +1179,6 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
last_seq->seq1 = seq1; last_seq->seq1 = seq1;
last_seq->seq2 = seq2; last_seq->seq2 = seq2;
last_seq->seq3 = seq3;
int old_start = last_seq->start; int old_start = last_seq->start;
@@ -1288,7 +1257,7 @@ void SEQUENCER_OT_swap_inputs(wmOperatorType *ot)
/* Identifiers. */ /* Identifiers. */
ot->name = "Swap Inputs"; ot->name = "Swap Inputs";
ot->idname = "SEQUENCER_OT_swap_inputs"; ot->idname = "SEQUENCER_OT_swap_inputs";
ot->description = "Swap the first two inputs for the effect strip"; ot->description = "Swap the two inputs of the effect strip";
/* Api callbacks. */ /* Api callbacks. */
ot->exec = sequencer_swap_inputs_exec; ot->exec = sequencer_swap_inputs_exec;
@@ -2229,7 +2198,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
static bool seq_is_parent(const Sequence *par, const Sequence *seq) static bool seq_is_parent(const Sequence *par, const Sequence *seq)
{ {
return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq)); return ((par->seq1 == seq) || (par->seq2 == seq));
} }
static int sequencer_swap_exec(bContext *C, wmOperator *op) static int sequencer_swap_exec(bContext *C, wmOperator *op)
@@ -2250,13 +2219,11 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
if (seq) { if (seq) {
/* Disallow effect strips. */ /* Disallow effect strips. */
if (SEQ_effect_get_num_inputs(seq->type) >= 1 && if (SEQ_effect_get_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2)) {
(seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3))
{
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
if ((SEQ_effect_get_num_inputs(active_seq->type) >= 1) && if ((SEQ_effect_get_num_inputs(active_seq->type) >= 1) &&
(active_seq->effectdata || active_seq->seq1 || active_seq->seq2 || active_seq->seq3)) (active_seq->effectdata || active_seq->seq1 || active_seq->seq2))
{ {
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
@@ -2516,34 +2483,12 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot)
/** \name Change Effect Input Operator /** \name Change Effect Input Operator
* \{ */ * \{ */
static const EnumPropertyItem prop_change_effect_input_types[] = {
{0, "A_B", 0, "A " BLI_STR_UTF8_RIGHTWARDS_ARROW " B", ""},
{1, "B_C", 0, "B " BLI_STR_UTF8_RIGHTWARDS_ARROW " C", ""},
{2, "A_C", 0, "A " BLI_STR_UTF8_RIGHTWARDS_ARROW " C", ""},
{0, nullptr, 0, nullptr, nullptr},
};
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
{ {
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
Sequence *seq = SEQ_select_active_get(scene); Sequence *seq = SEQ_select_active_get(scene);
Sequence **seq_1, **seq_2; Sequence **seq_1 = &seq->seq1, **seq_2 = &seq->seq2;
switch (RNA_enum_get(op->ptr, "swap")) {
case 0:
seq_1 = &seq->seq1;
seq_2 = &seq->seq2;
break;
case 1:
seq_1 = &seq->seq2;
seq_2 = &seq->seq3;
break;
default: /* 2 */
seq_1 = &seq->seq1;
seq_2 = &seq->seq3;
break;
}
if (*seq_1 == nullptr || *seq_2 == nullptr) { if (*seq_1 == nullptr || *seq_2 == nullptr) {
BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap"); BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap");
@@ -2570,9 +2515,6 @@ void SEQUENCER_OT_change_effect_input(wmOperatorType *ot)
/* Flags. */ /* Flags. */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(
ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
} }
/** \} */ /** \} */
@@ -152,7 +152,6 @@ int seq_effect_find_selected(Scene *scene,
int type, int type,
Sequence **r_selseq1, Sequence **r_selseq1,
Sequence **r_selseq2, Sequence **r_selseq2,
Sequence **r_selseq3,
const char **r_error_str); const char **r_error_str);
/* Operator helpers. */ /* Operator helpers. */
@@ -2335,9 +2335,6 @@ static bool select_grouped_effect(blender::Span<Sequence *> strips,
if (seq->seq2) { if (seq->seq2) {
seq->seq2->flag |= SELECT; seq->seq2->flag |= SELECT;
} }
if (seq->seq3) {
seq->seq3->flag |= SELECT;
}
changed = true; changed = true;
} }
} }
+7 -4
View File
@@ -191,16 +191,14 @@ typedef struct Sequence {
float startstill, endstill; float startstill, endstill;
/** Machine: the strip channel */ /** Machine: the strip channel */
int machine; int machine;
int _pad;
/** Starting and ending points of the effect strip. Undefined for other strip types. */ /** Starting and ending points of the effect strip. Undefined for other strip types. */
int startdisp, enddisp; int startdisp, enddisp;
float sat; float sat;
float mul; float mul;
float _pad1;
short anim_preseek; /* UNUSED. */
/** Stream-index for movie or sound files with several streams. */ /** Stream-index for movie or sound files with several streams. */
short streamindex; short streamindex;
short _pad;
/** For multi-camera source selection. */ /** For multi-camera source selection. */
int multicam_source; int multicam_source;
/** MOVIECLIP render flags. */ /** MOVIECLIP render flags. */
@@ -228,7 +226,12 @@ typedef struct Sequence {
float speed_fader; float speed_fader;
/* pointers for effects: */ /* pointers for effects: */
struct Sequence *seq1, *seq2, *seq3; struct Sequence *seq1, *seq2;
/* This strange padding is needed due to how seqbasep deserialization is
* done right now in #scene_blend_read_data. */
void *_pad7;
int _pad8[2];
/** List of strips for meta-strips. */ /** List of strips for meta-strips. */
ListBase seqbase; ListBase seqbase;
@@ -2682,16 +2682,6 @@ static void rna_def_effect_inputs(StructRNA *srna, int count)
RNA_def_property_pointer_funcs(prop, nullptr, "rna_Sequence_input_2_set", nullptr, nullptr); RNA_def_property_pointer_funcs(prop, nullptr, "rna_Sequence_input_2_set", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip"); RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
} }
# if 0
if (count == 3) {
/* Not used by any effects (perhaps one day plugins?). */
prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, nullptr, "seq3");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
}
# endif
} }
static void rna_def_color_management(StructRNA *srna) static void rna_def_color_management(StructRNA *srna)
@@ -450,8 +450,7 @@ static Sequence *rna_Sequences_new_effect(ID *id,
int frame_start, int frame_start,
int frame_end, int frame_end,
Sequence *seq1, Sequence *seq1,
Sequence *seq2, Sequence *seq2)
Sequence *seq3)
{ {
Scene *scene = (Scene *)id; Scene *scene = (Scene *)id;
Sequence *seq; Sequence *seq;
@@ -476,17 +475,11 @@ static Sequence *rna_Sequences_new_effect(ID *id,
return nullptr; return nullptr;
} }
break; break;
case 3:
if (seq1 == nullptr || seq2 == nullptr || seq3 == nullptr) {
BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
return nullptr;
}
break;
default: default:
BKE_reportf( BKE_reportf(
reports, reports,
RPT_ERROR, RPT_ERROR,
"Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)", "Sequences.new_effect: effect expects more than 2 inputs (%d, should never happen!)",
num_inputs); num_inputs);
return nullptr; return nullptr;
} }
@@ -497,7 +490,6 @@ static Sequence *rna_Sequences_new_effect(ID *id,
load_data.effect.type = type; load_data.effect.type = type;
load_data.effect.seq1 = seq1; load_data.effect.seq1 = seq1;
load_data.effect.seq2 = seq2; load_data.effect.seq2 = seq2;
load_data.effect.seq3 = seq3;
seq = SEQ_add_effect_strip(scene, seqbase, &load_data); seq = SEQ_add_effect_strip(scene, seqbase, &load_data);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -515,11 +507,10 @@ static Sequence *rna_Sequences_editing_new_effect(ID *id,
int frame_start, int frame_start,
int frame_end, int frame_end,
Sequence *seq1, Sequence *seq1,
Sequence *seq2, Sequence *seq2)
Sequence *seq3)
{ {
return rna_Sequences_new_effect( return rna_Sequences_new_effect(
id, &ed->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3); id, &ed->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2);
} }
static Sequence *rna_Sequences_meta_new_effect(ID *id, static Sequence *rna_Sequences_meta_new_effect(ID *id,
@@ -531,11 +522,10 @@ static Sequence *rna_Sequences_meta_new_effect(ID *id,
int frame_start, int frame_start,
int frame_end, int frame_end,
Sequence *seq1, Sequence *seq1,
Sequence *seq2, Sequence *seq2)
Sequence *seq3)
{ {
return rna_Sequences_new_effect( return rna_Sequences_new_effect(
id, &seq->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3); id, &seq->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2);
} }
static void rna_Sequences_remove( static void rna_Sequences_remove(
@@ -1075,7 +1065,6 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri
INT_MAX); INT_MAX);
RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect"); RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect"); RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
/* return type */ /* return type */
parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
RNA_def_function_return(func, parm); RNA_def_function_return(func, parm);
-1
View File
@@ -48,7 +48,6 @@ struct SeqLoadData {
int end_frame; int end_frame;
Sequence *seq1; Sequence *seq1;
Sequence *seq2; Sequence *seq2;
Sequence *seq3;
} effect; /* Only for effect strips. */ } effect; /* Only for effect strips. */
eSeqLoadFlags flags; eSeqLoadFlags flags;
eSeqImageFitMethod fit_method; eSeqImageFitMethod fit_method;
+2 -4
View File
@@ -70,10 +70,9 @@ struct SeqEffectHandle {
float timeline_frame, float timeline_frame,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2);
ImBuf *ibuf3);
ImBuf *(*init_execution)(const SeqRenderData *context, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3); ImBuf *(*init_execution)(const SeqRenderData *context, ImBuf *ibuf1, ImBuf *ibuf2);
void (*execute_slice)(const SeqRenderData *context, void (*execute_slice)(const SeqRenderData *context,
Sequence *seq, Sequence *seq,
@@ -81,7 +80,6 @@ struct SeqEffectHandle {
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf *ibuf3,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out); ImBuf *out);
+42 -119
View File
@@ -71,12 +71,10 @@ static SeqEffectHandle get_sequence_effect_impl(int seq_type);
static void slice_get_byte_buffers(const SeqRenderData *context, static void slice_get_byte_buffers(const SeqRenderData *context,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf *ibuf3,
const ImBuf *out, const ImBuf *out,
int start_line, int start_line,
uchar **rect1, uchar **rect1,
uchar **rect2, uchar **rect2,
uchar **rect3,
uchar **rect_out) uchar **rect_out)
{ {
int offset = 4 * start_line * context->rectx; int offset = 4 * start_line * context->rectx;
@@ -87,21 +85,15 @@ static void slice_get_byte_buffers(const SeqRenderData *context,
if (ibuf2) { if (ibuf2) {
*rect2 = ibuf2->byte_buffer.data + offset; *rect2 = ibuf2->byte_buffer.data + offset;
} }
if (ibuf3) {
*rect3 = ibuf3->byte_buffer.data + offset;
}
} }
static void slice_get_float_buffers(const SeqRenderData *context, static void slice_get_float_buffers(const SeqRenderData *context,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf *ibuf3,
const ImBuf *out, const ImBuf *out,
int start_line, int start_line,
float **rect1, float **rect1,
float **rect2, float **rect2,
float **rect3,
float **rect_out) float **rect_out)
{ {
int offset = 4 * start_line * context->rectx; int offset = 4 * start_line * context->rectx;
@@ -112,10 +104,6 @@ static void slice_get_float_buffers(const SeqRenderData *context,
if (ibuf2) { if (ibuf2) {
*rect2 = ibuf2->float_buffer.data + offset; *rect2 = ibuf2->float_buffer.data + offset;
} }
if (ibuf3) {
*rect3 = ibuf3->float_buffer.data + offset;
}
} }
static float4 load_premul_pixel(const uchar *ptr) static float4 load_premul_pixel(const uchar *ptr)
@@ -165,7 +153,6 @@ static void store_opaque_black_pixel(float *dst)
static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, static ImBuf *prepare_effect_imbufs(const SeqRenderData *context,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2,
ImBuf *ibuf3,
bool uninitialized_pixels = true) bool uninitialized_pixels = true)
{ {
ImBuf *out; ImBuf *out;
@@ -174,15 +161,12 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context,
int y = context->recty; int y = context->recty;
int base_flags = uninitialized_pixels ? IB_uninitialized_pixels : 0; int base_flags = uninitialized_pixels ? IB_uninitialized_pixels : 0;
if (!ibuf1 && !ibuf2 && !ibuf3) { if (!ibuf1 && !ibuf2) {
/* hmmm, global float option ? */ /* hmmm, global float option ? */
out = IMB_allocImBuf(x, y, 32, IB_rect | base_flags); out = IMB_allocImBuf(x, y, 32, IB_rect | base_flags);
} }
else if ((ibuf1 && ibuf1->float_buffer.data) || (ibuf2 && ibuf2->float_buffer.data) || else if ((ibuf1 && ibuf1->float_buffer.data) || (ibuf2 && ibuf2->float_buffer.data)) {
(ibuf3 && ibuf3->float_buffer.data)) /* if any inputs are float, output is float too */
{
/* if any inputs are rectfloat, output is float too */
out = IMB_allocImBuf(x, y, 32, IB_rectfloat | base_flags); out = IMB_allocImBuf(x, y, 32, IB_rectfloat | base_flags);
} }
else { else {
@@ -198,10 +182,6 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context,
seq_imbuf_to_sequencer_space(scene, ibuf2, true); seq_imbuf_to_sequencer_space(scene, ibuf2, true);
} }
if (ibuf3 && !ibuf3->float_buffer.data) {
seq_imbuf_to_sequencer_space(scene, ibuf3, true);
}
IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name); IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
} }
else { else {
@@ -212,14 +192,10 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context,
if (ibuf2 && !ibuf2->byte_buffer.data) { if (ibuf2 && !ibuf2->byte_buffer.data) {
IMB_rect_from_float(ibuf2); IMB_rect_from_float(ibuf2);
} }
if (ibuf3 && !ibuf3->byte_buffer.data) {
IMB_rect_from_float(ibuf3);
}
} }
/* If effect only affecting a single channel, forward input's metadata to the output. */ /* If effect only affecting a single channel, forward input's metadata to the output. */
if (ibuf1 != nullptr && ibuf1 == ibuf2 && ibuf2 == ibuf3) { if (ibuf1 != nullptr && ibuf1 == ibuf2) {
IMB_metadata_copy(out, ibuf1); IMB_metadata_copy(out, ibuf1);
} }
@@ -289,7 +265,6 @@ static void do_alphaover_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -297,16 +272,14 @@ static void do_alphaover_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_alphaover_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_alphaover_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_alphaover_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_alphaover_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -354,7 +327,6 @@ static void do_alphaunder_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -362,16 +334,14 @@ static void do_alphaunder_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_alphaunder_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_alphaunder_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_alphaunder_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_alphaunder_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -434,7 +404,6 @@ static void do_cross_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -442,16 +411,14 @@ static void do_cross_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_cross_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_cross_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_cross_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_cross_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -503,22 +470,12 @@ static void do_gammacross_effect(
} }
} }
static ImBuf *gammacross_init_execution(const SeqRenderData *context,
ImBuf *ibuf1,
ImBuf *ibuf2,
ImBuf *ibuf3)
{
ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
return out;
}
static void do_gammacross_effect(const SeqRenderData *context, static void do_gammacross_effect(const SeqRenderData *context,
Sequence * /*seq*/, Sequence * /*seq*/,
float /*timeline_frame*/, float /*timeline_frame*/,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -526,16 +483,14 @@ static void do_gammacross_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_gammacross_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_gammacross_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_gammacross_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_gammacross_effect(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -597,7 +552,6 @@ static void do_add_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -605,16 +559,14 @@ static void do_add_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_add_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_add_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_add_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_add_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -678,7 +630,6 @@ static void do_sub_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -686,16 +637,14 @@ static void do_sub_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_sub_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_sub_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_sub_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_sub_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -839,7 +788,6 @@ static void do_mul_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -847,16 +795,14 @@ static void do_mul_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_mul_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_mul_effect_float(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_mul_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out); do_mul_effect_byte(fac, context->rectx, total_lines, rect1, rect2, rect_out);
} }
@@ -1037,22 +983,19 @@ static void do_blend_mode_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
{ {
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_blend_effect_float( do_blend_effect_float(
fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out); fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_blend_effect_byte( do_blend_effect_byte(
fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out); fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out);
} }
@@ -1083,7 +1026,6 @@ static void do_colormix_effect(const SeqRenderData *context,
float /*fac*/, float /*fac*/,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -1095,15 +1037,13 @@ static void do_colormix_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_blend_effect_float( do_blend_effect_float(
fac, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out); fac, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out);
} }
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_blend_effect_byte( do_blend_effect_byte(
fac, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out); fac, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out);
} }
@@ -1457,10 +1397,9 @@ static ImBuf *do_wipe_effect(const SeqRenderData *context,
float /*timeline_frame*/, float /*timeline_frame*/,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2)
ImBuf *ibuf3)
{ {
ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2);
if (out->float_buffer.data) { if (out->float_buffer.data) {
do_wipe_effect(seq, do_wipe_effect(seq,
@@ -1607,7 +1546,6 @@ static void do_transform_effect(const SeqRenderData *context,
float /*fac*/, float /*fac*/,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf * /*ibuf2*/, const ImBuf * /*ibuf2*/,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -1874,10 +1812,9 @@ static ImBuf *do_glow_effect(const SeqRenderData *context,
float /*timeline_frame*/, float /*timeline_frame*/,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2)
ImBuf *ibuf3)
{ {
ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2);
int render_size = 100 * context->rectx / context->scene->r.xsch; int render_size = 100 * context->rectx / context->scene->r.xsch;
@@ -1950,11 +1887,10 @@ static ImBuf *do_solid_color(const SeqRenderData *context,
float /*timeline_frame*/, float /*timeline_frame*/,
float /*fac*/, float /*fac*/,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2)
ImBuf *ibuf3)
{ {
using namespace blender; using namespace blender;
ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2);
SolidColorVars *cv = (SolidColorVars *)seq->effectdata; SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
@@ -2016,8 +1952,7 @@ static ImBuf *do_multicam(const SeqRenderData *context,
float timeline_frame, float timeline_frame,
float /*fac*/, float /*fac*/,
ImBuf * /*ibuf1*/, ImBuf * /*ibuf1*/,
ImBuf * /*ibuf2*/, ImBuf * /*ibuf2*/)
ImBuf * /*ibuf3*/)
{ {
ImBuf *out; ImBuf *out;
Editing *ed; Editing *ed;
@@ -2103,8 +2038,7 @@ static ImBuf *do_adjustment(const SeqRenderData *context,
float timeline_frame, float timeline_frame,
float /*fac*/, float /*fac*/,
ImBuf * /*ibuf1*/, ImBuf * /*ibuf1*/,
ImBuf * /*ibuf2*/, ImBuf * /*ibuf2*/)
ImBuf * /*ibuf3*/)
{ {
ImBuf *out; ImBuf *out;
Editing *ed; Editing *ed;
@@ -2294,8 +2228,7 @@ static ImBuf *do_speed_effect(const SeqRenderData *context,
float timeline_frame, float timeline_frame,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2)
ImBuf *ibuf3)
{ {
SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
SeqEffectHandle cross_effect = get_sequence_effect_impl(SEQ_TYPE_CROSS); SeqEffectHandle cross_effect = get_sequence_effect_impl(SEQ_TYPE_CROSS);
@@ -2305,7 +2238,7 @@ static ImBuf *do_speed_effect(const SeqRenderData *context,
fac = speed_effect_interpolation_ratio_get(context->scene, seq, timeline_frame); fac = speed_effect_interpolation_ratio_get(context->scene, seq, timeline_frame);
/* Current frame is ibuf1, next frame is ibuf2. */ /* Current frame is ibuf1, next frame is ibuf2. */
out = seq_render_effect_execute_threaded( out = seq_render_effect_execute_threaded(
&cross_effect, context, nullptr, timeline_frame, fac, ibuf1, ibuf2, ibuf3); &cross_effect, context, nullptr, timeline_frame, fac, ibuf1, ibuf2);
return out; return out;
} }
@@ -2325,7 +2258,6 @@ static void do_overdrop_effect(const SeqRenderData *context,
float fac, float fac,
const ImBuf *ibuf1, const ImBuf *ibuf1,
const ImBuf *ibuf2, const ImBuf *ibuf2,
const ImBuf * /*ibuf3*/,
int start_line, int start_line,
int total_lines, int total_lines,
ImBuf *out) ImBuf *out)
@@ -2336,8 +2268,7 @@ static void do_overdrop_effect(const SeqRenderData *context,
if (out->float_buffer.data) { if (out->float_buffer.data) {
float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; float *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_float_buffers( slice_get_float_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_drop_effect_float(fac, x, y, rect1, rect2, rect_out); do_drop_effect_float(fac, x, y, rect1, rect2, rect_out);
do_alphaover_effect(fac, x, y, rect1, rect2, rect_out); do_alphaover_effect(fac, x, y, rect1, rect2, rect_out);
@@ -2345,8 +2276,7 @@ static void do_overdrop_effect(const SeqRenderData *context,
else { else {
uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr; uchar *rect1 = nullptr, *rect2 = nullptr, *rect_out = nullptr;
slice_get_byte_buffers( slice_get_byte_buffers(context, ibuf1, ibuf2, out, start_line, &rect1, &rect2, &rect_out);
context, ibuf1, ibuf2, nullptr, out, start_line, &rect1, &rect2, nullptr, &rect_out);
do_drop_effect_byte(fac, x, y, rect1, rect2, rect_out); do_drop_effect_byte(fac, x, y, rect1, rect2, rect_out);
do_alphaover_effect(fac, x, y, rect1, rect2, rect_out); do_alphaover_effect(fac, x, y, rect1, rect2, rect_out);
@@ -2485,8 +2415,7 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context,
float /*timeline_frame*/, float /*timeline_frame*/,
float /*fac*/, float /*fac*/,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf * /*ibuf2*/, ImBuf * /*ibuf2*/)
ImBuf * /*ibuf3*/)
{ {
using namespace blender; using namespace blender;
@@ -2502,7 +2431,7 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context,
const bool is_float = ibuf1->float_buffer.data; const bool is_float = ibuf1->float_buffer.data;
/* Horizontal blur: create output, blur ibuf1 into it. */ /* Horizontal blur: create output, blur ibuf1 into it. */
ImBuf *out = prepare_effect_imbufs(context, ibuf1, nullptr, nullptr); ImBuf *out = prepare_effect_imbufs(context, ibuf1, nullptr);
threading::parallel_for(IndexRange(context->recty), 32, [&](const IndexRange y_range) { threading::parallel_for(IndexRange(context->recty), 32, [&](const IndexRange y_range) {
const int y_first = y_range.first(); const int y_first = y_range.first();
const int y_size = y_range.size(); const int y_size = y_range.size();
@@ -2530,7 +2459,7 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context,
/* Vertical blur: create output, blur previous output into it. */ /* Vertical blur: create output, blur previous output into it. */
ibuf1 = out; ibuf1 = out;
out = prepare_effect_imbufs(context, ibuf1, nullptr, nullptr); out = prepare_effect_imbufs(context, ibuf1, nullptr);
threading::parallel_for(IndexRange(context->recty), 32, [&](const IndexRange y_range) { threading::parallel_for(IndexRange(context->recty), 32, [&](const IndexRange y_range) {
const int y_first = y_range.first(); const int y_first = y_range.first();
const int y_size = y_range.size(); const int y_size = y_range.size();
@@ -3130,13 +3059,12 @@ static ImBuf *do_text_effect(const SeqRenderData *context,
Sequence *seq, Sequence *seq,
float /*timeline_frame*/, float /*timeline_frame*/,
float /*fac*/, float /*fac*/,
ImBuf * /* ibuf1*/, ImBuf * /*ibuf1*/,
ImBuf * /* ibuf2*/, ImBuf * /*ibuf2*/)
ImBuf * /* ibuf3*/)
{ {
/* NOTE: text rasterization only fills in part of output image, /* NOTE: text rasterization only fills in part of output image,
* need to clear it. */ * need to clear it. */
ImBuf *out = prepare_effect_imbufs(context, nullptr, nullptr, nullptr, false); ImBuf *out = prepare_effect_imbufs(context, nullptr, nullptr, false);
TextVars *data = static_cast<TextVars *>(seq->effectdata); TextVars *data = static_cast<TextVars *>(seq->effectdata);
const int width = out->x; const int width = out->x;
const int height = out->y; const int height = out->y;
@@ -3322,13 +3250,9 @@ static void get_default_fac_fade(const Scene *scene,
*fac = math::clamp(*fac, 0.0f, 1.0f); *fac = math::clamp(*fac, 0.0f, 1.0f);
} }
static ImBuf *init_execution(const SeqRenderData *context, static ImBuf *init_execution(const SeqRenderData *context, ImBuf *ibuf1, ImBuf *ibuf2)
ImBuf *ibuf1,
ImBuf *ibuf2,
ImBuf *ibuf3)
{ {
ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2);
return out; return out;
} }
@@ -3361,7 +3285,6 @@ static SeqEffectHandle get_sequence_effect_impl(int seq_type)
rval.multithreaded = true; rval.multithreaded = true;
rval.early_out = early_out_fade; rval.early_out = early_out_fade;
rval.get_default_fac = get_default_fac_fade; rval.get_default_fac = get_default_fac_fade;
rval.init_execution = gammacross_init_execution;
rval.execute_slice = do_gammacross_effect; rval.execute_slice = do_gammacross_effect;
break; break;
case SEQ_TYPE_ADD: case SEQ_TYPE_ADD:
+1 -6
View File
@@ -243,16 +243,11 @@ void SEQ_query_strip_effect_chain(const Scene *scene,
if (reference_strip->seq2) { if (reference_strip->seq2) {
SEQ_query_strip_effect_chain(scene, reference_strip->seq2, seqbase, strips); SEQ_query_strip_effect_chain(scene, reference_strip->seq2, seqbase, strips);
} }
if (reference_strip->seq3) {
SEQ_query_strip_effect_chain(scene, reference_strip->seq3, seqbase, strips);
}
} }
/* Find all strips connected to reference_strip. */ /* Find all strips connected to reference_strip. */
LISTBASE_FOREACH (Sequence *, seq_test, seqbase) { LISTBASE_FOREACH (Sequence *, seq_test, seqbase) {
if (seq_test->seq1 == reference_strip || seq_test->seq2 == reference_strip || if (seq_test->seq1 == reference_strip || seq_test->seq2 == reference_strip) {
seq_test->seq3 == reference_strip)
{
SEQ_query_strip_effect_chain(scene, seq_test, seqbase, strips); SEQ_query_strip_effect_chain(scene, seq_test, seqbase, strips);
} }
} }
+16 -21
View File
@@ -787,7 +787,7 @@ struct RenderEffectInitData {
const SeqRenderData *context; const SeqRenderData *context;
Sequence *seq; Sequence *seq;
float timeline_frame, fac; float timeline_frame, fac;
ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *ibuf1, *ibuf2;
ImBuf *out; ImBuf *out;
}; };
@@ -797,7 +797,7 @@ struct RenderEffectThread {
const SeqRenderData *context; const SeqRenderData *context;
Sequence *seq; Sequence *seq;
float timeline_frame, fac; float timeline_frame, fac;
ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *ibuf1, *ibuf2;
ImBuf *out; ImBuf *out;
int start_line, tot_line; int start_line, tot_line;
@@ -818,7 +818,6 @@ static void render_effect_execute_init_handle(void *handle_v,
handle->fac = init_data->fac; handle->fac = init_data->fac;
handle->ibuf1 = init_data->ibuf1; handle->ibuf1 = init_data->ibuf1;
handle->ibuf2 = init_data->ibuf2; handle->ibuf2 = init_data->ibuf2;
handle->ibuf3 = init_data->ibuf3;
handle->out = init_data->out; handle->out = init_data->out;
handle->start_line = start_line; handle->start_line = start_line;
@@ -835,7 +834,6 @@ static void *render_effect_execute_do_thread(void *thread_data_v)
thread_data->fac, thread_data->fac,
thread_data->ibuf1, thread_data->ibuf1,
thread_data->ibuf2, thread_data->ibuf2,
thread_data->ibuf3,
thread_data->start_line, thread_data->start_line,
thread_data->tot_line, thread_data->tot_line,
thread_data->out); thread_data->out);
@@ -849,11 +847,10 @@ ImBuf *seq_render_effect_execute_threaded(SeqEffectHandle *sh,
float timeline_frame, float timeline_frame,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2)
ImBuf *ibuf3)
{ {
RenderEffectInitData init_data; RenderEffectInitData init_data;
ImBuf *out = sh->init_execution(context, ibuf1, ibuf2, ibuf3); ImBuf *out = sh->init_execution(context, ibuf1, ibuf2);
init_data.sh = sh; init_data.sh = sh;
init_data.context = context; init_data.context = context;
@@ -862,7 +859,6 @@ ImBuf *seq_render_effect_execute_threaded(SeqEffectHandle *sh,
init_data.fac = fac; init_data.fac = fac;
init_data.ibuf1 = ibuf1; init_data.ibuf1 = ibuf1;
init_data.ibuf2 = ibuf2; init_data.ibuf2 = ibuf2;
init_data.ibuf3 = ibuf3;
init_data.out = out; init_data.out = out;
IMB_processor_apply_threaded(out->y, IMB_processor_apply_threaded(out->y,
@@ -884,15 +880,14 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context,
int i; int i;
SeqEffectHandle sh = SEQ_effect_handle_get(seq); SeqEffectHandle sh = SEQ_effect_handle_get(seq);
const FCurve *fcu = nullptr; const FCurve *fcu = nullptr;
ImBuf *ibuf[3]; ImBuf *ibuf[2];
Sequence *input[3]; Sequence *input[2];
ImBuf *out = nullptr; ImBuf *out = nullptr;
ibuf[0] = ibuf[1] = ibuf[2] = nullptr; ibuf[0] = ibuf[1] = nullptr;
input[0] = seq->seq1; input[0] = seq->seq1;
input[1] = seq->seq2; input[1] = seq->seq2;
input[2] = seq->seq3;
if (!sh.execute && !(sh.execute_slice && sh.init_execution)) { if (!sh.execute && !(sh.execute_slice && sh.init_execution)) {
/* effect not supported in this version... */ /* effect not supported in this version... */
@@ -917,10 +912,10 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context,
switch (early_out) { switch (early_out) {
case StripEarlyOut::NoInput: case StripEarlyOut::NoInput:
out = sh.execute(context, seq, timeline_frame, fac, nullptr, nullptr, nullptr); out = sh.execute(context, seq, timeline_frame, fac, nullptr, nullptr);
break; break;
case StripEarlyOut::DoEffect: case StripEarlyOut::DoEffect:
for (i = 0; i < 3; i++) { for (i = 0; i < 2; i++) {
/* Speed effect requires time remapping of `timeline_frame` for input(s). */ /* Speed effect requires time remapping of `timeline_frame` for input(s). */
if (input[0] && seq->type == SEQ_TYPE_SPEED) { if (input[0] && seq->type == SEQ_TYPE_SPEED) {
int target_frame = floor( int target_frame = floor(
@@ -937,10 +932,10 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context,
if (ibuf[0] && (ibuf[1] || SEQ_effect_get_num_inputs(seq->type) == 1)) { if (ibuf[0] && (ibuf[1] || SEQ_effect_get_num_inputs(seq->type) == 1)) {
if (sh.multithreaded) { if (sh.multithreaded) {
out = seq_render_effect_execute_threaded( out = seq_render_effect_execute_threaded(
&sh, context, seq, timeline_frame, fac, ibuf[0], ibuf[1], ibuf[2]); &sh, context, seq, timeline_frame, fac, ibuf[0], ibuf[1]);
} }
else { else {
out = sh.execute(context, seq, timeline_frame, fac, ibuf[0], ibuf[1], ibuf[2]); out = sh.execute(context, seq, timeline_frame, fac, ibuf[0], ibuf[1]);
} }
} }
break; break;
@@ -956,7 +951,7 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context,
break; break;
} }
for (i = 0; i < 3; i++) { for (i = 0; i < 2; i++) {
IMB_freeImBuf(ibuf[i]); IMB_freeImBuf(ibuf[i]);
} }
@@ -1955,19 +1950,19 @@ static ImBuf *seq_render_strip_stack_apply_effect(
if (swap_input) { if (swap_input) {
if (sh.multithreaded) { if (sh.multithreaded) {
out = seq_render_effect_execute_threaded( out = seq_render_effect_execute_threaded(
&sh, context, seq, timeline_frame, fac, ibuf2, ibuf1, nullptr); &sh, context, seq, timeline_frame, fac, ibuf2, ibuf1);
} }
else { else {
out = sh.execute(context, seq, timeline_frame, fac, ibuf2, ibuf1, nullptr); out = sh.execute(context, seq, timeline_frame, fac, ibuf2, ibuf1);
} }
} }
else { else {
if (sh.multithreaded) { if (sh.multithreaded) {
out = seq_render_effect_execute_threaded( out = seq_render_effect_execute_threaded(
&sh, context, seq, timeline_frame, fac, ibuf1, ibuf2, nullptr); &sh, context, seq, timeline_frame, fac, ibuf1, ibuf2);
} }
else { else {
out = sh.execute(context, seq, timeline_frame, fac, ibuf1, ibuf2, nullptr); out = sh.execute(context, seq, timeline_frame, fac, ibuf1, ibuf2);
} }
} }
+1 -2
View File
@@ -34,8 +34,7 @@ ImBuf *seq_render_effect_execute_threaded(SeqEffectHandle *sh,
float timeline_frame, float timeline_frame,
float fac, float fac,
ImBuf *ibuf1, ImBuf *ibuf1,
ImBuf *ibuf2, ImBuf *ibuf2);
ImBuf *ibuf3);
void seq_imbuf_to_sequencer_space(const Scene *scene, ImBuf *ibuf, bool make_float); void seq_imbuf_to_sequencer_space(const Scene *scene, ImBuf *ibuf, bool make_float);
blender::Vector<Sequence *> seq_get_shown_sequences( blender::Vector<Sequence *> seq_get_shown_sequences(
const Scene *scene, ListBase *channels, ListBase *seqbase, int timeline_frame, int chanshown); const Scene *scene, ListBase *channels, ListBase *seqbase, int timeline_frame, int chanshown);
@@ -309,9 +309,6 @@ static void seq_new_fix_links_recursive(Sequence *seq)
if (seq->seq2 && seq->seq2->tmp) { if (seq->seq2 && seq->seq2->tmp) {
seq->seq2 = static_cast<Sequence *>(seq->seq2->tmp); seq->seq2 = static_cast<Sequence *>(seq->seq2->tmp);
} }
if (seq->seq3 && seq->seq3->tmp) {
seq->seq3 = static_cast<Sequence *>(seq->seq3->tmp);
}
} }
else if (seq->type == SEQ_TYPE_META) { else if (seq->type == SEQ_TYPE_META) {
LISTBASE_FOREACH (Sequence *, seqn, &seq->seqbase) { LISTBASE_FOREACH (Sequence *, seqn, &seq->seqbase) {
@@ -795,12 +792,6 @@ static bool seq_read_data_cb(Sequence *seq, void *user_data)
BLO_read_struct(reader, Sequence, &seq->seq1); BLO_read_struct(reader, Sequence, &seq->seq1);
BLO_read_struct(reader, Sequence, &seq->seq2); BLO_read_struct(reader, Sequence, &seq->seq2);
BLO_read_struct(reader, Sequence, &seq->seq3);
/* a patch: after introduction of effects with 3 input strips */
if (seq->seq3 == nullptr) {
seq->seq3 = seq->seq2;
}
BLO_read_data_address(reader, &seq->effectdata); BLO_read_data_address(reader, &seq->effectdata);
BLO_read_struct(reader, Stereo3dFormat, &seq->stereo3d_format); BLO_read_struct(reader, Stereo3dFormat, &seq->stereo3d_format);
@@ -167,7 +167,6 @@ Sequence *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, SeqLoadData *loa
sh.init(seq); sh.init(seq);
seq->seq1 = load_data->effect.seq1; seq->seq1 = load_data->effect.seq1;
seq->seq2 = load_data->effect.seq2; seq->seq2 = load_data->effect.seq2;
seq->seq3 = load_data->effect.seq3;
if (SEQ_effect_get_num_inputs(seq->type) == 1) { if (SEQ_effect_get_num_inputs(seq->type) == 1) {
seq->blend_mode = seq->seq1->blend_mode; seq->blend_mode = seq->seq1->blend_mode;
@@ -364,14 +364,6 @@ static bool seq_edit_split_effect_inputs_intersect(const Scene *scene,
scene, seq->seq2, timeline_frame); scene, seq->seq2, timeline_frame);
} }
} }
if (seq->seq3) {
input_does_intersect |= seq_edit_split_effect_intersect_check(
scene, seq->seq3, timeline_frame);
if ((seq->seq1->type & SEQ_TYPE_EFFECT) != 0) {
input_does_intersect |= seq_edit_split_effect_inputs_intersect(
scene, seq->seq3, timeline_frame);
}
}
return input_does_intersect; return input_does_intersect;
} }
@@ -377,8 +377,7 @@ bool SEQ_relations_render_loop_check(Sequence *seq_main, Sequence *seq)
} }
if ((seq_main->seq1 && SEQ_relations_render_loop_check(seq_main->seq1, seq)) || if ((seq_main->seq1 && SEQ_relations_render_loop_check(seq_main->seq1, seq)) ||
(seq_main->seq2 && SEQ_relations_render_loop_check(seq_main->seq2, seq)) || (seq_main->seq2 && SEQ_relations_render_loop_check(seq_main->seq2, seq)))
(seq_main->seq3 && SEQ_relations_render_loop_check(seq_main->seq3, seq)))
{ {
return true; return true;
} }
@@ -59,16 +59,13 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase)
if (seq->flag & SELECT) { if (seq->flag & SELECT) {
if ((seq->seq1 && (seq->seq1->flag & SELECT) == 0) || if ((seq->seq1 && (seq->seq1->flag & SELECT) == 0) ||
(seq->seq2 && (seq->seq2->flag & SELECT) == 0) || (seq->seq2 && (seq->seq2->flag & SELECT) == 0))
(seq->seq3 && (seq->seq3->flag & SELECT) == 0))
{ {
return false; return false;
} }
} }
else { else {
if ((seq->seq1 && (seq->seq1->flag & SELECT)) || (seq->seq2 && (seq->seq2->flag & SELECT)) || if ((seq->seq1 && (seq->seq1->flag & SELECT)) || (seq->seq2 && (seq->seq2->flag & SELECT))) {
(seq->seq3 && (seq->seq3->flag & SELECT)))
{
return false; return false;
} }
} }