Index: source/blender/include/BIF_editseq.h =================================================================== --- source/blender/include/BIF_editseq.h (revision 13501) +++ source/blender/include/BIF_editseq.h (working copy) @@ -55,6 +55,7 @@ struct Sequence* find_nearest_seq(int *hand); int insert_gap(int gap, int cfra); void make_meta(void); +void select_single_seq(struct Sequence *seq, int deselect_all); void select_channel_direction(struct Sequence *test,int lr); void select_more_seq(void); void select_less_seq(void); Index: source/blender/include/BIF_outliner.h =================================================================== --- source/blender/include/BIF_outliner.h (revision 13501) +++ source/blender/include/BIF_outliner.h (working copy) @@ -44,7 +44,7 @@ short idcode; // from TreeStore id short xend; // width of item display, for select char *name; - void *directdata; // Armature Bones, Base, ... + void *directdata; // Armature Bones, Base, Sequence, Strip... } TreeElement; /* TreeElement->flag */ @@ -80,6 +80,9 @@ #define TSE_LINKED_LAMP 23 #define TSE_POSEGRP_BASE 24 #define TSE_POSEGRP 25 +#define TSE_SEQUENCE 26 +#define TSE_SEQ_STRIP 27 +#define TSE_SEQUENCE_DUP 28 /* outliner search flags */ #define OL_FIND 0 Index: source/blender/makesdna/DNA_space_types.h =================================================================== --- source/blender/makesdna/DNA_space_types.h (revision 13501) +++ source/blender/makesdna/DNA_space_types.h (working copy) @@ -549,6 +549,7 @@ #define SO_LIBRARIES 7 #define SO_VERSE_SESSION 8 #define SO_VERSE_MS 9 +#define SO_SEQUENCE 10 /* SpaceOops->storeflag */ #define SO_TREESTORE_CLEANUP 1 Index: source/blender/src/header_oops.c =================================================================== --- source/blender/src/header_oops.c (revision 13501) +++ source/blender/src/header_oops.c (working copy) @@ -558,15 +558,15 @@ else { if(G.main->library.first) #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ else #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ } Index: source/blender/src/outliner.c =================================================================== --- source/blender/src/outliner.c (revision 13501) +++ source/blender/src/outliner.c (working copy) @@ -56,9 +56,12 @@ #include "DNA_texture_types.h" #include "DNA_text_types.h" #include "DNA_world_types.h" +#include "DNA_sequence_types.h" #include "BLI_blenlib.h" +#include "IMB_imbuf_types.h" + #include "BKE_constraint.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" @@ -99,6 +102,7 @@ #include "BIF_screen.h" #include "BIF_space.h" #include "BIF_toolbox.h" +#include "BIF_editseq.h" #ifdef WITH_VERSE #include "BIF_verse.h" @@ -300,7 +304,7 @@ while(te) { tselem= TREESTORE(te); - if(te->idcode==idcode && tselem->type==0) return tselem->id; + if(tselem->type==0 && te->idcode==idcode) return tselem->id; te= te->parent; } return NULL; @@ -557,8 +561,10 @@ te->parent= parent; te->index= index; // for data arays - te->name= id->name+2; // default, can be overridden by Library or non-ID data - te->idcode= GS(id->name); + if((type!=TSE_SEQUENCE) && (type != TSE_SEQ_STRIP) && (type != TSE_SEQUENCE_DUP)) { + te->name= id->name+2; // default, can be overridden by Library or non-ID data + te->idcode= GS(id->name); + } if(type==0) { @@ -895,6 +901,65 @@ break; } } + else if(type==TSE_SEQUENCE) { + Sequence *seq= (Sequence*) idv; + Sequence *p; + + /* + * The idcode is a little hack, but the outliner + * only check te->idcode if te->type is equal to zero, + * so this is "safe". + */ + te->idcode= seq->type; + te->directdata= seq; + + if(seq->type<7) { + /* + * This work like the sequence. + * If the sequence have a name (not default name) + * show it, in other case put the filename. + */ + if(strcmp(seq->name, "SQ")) + te->name= seq->name; + else { + if((seq->strip) && (seq->strip->stripdata)) + te->name= seq->strip->stripdata->name; + else if((seq->strip) && (seq->strip->tstripdata) && (seq->strip->tstripdata->ibuf)) + te->name= seq->strip->tstripdata->ibuf->name; + else + te->name= "SQ None"; + } + + if(seq->type==SEQ_META) { + te->name= "Meta Strip"; + p= seq->seqbase.first; + while(p) { + outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } + } + else + outliner_add_element(soops, &te->subtree, (void*)seq->strip, te, TSE_SEQ_STRIP, index); + } + else + te->name= "Effect"; + } + else if(type==TSE_SEQ_STRIP) { + Strip *strip= (Strip *)idv; + + if(strip->dir) + te->name= strip->dir; + else + te->name= "Strip None"; + te->directdata= strip; + } + else if(type==TSE_SEQUENCE_DUP) { + Sequence *seq= (Sequence*)idv; + + te->idcode= seq->type; + te->directdata= seq; + te->name= seq->strip->stripdata->name; + } #ifdef WITH_VERSE else if(type==ID_VS) { struct VerseSession *session = (VerseSession*)idv; @@ -961,6 +1026,62 @@ } } +/* Helped function to put duplicate sequence in the same tree. */ +int need_add_seq_dup(Sequence *seq) +{ + Sequence *p; + + if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) + return(1); + + /* + * First check backward, if we found a duplicate + * sequence before this, don't need it, just return. + */ + p= seq->prev; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->prev; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(2); + p= p->prev; + } + + p= seq->next; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(0); + p= p->next; + } + return(1); +} + +void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index) +{ + TreeElement *ch; + Sequence *p; + + p= seq; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + ch= outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } +} + static void outliner_build_tree(SpaceOops *soops) { Base *base; @@ -1117,6 +1238,30 @@ } } #endif + else if(soops->outlinevis==SO_SEQUENCE) { + Sequence *seq; + Editing *ed; + int op; + + ed= G.scene->ed; + if(!ed) + return; + + seq= ed->seqbasep->first; + if(!seq) + return; + + while(seq) { + op= need_add_seq_dup(seq); + if(op==1) + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + else if(op==0) { + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); + add_seq_dup(soops, seq, ten, 0); + } + seq= seq->next; + } + } else { ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); if(ten) ten->directdata= BASACT; @@ -1878,6 +2023,50 @@ return 0; } +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq= (Sequence*) te->directdata; + + if(set) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } + else { + if(seq->flag & SELECT) + return(1); + } + return(0); +} + +static int tree_element_active_sequence_dup(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq, *p; + Editing *ed; + + seq= (Sequence*)te->directdata; + if(set==0) { + if(seq->flag & SELECT) + return(1); + return(0); + } + + select_single_seq(seq, 1); + ed= G.scene->ed; + p= ed->seqbasep->first; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + select_single_seq(p, 0); + p= p->next; + } + allqueue(REDRAWSEQ, 0); + return(0); +} + /* generic call for non-id data to make/check active in UI */ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set) { @@ -1908,6 +2097,12 @@ return tree_element_active_renderlayer(te, tselem, set); case TSE_POSEGRP: return tree_element_active_posegroup(te, tselem, set); + case TSE_SEQUENCE: + return tree_element_active_sequence(te, tselem, set); + break; + case TSE_SEQUENCE_DUP: + return tree_element_active_sequence_dup(te, tselem, set); + break; } return 0; } @@ -2029,6 +2224,8 @@ if (G.qual == LR_CTRLKEY) { if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) error("Cannot edit builtin name"); + else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) + error("Cannot edit sequence name"); else if(tselem->id->lib) { error_libdata(); } else if(te->idcode == ID_LI && te->parent) { @@ -2038,7 +2235,8 @@ } } else { /* always makes active object */ - tree_element_active_object(soops, te); + if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) + tree_element_active_object(soops, te); if(tselem->type==0) { // the lib blocks /* editmode? */ @@ -2064,7 +2262,7 @@ } else if(event==RIGHTMOUSE) { #ifdef WITH_VERSE - if(ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) + if((tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) && ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) verse_operation_menu(te); else #endif @@ -2268,8 +2466,8 @@ /* check if 'tse' is in treestore */ tselem= ts->data; for(a=0; ausedelem; a++, tselem++) { - if(tselem->id==tse->id) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { break; } } @@ -2482,12 +2680,18 @@ tselem= TREESTORE(te); if(tselem->flag & TSE_SELECTED) { if(tselem->type) { + if(tselem->type==TSE_SEQUENCE) + *datalevel= TSE_SEQUENCE; + else if(tselem->type==TSE_SEQ_STRIP) + *datalevel= TSE_SEQ_STRIP; + else if(tselem->type==TSE_SEQUENCE_DUP) + *datalevel= TSE_SEQUENCE_DUP; #ifdef WITH_VERSE - if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; + else if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; else if(te->idcode==ID_VN) *datalevel= TSE_VERSE_OBJ_NODE; else if(*datalevel==0) *datalevel= tselem->type; #else - if(*datalevel==0) *datalevel= tselem->type; + else if(*datalevel==0) *datalevel= tselem->type; #endif else if(*datalevel!=tselem->type) *datalevel= -1; } @@ -2777,6 +2981,15 @@ } #endif +static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +{ + Sequence *seq= (Sequence*) te->directdata; + if(event==1) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } +} + static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, void (*operation_cb)(int, TreeElement *, TreeStoreElem *)) { @@ -2799,10 +3012,14 @@ void outliner_del(ScrArea *sa) { SpaceOops *soops= sa->spacedata.first; - outliner_do_object_operation(soops, &soops->tree, object_delete_cb); - DAG_scene_sort(G.scene); - countall(); - BIF_undo_push("Delete Objects"); + if(soops->outlinevis==SO_SEQUENCE) + del_seq(); + else { + outliner_do_object_operation(soops, &soops->tree, object_delete_cb); + DAG_scene_sort(G.scene); + countall(); + BIF_undo_push("Delete Objects"); + } allqueue(REDRAWALL, 0); } @@ -2935,7 +3152,13 @@ } } #endif - + else if(datalevel==TSE_SEQUENCE) { + short event= pupmenu("Sequence Operations %t|Select %x1"); + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); + } + } + allqueue(REDRAWOOPS, 0); allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWVIEW3D, 0); @@ -3015,7 +3238,26 @@ BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break; case TSE_POSEGRP_BASE: BIF_icon_draw(x, y, ICON_VERTEXSEL); break; - + case TSE_SEQUENCE: + if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SEQUENCE); + else if(te->idcode==SEQ_META) + BIF_icon_draw(x, y, ICON_DOT); + else if(te->idcode==SEQ_SCENE) + BIF_icon_draw(x, y, ICON_SCENE); + else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SOUND); + else if(te->idcode==SEQ_IMAGE) + BIF_icon_draw(x, y, ICON_IMAGE_COL); + else + BIF_icon_draw(x, y, ICON_PARTICLES); + break; + case TSE_SEQ_STRIP: + BIF_icon_draw(x, y, ICON_LIBRARY_DEHLT); + break; + case TSE_SEQUENCE_DUP: + BIF_icon_draw(x, y, ICON_OBJECT); + break; #ifdef WITH_VERSE case ID_VS: case ID_MS: @@ -3228,7 +3470,7 @@ } /* open/close icon, only when sublevels, except for scene */ - if(te->subtree.first || (te->idcode==ID_SCE && tselem->type==0)) { + if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE)) { int icon_x; if((tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) || ELEM4(te->idcode,ID_VN,ID_VS, ID_MS, ID_SS)) icon_x = startx; @@ -3249,7 +3491,7 @@ tselem_draw_icon(startx+offsx, *starty+2, tselem, te); offsx+= OL_X; - if(tselem->id->lib && tselem->type==0) { + if(tselem->type==0 && tselem->id->lib) { glPixelTransferf(GL_ALPHA_SCALE, 0.5); if(tselem->id->flag & LIB_INDIRECT) BIF_icon_draw(startx+offsx, *starty+2, ICON_DATALIB); @@ -3700,6 +3942,9 @@ if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { + /* If we add support to rename Sequence. + * need change this. + */ if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name); Index: source/blender/src/editseq.c =================================================================== --- source/blender/src/editseq.c (revision 13501) +++ source/blender/src/editseq.c (working copy) @@ -652,6 +652,24 @@ } } +void select_single_seq(Sequence *seq, int deselect_all) +{ + if(deselect_all) + deselect_all_seq(); + set_last_seq(seq); + + if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { + if(seq->strip) + strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1); + } + else if((seq->type==SEQ_HD_SOUND) || (seq->type==SEQ_RAM_SOUND)) { + if(seq->strip) + strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1); + } + seq->flag|= SELECT; + recurs_sel_seq(seq); +} + void swap_select_seq(void) { Sequence *seq; @@ -899,7 +917,11 @@ allqueue(REDRAWBUTSSCENE, 0); force_draw(0); - if(get_last_seq()) allqueue(REDRAWIPO, 0); + if(get_last_seq()) { + allqueue(REDRAWIPO, 0); + allqueue(REDRAWOOPS, 0); + } + BIF_undo_push("Select Strips, Sequencer"); std_rmouse_transform(transform_seq_nomarker); @@ -2163,6 +2185,7 @@ BIF_undo_push("Delete Strip(s), Sequencer"); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); } static Sequence *dupli_seq(Sequence *seq) @@ -2712,7 +2735,7 @@ BIF_undo_push("Un-Make Meta Strip, Sequencer"); allqueue(REDRAWSEQ, 0); - + allqueue(REDRAWOOPS, 0); } void exit_meta(void) @@ -2748,6 +2771,7 @@ MEM_freeN(ms); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Exit Meta Strip, Sequence"); } @@ -2776,6 +2800,7 @@ set_last_seq(NULL); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Enter Meta Strip, Sequence"); }