diff --git a/scripts/startup/bl_ui/space_sequencer.py b/scripts/startup/bl_ui/space_sequencer.py index a2f713337c5..0d56a5f73f3 100644 --- a/scripts/startup/bl_ui/space_sequencer.py +++ b/scripts/startup/bl_ui/space_sequencer.py @@ -691,8 +691,7 @@ class SEQUENCER_MT_change(Menu): if strip and strip.type in { 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'GAMMA_CROSS', 'MULTIPLY', 'WIPE', 'GLOW', - 'TRANSFORM', 'SPEED', 'MULTICAM', 'ADJUSTMENT', - 'GAUSSIAN_BLUR', + 'SPEED', 'MULTICAM', 'ADJUSTMENT', 'GAUSSIAN_BLUR', }: layout.menu("SEQUENCER_MT_strip_effect_change") layout.operator("sequencer.swap_inputs") @@ -850,7 +849,6 @@ class SEQUENCER_MT_add_effect(Menu): layout.separator() col = layout.column() - col.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM' col.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED' col.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW' col.operator("sequencer.effect_strip_add", text="Gaussian Blur").type = 'GAUSSIAN_BLUR' @@ -1090,7 +1088,6 @@ class SEQUENCER_MT_strip_effect_change(Menu): layout.separator() col = layout.column() - col.operator("sequencer.change_effect_type", text="Transform").type = 'TRANSFORM' col.operator("sequencer.change_effect_type", text="Speed Control").type = 'SPEED' col.operator("sequencer.change_effect_type", text="Glow").type = 'GLOW' col.operator("sequencer.change_effect_type", text="Gaussian Blur").type = 'GAUSSIAN_BLUR' @@ -1224,8 +1221,7 @@ class SEQUENCER_MT_strip(Menu): if strip_type in { 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'GAMMA_CROSS', 'MULTIPLY', 'WIPE', 'GLOW', - 'TRANSFORM', 'SPEED', 'MULTICAM', 'ADJUSTMENT', - 'GAUSSIAN_BLUR', + 'SPEED', 'MULTICAM', 'ADJUSTMENT', 'GAUSSIAN_BLUR', }: layout.separator() layout.menu("SEQUENCER_MT_strip_effect") @@ -1408,8 +1404,7 @@ class SEQUENCER_MT_context_menu(Menu): if strip_type in { 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'GAMMA_CROSS', 'MULTIPLY', 'WIPE', 'GLOW', - 'TRANSFORM', 'SPEED', 'MULTICAM', 'ADJUSTMENT', - 'GAUSSIAN_BLUR', + 'SPEED', 'MULTICAM', 'ADJUSTMENT', 'GAUSSIAN_BLUR', }: layout.separator() layout.menu("SEQUENCER_MT_strip_effect") @@ -1657,8 +1652,7 @@ class SEQUENCER_PT_strip(SequencerButtonsPanel, Panel): if strip_type in { 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'MULTIPLY', - 'GLOW', 'TRANSFORM', 'SPEED', 'MULTICAM', - 'GAUSSIAN_BLUR', 'COLORMIX', + 'GLOW', 'SPEED', 'MULTICAM', 'GAUSSIAN_BLUR', 'COLORMIX', }: icon_header = 'SHADERFX' elif strip_type in { @@ -1749,8 +1743,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): return strip.type in { 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', - 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', - 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED', + 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'WIPE', 'GLOW', 'COLOR', 'SPEED', 'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT', 'COLORMIX', } @@ -1814,30 +1807,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): row = layout.row(align=True, heading="Interpolation") row.prop(strip, "use_frame_interpolate", text="") - elif strip_type == 'TRANSFORM': - col = layout.column() - - col.prop(strip, "interpolation") - col.prop(strip, "translation_unit") - col = layout.column(align=True) - col.prop(strip, "translate_start_x", text="Position X") - col.prop(strip, "translate_start_y", text="Y") - - col.separator() - - colsub = col.column(align=True) - colsub.prop(strip, "use_uniform_scale") - if strip.use_uniform_scale: - colsub = col.column(align=True) - colsub.prop(strip, "scale_start_x", text="Scale") - else: - col.prop(strip, "scale_start_x", text="Scale X") - col.prop(strip, "scale_start_y", text="Y") - - col.separator() - - col.prop(strip, "rotation_start", text="Rotation") - elif strip_type == 'MULTICAM': col = layout.column(align=True) strip_channel = strip.channel @@ -2629,8 +2598,7 @@ class SEQUENCER_PT_adjust_video(SequencerButtonsPanel, Panel): 'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK', 'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', - 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', - 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX', + 'WIPE', 'GLOW', 'COLOR', 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX', } def draw(self, context): @@ -2666,8 +2634,7 @@ class SEQUENCER_PT_adjust_color(SequencerButtonsPanel, Panel): 'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK', 'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', - 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', - 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX', + 'WIPE', 'GLOW', 'COLOR', 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX', } def draw(self, context): diff --git a/source/blender/blenloader/intern/versioning_500.cc b/source/blender/blenloader/intern/versioning_500.cc index 336b63c2386..1022feef35d 100644 --- a/source/blender/blenloader/intern/versioning_500.cc +++ b/source/blender/blenloader/intern/versioning_500.cc @@ -67,9 +67,13 @@ #include "BLO_read_write.hh" +#include "SEQ_edit.hh" +#include "SEQ_effects.hh" #include "SEQ_iterator.hh" #include "SEQ_modifier.hh" +#include "SEQ_relations.hh" #include "SEQ_sequencer.hh" +#include "SEQ_utils.hh" #include "WM_api.hh" @@ -2461,6 +2465,38 @@ static bool window_has_sequence_editor_open(const wmWindow *win) return false; } +/* Merge transform effect properties with strip transform. Because this effect could use modifiers, + * change its type to gaussian blur with 0 radius. */ +static void sequencer_substitute_transform_effects(Scene *scene) +{ + blender::seq::for_each_callback(&scene->ed->seqbase, [&](Strip *strip) -> bool { + if (strip->type == STRIP_TYPE_TRANSFORM_LEGACY && strip->effectdata != nullptr) { + TransformVarsLegacy *tv = static_cast(strip->effectdata); + StripTransform *transform = strip->data->transform; + blender::float2 offset(tv->xIni, tv->yIni); + if (tv->percent == 1) { + blender::float2 scene_resolution(scene->r.xsch, scene->r.ysch); + offset *= scene_resolution; + } + transform->xofs += offset.x; + transform->yofs += offset.y; + transform->scale_x *= tv->ScalexIni; + transform->scale_y *= tv->ScaleyIni; + transform->rotation += tv->rotIni; + blender::seq::EffectHandle sh = blender::seq::strip_effect_handle_get(strip); + sh.free(strip, true); + strip->type = STRIP_TYPE_GAUSSIAN_BLUR; + sh = blender::seq::strip_effect_handle_get(strip); + sh.init(strip); + GaussianBlurVars *gv = static_cast(strip->effectdata); + gv->size_x = gv->size_y = 0.0f; + blender::seq::edit_strip_name_set(scene, strip, "Transform Placeholder (Migrated)"); + blender::seq::ensure_unique_name(strip, scene); + } + return true; + }); +} + void do_versions_after_linking_500(FileData *fd, Main *bmain) { if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 9)) { @@ -2563,6 +2599,14 @@ void do_versions_after_linking_500(FileData *fd, Main *bmain) } } + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 97)) { + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (scene->ed != nullptr) { + sequencer_substitute_transform_effects(scene); + } + } + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check. diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 4c17bf873d8..5dec761cdd3 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -2847,7 +2847,6 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case STRIP_TYPE_ALPHAUNDER: case STRIP_TYPE_COLORMIX: case STRIP_TYPE_MULTICAM: - case STRIP_TYPE_TRANSFORM: case STRIP_TYPE_SPEED: case STRIP_TYPE_GLOW: case STRIP_TYPE_GAUSSIAN_BLUR: diff --git a/source/blender/editors/space_sequencer/sequencer_add.cc b/source/blender/editors/space_sequencer/sequencer_add.cc index 33532dc75ac..be63904ce0b 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.cc +++ b/source/blender/editors/space_sequencer/sequencer_add.cc @@ -2047,8 +2047,6 @@ static std::string sequencer_add_effect_strip_get_description(bContext * /*C*/, return TIP_("Add a wipe transition strip for two selected strips with video content"); case STRIP_TYPE_GLOW: return TIP_("Add a glow effect strip for a single selected strip with video content"); - case STRIP_TYPE_TRANSFORM: - return TIP_("Add a transform effect strip for a single selected strip with video content"); case STRIP_TYPE_COLOR: return TIP_("Add a color strip to the sequencer"); case STRIP_TYPE_SPEED: diff --git a/source/blender/editors/space_sequencer/sequencer_edit.cc b/source/blender/editors/space_sequencer/sequencer_edit.cc index 098dcc4141f..3a2d5145c06 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.cc +++ b/source/blender/editors/space_sequencer/sequencer_edit.cc @@ -2998,7 +2998,6 @@ const EnumPropertyItem sequencer_prop_effect_types[] = { {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply color channels from two videos"}, {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", "Sweep a transition line across the frame"}, {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", "Add blur and brightness to light areas"}, - {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Apply scale, rotation, or translation"}, {STRIP_TYPE_COLOR, "COLOR", 0, "Color", "Add a simple color strip"}, {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", "Timewarp video strips, modifying playback speed"}, {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", "Control active camera angles"}, diff --git a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc index 0622ae57611..4426d9a251c 100644 --- a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc @@ -365,7 +365,6 @@ static void color3ubv_from_seq(const Scene *curscene, break; /* Effects. */ - case STRIP_TYPE_TRANSFORM: case STRIP_TYPE_SPEED: case STRIP_TYPE_ADD: case STRIP_TYPE_SUB: @@ -410,9 +409,6 @@ static void color3ubv_from_seq(const Scene *curscene, else if (strip->type == STRIP_TYPE_SPEED) { rgb_byte_set_hue_float_offset(r_col, 0.72); } - else if (strip->type == STRIP_TYPE_TRANSFORM) { - rgb_byte_set_hue_float_offset(r_col, 0.75); - } else if (strip->type == STRIP_TYPE_MULTICAM) { rgb_byte_set_hue_float_offset(r_col, 0.85); } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 35a697d9779..27c593d1456 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -412,7 +412,8 @@ typedef struct GlowVars { int bNoComp; } GlowVars; -typedef struct TransformVars { +/* Removed in 5.0. Only used in versioning and blend reading. */ +typedef struct TransformVarsLegacy { float ScalexIni; float ScaleyIni; float xIni; @@ -422,7 +423,7 @@ typedef struct TransformVars { int interpolation; /** Preserve aspect/ratio when scaling. */ int uniform_scale; -} TransformVars; +} TransformVarsLegacy; typedef struct SolidColorVars { float col[3]; @@ -822,10 +823,11 @@ typedef enum StripType { STRIP_TYPE_MUL = 14, /* Removed (behavior was the same as alpha-over), only used when reading old files. */ STRIP_TYPE_OVERDROP_REMOVED = 15, - /* STRIP_TYPE_PLUGIN = 24, */ /* Removed */ + /* STRIP_TYPE_PLUGIN = 24, */ /* Removed. */ STRIP_TYPE_WIPE = 25, STRIP_TYPE_GLOW = 26, - STRIP_TYPE_TRANSFORM = 27, + /* Removed in 5.0, used only for versioning. */ + STRIP_TYPE_TRANSFORM_LEGACY = 27, STRIP_TYPE_COLOR = 28, STRIP_TYPE_SPEED = 29, STRIP_TYPE_MULTICAM = 30, diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index 2752a13eefb..b811420d80e 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -53,6 +53,7 @@ DNA_STRUCT_RENAME(SpaceButs, SpaceProperties) DNA_STRUCT_RENAME(SpaceIpo, SpaceGraph) DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner) DNA_STRUCT_RENAME(Strip, StripData) +DNA_STRUCT_RENAME(TransformVars, TransformVarsLegacy) DNA_STRUCT_RENAME_MEMBER(ActionSlot, name, identifier) DNA_STRUCT_RENAME_MEMBER(AnimData, slot_name, last_slot_identifier) DNA_STRUCT_RENAME_MEMBER(AnimData, tmp_slot_name, tmp_last_slot_identifier) diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index c73585db8ca..3a7dc0b899e 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -912,8 +912,6 @@ static StructRNA *rna_Strip_refine(PointerRNA *ptr) return &RNA_WipeStrip; case STRIP_TYPE_GLOW: return &RNA_GlowStrip; - case STRIP_TYPE_TRANSFORM: - return &RNA_TransformStrip; case STRIP_TYPE_COLOR: return &RNA_ColorStrip; case STRIP_TYPE_SPEED: @@ -2278,7 +2276,6 @@ static void rna_def_strip(BlenderRNA *brna) {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", ""}, - {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, {STRIP_TYPE_COLOR, "COLOR", 0, "Color", ""}, {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", ""}, {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, @@ -3358,74 +3355,6 @@ static void rna_def_glow(StructRNA *srna) RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); } -static void rna_def_transform(StructRNA *srna) -{ - PropertyRNA *prop; - - static const EnumPropertyItem interpolation_items[] = { - {0, "NONE", 0, "None", "No interpolation"}, - {1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"}, - {2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"}, - {0, nullptr, 0, nullptr, nullptr}, - }; - - static const EnumPropertyItem translation_unit_items[] = { - {0, "PIXELS", 0, "Pixels", ""}, - {1, "PERCENT", 0, "Percent", ""}, - {0, nullptr, 0, nullptr, nullptr}, - }; - - RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata"); - - prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_float_sdna(prop, nullptr, "ScalexIni"); - RNA_def_property_ui_text(prop, "Scale X", "Amount to scale the input in the X axis"); - RNA_def_property_ui_range(prop, 0, 10, 3, 6); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_float_sdna(prop, nullptr, "ScaleyIni"); - RNA_def_property_ui_text(prop, "Scale Y", "Amount to scale the input in the Y axis"); - RNA_def_property_ui_range(prop, 0, 10, 3, 6); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "uniform_scale", 0); - RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "xIni"); - RNA_def_property_ui_text(prop, "Translate X", "Amount to move the input on the X axis"); - RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "yIni"); - RNA_def_property_ui_text(prop, "Translate Y", "Amount to move the input on the Y axis"); - RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "rotIni"); - RNA_def_property_ui_text(prop, "Rotation", "Degrees to rotate the input"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, nullptr, "percent"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */ - RNA_def_property_enum_items(prop, translation_unit_items); - RNA_def_property_ui_text(prop, "Translation Unit", "Unit of measure to translate the input"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); - - prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, interpolation_items); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */ - RNA_def_property_ui_text( - prop, "Interpolation", "Method to determine how missing pixels are created"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_invalidate_raw_update"); -} - static void rna_def_solid_color(StructRNA *srna) { PropertyRNA *prop; @@ -3767,11 +3696,6 @@ static EffectInfo def_effects[] = { rna_def_speed_control, 1}, {"SubtractStrip", "Subtract Strip", "Subtract Strip", nullptr, 2}, - {"TransformStrip", - "Transform Strip", - "Sequence strip applying affine transformations to other strips", - rna_def_transform, - 1}, {"WipeStrip", "Wipe Strip", "Sequence strip creating a wipe transition", rna_def_wipe, 2}, {"GaussianBlurStrip", "Gaussian Blur Strip", diff --git a/source/blender/makesrna/intern/rna_sequencer_api.cc b/source/blender/makesrna/intern/rna_sequencer_api.cc index 2aaba7f5c1a..5e0da2df1e4 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.cc +++ b/source/blender/makesrna/intern/rna_sequencer_api.cc @@ -839,7 +839,6 @@ void RNA_api_strips(StructRNA *srna, const bool metastrip) {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply color channels from two videos"}, {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", "Sweep a transition line across the frame"}, {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", "Add blur and brightness to light areas"}, - {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Apply scale, rotation, or translation"}, {STRIP_TYPE_COLOR, "COLOR", 0, "Color", "Add a simple color strip"}, {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", "Timewarp video strips, modifying playback speed"}, {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", "Control active camera angles"}, diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt index bd53ebb4cfd..bf287af3bc9 100644 --- a/source/blender/sequencer/CMakeLists.txt +++ b/source/blender/sequencer/CMakeLists.txt @@ -67,7 +67,6 @@ set(SRC intern/effects/vse_effect_solid_color.cc intern/effects/vse_effect_speed.cc intern/effects/vse_effect_text.cc - intern/effects/vse_effect_transform.cc intern/effects/vse_effect_wipe.cc intern/modifiers/MOD_brightness_contrast.cc intern/modifiers/MOD_color_balance.cc diff --git a/source/blender/sequencer/intern/effects/effects.cc b/source/blender/sequencer/intern/effects/effects.cc index 39966f52c1c..836d262b29c 100644 --- a/source/blender/sequencer/intern/effects/effects.cc +++ b/source/blender/sequencer/intern/effects/effects.cc @@ -200,9 +200,6 @@ EffectHandle effect_handle_get(StripType strip_type) case STRIP_TYPE_GLOW: glow_effect_get_handle(rval); break; - case STRIP_TYPE_TRANSFORM: - transform_effect_get_handle(rval); - break; case STRIP_TYPE_SPEED: speed_effect_get_handle(rval); break; diff --git a/source/blender/sequencer/intern/effects/vse_effect_transform.cc b/source/blender/sequencer/intern/effects/vse_effect_transform.cc deleted file mode 100644 index d2c8295ef2d..00000000000 --- a/source/blender/sequencer/intern/effects/vse_effect_transform.cc +++ /dev/null @@ -1,200 +0,0 @@ -/* SPDX-FileCopyrightText: 2024 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -/** \file - * \ingroup sequencer - */ - -#include "BLI_math_rotation.h" - -#include "DNA_sequence_types.h" -#include "DNA_space_types.h" - -#include "IMB_imbuf.hh" -#include "IMB_interp.hh" - -#include "SEQ_proxy.hh" -#include "SEQ_render.hh" - -#include "effects.hh" - -namespace blender::seq { - -static void init_transform_effect(Strip *strip) -{ - if (strip->effectdata) { - MEM_freeN(strip->effectdata); - } - - TransformVars *transform = MEM_callocN("transformvars"); - strip->effectdata = transform; - - transform->ScalexIni = 1.0f; - transform->ScaleyIni = 1.0f; - - transform->xIni = 0.0f; - transform->yIni = 0.0f; - - transform->rotIni = 0.0f; - - transform->interpolation = 1; - transform->percent = 1; - transform->uniform_scale = 0; -} - -static int num_inputs_transform() -{ - return 1; -} - -static void free_transform_effect(Strip *strip, const bool /*do_id_user*/) -{ - MEM_SAFE_FREE(strip->effectdata); -} - -static void copy_transform_effect(Strip *dst, const Strip *src, const int /*flag*/) -{ - dst->effectdata = MEM_dupallocN(src->effectdata); -} - -static void transform_image(int x, - int y, - int start_line, - int total_lines, - const ImBuf *ibuf, - ImBuf *out, - float scale_x, - float scale_y, - float translate_x, - float translate_y, - float rotate, - int interpolation) -{ - /* Rotate */ - float s = sinf(rotate); - float c = cosf(rotate); - - float4 *dst_fl = reinterpret_cast(out->float_buffer.data); - uchar4 *dst_ch = reinterpret_cast(out->byte_buffer.data); - - size_t offset = size_t(x) * start_line; - for (int yi = start_line; yi < start_line + total_lines; yi++) { - for (int xi = 0; xi < x; xi++) { - /* Translate point. */ - float xt = xi - translate_x; - float yt = yi - translate_y; - - /* Rotate point with center ref. */ - float xr = c * xt + s * yt; - float yr = -s * xt + c * yt; - - /* Scale point with center ref. */ - xt = xr / scale_x; - yt = yr / scale_y; - - /* Undo reference center point. */ - xt += (x / 2.0f); - yt += (y / 2.0f); - - /* interpolate */ - switch (interpolation) { - case 0: - if (dst_fl) { - dst_fl[offset] = imbuf::interpolate_nearest_border_fl(ibuf, xt, yt); - } - else { - dst_ch[offset] = imbuf::interpolate_nearest_border_byte(ibuf, xt, yt); - } - break; - case 1: - if (dst_fl) { - dst_fl[offset] = imbuf::interpolate_bilinear_border_fl(ibuf, xt, yt); - } - else { - dst_ch[offset] = imbuf::interpolate_bilinear_border_byte(ibuf, xt, yt); - } - break; - case 2: - if (dst_fl) { - dst_fl[offset] = imbuf::interpolate_cubic_bspline_fl(ibuf, xt, yt); - } - else { - dst_ch[offset] = imbuf::interpolate_cubic_bspline_byte(ibuf, xt, yt); - } - break; - } - offset++; - } - } -} - -static ImBuf *do_transform_effect(const RenderData *context, - SeqRenderState * /*state*/, - Strip *strip, - float /*timeline_frame*/, - float /*fac*/, - ImBuf *src1, - ImBuf * /*src2*/) -{ - ImBuf *dst = prepare_effect_imbufs(context, src1, nullptr); - - const TransformVars *transform = (TransformVars *)strip->effectdata; - - /* Scale */ - float scale_x, scale_y; - if (transform->uniform_scale) { - scale_x = scale_y = transform->ScalexIni; - } - else { - scale_x = transform->ScalexIni; - scale_y = transform->ScaleyIni; - } - - const int x = context->rectx; - const int y = context->recty; - - /* Translate */ - float translate_x, translate_y; - if (!transform->percent) { - /* Compensate for render scale. */ - const float size_scale = seq::get_render_scale_factor(*context); - translate_x = transform->xIni * size_scale + (x / 2.0f); - translate_y = transform->yIni * size_scale + (y / 2.0f); - } - else { - translate_x = x * (transform->xIni / 100.0f) + (x / 2.0f); - translate_y = y * (transform->yIni / 100.0f) + (y / 2.0f); - } - - /* Rotate */ - float rotate_radians = DEG2RADF(transform->rotIni); - - blender::threading::parallel_for( - blender::IndexRange(dst->y), 32, [&](blender::IndexRange y_range) { - transform_image(x, - y, - y_range.first(), - y_range.size(), - src1, - dst, - scale_x, - scale_y, - translate_x, - translate_y, - rotate_radians, - transform->interpolation); - }); - return dst; -} - -void transform_effect_get_handle(EffectHandle &rval) -{ - rval.init = init_transform_effect; - rval.num_inputs = num_inputs_transform; - rval.free = free_transform_effect; - rval.copy = copy_transform_effect; - rval.execute = do_transform_effect; -} - -} // namespace blender::seq diff --git a/source/blender/sequencer/intern/sequencer.cc b/source/blender/sequencer/intern/sequencer.cc index e76d608922b..15c38b48687 100644 --- a/source/blender/sequencer/intern/sequencer.cc +++ b/source/blender/sequencer/intern/sequencer.cc @@ -773,9 +773,6 @@ static bool strip_write_data_cb(Strip *strip, void *userdata) case STRIP_TYPE_GLOW: BLO_write_struct(writer, GlowVars, strip->effectdata); break; - case STRIP_TYPE_TRANSFORM: - BLO_write_struct(writer, TransformVars, strip->effectdata); - break; case STRIP_TYPE_GAUSSIAN_BLUR: BLO_write_struct(writer, GaussianBlurVars, strip->effectdata); break; @@ -879,8 +876,8 @@ static bool strip_read_data_cb(Strip *strip, void *user_data) case STRIP_TYPE_GLOW: BLO_read_struct(reader, GlowVars, &strip->effectdata); break; - case STRIP_TYPE_TRANSFORM: - BLO_read_struct(reader, TransformVars, &strip->effectdata); + case STRIP_TYPE_TRANSFORM_LEGACY: + BLO_read_struct(reader, TransformVarsLegacy, &strip->effectdata); break; case STRIP_TYPE_GAUSSIAN_BLUR: BLO_read_struct(reader, GaussianBlurVars, &strip->effectdata); diff --git a/source/blender/sequencer/intern/utils.cc b/source/blender/sequencer/intern/utils.cc index 18e96b6a07a..2e68e2d0da9 100644 --- a/source/blender/sequencer/intern/utils.cc +++ b/source/blender/sequencer/intern/utils.cc @@ -146,8 +146,6 @@ const char *get_default_stripname_by_type(int type) return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Wipe"); case STRIP_TYPE_GLOW: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Glow"); - case STRIP_TYPE_TRANSFORM: - return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Transform"); case STRIP_TYPE_COLOR: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Color"); case STRIP_TYPE_MULTICAM: