Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-12-17 17:45:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-17 17:45:47 +0300
commit51fdfa0de97bd3825161e245338c76711578f4cf (patch)
tree3617598687239995a29e3d614cb2e5bf292a5b8e
parent68ff5a87ecc7584408a09cec02aa4e6220b4d21e (diff)
sequencer clipboard
note: for inter-scene copying this uses a hack because Colin needs it because half his scene was scrambled by blender.
-rw-r--r--release/scripts/ui/space_sequencer.py4
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h1
-rw-r--r--source/blender/blenkernel/intern/sequencer.c16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c63
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c3
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h1
7 files changed, 90 insertions, 1 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index 7a51f1aa6d7..8edadb96de3 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -56,6 +56,10 @@ class SEQUENCER_HT_header(bpy.types.Header):
layout.prop(st, "display_mode", text="")
if (st.view_type == 'SEQUENCER'):
+ row = layout.row(align=True)
+ row.operator("sequencer.copy", text="", icon='COPYDOWN')
+ row.operator("sequencer.paste", text="", icon='PASTEDOWN')
+
layout.separator()
layout.operator("sequencer.refresh_all")
elif (st.view_type == 'SEQUENCER_PREVIEW'):
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 34d4b15b437..a101a096fe8 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -141,6 +141,7 @@ void printf_strip(struct Sequence *seq);
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
void seq_free_strip(struct Strip *strip);
void seq_free_editing(struct Scene *scene);
+void seq_free_clipboard(struct Scene *scene);
struct Editing *seq_give_editing(struct Scene *scene, int alloc);
char *give_seqname(struct Sequence *seq);
struct ImBuf *give_ibuf_seq(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 5165e570504..41e51885bfc 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -232,11 +232,23 @@ Editing *seq_give_editing(Scene *scene, int alloc)
return scene->ed;
}
+void seq_free_clipboard(Scene *scene)
+{
+ Editing *ed = scene->ed;
+ Sequence *seq, *nseq;
+
+ for(seq= ed->seqbase_clipboard.first; seq; seq= nseq) {
+ nseq= seq->next;
+ seq_free_sequence(scene, seq);
+ }
+ ed->seqbase_clipboard.first= ed->seqbase_clipboard.last= NULL;
+}
+
void seq_free_editing(Scene *scene)
{
Editing *ed = scene->ed;
MetaStack *ms;
- Sequence *seq;
+ Sequence *seq, *nseq;
if(ed==NULL)
return;
@@ -246,6 +258,8 @@ void seq_free_editing(Scene *scene)
}
SEQ_END
+ seq_free_clipboard(scene);
+
while((ms= ed->metastack.first)) {
BLI_remlink(&ed->metastack, ms);
MEM_freeN(ms);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 844bf51ae32..8c228e9ca74 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2746,3 +2746,66 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot)
/* properties */
}
+static void *_copy_scene= NULL; // XXX - FIXME
+static int sequencer_copy_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, FALSE);
+
+ if(ed==NULL)
+ return OPERATOR_CANCELLED;
+
+ seq_free_clipboard(scene);
+ recurs_dupli_seq(scene, ed->seqbasep, &ed->seqbase_clipboard);
+
+ _copy_scene = scene;
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_copy(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy";
+ ot->idname= "SEQUENCER_OT_copy";
+ ot->description="";
+
+ /* api callbacks */
+ ot->exec= sequencer_copy_exec;
+ ot->poll= ED_operator_sequencer_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+}
+
+static int sequencer_paste_exec(bContext *C, wmOperator *op)
+{
+ int retval = OPERATOR_CANCELLED;
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */
+ Editing *ed_from= seq_give_editing((Scene *)_copy_scene, TRUE); /* create if needed */
+
+
+ addlisttolist(ed->seqbasep, &ed_from->seqbase_clipboard);
+ ed_from->seqbase_clipboard.first= ed_from->seqbase_clipboard.last= NULL; // XXX - could duplicate these to use the clip
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_paste(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Paste";
+ ot->idname= "SEQUENCER_OT_paste";
+ ot->description="";
+
+ /* api callbacks */
+ ot->exec= sequencer_paste_exec;
+ ot->poll= ED_operator_sequencer_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 1cbc6e1bd1d..cf598bfb613 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -98,6 +98,9 @@ void SEQUENCER_OT_view_toggle(struct wmOperatorType *ot);
void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
+void SEQUENCER_OT_copy(struct wmOperatorType *ot);
+void SEQUENCER_OT_paste(struct wmOperatorType *ot);
+
/* preview specific operators */
void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 941df4d2e36..76c7b37f59e 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -106,6 +106,9 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_image_strip_add);
WM_operatortype_append(SEQUENCER_OT_effect_strip_add);
WM_operatortype_append(SEQUENCER_OT_properties);
+
+ WM_operatortype_append(SEQUENCER_OT_copy);
+ WM_operatortype_append(SEQUENCER_OT_paste);
}
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 0b45d62e347..329b5ef6d34 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -186,6 +186,7 @@ typedef struct Editing {
ListBase *seqbasep; /* pointer to the current list of seq's being edited (can be within a meta strip) */
ListBase seqbase; /* pointer to the top-most seq's */
ListBase metastack;
+ ListBase seqbase_clipboard; /* optionally store a copy */
/* Context vars, used to be static */
Sequence *act_seq;