Blender V2.61 - r43446
|
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) 2001-2002 by NaN Holding BV. 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 * General operations for brushes. 00027 */ 00028 00029 #ifndef BKE_BRUSH_H 00030 #define BKE_BRUSH_H 00031 00036 struct ID; 00037 struct Brush; 00038 struct ImBuf; 00039 struct Scene; 00040 struct wmOperator; 00041 // enum CurveMappingPreset; 00042 00043 /* datablock functions */ 00044 struct Brush *add_brush(const char *name); 00045 struct Brush *copy_brush(struct Brush *brush); 00046 void make_local_brush(struct Brush *brush); 00047 void free_brush(struct Brush *brush); 00048 00049 void brush_reset_sculpt(struct Brush *brush); 00050 00051 /* image icon function */ 00052 struct ImBuf *get_brush_icon(struct Brush *brush); 00053 00054 /* brush library operations used by different paint panels */ 00055 int brush_delete(struct Brush **current_brush); 00056 int brush_texture_set_nr(struct Brush *brush, int nr); 00057 int brush_texture_delete(struct Brush *brush); 00058 int brush_clone_image_set_nr(struct Brush *brush, int nr); 00059 int brush_clone_image_delete(struct Brush *brush); 00060 00061 /* jitter */ 00062 void brush_jitter_pos(const struct Scene *scene, struct Brush *brush, 00063 float *pos, float *jitterpos); 00064 00065 /* brush curve */ 00066 void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset); 00067 float brush_curve_strength_clamp(struct Brush *br, float p, const float len); 00068 float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ 00069 00070 /* sampling */ 00071 void brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread); 00072 void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, 00073 struct ImBuf **imbuf, int use_color_correction); 00074 00075 /* painting */ 00076 struct BrushPainter; 00077 typedef struct BrushPainter BrushPainter; 00078 typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos); 00079 00080 BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush); 00081 void brush_painter_require_imbuf(BrushPainter *painter, short flt, 00082 short texonly, int size); 00083 int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, 00084 double time, float pressure, void *user, int use_color_correction); 00085 void brush_painter_break_stroke(BrushPainter *painter); 00086 void brush_painter_free(BrushPainter *painter); 00087 00088 /* texture */ 00089 unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); 00090 00091 /* radial control */ 00092 struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br); 00093 00094 /* unified strength and size */ 00095 00096 int brush_size(const struct Scene *scene, struct Brush *brush); 00097 void brush_set_size(struct Scene *scene, struct Brush *brush, int value); 00098 00099 float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush); 00100 void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value); 00101 00102 float brush_alpha(const struct Scene *scene, struct Brush *brush); 00103 00104 int brush_use_locked_size(const struct Scene *scene, struct Brush *brush); 00105 int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); 00106 int brush_use_size_pressure(const struct Scene *scene, struct Brush *brush); 00107 00108 /* scale unprojected radius to reflect a change in the brush's 2D size */ 00109 void brush_scale_unprojected_radius(float *unprojected_radius, 00110 int new_brush_size, 00111 int old_brush_size); 00112 00113 /* scale brush size to reflect a change in the brush's unprojected radius */ 00114 void brush_scale_size(int *brush_size, 00115 float new_unprojected_radius, 00116 float old_unprojected_radius); 00117 00118 /* debugging only */ 00119 void brush_debug_print_state(struct Brush *br); 00120 00121 #endif 00122