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/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c143
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c39
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c16
5 files changed, 144 insertions, 63 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 53f1c35776c..dc5e11b6998 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -107,36 +107,53 @@
static Sequence *special_seq_update = NULL;
-void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
-{
+void color3ubv_from_seq(const Scene *curscene,
+ const Sequence *seq,
+ const bool show_strip_color_tag,
+ uchar r_col[3])
+{
+ if (show_strip_color_tag && (uint)seq->color_tag < SEQUENCE_COLOR_TOT &&
+ seq->color_tag != SEQUENCE_COLOR_NONE) {
+ bTheme *btheme = UI_GetTheme();
+ const ThemeStripColor *strip_color = &btheme->strip_color[seq->color_tag];
+ copy_v3_v3_uchar(r_col, strip_color->color);
+ return;
+ }
+
uchar blendcol[3];
+ /* Sometimes the active theme is not the sequencer theme, e.g. when an operator invokes the file
+ * browser. This makes sure we get the right color values for the theme. */
+ struct bThemeState theme_state;
+ UI_Theme_Store(&theme_state);
+ UI_SetTheme(SPACE_SEQ, RGN_TYPE_WINDOW);
+
switch (seq->type) {
case SEQ_TYPE_IMAGE:
- UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
+ UI_GetThemeColor3ubv(TH_SEQ_IMAGE, r_col);
break;
case SEQ_TYPE_META:
- UI_GetThemeColor3ubv(TH_SEQ_META, col);
+ UI_GetThemeColor3ubv(TH_SEQ_META, r_col);
break;
case SEQ_TYPE_MOVIE:
- UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
+ UI_GetThemeColor3ubv(TH_SEQ_MOVIE, r_col);
break;
case SEQ_TYPE_MOVIECLIP:
- UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
+ UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, r_col);
break;
case SEQ_TYPE_MASK:
- UI_GetThemeColor3ubv(TH_SEQ_MASK, col);
+ UI_GetThemeColor3ubv(TH_SEQ_MASK, r_col);
break;
case SEQ_TYPE_SCENE:
- UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
+ UI_GetThemeColor3ubv(TH_SEQ_SCENE, r_col);
if (seq->scene == curscene) {
- UI_GetColorPtrShade3ubv(col, col, 20);
+ UI_GetColorPtrShade3ubv(r_col, r_col, 20);
}
break;
@@ -144,9 +161,9 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
case SEQ_TYPE_CROSS:
case SEQ_TYPE_GAMCROSS:
case SEQ_TYPE_WIPE:
- col[0] = 130;
- col[1] = 130;
- col[2] = 130;
+ r_col[0] = 130;
+ r_col[1] = 130;
+ r_col[2] = 130;
break;
/* Effects. */
@@ -163,72 +180,74 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
case SEQ_TYPE_ADJUSTMENT:
case SEQ_TYPE_GAUSSIAN_BLUR:
case SEQ_TYPE_COLORMIX:
- UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
+ UI_GetThemeColor3ubv(TH_SEQ_EFFECT, r_col);
/* Slightly offset hue to distinguish different effects. */
if (seq->type == SEQ_TYPE_ADD) {
- rgb_byte_set_hue_float_offset(col, 0.03);
+ rgb_byte_set_hue_float_offset(r_col, 0.03);
}
else if (seq->type == SEQ_TYPE_SUB) {
- rgb_byte_set_hue_float_offset(col, 0.06);
+ rgb_byte_set_hue_float_offset(r_col, 0.06);
}
else if (seq->type == SEQ_TYPE_MUL) {
- rgb_byte_set_hue_float_offset(col, 0.13);
+ rgb_byte_set_hue_float_offset(r_col, 0.13);
}
else if (seq->type == SEQ_TYPE_ALPHAOVER) {
- rgb_byte_set_hue_float_offset(col, 0.16);
+ rgb_byte_set_hue_float_offset(r_col, 0.16);
}
else if (seq->type == SEQ_TYPE_ALPHAUNDER) {
- rgb_byte_set_hue_float_offset(col, 0.23);
+ rgb_byte_set_hue_float_offset(r_col, 0.23);
}
else if (seq->type == SEQ_TYPE_OVERDROP) {
- rgb_byte_set_hue_float_offset(col, 0.26);
+ rgb_byte_set_hue_float_offset(r_col, 0.26);
}
else if (seq->type == SEQ_TYPE_COLORMIX) {
- rgb_byte_set_hue_float_offset(col, 0.33);
+ rgb_byte_set_hue_float_offset(r_col, 0.33);
}
else if (seq->type == SEQ_TYPE_GAUSSIAN_BLUR) {
- rgb_byte_set_hue_float_offset(col, 0.43);
+ rgb_byte_set_hue_float_offset(r_col, 0.43);
}
else if (seq->type == SEQ_TYPE_GLOW) {
- rgb_byte_set_hue_float_offset(col, 0.46);
+ rgb_byte_set_hue_float_offset(r_col, 0.46);
}
else if (seq->type == SEQ_TYPE_ADJUSTMENT) {
- rgb_byte_set_hue_float_offset(col, 0.55);
+ rgb_byte_set_hue_float_offset(r_col, 0.55);
}
else if (seq->type == SEQ_TYPE_SPEED) {
- rgb_byte_set_hue_float_offset(col, 0.65);
+ rgb_byte_set_hue_float_offset(r_col, 0.65);
}
else if (seq->type == SEQ_TYPE_TRANSFORM) {
- rgb_byte_set_hue_float_offset(col, 0.75);
+ rgb_byte_set_hue_float_offset(r_col, 0.75);
}
else if (seq->type == SEQ_TYPE_MULTICAM) {
- rgb_byte_set_hue_float_offset(col, 0.85);
+ rgb_byte_set_hue_float_offset(r_col, 0.85);
}
break;
case SEQ_TYPE_COLOR:
- UI_GetThemeColor3ubv(TH_SEQ_COLOR, col);
+ UI_GetThemeColor3ubv(TH_SEQ_COLOR, r_col);
break;
case SEQ_TYPE_SOUND_RAM:
- UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
+ UI_GetThemeColor3ubv(TH_SEQ_AUDIO, r_col);
blendcol[0] = blendcol[1] = blendcol[2] = 128;
if (seq->flag & SEQ_MUTE) {
- UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
+ UI_GetColorPtrBlendShade3ubv(r_col, blendcol, r_col, 0.5, 20);
}
break;
case SEQ_TYPE_TEXT:
- UI_GetThemeColor3ubv(TH_SEQ_TEXT, col);
+ UI_GetThemeColor3ubv(TH_SEQ_TEXT, r_col);
break;
default:
- col[0] = 10;
- col[1] = 255;
- col[2] = 40;
+ r_col[0] = 10;
+ r_col[1] = 255;
+ r_col[2] = 40;
break;
}
+
+ UI_Theme_Restore(&theme_state);
}
typedef struct WaveVizData {
@@ -558,7 +577,13 @@ static void draw_seq_waveform_overlay(View2D *v2d,
}
}
-static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
+static void drawmeta_contents(Scene *scene,
+ Sequence *seqm,
+ float x1,
+ float y1,
+ float x2,
+ float y2,
+ const bool show_strip_color_tag)
{
Sequence *seq;
uchar col[4];
@@ -614,7 +639,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
rgb_float_to_uchar(col, colvars->col);
}
else {
- color3ubv_from_seq(scene, seq, col);
+ color3ubv_from_seq(scene, seq, show_strip_color_tag, col);
}
if ((seqm->flag & SEQ_MUTE) || (seq->flag & SEQ_MUTE)) {
@@ -953,7 +978,8 @@ static void draw_seq_text_overlay(View2D *v2d,
UI_view2d_text_cache_add_rectf(v2d, &rect, overlay_string, overlay_string_len, col);
}
-static void draw_sequence_extensions_overlay(Scene *scene, Sequence *seq, uint pos, float pixely)
+static void draw_sequence_extensions_overlay(
+ Scene *scene, Sequence *seq, uint pos, float pixely, const bool show_strip_color_tag)
{
float x1, x2, y1, y2;
uchar col[4], blend_col[3];
@@ -966,7 +992,7 @@ static void draw_sequence_extensions_overlay(Scene *scene, Sequence *seq, uint p
GPU_blend(GPU_BLEND_ALPHA);
- color3ubv_from_seq(scene, seq, col);
+ color3ubv_from_seq(scene, seq, show_strip_color_tag, col);
if (seq->flag & SELECT) {
UI_GetColorPtrShade3ubv(col, col, 50);
}
@@ -1036,7 +1062,8 @@ static void draw_seq_background(Scene *scene,
float x2,
float y1,
float y2,
- bool is_single_image)
+ bool is_single_image,
+ bool show_strip_color_tag)
{
uchar col[4];
GPU_blend(GPU_BLEND_ALPHA);
@@ -1049,11 +1076,11 @@ static void draw_seq_background(Scene *scene,
rgb_float_to_uchar(col, colvars->col);
}
else {
- color3ubv_from_seq(scene, seq1, col);
+ color3ubv_from_seq(scene, seq1, show_strip_color_tag, col);
}
}
else {
- color3ubv_from_seq(scene, seq, col);
+ color3ubv_from_seq(scene, seq, show_strip_color_tag, col);
}
/* Draw muted strips semi-transparent. */
@@ -1108,7 +1135,7 @@ static void draw_seq_background(Scene *scene,
rgb_float_to_uchar(col, colvars->col);
}
else {
- color3ubv_from_seq(scene, seq2, col);
+ color3ubv_from_seq(scene, seq2, show_strip_color_tag, col);
/* If the transition inputs are of the same type, draw the right side slightly darker. */
if (seq1->type == seq2->type) {
UI_GetColorPtrShade3ubv(col, col, -15);
@@ -1822,6 +1849,10 @@ static void draw_seq_strip(const bContext *C,
/* Check if we are doing "solo preview". */
bool is_single_image = (char)SEQ_transform_single_image_check(seq);
+ /* Use the seq->color_tag to display the tag color. */
+ const bool show_strip_color_tag = (sseq->timeline_overlay.flag &
+ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG);
+
/* Draw strip body. */
x1 = (seq->startstill) ? seq->start : seq->startdisp;
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
@@ -1852,7 +1883,7 @@ static void draw_seq_strip(const bContext *C,
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- draw_seq_background(scene, seq, pos, x1, x2, y1, y2, is_single_image);
+ draw_seq_background(scene, seq, pos, x1, x2, y1, y2, is_single_image, show_strip_color_tag);
/* Draw a color band inside color strip. */
if (seq->type == SEQ_TYPE_COLOR && y_threshold) {
@@ -1864,7 +1895,7 @@ static void draw_seq_strip(const bContext *C,
if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) {
if ((sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS) ||
(seq == special_seq_update)) {
- draw_sequence_extensions_overlay(scene, seq, pos, pixely);
+ draw_sequence_extensions_overlay(scene, seq, pos, pixely, show_strip_color_tag);
}
}
}
@@ -1875,7 +1906,7 @@ static void draw_seq_strip(const bContext *C,
if ((seq->type == SEQ_TYPE_META) ||
((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS))) {
- drawmeta_contents(scene, seq, x1, y1, x2, y2);
+ drawmeta_contents(scene, seq, x1, y1, x2, y2, show_strip_color_tag);
}
if ((sseq->flag & SEQ_SHOW_OVERLAY) &&
@@ -2585,7 +2616,7 @@ static int sequencer_draw_get_transform_preview_frame(Scene *scene)
return preview_frame;
}
-static void seq_draw_image_origin_and_outline(const bContext *C, Sequence *seq)
+static void seq_draw_image_origin_and_outline(const bContext *C, Sequence *seq, bool is_active_seq)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
if ((seq->flag & SELECT) == 0) {
@@ -2628,7 +2659,12 @@ static void seq_draw_image_origin_and_outline(const bContext *C, Sequence *seq)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
float col[3];
- UI_GetThemeColor3fv(TH_SEQ_SELECTED, col);
+ if (is_active_seq) {
+ UI_GetThemeColor3fv(TH_SEQ_ACTIVE, col);
+ }
+ else {
+ UI_GetThemeColor3fv(TH_SEQ_SELECTED, col);
+ }
immUniformColor3fv(col);
immUniform1f("lineWidth", U.pixelsize);
immBegin(GPU_PRIM_LINE_LOOP, 4);
@@ -2719,12 +2755,15 @@ void sequencer_draw_preview(const bContext *C,
sequencer_draw_borders_overlay(sseq, v2d, scene);
}
- SeqCollection *collection = SEQ_query_rendered_strips(&scene->ed->seqbase, timeline_frame, 0);
- Sequence *seq;
- SEQ_ITERATOR_FOREACH (seq, collection) {
- seq_draw_image_origin_and_outline(C, seq);
+ if (!draw_backdrop && scene->ed != NULL) {
+ SeqCollection *collection = SEQ_query_rendered_strips(&scene->ed->seqbase, timeline_frame, 0);
+ Sequence *seq;
+ Sequence *active_seq = SEQ_select_active_get(scene);
+ SEQ_ITERATOR_FOREACH (seq, collection) {
+ seq_draw_image_origin_and_outline(C, seq, seq == active_seq);
+ }
+ SEQ_collection_free(collection);
}
- SEQ_collection_free(collection);
if (draw_gpencil && show_imbuf && (sseq->flag & SEQ_SHOW_OVERLAY)) {
sequencer_draw_gpencil_overlay(C);
@@ -3292,6 +3331,6 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region)
UI_view2d_view_restore(C);
}
- ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
+ ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES));
UI_view2d_scrollers_draw(v2d, NULL);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9f21fc0676c..9be947b9112 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -63,6 +63,7 @@
#include "WM_types.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
/* For menu, popup, icons, etc. */
#include "ED_numinput.h"
@@ -869,9 +870,9 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
void SEQUENCER_OT_slip(struct wmOperatorType *ot)
{
/* Identifiers. */
- ot->name = "Trim Strips";
+ ot->name = "Slip Strips";
ot->idname = "SEQUENCER_OT_slip";
- ot->description = "Trim the contents of the active strip";
+ ot->description = "Slip the contents of selected strips";
/* Api callbacks. */
ot->invoke = sequencer_slip_invoke;
@@ -3322,4 +3323,38 @@ void SEQUENCER_OT_strip_transform_fit(struct wmOperatorType *ot)
"Scale fit fit_method");
}
+static int sequencer_strip_color_tag_set_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ const Editing *ed = SEQ_editing_get(scene);
+ const short color_tag = RNA_enum_get(op->ptr, "color");
+
+ LISTBASE_FOREACH (Sequence *, seq, &ed->seqbase) {
+ if (seq->flag & SELECT) {
+ seq->color_tag = color_tag;
+ }
+ }
+
+ WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot)
+{
+ /* Identifiers. */
+ ot->name = "Set Color Tag";
+ ot->idname = "SEQUENCER_OT_strip_color_tag_set";
+ ot->description = "Set a color tag for the selected strips";
+
+ /* Api callbacks. */
+ ot->exec = sequencer_strip_color_tag_set_exec;
+ ot->poll = sequencer_edit_poll;
+
+ /* Flags. */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_enum(
+ ot->srna, "color", rna_enum_strip_color_items, SEQUENCE_COLOR_NONE, "Color Tag", "");
+}
+
/** \} */
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 5b5c381509f..202eda85dca 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -51,7 +51,10 @@ void sequencer_draw_preview(const struct bContext *C,
int offset,
bool draw_overlay,
bool draw_backdrop);
-void color3ubv_from_seq(struct Scene *curscene, struct Sequence *seq, unsigned char col[3]);
+void color3ubv_from_seq(const struct Scene *curscene,
+ const struct Sequence *seq,
+ const bool show_strip_color_tag,
+ uchar r_col[3]);
void sequencer_special_update_set(Sequence *seq);
float sequence_handle_size_get_clamped(struct Sequence *seq, const float pixelx);
@@ -148,6 +151,8 @@ void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot);
void SEQUENCER_OT_strip_transform_clear(struct wmOperatorType *ot);
void SEQUENCER_OT_strip_transform_fit(struct wmOperatorType *ot);
+void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot);
+
/* sequencer_select.c */
void SEQUENCER_OT_select_all(struct wmOperatorType *ot);
void SEQUENCER_OT_select(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 48e6cfcdcd0..95f7b44264c 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -79,6 +79,8 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_strip_transform_clear);
WM_operatortype_append(SEQUENCER_OT_strip_transform_fit);
+ WM_operatortype_append(SEQUENCER_OT_strip_color_tag_set);
+
/* sequencer_select.c */
WM_operatortype_append(SEQUENCER_OT_select_all);
WM_operatortype_append(SEQUENCER_OT_select);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 99b75f82922..ad0ceb82709 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -104,25 +104,25 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce
sseq->preview_overlay.flag = SEQ_PREVIEW_SHOW_GPENCIL | SEQ_PREVIEW_SHOW_OUTLINE_SELECTED;
sseq->timeline_overlay.flag = SEQ_TIMELINE_SHOW_STRIP_NAME | SEQ_TIMELINE_SHOW_STRIP_SOURCE |
SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID |
- SEQ_TIMELINE_SHOW_FCURVES;
+ SEQ_TIMELINE_SHOW_FCURVES | SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
BLI_rctf_init(&sseq->runtime.last_thumbnail_area, 0.0f, 0.0f, 0.0f, 0.0f);
sseq->runtime.last_displayed_thumbnails = NULL;
- /* Tool header. */
- region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
+ /* Header. */
+ region = MEM_callocN(sizeof(ARegion), "header for sequencer");
BLI_addtail(&sseq->regionbase, region);
- region->regiontype = RGN_TYPE_TOOL_HEADER;
+ region->regiontype = RGN_TYPE_HEADER;
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
- region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
- /* Header. */
- region = MEM_callocN(sizeof(ARegion), "header for sequencer");
+ /* Tool header. */
+ region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
BLI_addtail(&sseq->regionbase, region);
- region->regiontype = RGN_TYPE_HEADER;
+ region->regiontype = RGN_TYPE_TOOL_HEADER;
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
/* Buttons/list view. */
region = MEM_callocN(sizeof(ARegion), "buttons for sequencer");