Commit: abea4e7c9bb22bb43024eaee41676d968691fad5
Author: Antonio Vazquez
Date:   Wed Aug 30 16:15:03 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBabea4e7c9bb22bb43024eaee41676d968691fad5

New option to define color of edit line

A new field for MultiEdit was added too

===================================================================

M       release/scripts/startup/bl_ui/properties_data_gpencil.py
M       source/blender/blenkernel/intern/gpencil.c
M       source/blender/blenloader/intern/versioning_280.c
M       source/blender/draw/engines/gpencil/gpencil_geom.c
M       source/blender/makesdna/DNA_gpencil_types.h
M       source/blender/makesrna/intern/rna_gpencil.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index f46eabdb60a..cd946d3ade8 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -123,6 +123,11 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         row = layout.row()
         row.prop(gpd, "pixfactor", text="Pixel Factor")
 
+        col = layout.column()
+        col.label("Edit")
+        col.prop(gpd, "edit_line_color", text="")
+        col.prop(gpd, "multiedit_line_only", text="Only Lines in MultiEdit")
+
 classes = (
     DATA_PT_gpencil,
     DATA_PT_gpencil_datapanel,
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 76b3f3a7f1d..df368ef36ef 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -773,6 +773,7 @@ bGPdata *BKE_gpencil_data_addnew(const char name[])
        gpd->xray_mode = GP_XRAY_3DSPACE;
        gpd->batch_cache_data = NULL;
        gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
+       ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.3f);
 
        return gpd;
 }
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 0a767802366..49193ce920a 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -551,6 +551,12 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *main)
                                }
                        }
                }
+               /* init grease pencil edit line color */
+               if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", 
"line_color[4]")) {
+                       for (bGPdata *gpd = main->gpencil.first; gpd; gpd = 
gpd->id.next) {
+                               ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 
0.6f, 0.3f);
+                       }
+               }
                /* init pixel size factor */
                if (!DNA_struct_elem_find(fd->filesdna, "bGPDdata", "int", 
"pixfactor")) {
                        for (bGPdata *gpd = main->gpencil.first; gpd; gpd = 
gpd->id.next) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_geom.c 
b/source/blender/draw/engines/gpencil/gpencil_geom.c
index 43e95e17919..1197777119b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_geom.c
+++ b/source/blender/draw/engines/gpencil/gpencil_geom.c
@@ -744,8 +744,7 @@ Gwn_Batch *DRW_gpencil_get_edlin_geom(bGPDstroke *gps, 
float alpha, short dflag)
        UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor);
        selectColor[3] = alpha;
        float linecolor[4];
-       ARRAY_SET_ITEMS(linecolor, 0.6f, 0.6f, 0.6f, 0.3f);
-
+       copy_v4_v4(linecolor, gpd->line_color);
 
        static Gwn_VertFormat format = { 0 };
        static unsigned int pos_id, color_id, size_id;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index a071d149ef1..4c56d70ed11 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -349,6 +349,7 @@ typedef struct bGPdata {
        char last_palette_name[66]; /* name of the last palette used */
        char pad[6];
        int pixfactor;              /* factor to define pixel size conversion */
+       float line_color[4];        /* color for edit line */
        char pad1[4];
 } bGPdata;
 
@@ -399,6 +400,8 @@ typedef enum eGPdata_Flag {
        GP_DATA_STROKE_KEEPTHICKNESS = (1 << 15),
        /* Allow edit several frames at the same time */
        GP_DATA_STROKE_MULTIEDIT = (1 << 16),
+       /* Only show edit lines */
+       GP_DATA_STROKE_MULTIEDIT_LINES = (1 << 17),
 } eGPdata_Flag;
 
 #endif /*  __DNA_GPENCIL_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 23a1fc19451..29e44af982f 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1278,6 +1278,18 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "MultiEdit", "Edit strokes in several 
grease pencil Keyframes at same time");
        RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
+       prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "line_color");
+       RNA_def_property_array(prop, 4);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Edit Line Color", "Color for editing 
line");
+       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
+
+       prop = RNA_def_property(srna, "multiedit_line_only", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_DATA_STROKE_MULTIEDIT_LINES);
+       RNA_def_property_ui_text(prop, "Lines Only", "Show only edit lines for 
additional frames");
+       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
+
        /* API Functions */
        func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
        RNA_def_function_ui_description(func, "Remove all the grease pencil 
data");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to