diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-02 13:05:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-02 13:07:23 +0300 |
commit | 2fc69d11c8a2df89c32a8bb320da2350fff7c8ba (patch) | |
tree | 6bba9022159f5c79b455c7d2a2138318045a6f3c /source | |
parent | ac2530be8c7b5742e89e517ae97386d89d935982 (diff) |
Add custom properties to sequence strips
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 10 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 14 |
5 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 1e32c586176..721555097d7 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -66,6 +66,7 @@ #include "BKE_scene.h" #include "BKE_mask.h" #include "BKE_library.h" +#include "BKE_idprop.h" #include "RNA_access.h" @@ -210,6 +211,11 @@ static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const bool do_cach seq_free_animdata(scene, seq); } + if (seq->prop) { + IDP_FreeProperty(seq->prop); + MEM_freeN(seq->prop); + } + /* free modifiers */ BKE_sequence_modifier_clear(seq); @@ -4630,6 +4636,10 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup seqn->strip->proxy->anim = NULL; } + if (seq->prop) { + seqn->prop = IDP_CopyProperty(seq->prop); + } + if (seqn->modifiers.first) { BLI_listbase_clear(&seqn->modifiers); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b0aa47787b6..8c5959f20bf 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5618,7 +5618,10 @@ static void direct_link_scene(FileData *fd, Scene *sce) SpeedControlVars *s = seq->effectdata; s->frameMap = NULL; } - + + seq->prop = newdataadr(fd, seq->prop); + IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + seq->strip = newdataadr(fd, seq->strip); if (seq->strip && seq->strip->done==0) { seq->strip->done = true; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index afc53f343f1..c616436d584 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2441,6 +2441,10 @@ static void write_scenes(WriteData *wd, ListBase *scebase) strip->done = true; } + if (seq->prop) { + IDP_WriteProperty(seq->prop, wd); + } + write_sequence_modifiers(wd, &seq->modifiers); } SEQ_END diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 9a6d8a533b0..46a91cf6ceb 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -189,6 +189,8 @@ typedef struct Sequence { char alpha_mode; char pad[3]; + struct IDProperty *prop; + /* modifiers */ ListBase modifiers; } Sequence; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 231341ef554..0d46924c129 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -72,6 +72,7 @@ EnumPropertyItem sequence_modifier_type_items[] = { #ifdef RNA_RUNTIME #include "BKE_report.h" +#include "BKE_idprop.h" #include "WM_api.h" #include "WM_types.h" @@ -564,6 +565,18 @@ static char *rna_Sequence_path(PointerRNA *ptr) } } +static IDProperty *rna_Sequence_idprops(PointerRNA *ptr, bool create) +{ + Sequence *seq = ptr->data; + + if (create && !seq->prop) { + IDPropertyTemplate val = {0}; + seq->prop = IDP_New(IDP_GROUP, &val, "Sequence ID properties"); + } + + return seq->prop; +} + static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; @@ -1397,6 +1410,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor"); RNA_def_struct_refine_func(srna, "rna_Sequence_refine"); RNA_def_struct_path_func(srna, "rna_Sequence_path"); + RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set"); |