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
path: root/source
diff options
context:
space:
mode:
authorFalk David <filedescriptor>2021-09-29 15:29:32 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-09-29 15:34:01 +0300
commit5cebcb415e76aaff74bc03c66414aa93b5c90e70 (patch)
tree3f5ab94862ce9a0f5e89e974ae4851135ae495b7 /source
parentffb9577ac9a4c79483941389a052284b64930c8e (diff)
VSE: Add color tags to strips
This patch adds color tags to VSE strips, an overlay option to toggle the colors on and off, a section in the theme settings to define the 9 possible colors and two ways of changing the color tag through the UI. You can change the color through the right-click context menu, or in the strip side panel next to the strip name. Color tags are defined in user preferences and they can be disabled in overlay settings. Reviewed By: campbellbarton, ISS Differential Revision: https://developer.blender.org/D12405
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_300.c51
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c3
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c6
-rw-r--r--source/blender/editors/include/UI_icons.h10
-rw-r--r--source/blender/editors/interface/interface_icons.c40
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c119
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c35
-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.c2
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h20
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesrna/RNA_enum_items.h1
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c34
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c24
-rw-r--r--source/blender/sequencer/intern/sequencer.c2
19 files changed, 312 insertions, 61 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index fc98abf619d..b04bbdfb187 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 30
+#define BLENDER_FILE_SUBVERSION 31
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 1c4a0690886..8b8b7218c0e 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -449,6 +449,12 @@ static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const Lis
#undef SEQ_SPEED_COMPRESS_IPO_Y
}
+static bool do_versions_sequencer_color_tags(Sequence *seq, void *UNUSED(user_data))
+{
+ seq->color_tag = SEQUENCE_COLOR_NONE;
+ return true;
+}
+
static bNodeLink *find_connected_link(bNodeTree *ntree, bNodeSocket *in_socket)
{
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
@@ -1614,18 +1620,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- /**
- * Versioning code until next subversion bump goes here.
- *
- * \note Be sure to check when bumping the version:
- * - "versioning_userdef.c", #blo_do_versions_userdef
- * - "versioning_userdef.c", #do_versions_theme
- *
- * \note Keep this message at the bottom of the function.
- */
- {
- /* Keep this block, even when empty. */
-
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 31)) {
/* Swap header with the tool header so the regular header is always on the edge. */
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
@@ -1650,5 +1645,37 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Set strip color tags to SEQUENCE_COLOR_NONE. */
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ if (scene->ed != NULL) {
+ SEQ_for_each_callback(&scene->ed->seqbase, do_versions_sequencer_color_tags, NULL);
+ }
+ }
+
+ /* Show vse color tags by default. */
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ if (sl->spacetype == SPACE_SEQ) {
+ SpaceSeq *sseq = (SpaceSeq *)sl;
+ sseq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - "versioning_userdef.c", #blo_do_versions_userdef
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 152ef79a38f..c383c1cc4e5 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -160,7 +160,8 @@ static void blo_update_defaults_screen(bScreen *screen,
seq->flag |= SEQ_SHOW_MARKERS | SEQ_ZOOM_TO_FIT | SEQ_USE_PROXIES | SEQ_SHOW_OVERLAY;
seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
seq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_NAME |
- SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID;
+ SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID |
+ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
seq->preview_overlay.flag |= SEQ_PREVIEW_SHOW_OUTLINE_SELECTED;
}
else if (area->spacetype == SPACE_TEXT) {
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 54a0f1beec1..cd365b6be78 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -295,6 +295,12 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_node.wire);
}
+ if (!USER_VERSION_ATLEAST(300, 31)) {
+ for (int i = 0; i < SEQUENCE_COLOR_TOT; ++i) {
+ FROM_DEFAULT_V4_UCHAR(strip_color[i].color);
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index ddd9ca4a98c..8a7df5b54ff 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -989,6 +989,16 @@ DEF_ICON_VECTOR(COLLECTION_COLOR_06)
DEF_ICON_VECTOR(COLLECTION_COLOR_07)
DEF_ICON_VECTOR(COLLECTION_COLOR_08)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_01)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_02)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_03)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_04)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_05)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_06)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_07)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_08)
+DEF_ICON_VECTOR(SEQUENCE_COLOR_09)
+
/* Events. */
DEF_ICON_COLOR(EVENT_A)
DEF_ICON_COLOR(EVENT_B)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 7f1a8ee99e0..c20129b4184 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -47,6 +47,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "RNA_access.h"
@@ -480,6 +481,35 @@ DEF_ICON_COLLECTION_COLOR_DRAW(08, COLLECTION_COLOR_08);
# undef DEF_ICON_COLLECTION_COLOR_DRAW
+static void vicon_strip_color_draw(
+ short color_tag, int x, int y, int w, int UNUSED(h), float UNUSED(alpha))
+{
+ bTheme *btheme = UI_GetTheme();
+ const ThemeStripColor *strip_color = &btheme->strip_color[color_tag];
+
+ const float aspect = (float)ICON_DEFAULT_WIDTH / (float)w;
+
+ UI_icon_draw_ex(x, y, ICON_SNAP_FACE, aspect, 1.0f, 0.0f, strip_color->color, true);
+}
+
+# define DEF_ICON_STRIP_COLOR_DRAW(index, color) \
+ static void vicon_strip_color_draw_##index(int x, int y, int w, int h, float alpha) \
+ { \
+ vicon_strip_color_draw(color, x, y, w, h, alpha); \
+ }
+
+DEF_ICON_STRIP_COLOR_DRAW(01, SEQUENCE_COLOR_01);
+DEF_ICON_STRIP_COLOR_DRAW(02, SEQUENCE_COLOR_02);
+DEF_ICON_STRIP_COLOR_DRAW(03, SEQUENCE_COLOR_03);
+DEF_ICON_STRIP_COLOR_DRAW(04, SEQUENCE_COLOR_04);
+DEF_ICON_STRIP_COLOR_DRAW(05, SEQUENCE_COLOR_05);
+DEF_ICON_STRIP_COLOR_DRAW(06, SEQUENCE_COLOR_06);
+DEF_ICON_STRIP_COLOR_DRAW(07, SEQUENCE_COLOR_07);
+DEF_ICON_STRIP_COLOR_DRAW(08, SEQUENCE_COLOR_08);
+DEF_ICON_STRIP_COLOR_DRAW(09, SEQUENCE_COLOR_09);
+
+# undef DEF_ICON_STRIP_COLOR_DRAW
+
/* Dynamically render icon instead of rendering a plain color to a texture/buffer
* This is not strictly a "vicon", as it needs access to icon->obj to get the color info,
* but it works in a very similar way.
@@ -995,6 +1025,16 @@ static void init_internal_icons(void)
def_internal_vicon(ICON_COLLECTION_COLOR_06, vicon_collection_color_draw_06);
def_internal_vicon(ICON_COLLECTION_COLOR_07, vicon_collection_color_draw_07);
def_internal_vicon(ICON_COLLECTION_COLOR_08, vicon_collection_color_draw_08);
+
+ def_internal_vicon(ICON_SEQUENCE_COLOR_01, vicon_strip_color_draw_01);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_02, vicon_strip_color_draw_02);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_03, vicon_strip_color_draw_03);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_04, vicon_strip_color_draw_04);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_05, vicon_strip_color_draw_05);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_06, vicon_strip_color_draw_06);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_07, vicon_strip_color_draw_07);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_08, vicon_strip_color_draw_08);
+ def_internal_vicon(ICON_SEQUENCE_COLOR_09, vicon_strip_color_draw_09);
}
static void init_iconfile_list(struct ListBase *list)
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 04377f02a7f..ae392980069 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) &&
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9f21fc0676c..6daa8d690e5 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"
@@ -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 813259159f9..ad0ceb82709 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -104,7 +104,7 @@ 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;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 86369ff7684..828702f9aa8 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -232,6 +232,10 @@ typedef struct Sequence {
int blend_mode;
float blend_opacity;
+ /* Tag color showed if `SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG` is set. */
+ int16_t color_tag;
+ char _pad4[6];
+
/* is sfra needed anymore? - it looks like its only used in one place */
/** Starting frame according to the timeline of the scene. */
int sfra;
@@ -727,6 +731,22 @@ enum {
SEQ_CACHE_STORE_THUMBNAIL = (1 << 12),
};
+/* Sequence->color_tag. */
+typedef enum SequenceColorTag {
+ SEQUENCE_COLOR_NONE = -1,
+ SEQUENCE_COLOR_01,
+ SEQUENCE_COLOR_02,
+ SEQUENCE_COLOR_03,
+ SEQUENCE_COLOR_04,
+ SEQUENCE_COLOR_05,
+ SEQUENCE_COLOR_06,
+ SEQUENCE_COLOR_07,
+ SEQUENCE_COLOR_08,
+ SEQUENCE_COLOR_09,
+
+ SEQUENCE_COLOR_TOT,
+} SequenceColorTag;
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index a8f21e597c5..a7fcf2cfb89 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -599,6 +599,7 @@ typedef struct SequencerTimelineOverlay {
typedef enum eSpaceSeq_SequencerTimelineOverlay_Flag {
SEQ_TIMELINE_SHOW_STRIP_OFFSETS = (1 << 1),
SEQ_TIMELINE_SHOW_THUMBNAILS = (1 << 2),
+ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG = (1 << 3), /* use Sequence->color_tag */
SEQ_TIMELINE_SHOW_FCURVES = (1 << 5),
SEQ_TIMELINE_ALL_WAVEFORMS = (1 << 7), /* draw all waveforms */
SEQ_TIMELINE_NO_WAVEFORMS = (1 << 8), /* draw no waveforms */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 247f67f6b95..291f6de5ba2 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -458,6 +458,10 @@ typedef struct ThemeCollectionColor {
unsigned char color[4];
} ThemeCollectionColor;
+typedef struct ThemeStripColor {
+ unsigned char color[4];
+} ThemeStripColor;
+
/**
* A theme.
*
@@ -500,8 +504,10 @@ typedef struct bTheme {
/* See COLLECTION_COLOR_TOT for the number of collection colors. */
ThemeCollectionColor collection_color[8];
+ /* See SEQUENCE_COLOR_TOT for the total number of strip colors. */
+ ThemeStripColor strip_color[9];
+
int active_theme_area;
- char _pad0[4];
} bTheme;
#define UI_THEMESPACE_START(btheme) \
diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h
index c8f44262020..03d371be1f7 100644
--- a/source/blender/makesrna/RNA_enum_items.h
+++ b/source/blender/makesrna/RNA_enum_items.h
@@ -211,6 +211,7 @@ DEF_ENUM(rna_enum_attribute_domain_items)
DEF_ENUM(rna_enum_attribute_domain_with_auto_items)
DEF_ENUM(rna_enum_collection_color_items)
+DEF_ENUM(rna_enum_strip_color_items)
DEF_ENUM(rna_enum_subdivision_uv_smooth_items)
DEF_ENUM(rna_enum_subdivision_boundary_smooth_items)
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 6a03ee03f71..7303f6c920a 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -81,6 +81,20 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_strip_color_items[] = {
+ {SEQUENCE_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"},
+ {SEQUENCE_COLOR_01, "COLOR_01", ICON_SEQUENCE_COLOR_01, "Color 01", ""},
+ {SEQUENCE_COLOR_02, "COLOR_02", ICON_SEQUENCE_COLOR_02, "Color 02", ""},
+ {SEQUENCE_COLOR_03, "COLOR_03", ICON_SEQUENCE_COLOR_03, "Color 03", ""},
+ {SEQUENCE_COLOR_04, "COLOR_04", ICON_SEQUENCE_COLOR_04, "Color 04", ""},
+ {SEQUENCE_COLOR_05, "COLOR_05", ICON_SEQUENCE_COLOR_05, "Color 05", ""},
+ {SEQUENCE_COLOR_06, "COLOR_06", ICON_SEQUENCE_COLOR_06, "Color 06", ""},
+ {SEQUENCE_COLOR_07, "COLOR_07", ICON_SEQUENCE_COLOR_07, "Color 07", ""},
+ {SEQUENCE_COLOR_08, "COLOR_08", ICON_SEQUENCE_COLOR_08, "Color 08", ""},
+ {SEQUENCE_COLOR_09, "COLOR_09", ICON_SEQUENCE_COLOR_09, "Color 09", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
#ifdef RNA_RUNTIME
# include "BKE_global.h"
@@ -1000,6 +1014,18 @@ static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
seq->blend_opacity = value * 100.0f;
}
+static int rna_Sequence_color_tag_get(PointerRNA *ptr)
+{
+ Sequence *seq = (Sequence *)(ptr->data);
+ return seq->color_tag;
+}
+
+static void rna_Sequence_color_tag_set(PointerRNA *ptr, int value)
+{
+ Sequence *seq = (Sequence *)(ptr->data);
+ seq->color_tag = value;
+}
+
static bool colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
@@ -1938,6 +1964,14 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_update(
prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update");
+ prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "color_tag");
+ RNA_def_property_enum_funcs(
+ prop, "rna_Sequence_color_tag_get", "rna_Sequence_color_tag_set", NULL);
+ RNA_def_property_enum_items(prop, rna_enum_strip_color_items);
+ RNA_def_property_ui_text(prop, "Strip Color", "Color tag for a strip");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
/* modifiers */
prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "SequenceModifier");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index a9219fb11be..a4f79696276 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -5500,6 +5500,12 @@ static void rna_def_space_sequencer_timeline_overlay(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_THUMBNAILS);
RNA_def_property_ui_text(prop, "Show Thumbnails", "Show strip thumbnails");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_strip_tag_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG);
+ RNA_def_property_ui_text(
+ prop, "Show Color Tags", "Display the strip color tags in the sequencer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
}
static void rna_def_space_sequencer(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 684c331e14e..ccfc1222d4c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3680,6 +3680,23 @@ static void rna_def_userdef_theme_collection_color(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
+static void rna_def_userdef_theme_strip_color(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThemeStripColor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeStripColor");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Strip Color", "Theme settings for strip colors");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Strip Color");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+}
+
static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
{
StructRNA *srna;
@@ -4029,6 +4046,12 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "collection_color", "");
RNA_def_property_struct_type(prop, "ThemeCollectionColor");
RNA_def_property_ui_text(prop, "Collection Color", "");
+
+ prop = RNA_def_property(srna, "strip_color", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_collection_sdna(prop, NULL, "strip_color", "");
+ RNA_def_property_struct_type(prop, "ThemeStripColor");
+ RNA_def_property_ui_text(prop, "Strip Color", "");
}
static void rna_def_userdef_addon(BlenderRNA *brna)
@@ -4272,6 +4295,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_space_spreadsheet(brna);
rna_def_userdef_theme_colorset(brna);
rna_def_userdef_theme_collection_color(brna);
+ rna_def_userdef_theme_strip_color(brna);
rna_def_userdef_themes(brna);
}
diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c
index c164e7fc2ee..3478c2d4f97 100644
--- a/source/blender/sequencer/intern/sequencer.c
+++ b/source/blender/sequencer/intern/sequencer.c
@@ -144,6 +144,8 @@ Sequence *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int
seq->strip = seq_strip_alloc(type);
seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format");
+ seq->color_tag = SEQUENCE_COLOR_NONE;
+
SEQ_relations_session_uuid_generate(seq);
return seq;