Commit: c50003cd09ab8d3477406f58f00e530e5e67b45f
Author: Joshua Leung
Date:   Sat Jan 3 18:07:05 2015 +1300
Branches: master
https://developer.blender.org/rBc50003cd09ab8d3477406f58f00e530e5e67b45f

Grease Pencil: Vertex size and colours are now themable

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

M       source/blender/editors/gpencil/drawgpencil.c
M       source/blender/editors/include/UI_resources.h
M       source/blender/editors/interface/resources.c
M       source/blender/makesdna/DNA_userdef_types.h
M       source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index f7795a3..895fc66 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -794,7 +794,7 @@ static void gp_draw_strokes_edit(bGPDframe *gpf, int offsx, 
int offsy, int winx,
                 *   they stand out more.
                 * - We use the theme setting for size of the unselected verts
                 */
-               bsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
+               bsize = UI_GetThemeValuef(TH_GP_VERTEX_SIZE);
                if ((int)bsize > 8) {
                        vsize = 10.0f;
                        bsize = 8.0f;
@@ -810,7 +810,7 @@ static void gp_draw_strokes_edit(bGPDframe *gpf, int offsx, 
int offsy, int winx,
                }
                else {
                        /* this doesn't work well with the default theme and 
black strokes... */
-                       UI_ThemeColor(TH_VERTEX);
+                       UI_ThemeColor(TH_GP_VERTEX);
                }
                glPointSize(bsize);
                
@@ -830,7 +830,7 @@ static void gp_draw_strokes_edit(bGPDframe *gpf, int offsx, 
int offsy, int winx,
                
                
                /* Second Pass: Draw only verts which are selected */
-               UI_ThemeColor(TH_VERTEX_SELECT);
+               UI_ThemeColor(TH_GP_VERTEX_SELECT);
                glPointSize(vsize);
                
                glBegin(GL_POINTS);
@@ -841,7 +841,7 @@ static void gp_draw_strokes_edit(bGPDframe *gpf, int offsx, 
int offsy, int winx,
                                }
                                else {
                                        float co[2];
-
+                                       
                                        gp_calc_2d_stroke_xy(pt, gps->flag, 
offsx, offsy, winx, winy, co);
                                        glVertex2fv(co);
                                }
diff --git a/source/blender/editors/include/UI_resources.h 
b/source/blender/editors/include/UI_resources.h
index c3d6dd5..23936f7 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -207,6 +207,10 @@ enum {
        TH_HANDLE_VERTEX_SELECT,
        TH_HANDLE_VERTEX_SIZE,
        
+       TH_GP_VERTEX,
+       TH_GP_VERTEX_SELECT,
+       TH_GP_VERTEX_SIZE,
+       
        TH_DOPESHEET_CHANNELOB,
        TH_DOPESHEET_CHANNELSUBOB,
        
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index c7915d4..f89d017 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -506,6 +506,17 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, 
int spacetype, int colo
                                case TH_HANDLE_VERTEX_SIZE:
                                        cp = &ts->handle_vertex_size;
                                        break;
+                                       
+                               case TH_GP_VERTEX:
+                                       cp = ts->gp_vertex;
+                                       break;
+                               case TH_GP_VERTEX_SELECT:
+                                       cp = ts->gp_vertex_select;
+                                       break;
+                               case TH_GP_VERTEX_SIZE:
+                                       cp = &ts->gp_vertex_size;
+                                       break;
+                                       
                                case TH_DOPESHEET_CHANNELOB:
                                        cp = ts->ds_channel;
                                        break;
@@ -893,6 +904,9 @@ void ui_theme_init_default(void)
        rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 
51);
        rgba_char_args_set_fl(btheme->tv3d.paint_curve_handle, 0.5f, 1.0f, 
0.5f, 0.5f);
        rgba_char_args_set_fl(btheme->tv3d.paint_curve_pivot, 1.0f, 0.5f, 0.5f, 
0.5f);
+       rgba_char_args_set(btheme->tv3d.gp_vertex, 0, 0, 0, 255);
+       rgba_char_args_set(btheme->tv3d.gp_vertex_select, 255, 133, 0, 255);
+       btheme->tv3d.gp_vertex_size = 3;
 
        btheme->tv3d.facedot_size = 4;
 
@@ -2505,6 +2519,28 @@ void init_userdef_do_versions(void)
                        rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 
1.0f, 1.0f, 0.02f);
                }
        }
+       
+       if (U.versionfile < 273 || (U.versionfile == 273 && U.subversionfile < 
1)) {
+               bTheme *btheme;
+               for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+                       /* Grease Pencil vertex settings */
+                       rgba_char_args_set(btheme->tv3d.gp_vertex, 0, 0, 0, 
255);
+                       rgba_char_args_set(btheme->tv3d.gp_vertex_select, 255, 
133, 0, 255);
+                       btheme->tv3d.gp_vertex_size = 3;
+                       
+                       rgba_char_args_set(btheme->tseq.gp_vertex, 0, 0, 0, 
255);
+                       rgba_char_args_set(btheme->tseq.gp_vertex_select, 255, 
133, 0, 255);
+                       btheme->tseq.gp_vertex_size = 3;
+                       
+                       rgba_char_args_set(btheme->tima.gp_vertex, 0, 0, 0, 
255);
+                       rgba_char_args_set(btheme->tima.gp_vertex_select, 255, 
133, 0, 255);
+                       btheme->tima.gp_vertex_size = 3;
+                       
+                       rgba_char_args_set(btheme->tnode.gp_vertex, 0, 0, 0, 
255);
+                       rgba_char_args_set(btheme->tnode.gp_vertex_select, 255, 
133, 0, 255);
+                       btheme->tnode.gp_vertex_size = 3;
+               }
+       }
 
        if (U.pixelsize == 0.0f)
                U.pixelsize = 1.0f;
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 73902e9..7e589ad 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -295,7 +295,10 @@ typedef struct ThemeSpace {
        char bundle_solid[4];
        char path_before[4], path_after[4];
        char camera_path[4];
-       char hpad[3];
+       char hpad[2];
+       
+       char gp_vertex_size;
+       char gp_vertex[4], gp_vertex_select[4];
        
        char preview_back[4];
        char preview_stitch_face[4];
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 6519781..c2bcdfb 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1488,6 +1488,26 @@ static void 
rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs
        }
 }
 
+static void rna_def_userdef_theme_spaces_gpencil(StructRNA *srna)
+{
+       PropertyRNA *prop;
+
+       prop = RNA_def_property(srna, "gp_vertex", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Grease Pencil Vertex", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop = RNA_def_property(srna, "gp_vertex_select", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Grease Pencil Vertex Select", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop = RNA_def_property(srna, "gp_vertex_size", PROP_INT, PROP_NONE);
+       RNA_def_property_range(prop, 1, 10);
+       RNA_def_property_ui_text(prop, "Grease Pencil Vertex Size", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+}
+
 static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1516,6 +1536,8 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA 
*brna)
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Wire Edit", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       rna_def_userdef_theme_spaces_gpencil(srna);
 
        prop = RNA_def_property(srna, "lamp", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 4);
@@ -2046,6 +2068,8 @@ static void rna_def_userdef_theme_space_node(BlenderRNA 
*brna)
 
        rna_def_userdef_theme_spaces_main(srna);
        rna_def_userdef_theme_spaces_list_main(srna);
+       
+       rna_def_userdef_theme_spaces_gpencil(srna);
 
        prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, 
PROP_COLOR_GAMMA);
        RNA_def_property_float_sdna(prop, NULL, "select");
@@ -2265,8 +2289,10 @@ static void rna_def_userdef_theme_space_image(BlenderRNA 
*brna)
        RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for 
the Image Editor");
 
        rna_def_userdef_theme_spaces_main(srna);
+       rna_def_userdef_theme_spaces_gpencil(srna);
        rna_def_userdef_theme_spaces_vertex(srna);
        rna_def_userdef_theme_spaces_face(srna);
+       
 
        prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, 
PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 4);
@@ -2361,6 +2387,7 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA 
*brna)
        RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings 
for the Sequence Editor");
 
        rna_def_userdef_theme_spaces_main(srna);
+       rna_def_userdef_theme_spaces_gpencil(srna);
 
        prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 3);
@@ -2772,6 +2799,8 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA 
*brna)
 
        rna_def_userdef_theme_spaces_main(srna);
        rna_def_userdef_theme_spaces_list_main(srna);
+       
+       rna_def_userdef_theme_spaces_gpencil(srna);
 
        prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, 
PROP_COLOR_GAMMA);
        RNA_def_property_float_sdna(prop, NULL, "marker_outline");

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

Reply via email to