Add custom properties to sequence strips
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -189,6 +189,8 @@ typedef struct Sequence {
|
||||
char alpha_mode;
|
||||
char pad[3];
|
||||
|
||||
struct IDProperty *prop;
|
||||
|
||||
/* modifiers */
|
||||
ListBase modifiers;
|
||||
} Sequence;
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user