Commit: da23f184cead1594d696cb2258b3dde80048e39c
Author: Antony Riakiotakis
Date:   Wed Jul 16 01:55:56 2014 +0300
https://developer.blender.org/rBda23f184cead1594d696cb2258b3dde80048e39c

Themefy paint curve colors, some tweaks to make selected paint handles
more visible.

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

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

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

diff --git a/source/blender/editors/include/UI_resources.h 
b/source/blender/editors/include/UI_resources.h
index 2e78940..da36535 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -237,6 +237,9 @@ enum {
        TH_STITCH_PREVIEW_UNSTITCHABLE,
        TH_STITCH_PREVIEW_ACTIVE,
 
+       TH_PAINT_CURVE_HANDLE,
+       TH_PAINT_CURVE_PIVOT,
+
        TH_UV_SHADOW,
        TH_UV_OTHERS,
 
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index 2ea3e19..65c0178 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -541,6 +541,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, 
int spacetype, int colo
                                        cp = ts->preview_stitch_active;
                                        break;
 
+                               case TH_PAINT_CURVE_HANDLE:
+                                       cp = ts->paint_curve_handle;
+                                       break;
+                               case TH_PAINT_CURVE_PIVOT:
+                                       cp = ts->paint_curve_pivot;
+                                       break;
+
                                case TH_UV_OTHERS:
                                        cp = ts->uv_others;
                                        break;
@@ -875,6 +882,8 @@ void ui_theme_init_default(void)
        rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255);
        rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 
255);
        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);
 
        btheme->tv3d.facedot_size = 4;
 
@@ -2431,6 +2440,16 @@ void init_userdef_do_versions(void)
                }
        }
 
+       if (U.versionfile < 272|| (U.versionfile == 272 && U.subversionfile < 
2)) {
+               bTheme *btheme;
+               for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+                       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_fl(btheme->tima.paint_curve_handle, 
0.5f, 1.0f, 0.5f, 0.5f);
+                       rgba_char_args_set_fl(btheme->tima.paint_curve_pivot, 
1.0f, 0.5f, 0.5f, 0.5f);
+               }
+       }
+
        {
                bTheme *btheme;
                for (btheme = U.themes.first; btheme; btheme = btheme->next) {
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c 
b/source/blender/editors/sculpt_paint/paint_cursor.c
index 44d2235..dcf3c13 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -59,6 +59,8 @@
 
 #include "ED_view3d.h"
 
+#include "UI_resources.h"
+
 #include "paint_intern.h"
 /* still needed for sculpt_stroke_get_location, should be
  * removed eventually (TODO) */
@@ -797,9 +799,9 @@ BLI_INLINE void draw_tri_point(float *co, float width, bool 
selected)
 {
        float w = width / 2.0f;
        if (selected)
-               glColor4f(1.0, 1.0, 0.5, 0.5);
+               UI_ThemeColor4(TH_VERTEX_SELECT);
        else
-               glColor4f(1.0, 0.5, 0.5, 0.5);
+               UI_ThemeColor4(TH_PAINT_CURVE_PIVOT);
 
        glLineWidth(3.0);
 
@@ -823,9 +825,9 @@ BLI_INLINE void draw_rect_point(float *co, float width, 
bool selected)
 {
        float w = width / 2.0f;
        if (selected)
-               glColor4f(1.0, 1.0, 0.5, 0.5);
+               UI_ThemeColor4(TH_VERTEX_SELECT);
        else
-               glColor4f(0.5, 1.0, 0.5, 0.5);
+               UI_ThemeColor4(TH_PAINT_CURVE_HANDLE);
        glLineWidth(3.0);
 
        glBegin(GL_LINE_LOOP);
@@ -849,14 +851,25 @@ BLI_INLINE void draw_rect_point(float *co, float width, 
bool selected)
 
 BLI_INLINE void draw_bezier_handle_lines(BezTriple *bez)
 {
+       short line1[] = {0, 1};
+       short line2[] = {1, 2};
+
        glVertexPointer(2, GL_FLOAT, 3 * sizeof(float), bez->vec);
        glColor4f(0.0, 0.0, 0.0, 0.5);
        glLineWidth(3.0);
        glDrawArrays(GL_LINE_STRIP, 0, 3);
 
-       glColor4f(1.0, 1.0, 1.0, 0.5);
        glLineWidth(1.0);
-       glDrawArrays(GL_LINE_STRIP, 0, 3);
+       if (bez->f1 || bez->f2)
+               UI_ThemeColor4(TH_VERTEX_SELECT);
+       else
+               glColor4f(1.0, 1.0, 1.0, 0.5);
+       glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, line1);
+       if (bez->f3 || bez->f2)
+               UI_ThemeColor4(TH_VERTEX_SELECT);
+       else
+               glColor4f(1.0, 1.0, 1.0, 0.5);
+       glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, line2);
 }
 
 static void paint_draw_curve_cursor(Brush *brush)
@@ -878,8 +891,8 @@ static void paint_draw_curve_cursor(Brush *brush)
                        /* use color coding to distinguish handles vs curve 
segments  */
                        draw_bezier_handle_lines(&cp->bez);
                        draw_tri_point(&cp->bez.vec[1][0], 10.0, cp->bez.f2);
-                       draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1);
-                       draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3);
+                       draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1 || 
cp->bez.f2);
+                       draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3 || 
cp->bez.f2);
 
                        for (j = 0; j < 2; j++)
                                BKE_curve_forward_diff_bezier(
@@ -902,8 +915,8 @@ static void paint_draw_curve_cursor(Brush *brush)
                /* draw last line segment */
                draw_bezier_handle_lines(&cp->bez);
                draw_tri_point(&cp->bez.vec[1][0], 10.0, cp->bez.f2);
-               draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1);
-               draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3);
+               draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1 || 
cp->bez.f2);
+               draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3 || 
cp->bez.f2);
 
                glLineWidth(1.0);
 
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index cb2341b..d7a3363 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -154,7 +154,6 @@ typedef struct uiGradientColors {
        char high_gradient[4];
        int show_grad;
        int pad2;
-
 } uiGradientColors;
 
 typedef struct ThemeUI {
@@ -328,6 +327,9 @@ typedef struct ThemeSpace {
        char info_warning[4], info_warning_text[4];
        char info_info[4], info_info_text[4];
        char info_debug[4], info_debug_text[4];
+
+       char paint_curve_pivot[4];
+       char paint_curve_handle[4];
 } ThemeSpace;
 
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index f497426..d43bd8c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1292,6 +1292,21 @@ static void rna_def_userdef_theme_spaces_face(StructRNA 
*srna)
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
+static void rna_def_userdef_theme_spaces_paint_curves(StructRNA *srna)
+{
+       PropertyRNA *prop;
+
+       prop = RNA_def_property(srna, "paint_curve_handle", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 4);
+       RNA_def_property_ui_text(prop, "Paint Curve Handle", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop = RNA_def_property(srna, "paint_curve_pivot", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 4);
+       RNA_def_property_ui_text(prop, "Paint Curve Pivot", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+}
+
 static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool 
incl_nurbs, bool incl_lastsel, bool incl_vector)
 {
        PropertyRNA *prop;
@@ -1567,6 +1582,8 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA 
*brna)
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Skin Root", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       rna_def_userdef_theme_spaces_paint_curves(srna);
 }
 
 
@@ -2259,6 +2276,8 @@ static void rna_def_userdef_theme_space_image(BlenderRNA 
*brna)
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        rna_def_userdef_theme_spaces_curves(srna, false, false, false);
+
+       rna_def_userdef_theme_spaces_paint_curves(srna);
 }
 
 static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)

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

Reply via email to