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