diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 08:21:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 08:21:44 +0300 |
commit | ed7bf5a479fdf8ff778a3dd645400830d805e038 (patch) | |
tree | 96e268585c10692b1fb3aa425c1291f9b7625c5d /source/blender/blenloader | |
parent | b1e07d13ec7aa04cae31495343fcadc70e9a2be3 (diff) |
2.50: added sequence.c in blenkernel for sequencer functionality
that is not supposed to be in the editor but at blenkernel level
to avoid bad level calls. Added sequencer free and strip iterator
functions there and used them to make sequencer data load/save
work again.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 102 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 10 |
2 files changed, 49 insertions, 63 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index df2c680c951..91120f78e9a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -134,6 +134,7 @@ #include "BKE_softbody.h" // sbNew() #include "BKE_bullet.h" // bsbNew() #include "BKE_sculpt.h" +#include "BKE_sequence.h" #include "BKE_texture.h" // for open_plugin_tex #include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND #include "BKE_idprop.h" @@ -3443,7 +3444,6 @@ static void lib_link_scene(FileData *fd, Main *main) { Scene *sce; Base *base, *next; - Editing *ed; Sequence *seq; SceneRenderLayer *srl; int a; @@ -3486,23 +3486,20 @@ static void lib_link_scene(FileData *fd, Main *main) } } - ed= sce->ed; - if(ed) { - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ - if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo); - if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene); - if(seq->sound) { - seq->sound= newlibadr(fd, sce->id.lib, seq->sound); - if (seq->sound) { - seq->sound->id.us++; - seq->sound->flags |= SOUND_FLAGS_SEQUENCE; - } + SEQ_BEGIN(sce->ed, seq) { + if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo); + if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene); + if(seq->sound) { + seq->sound= newlibadr(fd, sce->id.lib, seq->sound); + if (seq->sound) { + seq->sound->id.us++; + seq->sound->flags |= SOUND_FLAGS_SEQUENCE; } - seq->anim= 0; - seq->hdaudio = 0; } - END_SEQ + seq->anim= 0; + seq->hdaudio = 0; } + SEQ_END lib_link_scriptlink(fd, &sce->id, &sce->scriptlink); @@ -3526,11 +3523,10 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) Sequence *seq; link_list(fd, lb); - seq= lb->first; - while(seq) { - if(seq->seqbase.first) link_recurs_seq(fd, &seq->seqbase); - seq= seq->next; - } + + for(seq=lb->first; seq; seq=seq->next) + if(seq->seqbase.first) + link_recurs_seq(fd, &seq->seqbase); } static void direct_link_scene(FileData *fd, Scene *sce) @@ -3572,7 +3568,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) /* recursive link sequences, lb will be correctly initialized */ link_recurs_seq(fd, &ed->seqbase); - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ + SEQ_BEGIN(ed, seq) { seq->seq1= newdataadr(fd, seq->seq1); seq->seq2= newdataadr(fd, seq->seq2); seq->seq3= newdataadr(fd, seq->seq3); @@ -3630,7 +3626,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) } } } - END_SEQ + SEQ_END /* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */ { @@ -3714,30 +3710,26 @@ static void direct_link_scene(FileData *fd, Scene *sce) */ static Sequence * find_sequence_from_ipo_helper(Main * main, Ipo * ipo) { - Editing *ed; - Sequence *seq = NULL; - - Scene * sce= main->scene.first; - while(sce) { - if(sce->ed) { - int found = 0; - - ed= sce->ed; + Sequence *seq; + Scene *sce; + + for(sce=main->scene.first; sce; sce=sce->id.next) { + int found = 0; - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ - if (seq->ipo == ipo) { - found = 1; - break; - } - } - END_SEQ - if (found) { + SEQ_BEGIN(sce->ed, seq) { + if (seq->ipo == ipo) { + found = 1; break; } - seq = NULL; + } + SEQ_END + + if (found) { + break; } - sce= sce->id.next; + seq = NULL; } + if (seq) return seq; else @@ -5022,7 +5014,7 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) /* if we do, set alpha sort if the game engine did it before */ for(a=0, mf=me->mface; a<me->totface; a++, mf++) { if(mf->mat_nr < me->totcol) { - ma= newlibadr(fd, lib, me->mat[mf->mat_nr]); + ma= newlibadr(fd, lib, me->mat[(int)mf->mat_nr]); texalpha = 0; /* we can't read from this if it comes from a library, @@ -5208,7 +5200,6 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) static void do_versions_windowmanager_2_50(bScreen *screen) { ScrArea *sa; - ARegion *ar; SpaceLink *sl; /* add regions */ @@ -6522,10 +6513,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while(sce) { ed= sce->ed; if(ed) { - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ - if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) seq->flag |= SEQ_MAKE_PREMUL; + SEQ_BEGIN(sce->ed, seq) { + if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) + seq->flag |= SEQ_MAKE_PREMUL; } - END_SEQ + SEQ_END } sce= sce->id.next; @@ -8021,22 +8013,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 14)) { - Scene *sce= main->scene.first; + Scene *sce; Sequence *seq; Editing *ed; - while(sce) { - ed= sce->ed; - if(ed) { - WHILE_SEQ(&ed->seqbase) { - if (seq->blend_mode == 0) { - seq->blend_opacity = 100.0; - } - } - END_SEQ + for(sce=main->scene.first; sce; sce=sce->id.next) { + SEQ_BEGIN(ed, seq) { + if (seq->blend_mode == 0) + seq->blend_opacity = 100.0; } - - sce= sce->id.next; + SEQ_END } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 96611b6fa9d..b5081888a96 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -155,7 +155,7 @@ Any case: direct data is ALWAYS after the lib block #include "BKE_node.h" #include "BKE_packedFile.h" // for packAll #include "BKE_screen.h" // for waitcursor -#include "BKE_scene.h" // for do_seq +#include "BKE_sequence.h" #include "BKE_sound.h" /* ... and for samples */ #include "BKE_utildefines.h" // for defines #include "BKE_modifier.h" @@ -1471,13 +1471,13 @@ static void write_scenes(WriteData *wd, ListBase *scebase) /* reset write flags too */ - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ + SEQ_BEGIN(ed, seq) { if(seq->strip) seq->strip->done= 0; writestruct(wd, DATA, "Sequence", 1, seq); } - END_SEQ + SEQ_END - WHILE_SEQ(&ed->seqbase) { //XXX todo replace WHILE_SEQ + SEQ_BEGIN(ed, seq) { if(seq->strip && seq->strip->done==0) { /* write strip with 'done' at 0 because readfile */ @@ -1524,7 +1524,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) strip->done= 1; } } - END_SEQ + SEQ_END /* new; meta stack too, even when its nasty restore code */ for(ms= ed->metastack.first; ms; ms= ms->next) { |