VSE: remove lazy loading for strip crop and transform

Lazy loading prevented showing values in UI.
Now we just gray them out if not used.
This commit is contained in:
Richard Antalik
2019-05-23 11:50:15 -07:00
parent a3bc869038
commit 1fd7b380f4
4 changed files with 48 additions and 19 deletions

View File

@@ -847,13 +847,10 @@ class SEQUENCER_PT_adjust_offset(SequencerButtonsPanel, Panel):
layout.use_property_split = True
layout.use_property_decorate = False
if strip.use_translation:
col = layout.column(align=True)
col.prop(strip.transform, "offset_x", text="Position X")
col.prop(strip.transform, "offset_y", text="Y")
col.active = strip.use_translation
else:
layout.separator()
col = layout.column(align=True)
col.prop(strip.transform, "offset_x", text="Position X")
col.prop(strip.transform, "offset_y", text="Position Y")
col.active = strip.use_translation
class SEQUENCER_PT_adjust_crop(SequencerButtonsPanel, Panel):
@@ -877,14 +874,12 @@ class SEQUENCER_PT_adjust_crop(SequencerButtonsPanel, Panel):
layout.use_property_split = True
layout.use_property_decorate = False
if strip.use_crop:
col = layout.column(align=True)
col.prop(strip.crop, "min_x")
col.prop(strip.crop, "max_x")
col.prop(strip.crop, "max_y")
col.prop(strip.crop, "min_y")
else:
layout.separator()
col = layout.column(align=True)
col.prop(strip.crop, "min_x")
col.prop(strip.crop, "max_x")
col.prop(strip.crop, "max_y")
col.prop(strip.crop, "min_y")
col.active = strip.use_crop
class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):

View File

@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 71
#define BLENDER_SUBVERSION 72
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -5352,6 +5352,15 @@ static void seq_load_apply(Main *bmain, Scene *scene, Sequence *seq, SeqLoadInfo
}
}
static Strip *seq_strip_alloc()
{
Strip *strip = MEM_callocN(sizeof(Strip), "strip");
strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
return strip;
}
Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine)
{
Sequence *seq;
@@ -5460,7 +5469,7 @@ Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq->blend_mode = SEQ_TYPE_ALPHAOVER;
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = seq_strip_alloc();
seq->len = seq_load->len ? seq_load->len : 1;
strip->us = 1;
@@ -5515,7 +5524,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = seq_strip_alloc();
/* We add a very small negative offset here, because
* ceil(132.0) == 133.0, not nice with videos, see T47135. */
seq->len = (int)ceil((double)info.length * FPS - 1e-4);
@@ -5647,7 +5656,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
}
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = seq_strip_alloc();
seq->len = IMB_anim_get_duration(anim_arr[0], IMB_TC_RECORD_RUN);
strip->us = 1;

View File

@@ -715,6 +715,23 @@ static void do_version_constraints_copy_scale_power(ListBase *lb)
}
}
static void do_versions_seq_alloc_transform_and_crop(ListBase *seqbase)
{
for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) {
if (seq->strip->transform == NULL) {
seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
}
if (seq->strip->crop == NULL) {
seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
}
if (seq->seqbase.first != NULL) {
do_versions_seq_alloc_transform_and_crop(&seq->seqbase);
}
}
}
void do_versions_after_linking_280(Main *bmain)
{
bool use_collection_compat_28 = true;
@@ -3487,6 +3504,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 72)) {
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->ed != NULL) {
do_versions_seq_alloc_transform_and_crop(&scene->ed->seqbase);
}
}
}
{
/* Versioning code until next subversion bump goes here. */
}