Blender V2.61 - r43446

DNA_brush_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2005 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef DNA_BRUSH_TYPES_H
00033 #define DNA_BRUSH_TYPES_H
00034 
00035 
00036 #include "DNA_ID.h"
00037 #include "DNA_texture_types.h" /* for MTex */
00038 
00039 //#ifndef MAX_MTEX // XXX Not used?
00040 //#define MAX_MTEX  18
00041 //#endif
00042 
00043 struct CurveMapping;
00044 struct MTex;
00045 struct Image;
00046 
00047 typedef struct BrushClone {
00048     struct Image *image;        /* image for clone tool */
00049     float offset[2];        /* offset of clone image from canvas */
00050     float alpha, pad;       /* transparency for drawing of clone image */
00051 } BrushClone;
00052 
00053 typedef struct Brush {
00054     ID id;
00055 
00056     struct BrushClone clone;
00057     struct CurveMapping *curve; /* falloff curve */
00058     struct MTex mtex;
00059 
00060     struct ImBuf *icon_imbuf;
00061     PreviewImage *preview;
00062     char icon_filepath[240]; /* 240 = FILE_MAX */
00063 
00064     float normal_weight;
00065 
00066     short blend;        /* blend mode */
00067     short ob_mode;      /* & with ob->mode to see if the brush is compatible, use for display only. */
00068     int size;           /* brush diameter */
00069     int flag;           /* general purpose flag */  
00070     float jitter;           /* jitter the position of the brush */
00071     int spacing;            /* spacing of paint operations */
00072     int smooth_stroke_radius;   /* turning radius (in pixels) for smooth stroke */
00073     float smooth_stroke_factor; /* higher values limit fast changes in the stroke direction */
00074     float rate;         /* paint operations / second (airbrush) */
00075 
00076     float rgb[3];           /* color */
00077     float alpha;            /* opacity */
00078 
00079     int sculpt_plane;       /* the direction of movement for sculpt vertices */
00080 
00081     float plane_offset;     /* offset for plane brushes (clay, flatten, fill, scrape) */
00082 
00083     char sculpt_tool;       /* active sculpt tool */
00084     char vertexpaint_tool;      /* active vertex/weight paint blend mode (poorly named) */
00085     char imagepaint_tool;       /* active image paint tool */
00086     char pad3[5];
00087 
00088     float autosmooth_factor;
00089 
00090     float crease_pinch_factor;
00091 
00092     float plane_trim;
00093     float height;           /* affectable height of brush (layer height for layer tool, i.e.) */
00094 
00095     float texture_sample_bias;
00096     int   texture_overlay_alpha;
00097 
00098     float unprojected_radius;
00099 
00100     float add_col[3];
00101     float sub_col[3];
00102 } Brush;
00103 
00104 /* Brush.flag */
00105 #define BRUSH_AIRBRUSH      (1<<0)
00106 #define BRUSH_TORUS     (1<<1)
00107 #define BRUSH_ALPHA_PRESSURE    (1<<2)
00108 #define BRUSH_SIZE_PRESSURE (1<<3)
00109 #define BRUSH_JITTER_PRESSURE   (1<<4) /* was BRUSH_RAD_PRESSURE */
00110 #define BRUSH_SPACING_PRESSURE  (1<<5)
00111 #define BRUSH_FIXED_TEX     (1<<6)
00112 #define BRUSH_RAKE      (1<<7)
00113 #define BRUSH_ANCHORED      (1<<8)
00114 #define BRUSH_DIR_IN        (1<<9)
00115 #define BRUSH_SPACE     (1<<10)
00116 #define BRUSH_SMOOTH_STROKE (1<<11)
00117 #define BRUSH_PERSISTENT    (1<<12)
00118 #define BRUSH_ACCUMULATE    (1<<13)
00119 #define BRUSH_LOCK_ALPHA    (1<<14)
00120 #define BRUSH_ORIGINAL_NORMAL   (1<<15)
00121 #define BRUSH_OFFSET_PRESSURE   (1<<16)
00122 #define BRUSH_SPACE_ATTEN   (1<<18)
00123 #define BRUSH_ADAPTIVE_SPACE    (1<<19)
00124 #define BRUSH_LOCK_SIZE     (1<<20)
00125 #define BRUSH_TEXTURE_OVERLAY   (1<<21)
00126 #define BRUSH_EDGE_TO_EDGE  (1<<22)
00127 #define BRUSH_RESTORE_MESH  (1<<23)
00128 #define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24)
00129 #define BRUSH_RANDOM_ROTATION (1<<25)
00130 #define BRUSH_PLANE_TRIM (1<<26)
00131 #define BRUSH_FRONTFACE (1<<27)
00132 #define BRUSH_CUSTOM_ICON (1<<28)
00133 
00134 /* temporary flag which sets up autmatically for correct
00135  * brush drawing when inverted modal operator is running */
00136 #define BRUSH_INVERTED (1<<29)
00137 
00138 /* Brush.sculpt_tool */
00139 #define SCULPT_TOOL_DRAW        1
00140 #define SCULPT_TOOL_SMOOTH      2
00141 #define SCULPT_TOOL_PINCH       3
00142 #define SCULPT_TOOL_INFLATE     4
00143 #define SCULPT_TOOL_GRAB        5
00144 #define SCULPT_TOOL_LAYER       6
00145 #define SCULPT_TOOL_FLATTEN     7
00146 #define SCULPT_TOOL_CLAY        8
00147 #define SCULPT_TOOL_FILL        9
00148 #define SCULPT_TOOL_SCRAPE     10
00149 #define SCULPT_TOOL_NUDGE      11
00150 #define SCULPT_TOOL_THUMB      12
00151 #define SCULPT_TOOL_SNAKE_HOOK 13
00152 #define SCULPT_TOOL_ROTATE     14
00153 //#define SCULPT_TOOL_WAX        15 // XXX: reuse this slot later
00154 #define SCULPT_TOOL_CREASE     16
00155 #define SCULPT_TOOL_BLOB       17
00156 #define SCULPT_TOOL_CLAY_TUBES 18
00157 
00158 /* ImagePaintSettings.tool */
00159 #define PAINT_TOOL_DRAW     0
00160 #define PAINT_TOOL_SOFTEN   1
00161 #define PAINT_TOOL_SMEAR    2
00162 #define PAINT_TOOL_CLONE    3
00163 
00164 /* direction that the brush displaces along */
00165 enum {
00166     SCULPT_DISP_DIR_AREA,
00167     SCULPT_DISP_DIR_VIEW,
00168     SCULPT_DISP_DIR_X,
00169     SCULPT_DISP_DIR_Y,
00170     SCULPT_DISP_DIR_Z
00171 };
00172 
00173 enum {
00174     PAINT_BLEND_MIX,
00175     PAINT_BLEND_ADD,
00176     PAINT_BLEND_SUB,
00177     PAINT_BLEND_MUL,
00178     PAINT_BLEND_BLUR,
00179     PAINT_BLEND_LIGHTEN,
00180     PAINT_BLEND_DARKEN
00181 };
00182 
00183 
00184 #define MAX_BRUSH_PIXEL_RADIUS 200
00185 
00186 #endif
00187