[Bf-blender-cvs] [67a822e0868] master: Fix T73056: Cache not invalidated in fade operator

Richard Antalik noreply at git.blender.org
Thu Jun 18 05:54:01 CEST 2020


Commit: 67a822e08684ac7c89f915766920b9ff1c9f5328
Author: Richard Antalik
Date:   Thu Jun 18 05:31:42 2020 +0200
Branches: master
https://developer.blender.org/rB67a822e08684ac7c89f915766920b9ff1c9f5328

Fix T73056: Cache not invalidated in fade operator

This operator is written in python it is inserting keyframes to create fade
effects.

Add Sequence.invalidate() python function to invalidate strip if it is
changed in python.

Perhaps I could implement cache invalidation to actual curve manipulation.
I guess it wouldn't be very hard to do but having means to invalidate form
python is useful as well.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7885

===================================================================

M	release/scripts/startup/bl_operators/sequencer.py
M	source/blender/makesrna/intern/rna_sequencer_api.c

===================================================================

diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index af071561232..e0aaea3c085 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -164,6 +164,7 @@ class SequencerFadesClear(Operator):
             if curve:
                 fcurves.remove(curve)
             setattr(sequence, animated_property, 1.0)
+            sequence.invalidate('COMPOSITE')
 
         return {'FINISHED'}
 
@@ -230,6 +231,7 @@ class SequencerFadesAdd(Operator):
             self.fade_animation_clear(fade_fcurve, fades)
             self.fade_animation_create(fade_fcurve, fades)
             faded_sequences.append(sequence)
+            sequence.invalidate('COMPOSITE')
 
         sequence_string = "sequence" if len(faded_sequences) == 1 else "sequences"
         self.report({'INFO'}, "Added fade animation to {} {}.".format(len(faded_sequences), sequence_string))
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 6c8f51f97a1..e04dcd34663 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -447,6 +447,21 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports,
   WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
 }
 
+static void rna_Sequence_invalidate_cache_rnafunc(ID *id, Sequence *self, int type)
+{
+  switch (type) {
+    case SEQ_CACHE_STORE_RAW:
+      BKE_sequence_invalidate_cache_raw((Scene *)id, self);
+      break;
+    case SEQ_CACHE_STORE_PREPROCESSED:
+      BKE_sequence_invalidate_cache_preprocessed((Scene *)id, self);
+      break;
+    case SEQ_CACHE_STORE_COMPOSITE:
+      BKE_sequence_invalidate_cache_composite((Scene *)id, self);
+      break;
+  }
+}
+
 #else
 
 void RNA_api_sequence_strip(StructRNA *srna)
@@ -454,6 +469,13 @@ void RNA_api_sequence_strip(StructRNA *srna)
   FunctionRNA *func;
   PropertyRNA *parm;
 
+  static const EnumPropertyItem seq_cahce_type_items[] = {
+      {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
+      {SEQ_CACHE_STORE_PREPROCESSED, "PREPROCESSED", 0, "Preprocessed", ""},
+      {SEQ_CACHE_STORE_COMPOSITE, "COMPOSITE", 0, "Composite", ""},
+      {0, NULL, 0, NULL, NULL},
+  };
+
   func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
   RNA_def_function_flag(func, FUNC_USE_SELF_ID);
   RNA_def_function_ui_description(func, "Update the strip dimensions");
@@ -479,6 +501,12 @@ void RNA_api_sequence_strip(StructRNA *srna)
   RNA_def_function_flag(func, FUNC_USE_REPORTS);
   parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+  func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc");
+  RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+  RNA_def_function_ui_description(func, "Invalidate Cached images for strip and all dependant strips. ");
+  parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type");
+  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
 }
 
 void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop)



More information about the Bf-blender-cvs mailing list