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:
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/blender/makesrna/intern/rna_gpencil.c
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/blender/makesrna/intern/rna_gpencil.c')
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c29
1 files changed, 29 insertions, 0 deletions
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");