VSE: Add filter method to strip transform
Previously, nearest interpolation filter was used for preview, because it offered good performance and bilinear was used for rendering. This is not always desirable behavior, so filter method can now be chosen by user. Chosen method will be used for preview and for rendering. Reviewed By: ISS Differential Revision: https://developer.blender.org/D12807
This commit is contained in:
parent
6766699530
commit
1c5f2e49b7
|
@ -2027,6 +2027,9 @@ class SEQUENCER_PT_adjust_transform(SequencerButtonsPanel, Panel):
|
|||
layout.use_property_split = True
|
||||
layout.active = not strip.mute
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(strip.transform, "filter", text="Filter")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(strip.transform, "offset_x", text="Position X")
|
||||
col.prop(strip.transform, "offset_y", text="Y")
|
||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 1
|
||||
#define BLENDER_FILE_SUBVERSION 2
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and show a warning if the file
|
||||
|
|
|
@ -1107,6 +1107,15 @@ static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data))
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool seq_transform_filter_set(Sequence *seq, void *UNUSED(user_data))
|
||||
{
|
||||
StripTransform *transform = seq->strip->transform;
|
||||
if (seq->strip->transform != NULL) {
|
||||
transform->filter = SEQ_TRANSFORM_FILTER_BILINEAR;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void do_version_subsurface_methods(bNode *node)
|
||||
{
|
||||
if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
|
||||
|
@ -2549,6 +2558,14 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 302, 2)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
if (scene->ed != NULL) {
|
||||
SEQ_for_each_callback(&scene->ed->seqbase, seq_transform_filter_set, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
|
|
@ -80,6 +80,7 @@ typedef struct StripTransform {
|
|||
float rotation;
|
||||
/** 0-1 range, use SEQ_image_transform_origin_offset_pixelspace_get to convert to pixel space. */
|
||||
float origin[2];
|
||||
int filter;
|
||||
} StripTransform;
|
||||
|
||||
typedef struct StripColorBalance {
|
||||
|
@ -788,6 +789,12 @@ typedef enum SequenceColorTag {
|
|||
SEQUENCE_COLOR_TOT,
|
||||
} SequenceColorTag;
|
||||
|
||||
/* Sequence->StripTransform->filter */
|
||||
enum {
|
||||
SEQ_TRANSFORM_FILTER_NEAREST = 0,
|
||||
SEQ_TRANSFORM_FILTER_BILINEAR = 1,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1456,6 +1456,12 @@ static void rna_def_strip_crop(BlenderRNA *brna)
|
|||
RNA_def_struct_path_func(srna, "rna_SequenceCrop_path");
|
||||
}
|
||||
|
||||
static const EnumPropertyItem transform_filter_items[] = {
|
||||
{SEQ_TRANSFORM_FILTER_NEAREST, "NEAREST", 0, "Nearest", ""},
|
||||
{SEQ_TRANSFORM_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static void rna_def_strip_transform(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
|
@ -1502,6 +1508,13 @@ static void rna_def_strip_transform(BlenderRNA *brna)
|
|||
RNA_def_property_ui_range(prop, 0, 1, 1, 3);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
|
||||
|
||||
prop = RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "filter");
|
||||
RNA_def_property_enum_items(prop, transform_filter_items);
|
||||
RNA_def_property_enum_default(prop, SEQ_TRANSFORM_FILTER_BILINEAR);
|
||||
RNA_def_property_ui_text(prop, "Filter", "Type of filter to use for image transformation");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
|
||||
|
||||
RNA_def_struct_path_func(srna, "rna_SequenceTransform_path");
|
||||
}
|
||||
|
||||
|
|
|
@ -524,8 +524,15 @@ static void sequencer_preprocess_transform_crop(
|
|||
const float crop_scale_factor = do_scale_to_render_size ? preview_scale_factor : 1.0f;
|
||||
sequencer_image_crop_init(seq, in, crop_scale_factor, &source_crop);
|
||||
|
||||
const eIMBInterpolationFilterMode filter = context->for_render ? IMB_FILTER_BILINEAR :
|
||||
IMB_FILTER_NEAREST;
|
||||
eIMBInterpolationFilterMode filter;
|
||||
const StripTransform *transform = seq->strip->transform;
|
||||
if (transform->filter == SEQ_TRANSFORM_FILTER_NEAREST) {
|
||||
filter = IMB_FILTER_NEAREST;
|
||||
}
|
||||
else {
|
||||
filter = IMB_FILTER_BILINEAR;
|
||||
}
|
||||
|
||||
IMB_transform(in, out, IMB_TRANSFORM_MODE_CROP_SRC, filter, transform_matrix, &source_crop);
|
||||
|
||||
if (!seq_image_transform_transparency_gained(context, seq)) {
|
||||
|
|
|
@ -85,6 +85,7 @@ static Strip *seq_strip_alloc(int type)
|
|||
strip->transform->scale_y = 1;
|
||||
strip->transform->origin[0] = 0.5f;
|
||||
strip->transform->origin[1] = 0.5f;
|
||||
strip->transform->filter = SEQ_TRANSFORM_FILTER_BILINEAR;
|
||||
strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue