Blender  V2.59
rna_sequencer.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_sequencer.c 37330 2011-06-09 08:58:27Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008)
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <stdlib.h>
00031 #include <limits.h>
00032 
00033 #include "RNA_access.h"
00034 #include "RNA_define.h"
00035 
00036 #include "rna_internal.h"
00037 
00038 #include "DNA_anim_types.h"
00039 #include "DNA_object_types.h"
00040 #include "DNA_scene_types.h"
00041 #include "DNA_sequence_types.h"
00042 
00043 #include "BKE_animsys.h"
00044 #include "BKE_global.h"
00045 #include "BKE_sequencer.h"
00046 
00047 #include "MEM_guardedalloc.h"
00048 
00049 #include "WM_types.h"
00050 #include "BLI_math.h"
00051 
00052 #ifdef RNA_RUNTIME
00053 
00054 static float to_dB(float x)
00055 {
00056         return logf(x * x + 1e-30f) * 4.34294480f;
00057 }
00058 
00059 static float from_dB(float x)
00060 {
00061         return expf(x * 0.11512925f);
00062 }
00063 
00064 /* build a temp referene to the parent */
00065 static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
00066 {
00067         for (; seq; seq= seq->next) {
00068                 seq->tmp= seq_par;
00069                 if(seq->type == SEQ_META) {
00070                         meta_tmp_ref(seq, seq->seqbase.first);
00071                 }
00072         }
00073 }
00074 
00075 static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00076 {
00077         Scene *scene= (Scene*)ptr->id.data;
00078         Editing *ed= seq_give_editing(scene, FALSE);
00079 
00080         meta_tmp_ref(NULL, ed->seqbase.first);
00081 
00082         rna_iterator_listbase_begin(iter, &ed->seqbase, NULL);
00083 }
00084 
00085 static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter)
00086 {
00087         ListBaseIterator *internal= iter->internal;
00088         Sequence *seq= (Sequence*)internal->link;
00089 
00090         if(seq->seqbase.first)
00091                 internal->link= (Link*)seq->seqbase.first;
00092         else if(seq->next)
00093                 internal->link= (Link*)seq->next;
00094         else {
00095                 internal->link= NULL;
00096 
00097                 do {
00098                         seq= seq->tmp; // XXX - seq's dont reference their parents!
00099                         if(seq && seq->next) {
00100                                 internal->link= (Link*)seq->next;
00101                                 break;
00102                         }
00103                 } while(seq);
00104         }
00105 
00106         iter->valid= (internal->link != NULL);
00107 }
00108 
00109 /* internal use */
00110 static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
00111 {
00112         Sequence *seq= (Sequence*)ptr->data;
00113 
00114         /* Hack? copied from sequencer.c::reload_sequence_new_file() */
00115         size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem);
00116         
00117         /* the problem with seq->strip->len and seq->len is that it's discounted from the offset (hard cut trim) */
00118         return (int) olen;
00119 }
00120 
00121 static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00122 {
00123         Sequence *seq= (Sequence*)ptr->data;
00124         rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem), rna_SequenceEditor_elements_length(ptr), 0, NULL);
00125 }
00126 
00127 static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
00128 {
00129         Editing *ed= seq_give_editing(scene, FALSE);
00130         ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
00131         calc_sequence_disp(scene, seq);
00132 
00133         if(seq_test_overlap(seqbase, seq)) {
00134                 shuffle_seq(seqbase, seq, scene); // XXX - BROKEN!, uses context seqbasep
00135         }
00136         sort_seq(scene);
00137 }
00138 
00139 static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
00140 {
00141         Sequence *seq= (Sequence*)ptr->data;
00142         Scene *scene= (Scene*)ptr->id.data;
00143         
00144         seq_translate(scene, seq, value - seq->start);
00145         rna_Sequence_frame_change_update(scene, seq);
00146 }
00147 
00148 static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
00149 {
00150         Sequence *seq= (Sequence*)ptr->data;
00151         Scene *scene= (Scene*)ptr->id.data;
00152 
00153         seq_tx_set_final_left(seq, value);
00154         seq_single_fix(seq);
00155         rna_Sequence_frame_change_update(scene, seq);
00156 }
00157 
00158 static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
00159 {
00160         Sequence *seq= (Sequence*)ptr->data;
00161         Scene *scene= (Scene*)ptr->id.data;
00162 
00163         seq_tx_set_final_right(seq, value);
00164         seq_single_fix(seq);
00165         rna_Sequence_frame_change_update(scene, seq);
00166 }
00167 
00168 static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
00169 {
00170         Sequence *seq= (Sequence*)ptr->data;
00171         Scene *scene= (Scene*)ptr->id.data;
00172 
00173         seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
00174 
00175         reload_sequence_new_file(scene, seq, FALSE);
00176         rna_Sequence_frame_change_update(scene, seq);
00177 }
00178 
00179 static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
00180 {
00181         Sequence *seq= (Sequence*)ptr->data;
00182         Scene *scene= (Scene*)ptr->id.data;
00183 
00184         seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
00185 
00186         reload_sequence_new_file(scene, seq, FALSE);
00187         rna_Sequence_frame_change_update(scene, seq);
00188 }
00189 
00190 static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value)
00191 {
00192         Sequence *seq= (Sequence*)ptr->data;
00193         Scene *scene= (Scene*)ptr->id.data;
00194         
00195         seq_tx_set_final_right(seq, seq->start+value);
00196         rna_Sequence_frame_change_update(scene, seq);
00197 }
00198 
00199 static int rna_Sequence_frame_length_get(PointerRNA *ptr)
00200 {
00201         Sequence *seq= (Sequence*)ptr->data;
00202         return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0);
00203 }
00204 
00205 static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
00206 {
00207         Sequence *seq= (Sequence*)ptr->data;
00208         Scene *scene= (Scene*)ptr->id.data;
00209         Editing *ed= seq_give_editing(scene, FALSE);
00210         ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
00211 
00212         seq->machine= value;
00213         
00214         if( seq_test_overlap(seqbase, seq) ) {
00215                 shuffle_seq(seqbase, seq, scene);  // XXX - BROKEN!, uses context seqbasep
00216         }
00217         sort_seq(scene);
00218 }
00219 
00220 /* properties that need to allocate structs */
00221 static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
00222 {
00223         Sequence *seq= (Sequence*)ptr->data;
00224         int c;
00225         
00226         if(value) {
00227                 seq->flag |= SEQ_USE_COLOR_BALANCE;
00228                 if(seq->strip->color_balance == NULL) {
00229                         seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
00230                         for (c=0; c<3; c++) {
00231                                 seq->strip->color_balance->lift[c] = 1.0f;
00232                                 seq->strip->color_balance->gamma[c] = 1.0f;
00233                                 seq->strip->color_balance->gain[c] = 1.0f;
00234                         }
00235                 }
00236         } else {
00237                 seq->flag ^= SEQ_USE_COLOR_BALANCE;
00238         }
00239 }
00240 
00241 static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
00242 {
00243         Sequence *seq= (Sequence*)ptr->data;
00244         if(value) {
00245                 seq->flag |= SEQ_USE_PROXY;
00246                 if(seq->strip->proxy == NULL) {
00247                         seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy");
00248                 }
00249         } else {
00250                 seq->flag ^= SEQ_USE_PROXY;
00251         }
00252 }
00253 
00254 static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
00255 {
00256         Sequence *seq= (Sequence*)ptr->data;
00257         if(value) {
00258                 seq->flag |= SEQ_USE_TRANSFORM;
00259                 if(seq->strip->transform == NULL) {
00260                         seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
00261                 }
00262         } else {
00263                 seq->flag ^= SEQ_USE_TRANSFORM;
00264         }
00265 }
00266 
00267 static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
00268 {
00269         Sequence *seq= (Sequence*)ptr->data;
00270         if(value) {
00271                 seq->flag |= SEQ_USE_CROP;
00272                 if(seq->strip->crop == NULL) {
00273                         seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
00274                 }
00275         } else {
00276                 seq->flag ^= SEQ_USE_CROP;
00277         }
00278 }
00279 
00280 static int transform_seq_cmp_cb(Sequence *seq, void *arg_pt)
00281 {
00282         struct { Sequence *seq; void *transform; } *data= arg_pt;
00283 
00284         if(seq->strip && seq->strip->transform == data->transform) {
00285                 data->seq= seq;
00286                 return -1; /* done so bail out */
00287         }
00288         return 1;
00289 }
00290 
00291 static char *rna_SequenceTransform_path(PointerRNA *ptr)
00292 {
00293         Scene *scene= ptr->id.data;
00294         Editing *ed= seq_give_editing(scene, FALSE);
00295         Sequence *seq;
00296 
00297         struct { Sequence *seq; void *transform; } data;
00298         data.seq= NULL;
00299         data.transform= ptr->data;
00300 
00301         /* irritating we need to search for our sequence! */
00302         seqbase_recursive_apply(&ed->seqbase, transform_seq_cmp_cb, &data);
00303         seq= data.seq;
00304 
00305         if (seq && seq->name+2)
00306                 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform", seq->name+2);
00307         else
00308                 return BLI_strdup("");
00309 }
00310 
00311 static int crop_seq_cmp_cb(Sequence *seq, void *arg_pt)
00312 {
00313         struct { Sequence *seq; void *crop; } *data= arg_pt;
00314 
00315         if(seq->strip && seq->strip->crop == data->crop) {
00316                 data->seq= seq;
00317                 return -1; /* done so bail out */
00318         }
00319         return 1;
00320 }
00321 
00322 static char *rna_SequenceCrop_path(PointerRNA *ptr)
00323 {
00324         Scene *scene= ptr->id.data;
00325         Editing *ed= seq_give_editing(scene, FALSE);
00326         Sequence *seq;
00327 
00328         struct { Sequence *seq; void *crop; } data;
00329         data.seq= NULL;
00330         data.crop= ptr->data;
00331 
00332         /* irritating we need to search for our sequence! */
00333         seqbase_recursive_apply(&ed->seqbase, crop_seq_cmp_cb, &data);
00334         seq= data.seq;
00335 
00336         if (seq && seq->name+2)
00337                 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop", seq->name+2);
00338         else
00339                 return BLI_strdup("");
00340 }
00341 
00342 
00343 /* name functions that ignore the first two characters */
00344 static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
00345 {
00346         Sequence *seq= (Sequence*)ptr->data;
00347         BLI_strncpy(value, seq->name+2, sizeof(seq->name)-2);
00348 }
00349 
00350 static int rna_Sequence_name_length(PointerRNA *ptr)
00351 {
00352         Sequence *seq= (Sequence*)ptr->data;
00353         return strlen(seq->name+2);
00354 }
00355 
00356 static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
00357 {
00358         Scene *scene= (Scene*)ptr->id.data;
00359         Sequence *seq= (Sequence*)ptr->data;
00360         char oldname[sizeof(seq->name)];
00361         AnimData *adt;
00362         
00363         /* make a copy of the old name first */
00364         BLI_strncpy(oldname, seq->name+2, sizeof(seq->name)-2);
00365         
00366         /* copy the new name into the name slot */
00367         BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2);
00368         
00369         /* make sure the name is unique */
00370         seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
00371         
00372         /* fix all the animation data which may link to this */
00373 
00374         /* dont rename everywhere because these are per scene */
00375         /* BKE_all_animdata_fix_paths_rename("sequence_editor.sequences_all", oldname, seq->name+2); */
00376         adt= BKE_animdata_from_id(&scene->id);
00377         if(adt)
00378                 BKE_animdata_fix_paths_rename(&scene->id, adt, "sequence_editor.sequences_all", oldname, seq->name+2, 0, 0, 1);
00379 }
00380 
00381 static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
00382 {
00383         Sequence *seq= (Sequence*)ptr->data;
00384 
00385         switch(seq->type) {
00386                 case SEQ_IMAGE:
00387                         return &RNA_ImageSequence;
00388                 case SEQ_META:
00389                         return &RNA_MetaSequence;
00390                 case SEQ_SCENE:
00391                         return &RNA_SceneSequence;
00392                 case SEQ_MOVIE:
00393                         return &RNA_MovieSequence;
00394                 case SEQ_SOUND:
00395                         return &RNA_SoundSequence;
00396                 case SEQ_CROSS:
00397                 case SEQ_ADD:
00398                 case SEQ_SUB:
00399                 case SEQ_ALPHAOVER:
00400                 case SEQ_ALPHAUNDER:
00401                 case SEQ_GAMCROSS:
00402                 case SEQ_MUL:
00403                 case SEQ_OVERDROP:
00404                         return &RNA_EffectSequence;
00405                 case SEQ_MULTICAM:
00406                         return &RNA_MulticamSequence;
00407                 case SEQ_ADJUSTMENT:
00408                         return &RNA_AdjustmentSequence;
00409                 case SEQ_PLUGIN:
00410                         return &RNA_PluginSequence;
00411                 case SEQ_WIPE:
00412                         return &RNA_WipeSequence;
00413                 case SEQ_GLOW:
00414                         return &RNA_GlowSequence;
00415                 case SEQ_TRANSFORM:
00416                         return &RNA_TransformSequence;
00417                 case SEQ_COLOR:
00418                         return &RNA_ColorSequence;
00419                 case SEQ_SPEED:
00420                         return &RNA_SpeedControlSequence;
00421                 default:
00422                         return &RNA_Sequence;
00423         }
00424 }
00425 
00426 static char *rna_Sequence_path(PointerRNA *ptr)
00427 {
00428         Sequence *seq= (Sequence*)ptr->data;
00429         
00430         /* sequencer data comes from scene... 
00431          * TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
00432          */
00433         if (seq->name+2)
00434                 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"]", seq->name+2);
00435         else
00436                 return BLI_strdup("");
00437 }
00438 
00439 static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
00440 {
00441         ListBaseIterator *internal= iter->internal;
00442         MetaStack *ms= (MetaStack*)internal->link;
00443 
00444         return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
00445 }
00446 
00447 /* TODO, expose seq path setting as a higher level sequencer BKE function */
00448 static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
00449 {
00450         Sequence *seq= (Sequence*)(ptr->data);
00451         char dir[FILE_MAX], name[FILE_MAX];
00452 
00453         if(seq->type == SEQ_SOUND && seq->sound) {
00454                 /* for sound strips we need to update the sound as well.
00455                  * arguably, this could load in a new sound rather than modify an existing one.
00456                  * but while using the sequencer its most likely your not using the sound in the game engine too.
00457                  */
00458                 PointerRNA id_ptr;
00459                 RNA_id_pointer_create((ID *)seq->sound, &id_ptr);
00460                 RNA_string_set(&id_ptr, "filepath", value);
00461         }
00462 
00463         BLI_split_dirfile(value, dir, name);
00464         BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir));
00465         BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name));
00466 }
00467 
00468 static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value)
00469 {
00470         Sequence *seq= (Sequence*)(ptr->data);
00471         char path[FILE_MAX];
00472 
00473         BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
00474         BLI_strncpy(value, path, strlen(path)+1);
00475 }
00476 
00477 static int rna_Sequence_filepath_length(PointerRNA *ptr)
00478 {
00479         Sequence *seq= (Sequence*)(ptr->data);
00480         char path[FILE_MAX];
00481 
00482         BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
00483         return strlen(path)+1;
00484 }
00485 
00486 static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value)
00487 {
00488         StripProxy *proxy= (StripProxy*)(ptr->data);
00489         char dir[FILE_MAX], name[FILE_MAX];
00490 
00491         BLI_split_dirfile(value, dir, name);
00492         BLI_strncpy(proxy->dir, dir, sizeof(proxy->dir));
00493         BLI_strncpy(proxy->file, name, sizeof(proxy->file));
00494 }
00495 
00496 static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value)
00497 {
00498         StripProxy *proxy= (StripProxy*)(ptr->data);
00499         char path[FILE_MAX];
00500 
00501         BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
00502         BLI_strncpy(value, path, strlen(path)+1);
00503 }
00504 
00505 static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
00506 {
00507         StripProxy *proxy= (StripProxy*)(ptr->data);
00508         char path[FILE_MAX];
00509 
00510         BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
00511         return strlen(path)+1;
00512 }
00513 
00514 static float rna_Sequence_attenuation_get(PointerRNA *ptr)
00515 {
00516         Sequence *seq= (Sequence*)(ptr->data);
00517 
00518         return to_dB(seq->volume);
00519 }
00520 
00521 static void rna_Sequence_attenuation_set(PointerRNA *ptr, float value)
00522 {
00523         Sequence *seq= (Sequence*)(ptr->data);
00524 
00525         seq->volume = from_dB(value);
00526 }
00527 
00528 
00529 static int rna_Sequence_input_count_get(PointerRNA *ptr)
00530 {
00531         Sequence *seq= (Sequence*)(ptr->data);
00532 
00533         return get_sequence_effect_num_inputs(seq->type);
00534 }
00535 /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
00536 {
00537         Sequence *seq= (Sequence*)(ptr->data);
00538         char dir[FILE_MAX], name[FILE_MAX];
00539 
00540         BLI_split_dirfile(value, dir, name);
00541         BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir));
00542         BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name));
00543 }
00544 
00545 static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
00546 {
00547         StripElem *elem= (StripElem*)(ptr->data);
00548         char name[FILE_MAX];
00549 
00550         BLI_split_dirfile(value, NULL, name);
00551         BLI_strncpy(elem->name, name, sizeof(elem->name));
00552 }*/
00553 
00554 static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00555 {
00556         Editing *ed= seq_give_editing(scene, FALSE);
00557 
00558         free_imbuf_seq(scene, &ed->seqbase, FALSE, TRUE);
00559 
00560         if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
00561                 seq_update_sound(scene, ptr->data);
00562 }
00563 
00564 static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00565 {
00566         Editing *ed= seq_give_editing(scene, FALSE);
00567 
00568         free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
00569 
00570         if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
00571                 seq_update_sound(scene, ptr->data);
00572 }
00573 
00574 static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00575 {
00576         Editing *ed= seq_give_editing(scene, FALSE);
00577 
00578         seq_update_muting(scene, ed);
00579         rna_Sequence_update(bmain, scene, ptr);
00580 }
00581 
00582 static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00583 {
00584         Sequence *seq= (Sequence*)(ptr->data);
00585         reload_sequence_new_file(scene, seq, TRUE);
00586         calc_sequence(scene, seq);
00587         rna_Sequence_update(bmain, scene, ptr);
00588 }
00589 
00590 /* do_versions? */
00591 static float rna_Sequence_opacity_get(PointerRNA *ptr)
00592 {
00593         Sequence *seq= (Sequence*)(ptr->data);
00594         return seq->blend_opacity / 100.0f;
00595 }
00596 static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
00597 {
00598         Sequence *seq= (Sequence*)(ptr->data);
00599         CLAMP(value, 0.0f, 1.0f);
00600         seq->blend_opacity = value * 100.0f;
00601 }
00602 
00603 
00604 static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
00605 {
00606         struct { Sequence *seq; void *color_balance; } *data= arg_pt;
00607 
00608         if(seq->strip && seq->strip->color_balance == data->color_balance) {
00609                 data->seq= seq;
00610                 return -1; /* done so bail out */
00611         }
00612         return 1;
00613 }
00614 static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
00615 {
00616         Scene *scene= ptr->id.data;
00617         Editing *ed= seq_give_editing(scene, FALSE);
00618         Sequence *seq;
00619 
00620         struct { Sequence *seq; void *color_balance; } data;
00621         data.seq= NULL;
00622         data.color_balance= ptr->data;
00623 
00624         /* irritating we need to search for our sequence! */
00625         seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
00626         seq= data.seq;
00627 
00628         if (seq && seq->name+2)
00629                 return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name+2);
00630         else
00631                 return BLI_strdup("");
00632 }
00633 
00634 static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, int value)
00635 {
00636         Scene *scene= ptr->id.data;
00637         Editing *ed= seq_give_editing(scene, FALSE);
00638 
00639         if(ed==NULL)
00640                 return;
00641 
00642         /* convert from abs to relative and back */
00643         if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS)==0 && value) {
00644                 ed->over_cfra= scene->r.cfra + ed->over_ofs;
00645                 ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
00646         }
00647         else if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
00648                 ed->over_ofs= ed->over_cfra - scene->r.cfra;
00649                 ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
00650         }
00651 }
00652 
00653 static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
00654 {
00655         Scene *scene= (Scene *)ptr->id.data;
00656         Editing *ed= seq_give_editing(scene, FALSE);
00657 
00658         if(ed==NULL)
00659                 return scene->r.cfra;
00660 
00661         if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
00662                 return ed->over_cfra - scene->r.cfra;
00663         else
00664                 return ed->over_ofs;
00665 
00666 }
00667 
00668 static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
00669 {
00670         Scene *scene= (Scene *)ptr->id.data;
00671         Editing *ed= seq_give_editing(scene, FALSE);
00672 
00673         if(ed==NULL)
00674                 return;
00675 
00676 
00677         if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
00678                 ed->over_cfra= (scene->r.cfra + value);
00679         else
00680                 ed->over_ofs= value;
00681 }
00682 
00683 
00684 static void rna_WipeSequence_angle_set(PointerRNA *ptr, float value)
00685 {
00686         Sequence *seq= (Sequence *)(ptr->data);
00687         value= RAD2DEGF(value);
00688         CLAMP(value, -90.0f, 90.0f);
00689         ((WipeVars *)seq->effectdata)->angle= value;
00690 }
00691 
00692 static float rna_WipeSequence_angle_get(PointerRNA *ptr)
00693 {
00694         Sequence *seq= (Sequence *)(ptr->data);
00695 
00696         return DEG2RADF(((WipeVars *)seq->effectdata)->angle);
00697 }
00698 
00699 
00700 #else
00701 
00702 static void rna_def_strip_element(BlenderRNA *brna)
00703 {
00704         StructRNA *srna;
00705         PropertyRNA *prop;
00706         
00707         srna = RNA_def_struct(brna, "SequenceElement", NULL);
00708         RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame");
00709         RNA_def_struct_sdna(srna, "StripElem");
00710         
00711         prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
00712         RNA_def_property_string_sdna(prop, NULL, "name");
00713         RNA_def_property_ui_text(prop, "Filename", "");
00714         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00715 
00716         prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
00717         RNA_def_property_int_sdna(prop, NULL, "orig_width");
00718         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00719         RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
00720 
00721         prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
00722         RNA_def_property_int_sdna(prop, NULL, "orig_height");
00723         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00724         RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
00725 }
00726 
00727 static void rna_def_strip_crop(BlenderRNA *brna)
00728 {
00729         StructRNA *srna;
00730         PropertyRNA *prop;
00731         
00732         srna = RNA_def_struct(brna, "SequenceCrop", NULL);
00733         RNA_def_struct_ui_text(srna, "Sequence Crop", "Cropping parameters for a sequence strip");
00734         RNA_def_struct_sdna(srna, "StripCrop");
00735 
00736         prop= RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
00737         RNA_def_property_int_sdna(prop, NULL, "top");
00738         RNA_def_property_ui_text(prop, "Top", "");
00739         RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
00740         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00741         
00742         prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
00743         RNA_def_property_int_sdna(prop, NULL, "bottom");
00744         RNA_def_property_ui_text(prop, "Bottom", "");
00745         RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
00746         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00747         
00748         prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
00749         RNA_def_property_int_sdna(prop, NULL, "left");
00750         RNA_def_property_ui_text(prop, "Left", "");
00751         RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
00752         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00753 
00754         prop= RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
00755         RNA_def_property_int_sdna(prop, NULL, "right");
00756         RNA_def_property_ui_text(prop, "Right", "");
00757         RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
00758         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00759 
00760         RNA_def_struct_path_func(srna, "rna_SequenceCrop_path");
00761 }
00762 
00763 static void rna_def_strip_transform(BlenderRNA *brna)
00764 {
00765         StructRNA *srna;
00766         PropertyRNA *prop;
00767         
00768         srna = RNA_def_struct(brna, "SequenceTransform", NULL);
00769         RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip");
00770         RNA_def_struct_sdna(srna, "StripTransform");
00771 
00772         prop= RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
00773         RNA_def_property_int_sdna(prop, NULL, "xofs");
00774         RNA_def_property_ui_text(prop, "Offset X", "");
00775         RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
00776         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00777 
00778         prop= RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
00779         RNA_def_property_int_sdna(prop, NULL, "yofs");
00780         RNA_def_property_ui_text(prop, "Offset Y", "");
00781         RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
00782         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00783 
00784         RNA_def_struct_path_func(srna, "rna_SequenceTransform_path");
00785 
00786 }
00787 
00788 static void rna_def_strip_proxy(BlenderRNA *brna)
00789 {
00790         StructRNA *srna;
00791         PropertyRNA *prop;
00792         
00793         srna = RNA_def_struct(brna, "SequenceProxy", NULL);
00794         RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip");
00795         RNA_def_struct_sdna(srna, "StripProxy");
00796         
00797         prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
00798         RNA_def_property_string_sdna(prop, NULL, "dir");
00799         RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
00800         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00801         
00802         prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
00803         RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
00804         RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length", "rna_Sequence_proxy_filepath_set");
00805 
00806         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00807 }
00808 
00809 static void rna_def_strip_color_balance(BlenderRNA *brna)
00810 {
00811         StructRNA *srna;
00812         PropertyRNA *prop;
00813 
00814         srna = RNA_def_struct(brna, "SequenceColorBalance", NULL);
00815         RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
00816         RNA_def_struct_sdna(srna, "StripColorBalance");
00817 
00818         prop= RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
00819         RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
00820         RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
00821         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00822         
00823         prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
00824         RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
00825         RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
00826         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00827         
00828         prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
00829         RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
00830         RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
00831         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00832         
00833         prop= RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
00834         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
00835         RNA_def_property_ui_text(prop, "Inverse Gain", "");
00836         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00837 
00838         prop= RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
00839         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
00840         RNA_def_property_ui_text(prop, "Inverse Gamma", "");
00841         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00842 
00843         prop= RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
00844         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
00845         RNA_def_property_ui_text(prop, "Inverse Lift", "");
00846         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00847 
00848         RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
00849 
00850         /* not yet used
00851         prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
00852         RNA_def_property_range(prop, 0.0f, 1.0f);
00853         RNA_def_property_ui_text(prop, "Exposure", "");
00854         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00855         
00856         prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
00857         RNA_def_property_range(prop, 0.0f, 1.0f);
00858         RNA_def_property_ui_text(prop, "Saturation", "");
00859         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); */
00860 }
00861 
00862 static void rna_def_sequence(BlenderRNA *brna)
00863 {
00864         StructRNA *srna;
00865         PropertyRNA *prop;
00866 
00867         static const EnumPropertyItem seq_type_items[]= {
00868                 {SEQ_IMAGE, "IMAGE", 0, "Image", ""}, 
00869                 {SEQ_META, "META", 0, "Meta", ""}, 
00870                 {SEQ_SCENE, "SCENE", 0, "Scene", ""}, 
00871                 {SEQ_MOVIE, "MOVIE", 0, "Movie", ""}, 
00872                 {SEQ_SOUND, "SOUND", 0, "Sound", ""},
00873                 {SEQ_CROSS, "CROSS", 0, "Cross", ""}, 
00874                 {SEQ_ADD, "ADD", 0, "Add", ""}, 
00875                 {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""}, 
00876                 {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, 
00877                 {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, 
00878                 {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, 
00879                 {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""}, 
00880                 {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, 
00881                 {SEQ_PLUGIN, "PLUGIN", 0, "plugin", ""}, 
00882                 {SEQ_WIPE, "WIPE", 0, "Wipe", ""}, 
00883                 {SEQ_GLOW, "GLOW", 0, "Glow", ""}, 
00884                 {SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, 
00885                 {SEQ_COLOR, "COLOR", 0, "Color", ""}, 
00886                 {SEQ_SPEED, "SPEED", 0, "Speed", ""}, 
00887                 {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
00888                 {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
00889                 {0, NULL, 0, NULL, NULL}};
00890 
00891         static const EnumPropertyItem blend_mode_items[]= {
00892                 {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""}, 
00893                 {SEQ_CROSS, "CROSS", 0, "Cross", ""}, 
00894                 {SEQ_ADD, "ADD", 0, "Add", ""}, 
00895                 {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""}, 
00896                 {SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, 
00897                 {SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, 
00898                 {SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, 
00899                 {SEQ_MUL, "MULTIPLY", 0, "Multiply", ""}, 
00900                 {SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, 
00901                 {0, NULL, 0, NULL, NULL}};
00902         
00903         srna = RNA_def_struct(brna, "Sequence", NULL);
00904         RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor");
00905         RNA_def_struct_refine_func(srna, "rna_Sequence_refine");
00906         RNA_def_struct_path_func(srna, "rna_Sequence_path");
00907 
00908         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00909         RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set");
00910         RNA_def_property_string_maxlength(prop, sizeof(((Sequence*)NULL)->name)-2);
00911         RNA_def_property_ui_text(prop, "Name", "");
00912         RNA_def_struct_name_property(srna, prop);
00913         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
00914 
00915         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
00916         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00917         RNA_def_property_enum_items(prop, seq_type_items);
00918         RNA_def_property_ui_text(prop, "Type", "");
00919         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00920 
00921         //prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
00922         //RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by this sequence");
00923 
00924         /* flags */
00925 
00926         prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
00927         RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
00928         RNA_def_property_ui_text(prop, "Select", "");
00929         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
00930 
00931         prop= RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
00932         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL);
00933         RNA_def_property_ui_text(prop, "Left Handle Selected", "");
00934         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
00935 
00936         prop= RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
00937         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL);
00938         RNA_def_property_ui_text(prop, "Right Handle Selected", "");
00939         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
00940 
00941         prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
00942         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
00943         RNA_def_property_ui_text(prop, "Mute", "");
00944         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_mute_update");
00945 
00946         prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
00947         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
00948         RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed");
00949         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
00950 
00951         /* strip positioning */
00952 
00953         prop= RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
00954         RNA_def_property_range(prop, 1, MAXFRAME);
00955         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00956         RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
00957         RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set",NULL);
00958         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00959 
00960         prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
00961         RNA_def_property_int_sdna(prop, NULL, "len");
00962         RNA_def_property_clear_flag(prop, PROP_EDITABLE|PROP_ANIMATABLE);
00963         RNA_def_property_range(prop, 1, MAXFRAME);
00964         RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
00965         
00966         prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
00967         RNA_def_property_int_sdna(prop, NULL, "start");
00968         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00969         RNA_def_property_ui_text(prop, "Start Frame", "");
00970         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp
00971         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00972         
00973         prop= RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
00974         RNA_def_property_int_sdna(prop, NULL, "startdisp");
00975         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00976         RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivalent to moving the handle, not the actual start frame");
00977         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); // overlap tests and calc_seq_disp
00978         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00979 
00980         prop= RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
00981         RNA_def_property_int_sdna(prop, NULL, "enddisp");
00982         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00983         RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied");
00984         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); // overlap tests and calc_seq_disp
00985         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00986 
00987         prop= RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
00988         RNA_def_property_int_sdna(prop, NULL, "startofs");
00989         RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
00990         RNA_def_property_ui_text(prop, "Start Offset", "");
00991         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00992         
00993         prop= RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
00994         RNA_def_property_int_sdna(prop, NULL, "endofs");
00995         RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
00996         RNA_def_property_ui_text(prop, "End Offset", "");
00997         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
00998         
00999         prop= RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
01000         RNA_def_property_int_sdna(prop, NULL, "startstill");
01001         RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
01002         RNA_def_property_range(prop, 0, MAXFRAME);
01003         RNA_def_property_ui_text(prop, "Start Still", "");
01004         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01005         
01006         prop= RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
01007         RNA_def_property_int_sdna(prop, NULL, "endstill");
01008         RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
01009         RNA_def_property_range(prop, 0, MAXFRAME);
01010         RNA_def_property_ui_text(prop, "End Still", "");
01011         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01012         
01013         prop= RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
01014         RNA_def_property_int_sdna(prop, NULL, "machine");
01015         RNA_def_property_range(prop, 0, MAXSEQ-1);
01016         RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
01017         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set",NULL); // overlap test
01018         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01019 
01020         /* blending */
01021 
01022         prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
01023         RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
01024         RNA_def_property_enum_items(prop, blend_mode_items);
01025         RNA_def_property_ui_text(prop, "Blend Mode", "");
01026         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01027         
01028         prop= RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
01029         RNA_def_property_range(prop, 0.0f, 1.0f);
01030         RNA_def_property_ui_text(prop, "Blend Opacity", "");
01031         RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL); // stupid 0-100 -> 0-1
01032         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01033         
01034         prop= RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE);
01035         RNA_def_property_range(prop, 0.0f, 1.0f);
01036         RNA_def_property_float_sdna(prop, NULL, "effect_fader");
01037         RNA_def_property_ui_text(prop, "Effect fader position", "");
01038         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01039 
01040         prop= RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
01041         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
01042         RNA_def_property_ui_text(prop, "Use Default Fade", "Fade effect using the built-in default (usually make transition as long as effect strip)");
01043         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01044         
01045 
01046         prop= RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
01047         RNA_def_property_float_sdna(prop, NULL, "speed_fader");
01048         RNA_def_property_ui_text(prop, "Speed factor", "Multiply the current speed of the sequence with this number or remap current frame to this frame");
01049         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01050 
01051         /* effect strip inputs */
01052 
01053         prop= RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
01054         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01055         RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
01056 
01057         prop= RNA_def_property(srna, "input_1",  PROP_POINTER, PROP_NONE);
01058         RNA_def_property_pointer_sdna(prop, NULL, "seq1");
01059         RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
01060 
01061         prop= RNA_def_property(srna, "input_2",  PROP_POINTER, PROP_NONE);
01062         RNA_def_property_pointer_sdna(prop, NULL, "seq2");
01063         RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
01064 
01065         prop= RNA_def_property(srna, "input_3",  PROP_POINTER, PROP_NONE);
01066         RNA_def_property_pointer_sdna(prop, NULL, "seq1");
01067         RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
01068 
01069         RNA_api_sequence_strip(srna);
01070 }
01071 
01072 static void rna_def_editor(BlenderRNA *brna)
01073 {
01074         StructRNA *srna;
01075         PropertyRNA *prop;
01076         
01077         srna = RNA_def_struct(brna, "SequenceEditor", NULL);
01078         RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene datablock");
01079         RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
01080         RNA_def_struct_sdna(srna, "Editing");
01081 
01082         prop= RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
01083         RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
01084         RNA_def_property_struct_type(prop, "Sequence");
01085         RNA_def_property_ui_text(prop, "Sequences", "");
01086 
01087         prop= RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
01088         RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
01089         RNA_def_property_struct_type(prop, "Sequence");
01090         RNA_def_property_ui_text(prop, "Sequences", "");
01091         RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", 0, 0, 0, 0, 0);
01092 
01093         prop= RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
01094         RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
01095         RNA_def_property_struct_type(prop, "Sequence");
01096         RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
01097         RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEditor_meta_stack_get", 0, 0, 0);
01098         
01099         prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
01100         RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
01101         RNA_def_property_flag(prop, PROP_EDITABLE);
01102 
01103         prop= RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
01104         RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
01105         RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer");
01106         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
01107 
01108         prop= RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE);
01109         RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
01110         RNA_def_property_ui_text(prop, "Overlay Lock", "");
01111         RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
01112         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
01113 
01114         /* access to fixed and relative frame */
01115         prop= RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
01116         RNA_def_property_ui_text(prop, "Overlay Offset", "");
01117         RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL);
01118         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
01119         RNA_def_property_ui_text(prop, "Active Strip", "Sequencers active strip");
01120 }
01121 
01122 static void rna_def_filter_video(StructRNA *srna)
01123 {
01124         PropertyRNA *prop;
01125 
01126         prop= RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
01127         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY);
01128         RNA_def_property_ui_text(prop, "De-Interlace", "For video movies to remove fields");
01129         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update_reopen_files");
01130 
01131         prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
01132         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_PREMUL);
01133         RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
01134         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
01135 
01136         prop= RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
01137         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX);
01138         RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis");
01139         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01140 
01141         prop= RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
01142         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY);
01143         RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis");
01144         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01145 
01146         prop= RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
01147         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT);
01148         RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data");
01149         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01150 
01151         prop= RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
01152         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES);
01153         RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order");
01154         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01155 
01156         prop= RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
01157         RNA_def_property_float_sdna(prop, NULL, "mul");
01158         RNA_def_property_range(prop, 0.0f, 20.0f);
01159         RNA_def_property_ui_text(prop, "Multiply Colors", "");
01160         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01161 
01162         prop= RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
01163         RNA_def_property_float_sdna(prop, NULL, "sat");
01164         RNA_def_property_range(prop, 0.0f, 20.0f);
01165         RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
01166         RNA_def_property_ui_text(prop, "Saturation", "");
01167         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01168 
01169         prop= RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
01170         RNA_def_property_range(prop, 1.0f, 30.0f);
01171         RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
01172         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01173 
01174         prop= RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
01175         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
01176         RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input");
01177         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set");
01178         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01179 
01180         prop= RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
01181         RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
01182         RNA_def_property_ui_text(prop, "Color Balance", "");
01183 
01184         prop= RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
01185         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
01186         RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
01187         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set");
01188         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01189 
01190         prop= RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
01191         RNA_def_property_pointer_sdna(prop, NULL, "strip->transform");
01192         RNA_def_property_ui_text(prop, "Transform", "");
01193 
01194         prop= RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
01195         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP);
01196         RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing");
01197         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set");
01198         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01199 
01200         prop= RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
01201         RNA_def_property_pointer_sdna(prop, NULL, "strip->crop");
01202         RNA_def_property_ui_text(prop, "Crop", "");
01203 }
01204 
01205 static void rna_def_proxy(StructRNA *srna)
01206 {
01207         PropertyRNA *prop;
01208 
01209         prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
01210         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
01211         RNA_def_property_ui_text(prop, "Use Proxy", "Use a preview proxy for this strip");
01212         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set");
01213 
01214         prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
01215         RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");
01216         RNA_def_property_ui_text(prop, "Proxy", "");
01217 
01218         prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
01219         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR);
01220         RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
01221         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01222 
01223         prop= RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
01224         RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_FILE);
01225         RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from");
01226         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01227 }
01228 
01229 static void rna_def_input(StructRNA *srna)
01230 {
01231         PropertyRNA *prop;
01232 
01233         prop= RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
01234         RNA_def_property_int_sdna(prop, NULL, "anim_startofs");
01235         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01236         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); // overlap tests
01237 
01238         RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)");
01239         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01240         
01241         prop= RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
01242         RNA_def_property_int_sdna(prop, NULL, "anim_endofs");
01243         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01244         RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); // overlap tests
01245         RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
01246         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01247 }
01248 
01249 static void rna_def_image(BlenderRNA *brna)
01250 {
01251         StructRNA *srna;
01252         PropertyRNA *prop;
01253         
01254         srna = RNA_def_struct(brna, "ImageSequence", "Sequence");
01255         RNA_def_struct_ui_text(srna, "Image Sequence", "Sequence strip to load one or more images");
01256         RNA_def_struct_sdna(srna, "Sequence");
01257 
01258         prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
01259         RNA_def_property_string_sdna(prop, NULL, "strip->dir");
01260         RNA_def_property_ui_text(prop, "Directory", "");
01261         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01262 
01263         prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
01264         RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
01265         RNA_def_property_struct_type(prop, "SequenceElement");
01266         RNA_def_property_ui_text(prop, "Elements", "");
01267         RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0);
01268 
01269         rna_def_filter_video(srna);
01270         rna_def_proxy(srna);
01271         rna_def_input(srna);
01272 }
01273 
01274 static void rna_def_meta(BlenderRNA *brna)
01275 {
01276         StructRNA *srna;
01277         PropertyRNA *prop;
01278         
01279         srna = RNA_def_struct(brna, "MetaSequence", "Sequence");
01280         RNA_def_struct_ui_text(srna, "Meta Sequence", "Sequence strip to group other strips as a single sequence strip");
01281         RNA_def_struct_sdna(srna, "Sequence");
01282 
01283         prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
01284         RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
01285         RNA_def_property_struct_type(prop, "Sequence");
01286         RNA_def_property_ui_text(prop, "Sequences", "");
01287 
01288         rna_def_filter_video(srna);
01289         rna_def_proxy(srna);
01290         rna_def_input(srna);
01291 }
01292 
01293 static void rna_def_scene(BlenderRNA *brna)
01294 {
01295         StructRNA *srna;
01296         PropertyRNA *prop;
01297         
01298         srna = RNA_def_struct(brna, "SceneSequence", "Sequence");
01299         RNA_def_struct_ui_text(srna, "Scene Sequence", "Sequence strip to used the rendered image of a scene");
01300         RNA_def_struct_sdna(srna, "Sequence");
01301 
01302         prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
01303         RNA_def_property_flag(prop, PROP_EDITABLE);
01304         RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses");
01305         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01306 
01307         prop= RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
01308         RNA_def_property_flag(prop, PROP_EDITABLE);
01309         RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
01310         RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera");
01311         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01312 
01313         rna_def_filter_video(srna);
01314         rna_def_proxy(srna);
01315         rna_def_input(srna);
01316 }
01317 
01318 static void rna_def_movie(BlenderRNA *brna)
01319 {
01320         StructRNA *srna;
01321         PropertyRNA *prop;
01322         
01323         srna = RNA_def_struct(brna, "MovieSequence", "Sequence");
01324         RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
01325         RNA_def_struct_sdna(srna, "Sequence");
01326 
01327         prop= RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
01328         RNA_def_property_int_sdna(prop, NULL, "anim_preseek");
01329         RNA_def_property_range(prop, 0, 50);
01330         RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames");
01331         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01332 
01333         prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
01334         RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
01335         RNA_def_property_struct_type(prop, "SequenceElement");
01336         RNA_def_property_ui_text(prop, "Elements", "");
01337         RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0);
01338 
01339         prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
01340         RNA_def_property_ui_text(prop, "File", "");
01341         RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
01342                                                                                 "rna_Sequence_filepath_set");
01343         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update");
01344 
01345         rna_def_filter_video(srna);
01346         rna_def_proxy(srna);
01347         rna_def_input(srna);
01348 }
01349 
01350 static void rna_def_sound(BlenderRNA *brna)
01351 {
01352         StructRNA *srna;
01353         PropertyRNA *prop;
01354         
01355         srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
01356         RNA_def_struct_ui_text(srna, "Sound Sequence", "Sequence strip defining a sound to be played over a period of time");
01357         RNA_def_struct_sdna(srna, "Sequence");
01358 
01359         prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
01360         RNA_def_property_struct_type(prop, "Sound");
01361         RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence");
01362         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01363 
01364         prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
01365         RNA_def_property_float_sdna(prop, NULL, "volume");
01366         RNA_def_property_range(prop, 0.0f, 100.0f);
01367         RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
01368         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01369 
01370         prop= RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
01371         RNA_def_property_range(prop, -100.0f, +40.0f);
01372         RNA_def_property_ui_text(prop, "Attenuation/dB", "Attenuation in decibel");
01373         RNA_def_property_float_funcs(prop, "rna_Sequence_attenuation_get", "rna_Sequence_attenuation_set", NULL); 
01374 
01375         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01376 
01377         prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
01378         RNA_def_property_ui_text(prop, "File", "");
01379         RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", 
01380                                                                                 "rna_Sequence_filepath_set");
01381         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update");
01382         
01383         rna_def_input(srna);
01384 }
01385 
01386 static void rna_def_effect(BlenderRNA *brna)
01387 {
01388         StructRNA *srna;
01389 
01390         srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
01391         RNA_def_struct_ui_text(srna, "Effect Sequence", "Sequence strip applying an effect on the images created by other strips");
01392         RNA_def_struct_sdna(srna, "Sequence");
01393 
01394         rna_def_filter_video(srna);
01395         rna_def_proxy(srna);
01396 }
01397 
01398 static void rna_def_multicam(BlenderRNA *brna)
01399 {
01400         StructRNA *srna;
01401         PropertyRNA *prop;
01402         
01403         srna = RNA_def_struct(brna, "MulticamSequence", "Sequence");
01404         RNA_def_struct_ui_text(srna, "Multicam Select Sequence", "Sequence strip to perform multicam editing: select channel from below");
01405         RNA_def_struct_sdna(srna, "Sequence");
01406 
01407         prop= RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
01408         RNA_def_property_int_sdna(prop, NULL, "multicam_source");
01409         RNA_def_property_range(prop, 0, MAXSEQ-1);
01410         RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
01411         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01412 
01413         rna_def_filter_video(srna);
01414         rna_def_proxy(srna);
01415         rna_def_input(srna);
01416 }
01417 
01418 static void rna_def_adjustment(BlenderRNA *brna)
01419 {
01420         StructRNA *srna;
01421 //      PropertyRNA *prop;
01422         
01423         srna = RNA_def_struct(brna, "AdjustmentSequence", "Sequence");
01424         RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence", "Sequence strip to perform filter adjustments to layers below");
01425         RNA_def_struct_sdna(srna, "Sequence");
01426 
01427         rna_def_filter_video(srna);
01428         rna_def_proxy(srna);
01429         rna_def_input(srna);
01430 }
01431 
01432 static void rna_def_plugin(BlenderRNA *brna)
01433 {
01434         StructRNA *srna;
01435         PropertyRNA *prop;
01436         
01437         srna = RNA_def_struct(brna, "PluginSequence", "EffectSequence");
01438         RNA_def_struct_ui_text(srna, "Plugin Sequence", "Sequence strip applying an effect, loaded from an external plugin");
01439         RNA_def_struct_sdna_from(srna, "PluginSeq", "plugin");
01440 
01441         prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
01442         RNA_def_property_string_sdna(prop, NULL, "name");
01443         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01444         RNA_def_property_ui_text(prop, "Filename", "");
01445         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01446         
01447         /* plugin properties need custom wrapping code like ID properties */
01448 }
01449 
01450 static void rna_def_wipe(BlenderRNA *brna)
01451 {
01452         StructRNA *srna;
01453         PropertyRNA *prop;
01454         
01455         static const EnumPropertyItem wipe_type_items[]= {
01456                 {0, "SINGLE", 0, "Single", ""}, 
01457                 {1, "DOUBLE", 0, "Double", ""}, 
01458                 /* not used yet {2, "BOX", 0, "Box", ""}, */
01459                 /* not used yet {3, "CROSS", 0, "Cross", ""}, */
01460                 {4, "IRIS", 0, "Iris", ""}, 
01461                 {5, "CLOCK", 0, "Clock", ""},   
01462                 {0, NULL, 0, NULL, NULL}
01463         };
01464 
01465         static const EnumPropertyItem wipe_direction_items[]= {
01466                 {0, "OUT", 0, "Out", ""},
01467                 {1, "IN", 0, "In", ""},
01468                 {0, NULL, 0, NULL, NULL}
01469         };
01470 
01471         srna = RNA_def_struct(brna, "WipeSequence", "EffectSequence");
01472         RNA_def_struct_ui_text(srna, "Wipe Sequence", "Sequence strip creating a wipe transition");
01473         RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
01474 
01475         prop= RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
01476         RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
01477         RNA_def_property_range(prop, 0.0f, 1.0f);
01478         RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size");
01479         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01480 
01481 #if 1 /* expose as radians */
01482         prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
01483         RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL);
01484         RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f));
01485 #else
01486         prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
01487         RNA_def_property_float_sdna(prop, NULL, "angle");
01488         RNA_def_property_range(prop, -90.0f, 90.0f);
01489 #endif
01490         RNA_def_property_ui_text(prop, "Angle", "Edge angle");
01491         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01492         
01493         prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
01494         RNA_def_property_enum_sdna(prop, NULL, "forward");
01495         RNA_def_property_enum_items(prop, wipe_direction_items);
01496         RNA_def_property_ui_text(prop, "Direction", "Wipe direction");
01497         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01498         
01499         prop= RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
01500         RNA_def_property_enum_sdna(prop, NULL, "wipetype");
01501         RNA_def_property_enum_items(prop, wipe_type_items);
01502         RNA_def_property_ui_text(prop, "Transition Type", "");
01503         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01504 }
01505 
01506 static void rna_def_glow(BlenderRNA *brna)
01507 {
01508         StructRNA *srna;
01509         PropertyRNA *prop;
01510         
01511         srna = RNA_def_struct(brna, "GlowSequence", "EffectSequence");
01512         RNA_def_struct_ui_text(srna, "Glow Sequence", "Sequence strip creating a glow effect");
01513         RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
01514         
01515         prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
01516         RNA_def_property_float_sdna(prop, NULL, "fMini");
01517         RNA_def_property_range(prop, 0.0f, 1.0f);
01518         RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
01519         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01520         
01521         prop= RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE);
01522         RNA_def_property_float_sdna(prop, NULL, "fClamp");
01523         RNA_def_property_range(prop, 0.0f, 1.0f);
01524         RNA_def_property_ui_text(prop, "Clamp", "rightness limit of intensity");
01525         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01526         
01527         prop= RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
01528         RNA_def_property_float_sdna(prop, NULL, "fBoost");
01529         RNA_def_property_range(prop, 0.0f, 10.0f);
01530         RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier");
01531         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01532         
01533         prop= RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
01534         RNA_def_property_float_sdna(prop, NULL, "dDist");
01535         RNA_def_property_range(prop, 0.5f, 20.0f);
01536         RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect");
01537         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01538         
01539         prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
01540         RNA_def_property_int_sdna(prop, NULL, "dQuality");
01541         RNA_def_property_range(prop, 1, 5);
01542         RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect");
01543         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01544         
01545         prop= RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
01546         RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0);
01547         RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only");
01548         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01549 }
01550 
01551 static void rna_def_transform(BlenderRNA *brna)
01552 {
01553         StructRNA *srna;
01554         PropertyRNA *prop;
01555 
01556         static const EnumPropertyItem interpolation_items[]= {
01557                 {0, "NONE", 0, "None", "No interpolation"},
01558                 {1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
01559                 {2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
01560                 {0, NULL, 0, NULL, NULL}
01561         };
01562 
01563         static const EnumPropertyItem translation_unit_items[]= {
01564                 {0, "PIXELS", 0, "Pixels", ""},
01565                 {1, "PERCENT", 0, "Percent", ""},
01566                 {0, NULL, 0, NULL, NULL}
01567         };
01568 
01569         srna = RNA_def_struct(brna, "TransformSequence", "EffectSequence");
01570         RNA_def_struct_ui_text(srna, "Transform Sequence", "Sequence strip applying affine transformations to other strips");
01571         RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
01572         
01573         prop= RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
01574         RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
01575         RNA_def_property_ui_text(prop, "Scale X", "");
01576         RNA_def_property_ui_range(prop, 0, 10, 3, 10);
01577         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01578         
01579         prop= RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
01580         RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
01581         RNA_def_property_ui_text(prop, "Scale Y", "");
01582         RNA_def_property_ui_range(prop, 0, 10, 3, 10);
01583         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01584         
01585         prop= RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
01586         RNA_def_property_boolean_sdna(prop, NULL, "uniform_scale", 0);
01587         RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio");
01588         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01589         
01590         prop= RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
01591         RNA_def_property_float_sdna(prop, NULL, "xIni");
01592         RNA_def_property_ui_text(prop, "Translate X", "");
01593         RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
01594         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01595         
01596         prop= RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
01597         RNA_def_property_float_sdna(prop, NULL, "yIni");
01598         RNA_def_property_ui_text(prop, "Translate Y", "");
01599         RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
01600         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01601         
01602         prop= RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
01603         RNA_def_property_float_sdna(prop, NULL, "rotIni");
01604         RNA_def_property_range(prop, -360.0f, 360.0f);
01605         RNA_def_property_ui_text(prop, "Rotation", "");
01606         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01607         
01608         prop= RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
01609         RNA_def_property_enum_sdna(prop, NULL, "percent");
01610         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
01611         RNA_def_property_enum_items(prop, translation_unit_items);
01612         RNA_def_property_ui_text(prop, "Translation Unit", "");
01613         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01614         
01615         prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
01616         RNA_def_property_enum_items(prop, interpolation_items);
01617         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
01618         RNA_def_property_ui_text(prop, "Interpolation", "");
01619         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01620 }
01621 
01622 static void rna_def_solid_color(BlenderRNA *brna)
01623 {
01624         StructRNA *srna;
01625         PropertyRNA *prop;
01626 
01627         srna = RNA_def_struct(brna, "ColorSequence", "EffectSequence");
01628         RNA_def_struct_ui_text(srna, "Color Sequence", "Sequence strip creating an image filled with a single g");
01629         RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
01630         
01631         prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
01632         RNA_def_property_float_sdna(prop, NULL, "col");
01633         RNA_def_property_ui_text(prop, "Color", "");
01634         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01635 }
01636 
01637 static void rna_def_speed_control(BlenderRNA *brna)
01638 {
01639         StructRNA *srna;
01640         PropertyRNA *prop;
01641 
01642         srna = RNA_def_struct(brna, "SpeedControlSequence", "EffectSequence");
01643         RNA_def_struct_ui_text(srna, "SpeedControl Sequence", "Sequence strip to control the speed of other strips");
01644         RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
01645         
01646         prop= RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
01647         RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
01648         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
01649         RNA_def_property_ui_text(prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
01650         RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0);
01651         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01652         
01653         prop= RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
01654         RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
01655         RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
01656         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01657 
01658         prop= RNA_def_property(srna, "use_frame_blend", PROP_BOOLEAN, PROP_NONE);
01659         RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_BLEND);
01660         RNA_def_property_ui_text(prop, "Frame Blending", "Blend two frames into the target for a smoother result");
01661         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01662 
01663         prop= RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
01664         RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
01665         RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
01666         RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
01667 }
01668 
01669 void RNA_def_sequencer(BlenderRNA *brna)
01670 {
01671         rna_def_strip_element(brna);
01672         rna_def_strip_proxy(brna);
01673         rna_def_strip_color_balance(brna);
01674         rna_def_strip_crop(brna);
01675         rna_def_strip_transform(brna);
01676 
01677         rna_def_sequence(brna);
01678         rna_def_editor(brna);
01679 
01680         rna_def_image(brna);
01681         rna_def_meta(brna);
01682         rna_def_scene(brna);
01683         rna_def_movie(brna);
01684         rna_def_sound(brna);
01685         rna_def_effect(brna);
01686         rna_def_multicam(brna);
01687         rna_def_adjustment(brna);
01688         rna_def_plugin(brna);
01689         rna_def_wipe(brna);
01690         rna_def_glow(brna);
01691         rna_def_transform(brna);
01692         rna_def_solid_color(brna);
01693         rna_def_speed_control(brna);
01694 }
01695 
01696 #endif
01697