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:
authorJoshua Leung <aligorith@gmail.com>2014-12-27 17:02:47 +0300
committerJoshua Leung <aligorith@gmail.com>2014-12-27 17:05:11 +0300
commit155bb058f4e03a108b06f150b57e273e62d4f339 (patch)
tree7c9c372f722b7ec0b72075c1b5f9b959c79941ea /source
parent4ab58837667c990baeddea2e9d722c3203743c9c (diff)
GPencil UI: Color swatches for both Stroke and Fill colors are now shown
The layers list and the Dopesheet channels now show color swatches for both the stroke and fill colours now. This is useful when you've got layers that only use either/or. * Currently, these only get shown if the relevant opacity setting is high enough for that aspect to contribute to the result. * The sizing of these items could do with some more tweaking (especially in the Dopesheet), as these may now be too small to accurately see and/or interact with. * There are some potential issues when using near-gray (or actually, colours similar to the list backgrounds, but that issue exists in other areas of Blender anyway. (NOTE: At this stage, these changes are still experimental, and not for 2.73 yet)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c12
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c29
2 files changed, 39 insertions, 2 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index baab8a05030..9f992e1063a 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3966,16 +3966,24 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
/* color swatch for layer color */
bGPDlayer *gpl = (bGPDlayer *)ale->data;
PointerRNA ptr;
+ float w = ICON_WIDTH / 2.0f;
RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, &ptr);
- UI_block_emboss_set(block, UI_EMBOSS);
+ UI_block_align_begin(block);
- uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset, yminc, ICON_WIDTH, ICON_WIDTH,
+ UI_block_emboss_set(block, RNA_boolean_get(&ptr, "is_stroke_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
+ uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset, yminc, w, ICON_WIDTH,
&ptr, "color", -1,
0, 0, 0, 0, gpl->info);
+ UI_block_emboss_set(block, RNA_boolean_get(&ptr, "is_fill_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
+ uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset + w, yminc, w, ICON_WIDTH,
+ &ptr, "fill_color", -1,
+ 0, 0, 0, 0, gpl->info);
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
+ UI_block_align_end(block);
offset += ICON_WIDTH;
}
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 96d02016336..6b61b37ce5c 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -104,6 +104,24 @@ static void rna_GPencilLayer_line_width_range(PointerRNA *ptr, int *min, int *ma
}
}
+static int rna_GPencilLayer_is_stroke_visible_get(PointerRNA *ptr)
+{
+ /* see drawgpencil.c -> gp_draw_data_layers() for more details
+ * about this limit for showing/not showing
+ */
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ return (gpl->color[3] > 0.001f);
+}
+
+static int rna_GPencilLayer_is_fill_visible_get(PointerRNA *ptr)
+{
+ /* see drawgpencil.c -> gp_draw_data_layers() for more details
+ * about this limit for showing/not showing
+ */
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ return (gpl->fill[3] > 0.001f);
+}
+
static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr)
{
bGPdata *gpd = ptr->id.data;
@@ -764,6 +782,17 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ /* Read-only state props (for simpler UI code) */
+ prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_stroke_visible_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
+
+ prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_fill_visible_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
+
/* Layers API */
func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear");
RNA_def_function_ui_description(func, "Remove all the grease pencil layer data");