diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-10-17 15:17:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-10-17 15:17:11 +0400 |
commit | 8bb97b6efa90ca62289d5798890e55a12f34b638 (patch) | |
tree | cc3d3b081e85e8f473a266529ff00f0d8b3336c9 /source/blender | |
parent | 51ca77a114db1a5a92192151c485fed19e91e6a5 (diff) |
patch 7145 - Copy Select objects by PassIndex, Ctrl+C, Ctrl+G
Sequencer Feature, Split Image Sequence.
Splits a image sequence into strips. useful for importing frames for animatics.
Also added undo calls in a few places that did not have it.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/include/BIF_editseq.h | 1 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 9 | ||||
-rw-r--r-- | source/blender/src/editseq.c | 153 | ||||
-rw-r--r-- | source/blender/src/header_seq.c | 4 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 7 | ||||
-rw-r--r-- | source/blender/src/space.c | 27 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 1 |
7 files changed, 167 insertions, 35 deletions
diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index a2be100c159..f35a2e289ea 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -64,6 +64,7 @@ void seq_remap_paths(void); void transform_seq(int mode, int context); void un_meta(void); void seq_cut(int cutframe); +void seq_separate_images(void); void reassign_inputs_seq_effect(void); void select_surrounding_handles(struct Sequence *test); void select_surround_from_last(); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 244eaad037c..33b6dbfe664 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -1082,7 +1082,7 @@ void reset_slowparents(void) { /* back to original locations */ Base *base; - + base= FIRSTBASE; while(base) { if(base->object->parent) { @@ -1740,7 +1740,7 @@ void exit_editmode(int flag) /* freedata==0 at render, 1= freedata, 2= do undo b /* total remake of softbody data */ if(modifiers_isSoftbodyEnabled(ob)) { if (ob->soft && ob->soft->keys) { - notice("Erased Baked SoftBody"); + notice("Erase Baked SoftBody"); } sbObjectToSoftbody(ob); @@ -3382,6 +3382,9 @@ void copy_attr(short event) else if(event==29) { /* protected bits */ base->object->protectflag= ob->protectflag; } + else if(event==30) { /* index object */ + base->object->index= ob->index; + } } } base= base->next; @@ -3444,6 +3447,8 @@ void copy_attr_menu() if(ob->soft) strcat(str, "|Soft Body Settings%x23"); + strcat(str, "|Pass Index%x30"); + if(ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF){ strcat(str, "|Modifiers ...%x24"); } diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index 8ad1a33ba62..9499b515671 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -235,7 +235,7 @@ static void change_plugin_seq(char *str) /* called from fileselect */ if( test_overlap_seq(last_seq) ) shuffle_seq(last_seq); - BIF_undo_push("Load/change Sequencer plugin"); + BIF_undo_push("Load/Change Plugin, Sequencer"); } @@ -510,7 +510,7 @@ static void deselect_all_seq(void) } END_SEQ - BIF_undo_push("(De)select all Sequencer"); + BIF_undo_push("(De)select all Strips, Sequencer"); } static void recurs_sel_seq(Sequence *seqm) @@ -552,7 +552,7 @@ void swap_select_seq(void) END_SEQ allqueue(REDRAWSEQ, 0); - BIF_undo_push("Swap select all Sequencer"); + BIF_undo_push("Swap Selected Strips, Sequencer"); } @@ -585,8 +585,14 @@ void select_channel_direction(Sequence *test,int lr) { void select_dir_from_last(int lr) { Sequence *seq=get_last_seq(); + if (seq==NULL) + return; + + select_channel_direction(seq,lr); + allqueue(REDRAWSEQ, 0); - if (seq) select_channel_direction(seq,lr); + if (lr==1) BIF_undo_push("Select Strips to the Left, Sequencer"); + else BIF_undo_push("Select Strips to the Right, Sequencer"); } void select_surrounding_handles(Sequence *test) @@ -612,14 +618,19 @@ void select_surround_from_last() { Sequence *seq=get_last_seq(); - if (seq) select_surrounding_handles(seq); + if (seq==NULL) + return; + + select_surrounding_handles(seq); + allqueue(REDRAWSEQ, 0); + BIF_undo_push("Select Surrounding Handles, Sequencer"); } void select_neighbor_from_last(int lr) { Sequence *seq=get_last_seq(); Sequence *neighbor; - + int change = 0; if (seq) { neighbor=find_neighboring_sequence(seq, lr); if (neighbor) { @@ -638,8 +649,15 @@ void select_neighbor_from_last(int lr) break; } seq->flag |= SELECT; + change = 1; } } + if (change) { + allqueue(REDRAWSEQ, 0); + + if (lr==1) BIF_undo_push("Select Left Handles, Sequencer"); + else BIF_undo_push("Select Right Handles, Sequencer"); + } } void mouse_select_seq(void) @@ -736,7 +754,7 @@ void mouse_select_seq(void) force_draw(0); if(get_last_seq()) allqueue(REDRAWIPO, 0); - BIF_undo_push("Select Sequencer"); + BIF_undo_push("Select Strips, Sequencer"); std_rmouse_transform(transform_seq); } @@ -1165,7 +1183,7 @@ static void add_image_strips(char *name) waitcursor(0); - BIF_undo_push("Add image strip Sequencer"); + BIF_undo_push("Add Image Strip, Sequencer"); transform_seq('g', 0); } @@ -1200,7 +1218,7 @@ static void add_movie_strip(char *name) waitcursor(0); - BIF_undo_push("Add movie strip Sequencer"); + BIF_undo_push("Add Movie Strip, Sequencer"); transform_seq('g', 0); } @@ -1236,7 +1254,7 @@ static void add_movie_and_hdaudio_strip(char *name) waitcursor(0); - BIF_undo_push("Add movie and HD-audio strip Sequencer"); + BIF_undo_push("Add Movie and HD-Audio Strip, Sequencer"); transform_seq('g', 0); } @@ -1265,7 +1283,7 @@ static void add_sound_strip_ram(char *name) waitcursor(0); - BIF_undo_push("Add ram sound strip Sequencer"); + BIF_undo_push("Add Sound (RAM) Strip, Sequencer"); transform_seq('g', 0); } @@ -1293,7 +1311,7 @@ static void add_sound_strip_hd(char *name) waitcursor(0); - BIF_undo_push("Add hd sound strip Sequencer"); + BIF_undo_push("Add Sound (HD) Strip, Sequencer"); transform_seq('g', 0); } @@ -1534,9 +1552,9 @@ static int add_seq_effect(int type, char *str) /* push undo and go into grab mode */ if(newseq->type == SEQ_PLUGIN) { - BIF_undo_push("Add plugin strip Sequencer"); + BIF_undo_push("Add Plugin Strip, Sequencer"); } else { - BIF_undo_push("Add effect strip Sequencer"); + BIF_undo_push("Add Effect Strip, Sequencer"); } transform_seq('g', 0); @@ -1713,7 +1731,7 @@ void add_sequence(int type) strip->us= 1; if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - BIF_undo_push("Add scene strip Sequencer"); + BIF_undo_push("Add Scene Strip, Sequencer"); transform_seq('g', 0); } } @@ -1819,7 +1837,7 @@ void change_sequence(void) update_changed_seq_and_deps(last_seq, 0, 1); allqueue(REDRAWSEQ, 0); - BIF_undo_push("Change effect Sequencer"); + BIF_undo_push("Change Strip Effect, Sequencer"); } } else if(last_seq->type == SEQ_IMAGE) { @@ -1976,7 +1994,7 @@ void del_seq(void) ms= ms->prev; } - BIF_undo_push("Delete from Sequencer"); + BIF_undo_push("Delete Strip(s), Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2151,7 +2169,7 @@ void add_duplicate_seq(void) recurs_dupli_seq(ed->seqbasep, &new); addlisttolist(ed->seqbasep, &new); - BIF_undo_push("Add duplicate Sequencer"); + BIF_undo_push("Add Duplicate, Sequencer"); transform_seq('g', 0); } @@ -2268,7 +2286,7 @@ void seq_remap_paths(void) } END_SEQ - BIF_undo_push("Remap paths in Sequencer"); + BIF_undo_push("Remap Paths, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2295,7 +2313,7 @@ void no_gaps(void) } } - BIF_undo_push("No gaps Sequencer"); + BIF_undo_push("No Gaps, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2380,7 +2398,7 @@ void make_meta(void) if(seqm->len) seqm->strip->stripdata= MEM_callocN(seqm->len*sizeof(StripElem), "metastripdata"); set_meta_stripdata(seqm); - BIF_undo_push("Make Meta Sequencer"); + BIF_undo_push("Make Meta Strip, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2403,7 +2421,7 @@ void un_meta(void) if(last_seq==0 || last_seq->type!=SEQ_META) return; - if(okee("Un Meta")==0) return; + if(okee("Un Meta Strip")==0) return; addlisttolist(ed->seqbasep, &last_seq->seqbase); @@ -2433,7 +2451,7 @@ void un_meta(void) sort_seq(); - BIF_undo_push("Un-make Meta Sequencer"); + BIF_undo_push("Un-Make Meta Strip, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2472,7 +2490,7 @@ void exit_meta(void) MEM_freeN(ms); allqueue(REDRAWSEQ, 0); - BIF_undo_push("Exit meta strip Sequence"); + BIF_undo_push("Exit Meta Strip, Sequence"); } @@ -2499,7 +2517,7 @@ void enter_meta(void) set_last_seq(NULL); allqueue(REDRAWSEQ, 0); - BIF_undo_push("Enter meta strip Sequence"); + BIF_undo_push("Enter Meta Strip, Sequence"); } @@ -2890,9 +2908,9 @@ void transform_seq(int mode, int context) MEM_freeN(transmain); if (mode=='g') - BIF_undo_push("Transform Grab"); + BIF_undo_push("Transform Grab, Sequencer"); else if (mode=='e') - BIF_undo_push("Transform Extend"); + BIF_undo_push("Transform Extend, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -2916,7 +2934,7 @@ void seq_cut(int cutframe) } } if(seq) { - error("Cannot cut Meta strips"); + error("Cannot Cut Meta Strips"); return; } @@ -2931,7 +2949,7 @@ void seq_cut(int cutframe) } if(tot==0) { - error("No strips to cut"); + error("No Strips to Cut"); return; } @@ -3025,6 +3043,79 @@ void seq_cut(int cutframe) MEM_freeN(transmain); allqueue(REDRAWSEQ, 0); + BIF_undo_push("Cut Strips, Sequencer"); +} + +void seq_separate_images(void) +{ + Editing *ed; + Sequence *seq, *seq_new, *seq_next; + Strip *strip_new; + StripElem *se, *se_new; + int start, start_ofs, cfra, frame_end; + static int step= 1; + + add_numbut(0, NUM|INT, "Image Duration:", 1, 256, &step, NULL); + if (!do_clever_numbuts("Separate Images", 1, REDRAW)) + return; + + ed= G.scene->ed; + if(ed==0) return; + + seq= ed->seqbasep->first; + + while (seq) { + if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) { + /* remove seq so overlap tests dont conflict, + see free_sequence below for the real free'ing */ + seq_next = seq->next; + BLI_remlink(ed->seqbasep, seq); + if(seq->ipo) seq->ipo->id.us--; + + start_ofs = cfra = seq_tx_get_final_left(seq); + frame_end = seq_tx_get_final_right(seq); + + while (cfra < frame_end) { + /* new seq */ + se = give_stripelem(seq, cfra); + + seq_new= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, start_ofs, seq->machine); + seq_new->type= SEQ_IMAGE; + seq_new->len = 1; + seq_new->endstill = step-1; + + /* new strip */ + seq_new->strip= strip_new= MEM_callocN(sizeof(Strip)*1, "strip"); + strip_new->len= 1; + strip_new->us= 1; + strncpy(strip_new->dir, seq->strip->dir, FILE_MAXDIR-1); + + /* new stripdata */ + strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem"); + strncpy(se_new->name, se->name, FILE_MAXFILE-1); + se_new->ok= 1; + + calc_sequence(seq_new); + seq_new->flag &= ~SEQ_OVERLAP; + if (test_overlap_seq(seq_new)) { + shuffle_seq(seq_new); + } + + cfra++; + start_ofs += step; + } + + free_sequence(seq); + seq = seq->next; + } else { + seq = seq->next; + } + } + + /* as last: */ + sort_seq(); + BIF_undo_push("Separate Image Strips, Sequencer"); + allqueue(REDRAWSEQ, 0); } void seq_snap_menu(void) @@ -3079,7 +3170,7 @@ void seq_snap(short event) /* as last: */ sort_seq(); - BIF_undo_push("Snap menu Sequencer"); + BIF_undo_push("Snap Strips, Sequencer"); allqueue(REDRAWSEQ, 0); } @@ -3128,7 +3219,7 @@ void borderselect_seq(void) seq= seq->next; } - BIF_undo_push("Border select Sequencer"); + BIF_undo_push("Border Select, Sequencer"); addqueue(curarea->win, REDRAW, 1); } } diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c index 32a315c0dc8..935dd2854a8 100644 --- a/source/blender/src/header_seq.c +++ b/source/blender/src/header_seq.c @@ -425,6 +425,9 @@ static void do_seq_editmenu(void *arg, int event) case 15: seq_remap_paths(); break; + case 16: + seq_separate_images(); + break; } } @@ -449,6 +452,7 @@ static uiBlock *seq_editmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Images to Strips|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index d95cb13832e..105ac97f335 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -862,6 +862,7 @@ void do_view3d_select_object_groupedmenu(void *arg, int event) case 6: /* Objects on Shared Layers */ case 7: /* Objects in Same Group */ case 8: /* Object Hooks*/ + case 9: /* Object PassIndex*/ select_object_grouped((short)event); break; } @@ -884,7 +885,8 @@ static uiBlock *view3d_select_object_groupedmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); - + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); return block; @@ -2090,6 +2092,7 @@ static void do_view3d_edit_object_copyattrmenu(void *arg, int event) case 25: case 26: case 29: + case 30: copy_attr((short)event); break; } @@ -2153,6 +2156,8 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused) if( give_parteff(ob) ) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, ""); } + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Pass Index|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 30, ""); } uiBlockSetDirection(block, UI_RIGHT); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index ef87f02f28c..5f305efcb8b 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -854,6 +854,25 @@ static short select_same_layer(Object *ob) return changed; } +static short select_same_index_object(Object *ob) +{ + char changed = 0; + Base *base = FIRSTBASE; + + if (!ob) + return 0; + + while(base) { + if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) { + base->flag |= SELECT; + base->object->flag |= SELECT; + changed = 1; + } + base= base->next; + } + return changed; +} + void select_object_grouped(short nr) { short changed = 0; @@ -865,6 +884,7 @@ void select_object_grouped(short nr) else if(nr==6) changed = select_same_layer(OBACT); else if(nr==7) changed = select_same_group(OBACT); else if(nr==8) changed = select_object_hooks(OBACT); + else if(nr==9) changed = select_same_index_object(OBACT); if (changed) { countall(); @@ -890,7 +910,7 @@ static void select_object_grouped_menu(void) "Objects of Same Type%x5|" "Objects on Shared Layers%x6|" "Objects in Same Group%x7|" - "Object Hooks%x8|"); + "Object Hooks%x8|Object PassIndex%x9"); /* here we go */ @@ -4554,6 +4574,11 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(okee("Cut strips")) seq_cut(CFRA); } break; + case YKEY: + if((G.qual==0)) { /* Cut at current frame */ + seq_separate_images(); + } + break; case MKEY: if(G.qual==LR_ALTKEY) un_meta(); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 27c83799aa0..1951f3b1205 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -893,6 +893,7 @@ static TBitem tb_object_select_grouped[]= { { 0, "Objects on Shared Layers|Shift G, 6", 6, NULL}, { 0, "Objects in Same Group|Shift G, 7", 7, NULL}, { 0, "Object Hooks|Shift G, 8", 8, NULL}, +{ 0, "Object PassIndex|Shift G, 9", 9, NULL}, { -1, "", 0, do_view3d_select_object_groupedmenu}}; static TBitem tb_object_select[]= { |