[Bf-blender-cvs] [8850775] master: Sequencer: Add option to use absolute mask animation time

Sergey Sharybin noreply at git.blender.org
Mon Jan 25 11:20:13 CET 2016


Commit: 8850775ce86fc2873f00bdd87aaec11f460c298a
Author: Sergey Sharybin
Date:   Mon Jan 25 11:16:49 2016 +0100
Branches: master
https://developer.blender.org/rB8850775ce86fc2873f00bdd87aaec11f460c298a

Sequencer: Add option to use absolute mask animation time

This is handy for cases when mask is created on top of the edit and
used for tasks like color grading and other enhancement.

That was the main purpose of the masks which was totally broken in
6786ef6. Now it's possible to have masks created as both a part of
input movie roto process (which then better be re-mapped to the strip
timing) and as a grading tool (which should be using scene timing
for the animation).

Thanks artists from the Nieve for screaming about such a broken case.

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

M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/blenkernel/intern/seqmodifier.c
M	source/blender/makesdna/DNA_sequence_types.h
M	source/blender/makesrna/intern/rna_sequencer.c

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

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 260919b..eeb6a50 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1112,6 +1112,8 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
                     box.prop_search(mod, "input_mask_strip", sequences_object, "sequences", text="Mask")
                 else:
                     box.prop(mod, "input_mask_id")
+                    row = box.row()
+                    row.prop(mod, "mask_time", expand=True)
 
                 if mod.type == 'COLOR_BALANCE':
                     box.prop(mod, "color_multiply")
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 84d1c1b..2c46cf1 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -978,7 +978,19 @@ ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence
 			continue;
 
 		if (smti->apply) {
-			ImBuf *mask = modifier_mask_get(smd, context, cfra, seq->start, ibuf->rect_float != NULL);
+			int frame_offset;
+			if (smd->mask_time == SEQUENCE_MASK_TIME_RELATIVE) {
+				frame_offset = seq->start;
+			}
+			else /*if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE)*/ {
+				frame_offset = 0;
+			}
+
+			ImBuf *mask = modifier_mask_get(smd,
+			                                context,
+			                                cfra,
+			                                frame_offset,
+			                                ibuf->rect_float != NULL);
 
 			if (processed_ibuf == ibuf)
 				processed_ibuf = IMB_dupImBuf(ibuf);
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 0236f41..56112d2 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -308,7 +308,8 @@ typedef struct SequenceModifierData {
 	char name[64]; /* MAX_NAME */
 
 	/* mask input, either sequence or mask ID */
-	int mask_input_type, pad;
+	int mask_input_type;
+	int mask_time;
 
 	struct Sequence *mask_sequence;
 	struct Mask     *mask_id;
@@ -557,4 +558,11 @@ enum {
 	SEQUENCE_MASK_INPUT_ID      = 1
 };
 
+enum {
+	/* Mask animation will be remapped relative to the strip start frame. */
+	SEQUENCE_MASK_TIME_RELATIVE = 0,
+	/* Global (scene) frame number will be used to access the mask. */
+	SEQUENCE_MASK_TIME_ABSOLUTE = 1,
+};
+
 #endif  /* __DNA_SEQUENCE_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index b49318b..2c66b73 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -2422,6 +2422,12 @@ static void rna_def_modifier(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static const EnumPropertyItem mask_time_items[] = {
+		{SEQUENCE_MASK_TIME_RELATIVE, "RELATIVE", 0, "Relative", "Mask animation is offset to start of strip"},
+		{SEQUENCE_MASK_TIME_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Mask animation is in sync with scene frame"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna = RNA_def_struct(brna, "SequenceModifier", NULL);
 	RNA_def_struct_sdna(srna, "SequenceModifierData");
 	RNA_def_struct_ui_text(srna, "SequenceModifier", "Modifier for sequence strip");
@@ -2458,6 +2464,12 @@ static void rna_def_modifier(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Mask Input Type", "Type of input data used for mask");
 	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
 
+	prop = RNA_def_property(srna, "mask_time", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "mask_time");
+	RNA_def_property_enum_items(prop, mask_time_items);
+	RNA_def_property_ui_text(prop, "Mask Time", "Time to use for the Mask animation");
+	RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
 	prop = RNA_def_property(srna, "input_mask_strip",  PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll");




More information about the Bf-blender-cvs mailing list