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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_resources.h1
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c109
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c1
7 files changed, 118 insertions, 16 deletions
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index f676dcbdff2..c329a784d18 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -149,6 +149,7 @@ enum {
TH_CONSOLE_CURSOR,
TH_SEQ_MOVIE,
+ TH_SEQ_MOVIECLIP,
TH_SEQ_IMAGE,
TH_SEQ_SCENE,
TH_SEQ_AUDIO,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index c93e166baea..1875a098793 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -364,6 +364,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_SEQ_MOVIE:
cp= ts->movie; break;
+ case TH_SEQ_MOVIECLIP:
+ cp= ts->movieclip; break;
case TH_SEQ_IMAGE:
cp= ts->image; break;
case TH_SEQ_SCENE:
@@ -754,6 +756,7 @@ void ui_theme_init_default(void)
btheme->tseq= btheme->tv3d;
rgba_char_args_set(btheme->tseq.back, 116, 116, 116, 255);
rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
+ rgba_char_args_set(btheme->tseq.movieclip, 32, 32, 143, 255);
rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 30a8523b426..5249c74ba84 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -52,9 +52,9 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
#include "BKE_report.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -224,19 +224,16 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->scene= sce_seq;
- seq->sfra= sce_seq->r.sfra;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
+ seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
strip->us= 1;
- strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
- seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
+ seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
calc_sequence_disp(scene, seq);
sort_seq(scene);
@@ -298,6 +295,103 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
ot->prop= prop;
}
+/* add movieclip operator */
+static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, TRUE);
+
+ MovieClip *clip;
+
+ Sequence *seq; /* generic strip vars */
+ Strip *strip;
+
+ int start_frame, channel; /* operator props */
+
+ start_frame= RNA_int_get(op->ptr, "frame_start");
+ channel= RNA_int_get(op->ptr, "channel");
+
+ clip= BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip"));
+
+ if (clip == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "MovieClip not found");
+ return OPERATOR_CANCELLED;
+ }
+
+ seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+ seq->type= SEQ_MOVIECLIP;
+ seq->blend_mode= SEQ_CROSS;
+ seq->clip = clip;
+
+ /* basic defaults */
+ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+ seq->len = BKE_movieclip_get_duration(clip);
+ strip->us= 1;
+
+ BLI_strncpy(seq->name+2, clip->id.name+2, sizeof(seq->name)-2);
+ seqbase_unique_name_recursive(&ed->seqbase, seq);
+
+ calc_sequence_disp(scene, seq);
+ sort_seq(scene);
+
+ if (RNA_boolean_get(op->ptr, "replace_sel")) {
+ deselect_all_seq(scene);
+ seq_active_set(scene, seq);
+ seq->flag |= SELECT;
+ }
+
+ if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+ if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+ }
+
+ WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+
+static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ if(!ED_operator_sequencer_active(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
+ return OPERATOR_CANCELLED;
+ }
+
+ if(!RNA_struct_property_is_set(op->ptr, "clip"))
+ return WM_enum_search_invoke(C, op, event);
+
+ sequencer_generic_invoke_xy__internal(C, op, event, 0);
+ return sequencer_add_movieclip_strip_exec(C, op);
+ // needs a menu
+ // return WM_menu_invoke(C, op, event);
+}
+
+
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name= "Add MovieClip Strip";
+ ot->idname= "SEQUENCER_OT_movieclip_strip_add";
+ ot->description= "Add a movieclip strip to the sequencer";
+
+ /* api callbacks */
+ ot->invoke= sequencer_add_movieclip_strip_invoke;
+ ot->exec= sequencer_add_movieclip_strip_exec;
+
+ ot->poll= ED_operator_scene_editable;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
+ prop= RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
+ RNA_def_enum_funcs(prop, RNA_movieclip_itemf);
+ ot->prop= prop;
+}
+
+
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
{
Scene *scene= CTX_data_scene(C); /* only for sound */
@@ -624,10 +718,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len;
strip->us= 1;
- if(seq->len>0)
- strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
if (seq->type==SEQ_PLUGIN) {
char path[FILE_MAX];
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index a9c32b4dfde..99888ba4a37 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -93,6 +93,10 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
case SEQ_MOVIE:
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
break;
+
+ case SEQ_MOVIECLIP:
+ UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
+ break;
case SEQ_SCENE:
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
@@ -534,6 +538,14 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
}
+ else if(seq->type == SEQ_MOVIECLIP) {
+ if(seq->clip && strcmp(name, seq->clip->id.name+2) != 0) {
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->clip->id.name+2);
+ }
+ else {
+ BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+ }
+ }
else if(seq->type == SEQ_MULTICAM) {
BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 62bbe09c4d8..d9f5b283d6a 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -660,7 +660,6 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
- new_tstripdata(seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -701,7 +700,6 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
reload_sequence_new_file(scene, seqn, FALSE);
calc_sequence(scene, seqn);
- new_tstripdata(seqn);
}
return seqn;
}
@@ -754,7 +752,6 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
calc_sequence(scene, seq);
- new_tstripdata(seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
@@ -790,7 +787,6 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
calc_sequence(scene, seqn);
- new_tstripdata(seqn);
}
return seqn;
}
@@ -1632,7 +1628,6 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* free parent metas */
ms= ed->metastack.last;
while(ms) {
- ms->parseq->strip->len= 0; /* force new alloc */
calc_sequence(scene, ms->parseq);
ms= ms->prev;
}
@@ -1752,7 +1747,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new strip */
strip_new= seq_new->strip;
- strip_new->len= 1;
strip_new->us= 1;
/* new stripdata */
@@ -1912,7 +1906,6 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
calc_sequence(scene, seqm);
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
- seqm->strip->len= seqm->len;
seqm->strip->us= 1;
seq_active_set(scene, seqm);
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 2d98278e163..ef782832f13 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -136,6 +136,7 @@ void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot);
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index e53d06c9786..1ebb8af321c 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -104,6 +104,7 @@ void sequencer_operatortypes(void)
/* sequencer_add.c */
WM_operatortype_append(SEQUENCER_OT_scene_strip_add);
+ WM_operatortype_append(SEQUENCER_OT_movieclip_strip_add);
WM_operatortype_append(SEQUENCER_OT_movie_strip_add);
WM_operatortype_append(SEQUENCER_OT_sound_strip_add);
WM_operatortype_append(SEQUENCER_OT_image_strip_add);