diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-07-21 14:02:05 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-07-21 14:02:05 +0400 |
commit | f745564e4ee791e4faf804b09ce975b882f4f8d9 (patch) | |
tree | 90ebbe363ccd925cedc652c9bb018ce552b5a2ab /source/blender/makesdna | |
parent | 8489b94e07f9e73bd3c9c3e4f6a91f1f0a259827 (diff) |
GSOC 2013 paint
Yep, at last it's here!
There are a few minor issues remaining but development can go on in
master after discussion at blender institute.
For full list of features see:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Painting
Thanks to Sergey and Campbell for the extensive review and to the
countless artists that have given their input and reported issues during
development.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_brush_types.h | 94 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 15 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 33 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 4 |
6 files changed, 134 insertions, 16 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index f429360e1cf..cb6d17ab6c7 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -213,6 +213,8 @@ typedef struct PreviewImage { #define ID_MC MAKE_ID2('M', 'C') /* MovieClip */ #define ID_MSK MAKE_ID2('M', 'S') /* Mask */ #define ID_LS MAKE_ID2('L', 'S') /* FreestyleLineStyle */ +#define ID_PAL MAKE_ID2('P', 'L') /* Palette */ +#define ID_PC MAKE_ID2('P', 'C') /* Paint Curve */ /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 86fa7058f97..9fbd70419f4 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -35,6 +35,7 @@ #include "DNA_ID.h" #include "DNA_texture_types.h" /* for MTex */ +#include "DNA_curve_types.h" //#ifndef MAX_MTEX // XXX Not used? //#define MAX_MTEX 18 @@ -62,6 +63,9 @@ typedef struct Brush { struct ImBuf *icon_imbuf; PreviewImage *preview; + struct ColorBand *gradient; /* color gradient */ + struct PaintCurve *paint_curve; + char icon_filepath[1024]; /* 1024 = FILE_MAX */ float normal_weight; @@ -71,6 +75,7 @@ typedef struct Brush { float weight; /* brush weight */ int size; /* brush diameter */ int flag; /* general purpose flag */ + int mask_pressure; /* pressure influence for mask */ float jitter; /* jitter the position of the brush */ int jitter_absolute; /* absolute jitter in pixels */ int overlay_flags; @@ -82,10 +87,17 @@ typedef struct Brush { float rgb[3]; /* color */ float alpha; /* opacity */ + float secondary_rgb[3]; /* background color */ + int sculpt_plane; /* the direction of movement for sculpt vertices */ float plane_offset; /* offset for plane brushes (clay, flatten, fill, scrape) */ + float pad; + int gradient_spacing; + int gradient_stroke_mode; /* source for stroke color gradient application */ + int gradient_fill_mode; /* source for fill tool color gradient application */ + char sculpt_tool; /* active sculpt tool */ char vertexpaint_tool; /* active vertex/weight paint blend mode (poorly named) */ char imagepaint_tool; /* active image paint tool */ @@ -100,12 +112,21 @@ typedef struct Brush { float texture_sample_bias; + /* overlay */ int texture_overlay_alpha; int mask_overlay_alpha; int cursor_overlay_alpha; float unprojected_radius; + /* soften/sharpen */ + float sharp_threshold; + int blur_kernel_radius; + int blur_mode; + + /* fill tool */ + float fill_threshold; + float add_col[3]; float sub_col[3]; @@ -116,6 +137,52 @@ typedef struct Brush { float mask_stencil_dimension[2]; } Brush; +typedef struct PaletteColor +{ + struct PaletteColor *next, *prev; + /* two values, one to store rgb, other to store values for sculpt/weight */ + float rgb[3]; + float value; +} PaletteColor; + +typedef struct Palette +{ + ID id; + + /* pointer to individual colours */ + ListBase colors; + ListBase deleted; + + int num_of_colours; + int active_color; +} Palette; + +typedef struct PaintCurvePoint +{ + BezTriple bez; /* bezier handle */ + float pressure; /* pressure on that point */ +} PaintCurvePoint; + +typedef struct PaintCurve +{ + ID id; + PaintCurvePoint *points; /* points of curve */ + int tot_points; + int add_index; /* index where next point will be added */ +} PaintCurve; + +/* Brush.gradient_source */ +typedef enum BrushGradientSourceStroke { + BRUSH_GRADIENT_PRESSURE = 0, /* gradient from pressure */ + BRUSH_GRADIENT_SPACING_REPEAT = 1, /* gradient from spacing */ + BRUSH_GRADIENT_SPACING_CLAMP = 2 /* gradient from spacing */ +} BrushGradientSourceStroke; + +typedef enum BrushGradientSourceFill { + BRUSH_GRADIENT_LINEAR = 0, /* gradient from pressure */ + BRUSH_GRADIENT_RADIAL = 1 /* gradient from spacing */ +} BrushGradientSourceFill; + /* Brush.flag */ typedef enum BrushFlags { BRUSH_AIRBRUSH = (1 << 0), @@ -124,7 +191,7 @@ typedef enum BrushFlags { BRUSH_SIZE_PRESSURE = (1 << 3), BRUSH_JITTER_PRESSURE = (1 << 4), BRUSH_SPACING_PRESSURE = (1 << 5), - // BRUSH_FIXED_TEX = (1 << 6), /* obsolete, use mtex->brush_map_mode = MTEX_MAP_MODE_TILED instead */ + BRUSH_UNUSED = (1 << 6), BRUSH_RAKE = (1 << 7), BRUSH_ANCHORED = (1 << 8), BRUSH_DIR_IN = (1 << 9), @@ -138,7 +205,7 @@ typedef enum BrushFlags { BRUSH_SPACE_ATTEN = (1 << 18), BRUSH_ADAPTIVE_SPACE = (1 << 19), BRUSH_LOCK_SIZE = (1 << 20), -// BRUSH_TEXTURE_OVERLAY = (1 << 21), /* obsolete, use overlay_flags |= BRUSH_OVERLAY_PRIMARY instead */ + BRUSH_USE_GRADIENT = (1 << 21), BRUSH_EDGE_TO_EDGE = (1 << 22), BRUSH_DRAG_DOT = (1 << 23), BRUSH_INVERSE_SMOOTH_PRESSURE = (1 << 24), @@ -146,13 +213,16 @@ typedef enum BrushFlags { BRUSH_PLANE_TRIM = (1 << 26), BRUSH_FRONTFACE = (1 << 27), BRUSH_CUSTOM_ICON = (1 << 28), - - /* temporary flag which sets up automatically for correct brush - * drawing when inverted modal operator is running */ - BRUSH_INVERTED = (1 << 29), - BRUSH_ABSOLUTE_JITTER = (1 << 30) + BRUSH_LINE = (1 << 29), + BRUSH_ABSOLUTE_JITTER = (1 << 30), + BRUSH_CURVE = (1 << 31) } BrushFlags; +typedef enum { + BRUSH_MASK_PRESSURE_RAMP = (1 << 1), + BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2) +} BrushMaskPressureFlags; + /* Brush.overlay_flags */ typedef enum OverlayFlags { BRUSH_OVERLAY_CURSOR = (1), @@ -195,7 +265,9 @@ typedef enum BrushImagePaintTool { PAINT_TOOL_DRAW = 0, PAINT_TOOL_SOFTEN = 1, PAINT_TOOL_SMEAR = 2, - PAINT_TOOL_CLONE = 3 + PAINT_TOOL_CLONE = 3, + PAINT_TOOL_FILL = 4, + PAINT_TOOL_MASK = 5 } BrushImagePaintTool; /* direction that the brush displaces along */ @@ -222,6 +294,12 @@ typedef enum { BRUSH_MASK_SMOOTH = 1 } BrushMaskTool; +/* blur kernel types, Brush.blur_mode */ +typedef enum BlurKernelType { + KERNEL_GAUSSIAN, + KERNEL_BOX +} BlurKernelType; + #define MAX_BRUSH_PIXEL_RADIUS 200 #endif diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 5fda38f52a1..02d1103c08e 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -41,6 +41,7 @@ #endif struct MTex; +struct Image; struct ColorBand; struct Group; struct bNodeTree; @@ -82,6 +83,11 @@ typedef struct GameSettings { int pad1; } GameSettings; +typedef struct TexPaintSlot { + struct Image *ima; /* image to be painted on */ + char uvname[64]; /* customdata index for uv layer, MAX_NAME*/ +} TexPaintSlot; + typedef struct Material { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -182,8 +188,15 @@ typedef struct Material { float line_col[4]; short line_priority; short vcol_alpha; - int pad4; + /* texture painting */ + short paint_active_slot; + short paint_clone_slot; + short tot_slots; + short pad4[3]; + + struct TexPaintSlot *texpaintslot; /* cached slot for painting. Make sure to recalculate before use + * with refresh_texpaint_image_cache */ ListBase gpumaterial; /* runtime */ } Material; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index c4c1736c058..5e27fffcc97 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -811,7 +811,8 @@ typedef struct TimeMarker { /* Paint Tool Base */ typedef struct Paint { struct Brush *brush; - + struct Palette *palette; + /* WM Paint cursor */ void *paint_cursor; unsigned char paint_cursor_col[4]; @@ -840,9 +841,17 @@ typedef struct ImagePaintSettings { short seam_bleed, normal_angle; short screen_grab_size[2]; /* capture size for re-projection */ + /* new layer default resolution */ + int slot_xresolution_default; + int slot_yresolution_default; + int pad1; void *paintcursor; /* wm handle */ + struct Image *stencil; /* workaround until we support true layer masks */ + float slot_color_default[4]; + float stencil_col[3]; + float pad2; } ImagePaintSettings; /* ------------------------------------------- */ @@ -966,6 +975,11 @@ typedef struct UnifiedPaintSettings { /* unified brush weight, [0, 1] */ float weight; + /* unified brush color */ + float rgb[3]; + /* unified brush secondary color */ + float secondary_rgb[3]; + /* user preferences for sculpt and paint */ int flag; @@ -973,7 +987,6 @@ typedef struct UnifiedPaintSettings { /* record movement of mouse so that rake can start at an intuitive angle */ float last_rake[2]; - int pad; float brush_rotation; @@ -981,7 +994,14 @@ typedef struct UnifiedPaintSettings { * all data below are used to communicate with cursor drawing and tex sampling * *********************************************************************************/ int draw_anchored; - int anchored_size; + int anchored_size; + + char draw_inverted; + char pad3[7]; + + float overlap_factor; /* normalization factor due to accumulated value of curve along spacing. + * Calculated when brush spacing changes to dampen strength of stroke + * if space attenuation is used*/ float anchored_initial_mouse[2]; /* check is there an ongoing stroke right now */ @@ -1001,15 +1021,16 @@ typedef struct UnifiedPaintSettings { struct ColorSpace *colorspace; /* radius of brush, premultiplied with pressure. - * In case of anchored brushes contains that radius */ + * In case of anchored brushes contains the anchored radius */ float pixel_radius; - int pad2; + int pad4; } UnifiedPaintSettings; typedef enum { UNIFIED_PAINT_SIZE = (1 << 0), UNIFIED_PAINT_ALPHA = (1 << 1), UNIFIED_PAINT_WEIGHT = (1 << 5), + UNIFIED_PAINT_COLOR = (1 << 6), /* only used if unified size is enabled, mirrors the brush flags * BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */ @@ -1647,7 +1668,7 @@ enum { typedef enum { PAINT_SHOW_BRUSH = (1 << 0), PAINT_FAST_NAVIGATE = (1 << 1), - PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2), + PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2) } PaintFlags; /* Paint.symmetry_flags diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index c7a6d4809a5..e7a98246ecc 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -809,6 +809,8 @@ typedef enum eSpaceImage_Flag { SI_DRAW_OTHER = (1 << 23), SI_COLOR_CORRECTION = (1 << 24), + + SI_NO_DRAW_TEXPAINT = (1 << 25) } eSpaceImage_Flag; /* Text Editor ============================================ */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index cb2341b0b7f..d7a33638fa2 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; |