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:
authorAntonioya <blendergit@gmail.com>2019-04-03 11:25:49 +0300
committerAntonioya <blendergit@gmail.com>2019-04-03 11:25:49 +0300
commit382b2a9c66a9f8b64581dc2a360dffbbbe706e21 (patch)
tree4c0bd232085a821f3fe132eb4bb002f95d7d2099 /source
parenta813e259d6309b25fbd0a6d506df810ad2b11395 (diff)
GPencil: Implement custom channel color in Dopesheet
A new parameter in the layer adjustment panel allows to define the color of the channel in Dopesheet. This is needed when there are a lot of layers. See D4623 for more details.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c2
-rw-r--r--source/blender/blenloader/intern/versioning_280.c13
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c19
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c9
4 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6981d70019a..2ef8568e308 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -374,6 +374,8 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti
/* thickness parameter represents "thickness change", not absolute thickness */
gpl->thickness = 0;
gpl->opacity = 1.0f;
+ /* default channel color */
+ ARRAY_SET_ITEMS(gpl->color, 0.2f, 0.2f, 0.2f);
}
/* auto-name */
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 4173bb9d99a..a1087caf40c 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2952,6 +2952,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
mat->blend_shadow = MA_BS_SOLID;
}
}
+
+ /* grease pencil default animation channel color */
+ {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+ if (gpd->flag & GP_DATA_ANNOTATIONS) {
+ continue;
+ }
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* default channel color */
+ ARRAY_SET_ITEMS(gpl->color, 0.2f, 0.2f, 0.2f);
+ }
+ }
+ }
}
{
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 997b3c22e51..618ac8f6f13 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -220,6 +220,23 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
}
}
+/* get backdrop color for grease pencil channels */
+static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
+{
+ const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
+ bool showGroupColors = acf_show_channel_colors(ac);
+
+ if ((showGroupColors) && (ale->type == ANIMTYPE_GPLAYER)) {
+ bGPDlayer *gpl = (bGPDlayer *)ale->data;
+ copy_v3_v3(r_color, gpl->color);
+ }
+ else {
+ int colOfs = 10 - 10 * indent;
+ UI_GetThemeColorShade3fv(TH_SHADE2, colOfs, r_color);
+ }
+}
+
/* backdrop for generic channels */
static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
@@ -3058,7 +3075,7 @@ static bAnimChannelType ACF_GPL =
"GPencil Layer", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
- acf_generic_channel_color, /* backdrop color */
+ acf_gpencil_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index eefac818abe..73203beb3e2 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1145,6 +1145,15 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ /* layer channel color (grease pencil) */
+ prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Custom Channel Color",
+ "Custom color for animation channel in Dopesheet");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
/* Stroke Drawing Color (Annotations) */
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);