Revision: 16620
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16620
Author:   bdiego
Date:     2008-09-20 00:51:05 +0200 (Sat, 20 Sep 2008)

Log Message:
-----------
== Outliner ==

Commit patch #8195

New outliner mode: Sequence, it's show all the sequence and strip that
we have in the outliner, split it for type (particle, sound and so on..).

Some notes to take care:
 * The strip can be selected with LMB
 * The sequence can be deleted with XKEY (all the selected)
 * The "Meta" are stored in a single tree (Meta Strip)
   with all the sequence.
 * Duplicate sequence (with the same name) are store in a single tree
   and you can select all the Sequence with LMB in the "root" entry.
 * Also show the directory path.

[ As Ton point in the tracker, still need more work (and options, Luca made
  a really good list in the tracker), so move to the trunk and start
  working here, probably a good topic for next meeting. ]

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editseq.h
    trunk/blender/source/blender/include/BIF_outliner.h
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/src/editseq.c
    trunk/blender/source/blender/src/header_oops.c
    trunk/blender/source/blender/src/outliner.c

Modified: trunk/blender/source/blender/include/BIF_editseq.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editseq.h  2008-09-19 22:03:16 UTC 
(rev 16619)
+++ trunk/blender/source/blender/include/BIF_editseq.h  2008-09-19 22:51:05 UTC 
(rev 16620)
@@ -52,6 +52,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);

Modified: trunk/blender/source/blender/include/BIF_outliner.h
===================================================================
--- trunk/blender/source/blender/include/BIF_outliner.h 2008-09-19 22:03:16 UTC 
(rev 16619)
+++ trunk/blender/source/blender/include/BIF_outliner.h 2008-09-19 22:51:05 UTC 
(rev 16620)
@@ -41,7 +41,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 */
@@ -77,6 +77,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

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h     2008-09-19 
22:03:16 UTC (rev 16619)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h     2008-09-19 
22:51:05 UTC (rev 16620)
@@ -589,6 +589,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

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c  2008-09-19 22:03:16 UTC (rev 
16619)
+++ trunk/blender/source/blender/src/editseq.c  2008-09-19 22:51:05 UTC (rev 
16620)
@@ -687,6 +687,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;
@@ -932,7 +950,11 @@
                }
                force_draw_plus(SPACE_BUTS, 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);
@@ -2211,6 +2233,7 @@
 
        BIF_undo_push("Delete Strip(s), Sequencer");
        allqueue(REDRAWSEQ, 0);
+       allqueue(REDRAWOOPS, 0);
 }
 
 static Sequence *dupli_seq(Sequence *seq) 
@@ -2897,7 +2920,7 @@
 
        BIF_undo_push("Un-Make Meta Strip, Sequencer");
        allqueue(REDRAWSEQ, 0);
-
+       allqueue(REDRAWOOPS, 0);
 }
 
 void exit_meta(void)
@@ -2930,6 +2953,7 @@
 
        MEM_freeN(ms);
        allqueue(REDRAWSEQ, 0);
+       allqueue(REDRAWOOPS, 0);
 
        BIF_undo_push("Exit Meta Strip, Sequence");
 }
@@ -2958,6 +2982,7 @@
 
        set_last_seq(NULL);
        allqueue(REDRAWSEQ, 0);
+       allqueue(REDRAWOOPS, 0);
        BIF_undo_push("Enter Meta Strip, Sequence");
 }
 

Modified: trunk/blender/source/blender/src/header_oops.c
===================================================================
--- trunk/blender/source/blender/src/header_oops.c      2008-09-19 22:03:16 UTC 
(rev 16619)
+++ trunk/blender/source/blender/src/header_oops.c      2008-09-19 22:51:05 UTC 
(rev 16620)
@@ -559,15 +559,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 */
        }
        

Modified: trunk/blender/source/blender/src/outliner.c
===================================================================
--- trunk/blender/source/blender/src/outliner.c 2008-09-19 22:03:16 UTC (rev 
16619)
+++ trunk/blender/source/blender/src/outliner.c 2008-09-19 22:51:05 UTC (rev 
16620)
@@ -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"
@@ -100,6 +103,7 @@
 #include "BIF_screen.h"
 #include "BIF_space.h"
 #include "BIF_toolbox.h"
+#include "BIF_editseq.h"
 
 #ifdef WITH_VERSE
 #include "BIF_verse.h"
@@ -301,7 +305,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;
@@ -558,8 +562,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) {
 
@@ -898,6 +904,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;
@@ -964,6 +1029,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;
+       }
+}
+

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to