2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008)
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_sequencer.c
31 #include "RNA_access.h"
32 #include "RNA_define.h"
33 #include "RNA_enum_types.h"
35 #include "rna_internal.h"
37 #include "DNA_anim_types.h"
38 #include "DNA_object_types.h"
39 #include "DNA_scene_types.h"
40 #include "DNA_sequence_types.h"
41 #include "DNA_movieclip_types.h"
43 #include "BKE_animsys.h"
44 #include "BKE_global.h"
45 #include "BKE_sequencer.h"
46 #include "BKE_sound.h"
48 #include "MEM_guardedalloc.h"
53 typedef struct EffectInfo {
54 const char *struct_name;
57 void (*func)(StructRNA *);
61 EnumPropertyItem sequence_modifier_type_items[] = {
62 {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""},
63 {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""},
64 {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""},
65 {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""},
66 {0, NULL, 0, NULL, NULL}
71 #include "BKE_report.h"
76 typedef struct SequenceSearchData {
79 SequenceModifierData *smd;
82 /* build a temp reference to the parent */
83 static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
85 for (; seq; seq = seq->next) {
87 if (seq->type == SEQ_TYPE_META) {
88 meta_tmp_ref(seq, seq->seqbase.first);
93 static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
95 Scene *scene = (Scene *)ptr->id.data;
96 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
98 meta_tmp_ref(NULL, ed->seqbase.first);
100 rna_iterator_listbase_begin(iter, &ed->seqbase, NULL);
103 static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter)
105 ListBaseIterator *internal = iter->internal;
106 Sequence *seq = (Sequence *)internal->link;
108 if (seq->seqbase.first)
109 internal->link = (Link *)seq->seqbase.first;
111 internal->link = (Link *)seq->next;
113 internal->link = NULL;
116 seq = seq->tmp; /* XXX - seq's don't reference their parents! */
117 if (seq && seq->next) {
118 internal->link = (Link *)seq->next;
124 iter->valid = (internal->link != NULL);
128 static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
130 Sequence *seq = (Sequence *)ptr->data;
132 /* Hack? copied from sequencer.c::reload_sequence_new_file() */
133 size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem);
135 /* the problem with seq->strip->len and seq->len is that it's discounted from the offset (hard cut trim) */
139 static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
141 Sequence *seq = (Sequence *)ptr->data;
142 rna_iterator_array_begin(iter, (void *)seq->strip->stripdata, sizeof(StripElem),
143 rna_SequenceEditor_elements_length(ptr), 0, NULL);
146 static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
148 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
149 ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
150 BKE_sequence_calc_disp(scene, seq);
152 if (BKE_sequence_test_overlap(seqbase, seq)) {
153 BKE_sequence_base_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */
155 BKE_sequencer_sort(scene);
158 static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
160 Sequence *seq = (Sequence *)ptr->data;
161 Scene *scene = (Scene *)ptr->id.data;
163 BKE_sequence_translate(scene, seq, value - seq->start);
164 rna_Sequence_frame_change_update(scene, seq);
167 static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
169 Sequence *seq = (Sequence *)ptr->data;
170 Scene *scene = (Scene *)ptr->id.data;
172 BKE_sequence_tx_set_final_left(seq, value);
173 BKE_sequence_single_fix(seq);
174 rna_Sequence_frame_change_update(scene, seq);
177 static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
179 Sequence *seq = (Sequence *)ptr->data;
180 Scene *scene = (Scene *)ptr->id.data;
182 BKE_sequence_tx_set_final_right(seq, value);
183 BKE_sequence_single_fix(seq);
184 rna_Sequence_frame_change_update(scene, seq);
187 static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
189 Sequence *seq = (Sequence *)ptr->data;
190 Scene *scene = (Scene *)ptr->id.data;
192 seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
194 BKE_sequence_reload_new_file(scene, seq, FALSE);
195 rna_Sequence_frame_change_update(scene, seq);
198 static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
200 Sequence *seq = (Sequence *)ptr->data;
201 Scene *scene = (Scene *)ptr->id.data;
203 seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
205 BKE_sequence_reload_new_file(scene, seq, FALSE);
206 rna_Sequence_frame_change_update(scene, seq);
209 static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value)
211 Sequence *seq = (Sequence *)ptr->data;
212 Scene *scene = (Scene *)ptr->id.data;
214 BKE_sequence_tx_set_final_right(seq, seq->start + value);
215 rna_Sequence_frame_change_update(scene, seq);
218 static int rna_Sequence_frame_length_get(PointerRNA *ptr)
220 Sequence *seq = (Sequence *)ptr->data;
221 return BKE_sequence_tx_get_final_right(seq, 0) - BKE_sequence_tx_get_final_left(seq, 0);
224 static int rna_Sequence_frame_editable(PointerRNA *ptr)
226 Sequence *seq = (Sequence *)ptr->data;
227 /* Effect sequences' start frame and length must be readonly! */
228 return (BKE_sequence_effect_get_num_inputs(seq->type)) ? 0 : PROP_EDITABLE;
231 static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
233 Sequence *seq = (Sequence *)ptr->data;
234 Scene *scene = (Scene *)ptr->id.data;
235 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
236 ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
238 seq->machine = value;
240 if (BKE_sequence_test_overlap(seqbase, seq) ) {
241 BKE_sequence_base_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */
243 BKE_sequencer_sort(scene);
246 static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
248 Sequence *seq = (Sequence *)ptr->data;
250 seq->flag |= SEQ_USE_PROXY;
251 if (seq->strip->proxy == NULL) {
252 seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy");
253 seq->strip->proxy->quality = 90;
254 seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL;
255 seq->strip->proxy->build_size_flags = SEQ_PROXY_IMAGE_SIZE_25;
259 seq->flag ^= SEQ_USE_PROXY;
263 static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
265 Sequence *seq = (Sequence *)ptr->data;
267 seq->flag |= SEQ_USE_TRANSFORM;
268 if (seq->strip->transform == NULL) {
269 seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
273 seq->flag ^= SEQ_USE_TRANSFORM;
277 static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
279 Sequence *seq = (Sequence *)ptr->data;
281 seq->flag |= SEQ_USE_CROP;
282 if (seq->strip->crop == NULL) {
283 seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
287 seq->flag ^= SEQ_USE_CROP;
291 static int transform_seq_cmp_cb(Sequence *seq, void *arg_pt)
293 SequenceSearchData *data = arg_pt;
295 if (seq->strip && seq->strip->transform == data->data) {
297 return -1; /* done so bail out */
302 static Sequence *sequence_get_by_transform(Editing *ed, StripTransform *transform)
304 SequenceSearchData data;
307 data.data = transform;
309 /* irritating we need to search for our sequence! */
310 BKE_sequencer_base_recursive_apply(&ed->seqbase, transform_seq_cmp_cb, &data);
315 static char *rna_SequenceTransform_path(PointerRNA *ptr)
317 Scene *scene = ptr->id.data;
318 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
319 Sequence *seq = sequence_get_by_transform(ed, ptr->data);
321 if (seq && seq->name + 2)
322 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform", seq->name + 2);
324 return BLI_strdup("");
327 static void rna_SequenceTransform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
329 Scene *scene = (Scene *) ptr->id.data;
330 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
331 Sequence *seq = sequence_get_by_transform(ed, ptr->data);
333 BKE_sequence_invalidate_cache(scene, seq);
336 static int crop_seq_cmp_cb(Sequence *seq, void *arg_pt)
338 SequenceSearchData *data = arg_pt;
340 if (seq->strip && seq->strip->crop == data->data) {
342 return -1; /* done so bail out */
347 static Sequence *sequence_get_by_crop(Editing *ed, StripCrop *crop)
349 SequenceSearchData data;
354 /* irritating we need to search for our sequence! */
355 BKE_sequencer_base_recursive_apply(&ed->seqbase, crop_seq_cmp_cb, &data);
360 static char *rna_SequenceCrop_path(PointerRNA *ptr)
362 Scene *scene = ptr->id.data;
363 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
364 Sequence *seq = sequence_get_by_crop(ed, ptr->data);
366 if (seq && seq->name + 2)
367 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop", seq->name + 2);
369 return BLI_strdup("");
372 static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
374 Scene *scene = (Scene *) ptr->id.data;
375 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
376 Sequence *seq = sequence_get_by_crop(ed, ptr->data);
378 BKE_sequence_invalidate_cache(scene, seq);
381 /* name functions that ignore the first two characters */
382 static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
384 Sequence *seq = (Sequence *)ptr->data;
385 BLI_strncpy(value, seq->name + 2, sizeof(seq->name) - 2);
388 static int rna_Sequence_name_length(PointerRNA *ptr)
390 Sequence *seq = (Sequence *)ptr->data;
391 return strlen(seq->name + 2);
394 static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
396 Scene *scene = (Scene *)ptr->id.data;
397 Sequence *seq = (Sequence *)ptr->data;
398 char oldname[sizeof(seq->name)];
401 /* make a copy of the old name first */
402 BLI_strncpy(oldname, seq->name + 2, sizeof(seq->name) - 2);
404 /* copy the new name into the name slot */
405 BLI_strncpy_utf8(seq->name + 2, value, sizeof(seq->name) - 2);
407 /* make sure the name is unique */
408 BKE_seqence_base_unique_name_recursive(&scene->ed->seqbase, seq);
410 /* fix all the animation data which may link to this */
412 /* don't rename everywhere because these are per scene */
413 /* BKE_all_animdata_fix_paths_rename(NULL, "sequence_editor.sequences_all", oldname, seq->name+2); */
414 adt = BKE_animdata_from_id(&scene->id);
416 BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1);
419 static StructRNA *rna_Sequence_refine(struct PointerRNA *ptr)
421 Sequence *seq = (Sequence *)ptr->data;
425 return &RNA_ImageSequence;
427 return &RNA_MetaSequence;
429 return &RNA_SceneSequence;
431 return &RNA_MovieSequence;
432 case SEQ_TYPE_MOVIECLIP:
433 return &RNA_MovieClipSequence;
435 return &RNA_MaskSequence;
436 case SEQ_TYPE_SOUND_RAM:
437 return &RNA_SoundSequence;
439 return &RNA_CrossSequence;
441 return &RNA_AddSequence;
443 return &RNA_SubtractSequence;
444 case SEQ_TYPE_ALPHAOVER:
445 return &RNA_AlphaOverSequence;
446 case SEQ_TYPE_ALPHAUNDER:
447 return &RNA_AlphaUnderSequence;
448 case SEQ_TYPE_GAMCROSS:
449 return &RNA_GammaCrossSequence;
451 return &RNA_MultiplySequence;
452 case SEQ_TYPE_OVERDROP:
453 return &RNA_OverDropSequence;
454 case SEQ_TYPE_MULTICAM:
455 return &RNA_MulticamSequence;
456 case SEQ_TYPE_ADJUSTMENT:
457 return &RNA_AdjustmentSequence;
459 return &RNA_WipeSequence;
461 return &RNA_GlowSequence;
462 case SEQ_TYPE_TRANSFORM:
463 return &RNA_TransformSequence;
465 return &RNA_ColorSequence;
467 return &RNA_SpeedControlSequence;
469 return &RNA_Sequence;
473 static char *rna_Sequence_path(PointerRNA *ptr)
475 Sequence *seq = (Sequence *)ptr->data;
477 /* sequencer data comes from scene...
478 * TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
481 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"]", seq->name + 2);
483 return BLI_strdup("");
486 static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
488 ListBaseIterator *internal = iter->internal;
489 MetaStack *ms = (MetaStack *)internal->link;
491 return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
494 /* TODO, expose seq path setting as a higher level sequencer BKE function */
495 static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
497 Sequence *seq = (Sequence *)(ptr->data);
499 if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound) {
500 /* for sound strips we need to update the sound as well.
501 * arguably, this could load in a new sound rather than modify an existing one.
502 * but while using the sequencer its most likely your not using the sound in the game engine too.
505 RNA_id_pointer_create((ID *)seq->sound, &id_ptr);
506 RNA_string_set(&id_ptr, "filepath", value);
507 sound_load(G.main, seq->sound);
508 sound_update_scene_sound(seq->scene_sound, seq->sound);
511 BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
512 sizeof(seq->strip->stripdata->name));
515 static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value)
517 Sequence *seq = (Sequence *)(ptr->data);
519 BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name);
522 static int rna_Sequence_filepath_length(PointerRNA *ptr)
524 Sequence *seq = (Sequence *)(ptr->data);
527 BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
531 static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value)
533 StripProxy *proxy = (StripProxy *)(ptr->data);
534 BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file));
537 static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value)
539 StripProxy *proxy = (StripProxy *)(ptr->data);
541 BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file);
544 static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
546 StripProxy *proxy = (StripProxy *)(ptr->data);
549 BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
553 static void rna_Sequence_volume_set(PointerRNA *ptr, float value)
555 Sequence *seq = (Sequence *)(ptr->data);
558 if (seq->scene_sound)
559 sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
562 static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
564 Sequence *seq = (Sequence *)(ptr->data);
567 if (seq->scene_sound)
568 sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
571 static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
573 Sequence *seq = (Sequence *)(ptr->data);
576 if (seq->scene_sound)
577 sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
581 static int rna_Sequence_input_count_get(PointerRNA *ptr)
583 Sequence *seq = (Sequence *)(ptr->data);
585 return BKE_sequence_effect_get_num_inputs(seq->type);
589 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
591 Sequence *seq = (Sequence *)(ptr->data);
592 BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
593 sizeof(seq->strip->stripdata->name));
596 static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
598 StripElem *elem = (StripElem *)(ptr->data);
599 BLI_split_file_part(value, elem->name, sizeof(elem->name));
603 static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
605 Scene *scene = (Scene *) ptr->id.data;
606 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
609 Sequence *seq = (Sequence *) ptr->data;
611 BKE_sequence_invalidate_cache(scene, seq);
615 static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
617 Scene *scene = (Scene *) ptr->id.data;
618 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
620 BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
622 if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
623 BKE_sequencer_update_sound_bounds(scene, ptr->data);
626 static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
628 Scene *scene = (Scene *) ptr->id.data;
629 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
631 BKE_sequencer_update_muting(ed);
632 rna_Sequence_update(bmain, scene, ptr);
635 static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
637 Scene *scene = (Scene *) ptr->id.data;
638 Sequence *seq = (Sequence *)(ptr->data);
639 BKE_sequence_reload_new_file(scene, seq, TRUE);
640 BKE_sequence_calc(scene, seq);
641 rna_Sequence_update(bmain, scene, ptr);
644 static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)
646 SequenceSearchData *data = arg_pt;
648 if (seq->strip && seq->strip->proxy == data->data) {
650 return -1; /* done so bail out */
655 static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy)
657 SequenceSearchData data;
662 BKE_sequencer_base_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_cb, &data);
666 static void rna_Sequence_tcindex_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
668 Scene *scene = (Scene *) ptr->id.data;
669 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
670 Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
672 BKE_sequence_reload_new_file(scene, seq, FALSE);
673 rna_Sequence_frame_change_update(scene, seq);
676 static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
678 Scene *scene = (Scene *) ptr->id.data;
679 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
680 Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
682 BKE_sequence_invalidate_cache(scene, seq);
686 static float rna_Sequence_opacity_get(PointerRNA *ptr)
688 Sequence *seq = (Sequence *)(ptr->data);
689 return seq->blend_opacity / 100.0f;
691 static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
693 Sequence *seq = (Sequence *)(ptr->data);
694 CLAMP(value, 0.0f, 1.0f);
695 seq->blend_opacity = value * 100.0f;
698 static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
700 SequenceSearchData *data = arg_pt;
702 if (seq->strip && seq->strip->color_balance == data->data) {
705 return -1; /* done so bail out */
708 if (seq->modifiers.first) {
709 SequenceModifierData *smd = seq->modifiers.first;
711 for (smd = seq->modifiers.first; smd; smd = smd->next) {
712 if (smd->type == seqModifierType_ColorBalance) {
713 ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
715 if (&cbmd->color_balance == data->data) {
718 return -1; /* done so bail out */
727 static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb, SequenceModifierData **smd_r)
729 SequenceSearchData data;
735 /* irritating we need to search for our sequence! */
736 BKE_sequencer_base_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
743 static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
745 Scene *scene = ptr->id.data;
746 SequenceModifierData *smd;
747 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
748 Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
750 if (seq && seq->name + 2) {
752 /* path to old filter color balance */
753 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name + 2);
756 /* path to modifier */
757 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"].color_balance", seq->name + 2, smd->name);
761 return BLI_strdup("");
764 static void rna_SequenceColorBalance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
766 Scene *scene = (Scene *) ptr->id.data;
767 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
768 SequenceModifierData *smd;
769 Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
772 BKE_sequence_invalidate_cache(scene, seq);
774 BKE_sequence_invalidate_cache_for_modifier(scene, seq);
777 static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, int value)
779 Scene *scene = ptr->id.data;
780 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
785 /* convert from abs to relative and back */
786 if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) {
787 ed->over_cfra = scene->r.cfra + ed->over_ofs;
788 ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
790 else if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
791 ed->over_ofs = ed->over_cfra - scene->r.cfra;
792 ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
796 static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
798 Scene *scene = (Scene *)ptr->id.data;
799 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
802 return scene->r.cfra;
804 if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
805 return ed->over_cfra - scene->r.cfra;
811 static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
813 Scene *scene = (Scene *)ptr->id.data;
814 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
820 if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
821 ed->over_cfra = (scene->r.cfra + value);
823 ed->over_ofs = value;
827 static void rna_WipeSequence_angle_set(PointerRNA *ptr, float value)
829 Sequence *seq = (Sequence *)(ptr->data);
830 value = RAD2DEGF(value);
831 CLAMP(value, -90.0f, 90.0f);
832 ((WipeVars *)seq->effectdata)->angle = value;
835 static float rna_WipeSequence_angle_get(PointerRNA *ptr)
837 Sequence *seq = (Sequence *)(ptr->data);
839 return DEG2RADF(((WipeVars *)seq->effectdata)->angle);
842 static int modifier_seq_cmp_cb(Sequence *seq, void *arg_pt)
844 SequenceSearchData *data = arg_pt;
846 if (BLI_findindex(&seq->modifiers, data->data) != -1) {
848 return -1; /* done so bail out */
854 static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd)
856 SequenceSearchData data;
861 /* irritating we need to search for our sequence! */
862 BKE_sequencer_base_recursive_apply(&ed->seqbase, modifier_seq_cmp_cb, &data);
867 static StructRNA *rna_SequenceModifier_refine(struct PointerRNA *ptr)
869 SequenceModifierData *smd = (SequenceModifierData *) ptr->data;
872 case seqModifierType_ColorBalance:
873 return &RNA_ColorBalanceModifier;
874 case seqModifierType_Curves:
875 return &RNA_CurvesModifier;
876 case seqModifierType_HueCorrect:
877 return &RNA_HueCorrectModifier;
878 case seqModifierType_BrightContrast:
879 return &RNA_BrightContrastModifier;
881 return &RNA_SequenceModifier;
885 static char *rna_SequenceModifier_path(PointerRNA *ptr)
887 Scene *scene = ptr->id.data;
888 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
889 SequenceModifierData *smd = ptr->data;
890 Sequence *seq = sequence_get_by_modifier(ed, smd);
892 if (seq && seq->name + 2)
893 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"]", seq->name + 2, smd->name);
895 return BLI_strdup("");
898 static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value)
900 SequenceModifierData *smd = ptr->data;
901 Scene *scene = (Scene *) ptr->id.data;
902 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
903 Sequence *seq = sequence_get_by_modifier(ed, smd);
905 char oldname[sizeof(smd->name)];
907 /* make a copy of the old name first */
908 BLI_strncpy(oldname, smd->name, sizeof(smd->name));
910 /* copy the new name into the name slot */
911 BLI_strncpy_utf8(smd->name, value, sizeof(smd->name));
913 /* make sure the name is truly unique */
914 BKE_sequence_modifier_unique_name(seq, smd);
916 /* fix all the animation data which may link to this */
917 adt = BKE_animdata_from_id(&scene->id);
921 BLI_snprintf(path, sizeof(path), "sequence_editor.sequences_all[\"%s\"].modifiers", seq->name + 2);
922 BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, path, oldname, smd->name, 0, 0, 1);
926 static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
928 /* strip from other scenes could be modified, so using active scene is not reliable */
929 Scene *scene = (Scene *) ptr->id.data;
930 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
931 Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
933 BKE_sequence_invalidate_cache_for_modifier(scene, seq);
936 static int rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
938 Scene *scene = (Scene *) ptr->id.data;
939 Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
940 Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
941 Sequence *cur = (Sequence *) value.data;
946 if (BKE_sequence_check_depend(seq, cur))
952 static SequenceModifierData *rna_Sequence_modifier_new(Sequence *seq, bContext *C, ReportList *reports, const char *name, int type)
954 if (!BKE_sequence_supports_modifiers(seq)) {
955 BKE_report(reports, RPT_ERROR, "Sequence type does not support modifiers");
960 Scene *scene = CTX_data_scene(C);
961 SequenceModifierData *smd;
963 smd = BKE_sequence_modifier_new(seq, name, type);
965 BKE_sequence_invalidate_cache_for_modifier(scene, seq);
967 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
973 static void rna_Sequence_modifier_remove(Sequence *seq, bContext *C, ReportList *reports, SequenceModifierData *smd)
975 Scene *scene = CTX_data_scene(C);
977 if (BKE_sequence_modifier_remove(seq, smd)) {
978 BKE_sequence_invalidate_cache_for_modifier(scene, seq);
980 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
983 BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack");
987 static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C)
989 Scene *scene = CTX_data_scene(C);
991 BKE_sequence_modifier_clear(seq);
993 BKE_sequence_invalidate_cache_for_modifier(scene, seq);
995 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
1000 static void rna_def_strip_element(BlenderRNA *brna)
1005 srna = RNA_def_struct(brna, "SequenceElement", NULL);
1006 RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame");
1007 RNA_def_struct_sdna(srna, "StripElem");
1009 prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
1010 RNA_def_property_string_sdna(prop, NULL, "name");
1011 RNA_def_property_ui_text(prop, "Filename", "");
1012 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1014 prop = RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
1015 RNA_def_property_int_sdna(prop, NULL, "orig_width");
1016 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1017 RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
1019 prop = RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
1020 RNA_def_property_int_sdna(prop, NULL, "orig_height");
1021 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1022 RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
1025 static void rna_def_strip_crop(BlenderRNA *brna)
1030 srna = RNA_def_struct(brna, "SequenceCrop", NULL);
1031 RNA_def_struct_ui_text(srna, "Sequence Crop", "Cropping parameters for a sequence strip");
1032 RNA_def_struct_sdna(srna, "StripCrop");
1034 prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
1035 RNA_def_property_int_sdna(prop, NULL, "top");
1036 RNA_def_property_ui_text(prop, "Top", "");
1037 RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
1038 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
1040 prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
1041 RNA_def_property_int_sdna(prop, NULL, "bottom");
1042 RNA_def_property_ui_text(prop, "Bottom", "");
1043 RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
1044 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
1046 prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
1047 RNA_def_property_int_sdna(prop, NULL, "left");
1048 RNA_def_property_ui_text(prop, "Left", "");
1049 RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
1050 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
1052 prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
1053 RNA_def_property_int_sdna(prop, NULL, "right");
1054 RNA_def_property_ui_text(prop, "Right", "");
1055 RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
1056 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
1058 RNA_def_struct_path_func(srna, "rna_SequenceCrop_path");
1061 static void rna_def_strip_transform(BlenderRNA *brna)
1066 srna = RNA_def_struct(brna, "SequenceTransform", NULL);
1067 RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip");
1068 RNA_def_struct_sdna(srna, "StripTransform");
1070 prop = RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
1071 RNA_def_property_int_sdna(prop, NULL, "xofs");
1072 RNA_def_property_ui_text(prop, "Offset X", "");
1073 RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
1074 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
1076 prop = RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
1077 RNA_def_property_int_sdna(prop, NULL, "yofs");
1078 RNA_def_property_ui_text(prop, "Offset Y", "");
1079 RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
1080 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
1082 RNA_def_struct_path_func(srna, "rna_SequenceTransform_path");
1086 static void rna_def_strip_proxy(BlenderRNA *brna)
1091 static const EnumPropertyItem seq_tc_items[] = {
1092 {SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""},
1093 {SEQ_PROXY_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run",
1094 "Use images in the order as they are recorded"},
1095 {SEQ_PROXY_TC_FREE_RUN, "FREE_RUN", 0, "Free Run",
1096 "Use global timestamp written by recording device"},
1097 {SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
1098 "Interpolate a global timestamp using the "
1099 "record date and time written by recording device"},
1100 {SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "RECORD_RUN_NO_GAPS", 0, "Record Run No Gaps",
1101 "Like record run, but ignore timecode, "
1102 "changes in framerate or dropouts"},
1103 {0, NULL, 0, NULL, NULL}
1106 srna = RNA_def_struct(brna, "SequenceProxy", NULL);
1107 RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip");
1108 RNA_def_struct_sdna(srna, "StripProxy");
1110 prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
1111 RNA_def_property_string_sdna(prop, NULL, "dir");
1112 RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
1113 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
1115 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1116 RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
1117 RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length",
1118 "rna_Sequence_proxy_filepath_set");
1120 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
1122 prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
1123 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_25);
1124 RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution");
1126 prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
1127 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_50);
1128 RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution");
1130 prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
1131 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_75);
1132 RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution");
1134 prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
1135 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_100);
1136 RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution");
1138 prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
1139 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_RECORD_RUN);
1140 RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
1142 prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
1143 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_FREE_RUN);
1144 RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
1146 prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
1147 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN);
1148 RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
1150 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
1151 RNA_def_property_int_sdna(prop, NULL, "quality");
1152 RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build");
1153 RNA_def_property_ui_range(prop, 1, 100, 1, 0);
1155 prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
1156 RNA_def_property_enum_sdna(prop, NULL, "tc");
1157 RNA_def_property_enum_items(prop, seq_tc_items);
1158 RNA_def_property_ui_text(prop, "Timecode", "");
1159 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update");
1163 static void rna_def_color_balance(BlenderRNA *brna)
1168 srna = RNA_def_struct(brna, "SequenceColorBalanceData", NULL);
1169 RNA_def_struct_ui_text(srna, "Sequence Color Balance Data", "Color balance parameters for a sequence strip and it's modifiers");
1170 RNA_def_struct_sdna(srna, "StripColorBalance");
1172 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
1173 RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
1174 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
1175 RNA_def_property_float_default(prop, 1.0f);
1176 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1178 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
1179 RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
1180 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
1181 RNA_def_property_float_default(prop, 1.0f);
1182 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1184 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
1185 RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
1186 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
1187 RNA_def_property_float_default(prop, 1.0f);
1188 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1190 prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
1191 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
1192 RNA_def_property_ui_text(prop, "Inverse Gain", "");
1193 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1195 prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
1196 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
1197 RNA_def_property_ui_text(prop, "Inverse Gamma", "");
1198 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1200 prop = RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
1201 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
1202 RNA_def_property_ui_text(prop, "Inverse Lift", "");
1203 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
1207 prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
1208 RNA_def_property_range(prop, 0.0f, 1.0f);
1209 RNA_def_property_ui_text(prop, "Exposure", "");
1210 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
1212 prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
1213 RNA_def_property_range(prop, 0.0f, 1.0f);
1214 RNA_def_property_ui_text(prop, "Saturation", "");
1215 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
1218 RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
1221 static void rna_def_strip_color_balance(BlenderRNA *brna)
1225 srna = RNA_def_struct(brna, "SequenceColorBalance", "SequenceColorBalanceData");
1226 RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
1227 RNA_def_struct_sdna(srna, "StripColorBalance");
1230 EnumPropertyItem blend_mode_items[] = {
1231 {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
1232 {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
1233 {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
1234 {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
1235 {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
1236 {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
1237 {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
1238 {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
1239 {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
1240 {0, NULL, 0, NULL, NULL}
1243 static void rna_def_sequence_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
1250 RNA_def_property_srna(cprop, "SequenceModifiers");
1251 srna = RNA_def_struct(brna, "SequenceModifiers", NULL);
1252 RNA_def_struct_sdna(srna, "Sequence");
1253 RNA_def_struct_ui_text(srna, "Strip Modifiers", "Collection of strip modifiers");
1256 func = RNA_def_function(srna, "new", "rna_Sequence_modifier_new");
1257 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
1258 RNA_def_function_ui_description(func, "Add a new modifier");
1259 parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
1260 RNA_def_property_flag(parm, PROP_REQUIRED);
1261 /* modifier to add */
1262 parm = RNA_def_enum(func, "type", sequence_modifier_type_items, seqModifierType_ColorBalance, "", "Modifier type to add");
1263 RNA_def_property_flag(parm, PROP_REQUIRED);
1265 parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Newly created modifier");
1266 RNA_def_function_return(func, parm);
1268 /* remove modifier */
1269 func = RNA_def_function(srna, "remove", "rna_Sequence_modifier_remove");
1270 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
1271 RNA_def_function_ui_description(func, "Remove an existing modifier from the sequence");
1272 /* modifier to remove */
1273 parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Modifier to remove");
1274 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1276 /* clear all modifiers */
1277 func = RNA_def_function(srna, "clear", "rna_Sequence_modifier_clear");
1278 RNA_def_function_flag(func, FUNC_USE_CONTEXT);
1279 RNA_def_function_ui_description(func, "Remove all modifiers from the sequence");
1282 static void rna_def_sequence(BlenderRNA *brna)
1287 static const EnumPropertyItem seq_type_items[] = {
1288 {SEQ_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
1289 {SEQ_TYPE_META, "META", 0, "Meta", ""},
1290 {SEQ_TYPE_SCENE, "SCENE", 0, "Scene", ""},
1291 {SEQ_TYPE_MOVIE, "MOVIE", 0, "Movie", ""},
1292 {SEQ_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
1293 {SEQ_TYPE_MASK, "MASK", 0, "Mask", ""},
1294 {SEQ_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""},
1295 {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
1296 {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
1297 {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
1298 {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
1299 {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
1300 {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
1301 {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
1302 {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
1303 {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
1304 {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
1305 {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
1306 {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
1307 {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
1308 {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
1309 {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
1310 {0, NULL, 0, NULL, NULL}
1313 srna = RNA_def_struct(brna, "Sequence", NULL);
1314 RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor");
1315 RNA_def_struct_refine_func(srna, "rna_Sequence_refine");
1316 RNA_def_struct_path_func(srna, "rna_Sequence_path");
1318 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1319 RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set");
1320 RNA_def_property_string_maxlength(prop, sizeof(((Sequence *)NULL)->name) - 2);
1321 RNA_def_property_ui_text(prop, "Name", "");
1322 RNA_def_struct_name_property(srna, prop);
1323 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
1325 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1326 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1327 RNA_def_property_enum_items(prop, seq_type_items);
1328 RNA_def_property_ui_text(prop, "Type", "");
1329 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1333 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1334 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
1335 RNA_def_property_ui_text(prop, "Select", "");
1336 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
1338 prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
1339 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL);
1340 RNA_def_property_ui_text(prop, "Left Handle Selected", "");
1341 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
1343 prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
1344 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL);
1345 RNA_def_property_ui_text(prop, "Right Handle Selected", "");
1346 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
1348 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
1349 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
1350 RNA_def_property_ui_text(prop, "Mute", "");
1351 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_mute_update");
1353 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
1354 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
1355 RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed");
1356 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
1358 /* strip positioning */
1359 prop = RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
1360 RNA_def_property_range(prop, 1, MAXFRAME);
1361 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1362 RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied");
1363 RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set", NULL);
1364 RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
1365 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1367 prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
1368 RNA_def_property_int_sdna(prop, NULL, "len");
1369 RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
1370 RNA_def_property_range(prop, 1, MAXFRAME);
1371 RNA_def_property_ui_text(prop, "Length",
1372 "The length of the contents of this strip before the handles are applied");
1374 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
1375 RNA_def_property_int_sdna(prop, NULL, "start");
1376 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1377 RNA_def_property_ui_text(prop, "Start Frame", "");
1378 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set", NULL); /* overlap tests and calc_seq_disp */
1379 RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
1380 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1382 prop = RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
1383 RNA_def_property_int_sdna(prop, NULL, "startdisp");
1384 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1385 RNA_def_property_ui_text(prop, "Start Frame",
1386 "Start frame displayed in the sequence editor after offsets are applied, setting this is "
1387 "equivalent to moving the handle, not the actual start frame");
1388 /* overlap tests and calc_seq_disp */
1389 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL);
1390 RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
1391 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1393 prop = RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
1394 RNA_def_property_int_sdna(prop, NULL, "enddisp");
1395 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1396 RNA_def_property_ui_text(prop, "End Frame",
1397 "End frame displayed in the sequence editor after offsets are applied");
1398 /* overlap tests and calc_seq_disp */
1399 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL);
1400 RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
1401 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1403 prop = RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
1404 RNA_def_property_int_sdna(prop, NULL, "startofs");
1405 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
1406 RNA_def_property_ui_text(prop, "Start Offset", "");
1407 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1409 prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
1410 RNA_def_property_int_sdna(prop, NULL, "endofs");
1411 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
1412 RNA_def_property_ui_text(prop, "End Offset", "");
1413 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1415 prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
1416 RNA_def_property_int_sdna(prop, NULL, "startstill");
1417 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
1418 RNA_def_property_range(prop, 0, MAXFRAME);
1419 RNA_def_property_ui_text(prop, "Start Still", "");
1420 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1422 prop = RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
1423 RNA_def_property_int_sdna(prop, NULL, "endstill");
1424 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
1425 RNA_def_property_range(prop, 0, MAXFRAME);
1426 RNA_def_property_ui_text(prop, "End Still", "");
1427 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1429 prop = RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
1430 RNA_def_property_int_sdna(prop, NULL, "machine");
1431 RNA_def_property_range(prop, 0, MAXSEQ - 1);
1432 RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
1433 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set", NULL); /* overlap test */
1434 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1438 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
1439 RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
1440 RNA_def_property_enum_items(prop, blend_mode_items);
1441 RNA_def_property_ui_text(prop, "Blend Mode", "");
1442 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1444 prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
1445 RNA_def_property_range(prop, 0.0f, 1.0f);
1446 RNA_def_property_ui_text(prop, "Blend Opacity", "");
1447 /* stupid 0-100 -> 0-1 */
1448 RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL);
1449 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1451 prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE);
1452 RNA_def_property_range(prop, 0.0f, 1.0f);
1453 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
1454 RNA_def_property_float_sdna(prop, NULL, "effect_fader");
1455 RNA_def_property_ui_text(prop, "Effect fader position", "");
1456 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1458 prop = RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
1459 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
1460 RNA_def_property_ui_text(prop, "Use Default Fade",
1461 "Fade effect using the built-in default (usually make transition as long as "
1463 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1466 prop = RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
1467 RNA_def_property_float_sdna(prop, NULL, "speed_fader");
1468 RNA_def_property_ui_text(prop, "Speed factor",
1469 "Multiply the current speed of the sequence with this number or remap current frame "
1471 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1474 prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
1475 RNA_def_property_struct_type(prop, "SequenceModifier");
1476 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this strip");
1477 rna_def_sequence_modifiers(brna, prop);
1479 RNA_api_sequence_strip(srna);
1482 static void rna_def_editor(BlenderRNA *brna)
1487 srna = RNA_def_struct(brna, "SequenceEditor", NULL);
1488 RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene datablock");
1489 RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
1490 RNA_def_struct_sdna(srna, "Editing");
1492 prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
1493 RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
1494 RNA_def_property_struct_type(prop, "Sequence");
1495 RNA_def_property_ui_text(prop, "Sequences", "");
1496 RNA_api_sequences(brna, prop);
1498 prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
1499 RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
1500 RNA_def_property_struct_type(prop, "Sequence");
1501 RNA_def_property_ui_text(prop, "Sequences", "");
1502 RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin",
1503 "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
1505 prop = RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
1506 RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
1507 RNA_def_property_struct_type(prop, "Sequence");
1508 RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
1509 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get",
1510 NULL, NULL, NULL, NULL);
1512 prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
1513 RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
1514 RNA_def_property_flag(prop, PROP_EDITABLE);
1515 RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
1517 prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
1518 RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
1519 RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer");
1520 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
1522 prop = RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE);
1523 RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
1524 RNA_def_property_ui_text(prop, "Overlay Lock", "");
1525 RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
1526 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
1528 /* access to fixed and relative frame */
1529 prop = RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
1530 RNA_def_property_ui_text(prop, "Overlay Offset", "");
1531 RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get",
1532 "rna_SequenceEditor_overlay_frame_set", NULL);
1533 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
1536 static void rna_def_filter_video(StructRNA *srna)
1540 prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
1541 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY);
1542 RNA_def_property_ui_text(prop, "De-Interlace", "For video movies to remove fields");
1543 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
1545 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
1546 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_PREMUL);
1547 RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
1548 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1550 prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
1551 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX);
1552 RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis");
1553 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1555 prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
1556 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY);
1557 RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis");
1558 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1560 prop = RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
1561 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT);
1562 RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data");
1563 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1565 prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
1566 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES);
1567 RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order");
1568 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1570 prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
1571 RNA_def_property_float_sdna(prop, NULL, "mul");
1572 RNA_def_property_range(prop, 0.0f, 20.0f);
1573 RNA_def_property_float_default(prop, 1.0f);
1574 RNA_def_property_ui_text(prop, "Multiply Colors", "");
1575 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1577 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
1578 RNA_def_property_float_sdna(prop, NULL, "sat");
1579 RNA_def_property_range(prop, 0.0f, 20.0f);
1580 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
1581 RNA_def_property_float_default(prop, 1.0f);
1582 RNA_def_property_ui_text(prop, "Saturation", "");
1583 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1585 prop = RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
1586 RNA_def_property_range(prop, 1.0f, 30.0f);
1587 RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
1588 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1590 prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
1591 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
1592 RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
1593 RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set");
1594 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1596 prop = RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
1597 RNA_def_property_pointer_sdna(prop, NULL, "strip->transform");
1598 RNA_def_property_ui_text(prop, "Transform", "");
1600 prop = RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
1601 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP);
1602 RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing");
1603 RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set");
1604 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1606 prop = RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
1607 RNA_def_property_pointer_sdna(prop, NULL, "strip->crop");
1608 RNA_def_property_ui_text(prop, "Crop", "");
1611 static void rna_def_proxy(StructRNA *srna)
1615 prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
1616 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
1617 RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip");
1618 RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set");
1620 prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
1621 RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");
1622 RNA_def_property_ui_text(prop, "Proxy", "");
1624 prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
1625 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR);
1626 RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
1627 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1629 prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
1630 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_FILE);
1631 RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from");
1632 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1635 static void rna_def_input(StructRNA *srna)
1639 prop = RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
1640 RNA_def_property_int_sdna(prop, NULL, "anim_startofs");
1641 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1642 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); /* overlap tests */
1644 RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)");
1645 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1647 prop = RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
1648 RNA_def_property_int_sdna(prop, NULL, "anim_endofs");
1649 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1650 RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); /* overlap tests */
1651 RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
1652 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1655 static void rna_def_effect_inputs(StructRNA *srna, int count)
1659 prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
1660 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1661 RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
1664 prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE);
1665 RNA_def_property_pointer_sdna(prop, NULL, "seq1");
1666 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
1667 RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
1671 prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE);
1672 RNA_def_property_pointer_sdna(prop, NULL, "seq2");
1673 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
1674 RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
1678 if (count == 3) { // not used by any effects (perhaps one day plugins?)
1679 prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE);
1680 RNA_def_property_pointer_sdna(prop, NULL, "seq3");
1681 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
1682 RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
1687 static void rna_def_image(BlenderRNA *brna)
1692 srna = RNA_def_struct(brna, "ImageSequence", "Sequence");
1693 RNA_def_struct_ui_text(srna, "Image Sequence", "Sequence strip to load one or more images");
1694 RNA_def_struct_sdna(srna, "Sequence");
1696 prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
1697 RNA_def_property_string_sdna(prop, NULL, "strip->dir");
1698 RNA_def_property_ui_text(prop, "Directory", "");
1699 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1701 prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
1702 RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
1703 RNA_def_property_struct_type(prop, "SequenceElement");
1704 RNA_def_property_ui_text(prop, "Elements", "");
1705 RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
1706 "rna_iterator_array_end", "rna_iterator_array_get",
1707 "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
1708 RNA_api_sequence_elements(brna, prop);
1710 rna_def_filter_video(srna);
1711 rna_def_proxy(srna);
1712 rna_def_input(srna);
1715 static void rna_def_meta(BlenderRNA *brna)
1720 srna = RNA_def_struct(brna, "MetaSequence", "Sequence");
1721 RNA_def_struct_ui_text(srna, "Meta Sequence", "Sequence strip to group other strips as a single sequence strip");
1722 RNA_def_struct_sdna(srna, "Sequence");
1724 prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
1725 RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
1726 RNA_def_property_struct_type(prop, "Sequence");
1727 RNA_def_property_ui_text(prop, "Sequences", "");
1729 rna_def_filter_video(srna);
1730 rna_def_proxy(srna);
1731 rna_def_input(srna);
1734 static void rna_def_scene(BlenderRNA *brna)
1739 srna = RNA_def_struct(brna, "SceneSequence", "Sequence");
1740 RNA_def_struct_ui_text(srna, "Scene Sequence", "Sequence strip to used the rendered image of a scene");
1741 RNA_def_struct_sdna(srna, "Sequence");
1743 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
1744 RNA_def_property_flag(prop, PROP_EDITABLE);
1745 RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses");
1746 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1748 prop = RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
1749 RNA_def_property_flag(prop, PROP_EDITABLE);
1750 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
1751 RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera");
1752 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1754 rna_def_filter_video(srna);
1755 rna_def_proxy(srna);
1756 rna_def_input(srna);
1759 static void rna_def_movie(BlenderRNA *brna)
1764 srna = RNA_def_struct(brna, "MovieSequence", "Sequence");
1765 RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
1766 RNA_def_struct_sdna(srna, "Sequence");
1768 prop = RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
1769 RNA_def_property_int_sdna(prop, NULL, "anim_preseek");
1770 RNA_def_property_range(prop, 0, 50);
1771 RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames");
1772 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1774 prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
1775 RNA_def_property_int_sdna(prop, NULL, "streamindex");
1776 RNA_def_property_range(prop, 0, 20);
1777 RNA_def_property_ui_text(prop, "Stream Index",
1778 "For files with several movie streams, use the stream with the given index");
1779 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
1781 prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
1782 RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
1783 RNA_def_property_struct_type(prop, "SequenceElement");
1784 RNA_def_property_ui_text(prop, "Elements", "");
1785 RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
1786 "rna_iterator_array_end", "rna_iterator_array_get",
1787 "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
1789 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1790 RNA_def_property_ui_text(prop, "File", "");
1791 RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
1792 "rna_Sequence_filepath_set");
1793 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
1795 rna_def_filter_video(srna);
1796 rna_def_proxy(srna);
1797 rna_def_input(srna);
1800 static void rna_def_movieclip(BlenderRNA *brna)
1805 srna = RNA_def_struct(brna, "MovieClipSequence", "Sequence");
1806 RNA_def_struct_ui_text(srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
1807 RNA_def_struct_sdna(srna, "Sequence");
1809 /* TODO - add clip property? */
1811 prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
1812 RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
1813 RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
1814 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1816 prop = RNA_def_property(srna, "stabilize2d", PROP_BOOLEAN, PROP_NONE);
1817 RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_STABILIZED);
1818 RNA_def_property_ui_text(prop, "Stabilize 2D Clip", "Use the 2D stabilized version of the clip");
1819 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1821 rna_def_filter_video(srna);
1822 rna_def_input(srna);
1825 static void rna_def_mask(BlenderRNA *brna)
1830 srna = RNA_def_struct(brna, "MaskSequence", "Sequence");
1831 RNA_def_struct_ui_text(srna, "Mask Sequence", "Sequence strip to load a video from a mask");
1832 RNA_def_struct_sdna(srna, "Sequence");
1834 prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
1835 RNA_def_property_flag(prop, PROP_EDITABLE);
1836 RNA_def_property_ui_text(prop, "Mask", "Mask that this sequence uses");
1837 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1839 rna_def_filter_video(srna);
1840 rna_def_input(srna);
1843 static void rna_def_sound(BlenderRNA *brna)
1848 srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
1849 RNA_def_struct_ui_text(srna, "Sound Sequence",
1850 "Sequence strip defining a sound to be played over a period of time");
1851 RNA_def_struct_sdna(srna, "Sequence");
1853 prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
1854 RNA_def_property_struct_type(prop, "Sound");
1855 RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence");
1856 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1858 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
1859 RNA_def_property_float_sdna(prop, NULL, "volume");
1860 RNA_def_property_range(prop, 0.0f, 100.0f);
1861 RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
1862 RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
1863 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1865 prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
1866 RNA_def_property_float_sdna(prop, NULL, "pitch");
1867 RNA_def_property_range(prop, 0.1f, 10.0f);
1868 RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
1869 RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
1870 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1872 prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
1873 RNA_def_property_float_sdna(prop, NULL, "pan");
1874 RNA_def_property_range(prop, -2.0f, 2.0f);
1875 RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)");
1876 RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
1877 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1879 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1880 RNA_def_property_ui_text(prop, "File", "");
1881 RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
1882 "rna_Sequence_filepath_set");
1883 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
1885 prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
1886 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
1887 RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform");
1888 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
1890 rna_def_input(srna);
1893 static void rna_def_effect(BlenderRNA *brna)
1897 srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
1898 RNA_def_struct_ui_text(srna, "Effect Sequence",
1899 "Sequence strip applying an effect on the images created by other strips");
1900 RNA_def_struct_sdna(srna, "Sequence");
1902 rna_def_filter_video(srna);
1903 rna_def_proxy(srna);
1906 static void rna_def_multicam(StructRNA *srna)
1910 prop = RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
1911 RNA_def_property_int_sdna(prop, NULL, "multicam_source");
1912 RNA_def_property_range(prop, 0, MAXSEQ - 1);
1913 RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
1914 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1916 rna_def_input(srna);
1919 static void rna_def_wipe(StructRNA *srna)
1923 static const EnumPropertyItem wipe_type_items[] = {
1924 {0, "SINGLE", 0, "Single", ""},
1925 {1, "DOUBLE", 0, "Double", ""},
1926 /* not used yet {2, "BOX", 0, "Box", ""}, */
1927 /* not used yet {3, "CROSS", 0, "Cross", ""}, */
1928 {4, "IRIS", 0, "Iris", ""},
1929 {5, "CLOCK", 0, "Clock", ""},
1930 {0, NULL, 0, NULL, NULL}
1933 static const EnumPropertyItem wipe_direction_items[] = {
1934 {0, "OUT", 0, "Out", ""},
1935 {1, "IN", 0, "In", ""},
1936 {0, NULL, 0, NULL, NULL}
1939 RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
1941 prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
1942 RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
1943 RNA_def_property_range(prop, 0.0f, 1.0f);
1944 RNA_def_property_ui_text(prop, "Blur Width",
1945 "Width of the blur edge, in percentage relative to the image size");
1946 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1948 #if 1 /* expose as radians */
1949 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
1950 RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL);
1951 RNA_def_property_range(prop, DEG2RAD(-90.0), DEG2RAD(90.0));
1953 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
1954 RNA_def_property_float_sdna(prop, NULL, "angle");
1955 RNA_def_property_range(prop, -90.0f, 90.0f);
1957 RNA_def_property_ui_text(prop, "Angle", "Edge angle");
1958 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1960 prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
1961 RNA_def_property_enum_sdna(prop, NULL, "forward");
1962 RNA_def_property_enum_items(prop, wipe_direction_items);
1963 RNA_def_property_ui_text(prop, "Direction", "Wipe direction");
1964 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1966 prop = RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
1967 RNA_def_property_enum_sdna(prop, NULL, "wipetype");
1968 RNA_def_property_enum_items(prop, wipe_type_items);
1969 RNA_def_property_ui_text(prop, "Transition Type", "");
1970 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1973 static void rna_def_glow(StructRNA *srna)
1977 RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
1979 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
1980 RNA_def_property_float_sdna(prop, NULL, "fMini");
1981 RNA_def_property_range(prop, 0.0f, 1.0f);
1982 RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
1983 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1985 prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE);
1986 RNA_def_property_float_sdna(prop, NULL, "fClamp");
1987 RNA_def_property_range(prop, 0.0f, 1.0f);
1988 RNA_def_property_ui_text(prop, "Clamp", "Brightness limit of intensity");
1989 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1991 prop = RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
1992 RNA_def_property_float_sdna(prop, NULL, "fBoost");
1993 RNA_def_property_range(prop, 0.0f, 10.0f);
1994 RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier");
1995 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
1997 prop = RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
1998 RNA_def_property_float_sdna(prop, NULL, "dDist");
1999 RNA_def_property_range(prop, 0.5f, 20.0f);
2000 RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect");
2001 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2003 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
2004 RNA_def_property_int_sdna(prop, NULL, "dQuality");
2005 RNA_def_property_range(prop, 1, 5);
2006 RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect");
2007 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2009 prop = RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
2010 RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0);
2011 RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only");
2012 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2015 static void rna_def_transform(StructRNA *srna)
2019 static const EnumPropertyItem interpolation_items[] = {
2020 {0, "NONE", 0, "None", "No interpolation"},
2021 {1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
2022 {2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
2023 {0, NULL, 0, NULL, NULL}
2026 static const EnumPropertyItem translation_unit_items[] = {
2027 {0, "PIXELS", 0, "Pixels", ""},
2028 {1, "PERCENT", 0, "Percent", ""},
2029 {0, NULL, 0, NULL, NULL}
2032 RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
2034 prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
2035 RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
2036 RNA_def_property_ui_text(prop, "Scale X", "");
2037 RNA_def_property_ui_range(prop, 0, 10, 3, 10);
2038 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2040 prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
2041 RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
2042 RNA_def_property_ui_text(prop, "Scale Y", "");
2043 RNA_def_property_ui_range(prop, 0, 10, 3, 10);
2044 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2046 prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
2047 RNA_def_property_boolean_sdna(prop, NULL, "uniform_scale", 0);
2048 RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio");
2049 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2051 prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
2052 RNA_def_property_float_sdna(prop, NULL, "xIni");
2053 RNA_def_property_ui_text(prop, "Translate X", "");
2054 RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
2055 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2057 prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
2058 RNA_def_property_float_sdna(prop, NULL, "yIni");
2059 RNA_def_property_ui_text(prop, "Translate Y", "");
2060 RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
2061 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2063 prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
2064 RNA_def_property_float_sdna(prop, NULL, "rotIni");
2065 RNA_def_property_range(prop, -360.0f, 360.0f);
2066 RNA_def_property_ui_text(prop, "Rotation", "");
2067 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2069 prop = RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
2070 RNA_def_property_enum_sdna(prop, NULL, "percent");
2071 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
2072 RNA_def_property_enum_items(prop, translation_unit_items);
2073 RNA_def_property_ui_text(prop, "Translation Unit", "");
2074 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2076 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
2077 RNA_def_property_enum_items(prop, interpolation_items);
2078 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
2079 RNA_def_property_ui_text(prop, "Interpolation", "");
2080 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2083 static void rna_def_solid_color(StructRNA *srna)
2087 RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
2089 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2090 RNA_def_property_float_sdna(prop, NULL, "col");
2091 RNA_def_property_ui_text(prop, "Color", "");
2092 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2095 static void rna_def_speed_control(StructRNA *srna)
2099 RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
2101 prop = RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
2102 RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
2103 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
2104 RNA_def_property_ui_text(prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
2105 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0);
2106 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2108 prop = RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
2109 RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
2110 RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
2111 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2113 prop = RNA_def_property(srna, "use_frame_blend", PROP_BOOLEAN, PROP_NONE);
2114 RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_BLEND);
2115 RNA_def_property_ui_text(prop, "Frame Blending", "Blend two frames into the target for a smoother result");
2116 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2118 prop = RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
2119 RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
2120 RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
2121 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
2124 static EffectInfo def_effects[] = {
2125 {"AddSequence", "Add Sequence", "Add Sequence", NULL, 2},
2126 {"AdjustmentSequence", "Adjustment Layer Sequence",
2127 "Sequence strip to perform filter adjustments to layers below", rna_def_input, 0},
2128 {"AlphaOverSequence", "Alpha Over Sequence", "Alpha Over Sequence", NULL, 2},
2129 {"AlphaUnderSequence", "Alpha Under Sequence", "Alpha Under Sequence", NULL, 2},
2130 {"ColorSequence", "Color Sequence",
2131 "Sequence strip creating an image filled with a single color", rna_def_solid_color, 0},
2132 {"CrossSequence", "Cross Sequence", "Cross Sequence", NULL, 2},
2133 {"GammaCrossSequence", "Gamma Cross Sequence", "Gamma Cross Sequence", NULL, 2},
2134 {"GlowSequence", "Glow Sequence", "Sequence strip creating a glow effect", rna_def_glow, 1},
2135 {"MulticamSequence", "Multicam Select Sequence", "Sequence strip to perform multicam editing",
2136 rna_def_multicam, 0},
2137 {"MultiplySequence", "Multiply Sequence", "Multiply Sequence", NULL, 2},
2138 {"OverDropSequence", "Over Drop Sequence", "Over Drop Sequence", NULL, 2},
2139 {"SpeedControlSequence", "SpeedControl Sequence",
2140 "Sequence strip to control the speed of other strips", rna_def_speed_control, 1},
2141 {"SubtractSequence", "Subtract Sequence", "Subtract Sequence", NULL, 2},
2142 {"TransformSequence", "Transform Sequence",
2143 "Sequence strip applying affine transformations to other strips", rna_def_transform, 1},
2144 {"WipeSequence", "Wipe Sequence", "Sequence strip creating a wipe transition",
2146 {"", "", "", NULL, 0}
2149 static void rna_def_effects(BlenderRNA *brna)
2154 for (effect = def_effects; effect->struct_name[0] != '\0'; effect++) {
2155 srna = RNA_def_struct(brna, effect->struct_name, "EffectSequence");
2156 RNA_def_struct_ui_text(srna, effect->ui_name, effect->ui_desc);
2157 RNA_def_struct_sdna(srna, "Sequence");
2159 rna_def_effect_inputs(srna, effect->inputs);
2166 static void rna_def_modifier(BlenderRNA *brna)
2171 static const EnumPropertyItem mask_input_type_items[] = {
2172 {SEQUENCE_MASK_INPUT_STRIP, "STRIP", 0, "Strip", "Use sequencer strip as mask input"},
2173 {SEQUENCE_MASK_INPUT_ID, "ID", 0, "Mask", "Use mask ID as mask input"},
2174 {0, NULL, 0, NULL, NULL}
2177 srna = RNA_def_struct(brna, "SequenceModifier", NULL);
2178 RNA_def_struct_sdna(srna, "SequenceModifierData");
2179 RNA_def_struct_ui_text(srna, "SequenceModifier", "Modifier for sequence strip");
2180 RNA_def_struct_refine_func(srna, "rna_SequenceModifier_refine");
2181 RNA_def_struct_path_func(srna, "rna_SequenceModifier_path");
2183 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2184 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceModifier_name_set");
2185 RNA_def_property_ui_text(prop, "Name", "");
2186 RNA_def_struct_name_property(srna, prop);
2187 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
2189 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2190 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2191 RNA_def_property_enum_items(prop, sequence_modifier_type_items);
2192 RNA_def_property_ui_text(prop, "Type", "");
2193 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
2195 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
2196 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_MUTE);
2197 RNA_def_property_ui_text(prop, "Mute", "Mute this modifier");
2198 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
2199 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2201 prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
2202 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_EXPANDED);
2203 RNA_def_property_ui_text(prop, "Expanded", "Mute expanded settings for the modifier");
2204 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
2205 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
2207 prop = RNA_def_property(srna, "input_mask_type", PROP_ENUM, PROP_NONE);
2208 RNA_def_property_enum_sdna(prop, NULL, "mask_input_type");
2209 RNA_def_property_enum_items(prop, mask_input_type_items);
2210 RNA_def_property_ui_text(prop, "Mask Input Type", "Type of input data used for mask");
2211 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2213 prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE);
2214 RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
2215 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll");
2216 RNA_def_property_flag(prop, PROP_EDITABLE);
2217 RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier");
2218 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2220 prop = RNA_def_property(srna, "input_mask_id", PROP_POINTER, PROP_NONE);
2221 RNA_def_property_pointer_sdna(prop, NULL, "mask_id");
2222 RNA_def_property_flag(prop, PROP_EDITABLE);
2223 RNA_def_property_ui_text(prop, "Mask", "Mask ID used as mask input for the modifier");
2224 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2227 static void rna_def_colorbalance_modifier(BlenderRNA *brna)
2232 srna = RNA_def_struct(brna, "ColorBalanceModifier", "SequenceModifier");
2233 RNA_def_struct_sdna(srna, "ColorBalanceModifierData");
2234 RNA_def_struct_ui_text(srna, "ColorBalanceModifier", "Color balance modifier for sequence strip");
2236 prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
2237 RNA_def_property_struct_type(prop, "SequenceColorBalanceData");
2239 prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
2240 RNA_def_property_float_sdna(prop, NULL, "color_multiply");
2241 RNA_def_property_range(prop, 0.0f, 20.0f);
2242 RNA_def_property_float_default(prop, 1.0f);
2243 RNA_def_property_ui_text(prop, "Multiply Colors", "");
2244 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2247 static void rna_def_curves_modifier(BlenderRNA *brna)
2252 srna = RNA_def_struct(brna, "CurvesModifier", "SequenceModifier");
2253 RNA_def_struct_sdna(srna, "CurvesModifierData");
2254 RNA_def_struct_ui_text(srna, "CurvesModifier", "RGB curves modifier for sequence strip");
2256 prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
2257 RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
2258 RNA_def_property_struct_type(prop, "CurveMapping");
2259 RNA_def_property_ui_text(prop, "Curve Mapping", "");
2260 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2263 static void rna_def_hue_modifier(BlenderRNA *brna)
2268 srna = RNA_def_struct(brna, "HueCorrectModifier", "SequenceModifier");
2269 RNA_def_struct_sdna(srna, "HueCorrectModifierData");
2270 RNA_def_struct_ui_text(srna, "HueCorrectModifier", "Hue correction modifier for sequence strip");
2272 prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
2273 RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
2274 RNA_def_property_struct_type(prop, "CurveMapping");
2275 RNA_def_property_ui_text(prop, "Curve Mapping", "");
2276 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2279 static void rna_def_brightcontrast_modifier(BlenderRNA *brna)
2284 srna = RNA_def_struct(brna, "BrightContrastModifier", "SequenceModifier");
2285 RNA_def_struct_sdna(srna, "BrightContrastModifierData");
2286 RNA_def_struct_ui_text(srna, "BrightContrastModifier", "Bright/contrast modifier data for sequence strip");
2288 prop = RNA_def_property(srna, "bright", PROP_FLOAT, PROP_UNSIGNED);
2289 RNA_def_property_float_sdna(prop, NULL, "bright");
2290 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2291 RNA_def_property_ui_text(prop, "Bright", "");
2292 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2294 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
2295 RNA_def_property_float_sdna(prop, NULL, "contrast");
2296 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2297 RNA_def_property_ui_text(prop, "Contrast", "");
2298 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
2301 static void rna_def_modifiers(BlenderRNA *brna)
2303 rna_def_modifier(brna);
2305 rna_def_colorbalance_modifier(brna);
2306 rna_def_curves_modifier(brna);
2307 rna_def_hue_modifier(brna);
2308 rna_def_brightcontrast_modifier(brna);
2311 void RNA_def_sequencer(BlenderRNA *brna)
2313 rna_def_color_balance(brna);
2315 rna_def_strip_element(brna);
2316 rna_def_strip_proxy(brna);
2317 rna_def_strip_color_balance(brna);
2318 rna_def_strip_crop(brna);
2319 rna_def_strip_transform(brna);
2321 rna_def_sequence(brna);
2322 rna_def_editor(brna);
2324 rna_def_image(brna);
2326 rna_def_scene(brna);
2327 rna_def_movie(brna);
2328 rna_def_movieclip(brna);
2330 rna_def_sound(brna);
2331 rna_def_effect(brna);
2332 rna_def_effects(brna);
2333 rna_def_modifiers(brna);