2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
* General operations for brushes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BKE_BRUSH_H
|
|
|
|
#define BKE_BRUSH_H
|
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_brush.h
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
struct ID;
|
|
|
|
struct Brush;
|
2006-07-31 15:53:03 +00:00
|
|
|
struct ImBuf;
|
2009-03-11 00:43:08 +00:00
|
|
|
struct Scene;
|
2009-01-25 07:28:11 +00:00
|
|
|
struct wmOperator;
|
2010-10-30 17:16:37 +00:00
|
|
|
// enum CurveMappingPreset;
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
|
2006-07-31 15:53:03 +00:00
|
|
|
/* datablock functions */
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Brush *add_brush(const char *name);
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
struct Brush *copy_brush(struct Brush *brush);
|
|
|
|
void make_local_brush(struct Brush *brush);
|
|
|
|
void free_brush(struct Brush *brush);
|
|
|
|
|
2010-07-27 16:09:02 +00:00
|
|
|
void brush_reset_sculpt(struct Brush *brush);
|
|
|
|
|
2010-07-20 02:18:10 +00:00
|
|
|
/* image icon function */
|
2010-07-20 11:32:30 +00:00
|
|
|
struct ImBuf *get_brush_icon(struct Brush *brush);
|
2010-07-20 02:18:10 +00:00
|
|
|
|
2006-07-31 15:53:03 +00:00
|
|
|
/* brush library operations used by different paint panels */
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
int brush_delete(struct Brush **current_brush);
|
2006-07-31 15:53:03 +00:00
|
|
|
int brush_texture_set_nr(struct Brush *brush, int nr);
|
|
|
|
int brush_texture_delete(struct Brush *brush);
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
int brush_clone_image_set_nr(struct Brush *brush, int nr);
|
2006-07-31 15:53:03 +00:00
|
|
|
int brush_clone_image_delete(struct Brush *brush);
|
|
|
|
|
2011-01-08 01:45:02 +00:00
|
|
|
/* jitter */
|
2012-01-14 23:54:51 +00:00
|
|
|
void brush_jitter_pos(const struct Scene *scene, struct Brush *brush,
|
|
|
|
float *pos, float *jitterpos);
|
2011-01-08 01:45:02 +00:00
|
|
|
|
2009-01-07 04:38:30 +00:00
|
|
|
/* brush curve */
|
2010-01-08 01:39:41 +00:00
|
|
|
void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset);
|
2009-09-24 01:32:23 +00:00
|
|
|
float brush_curve_strength_clamp(struct Brush *br, float p, const float len);
|
|
|
|
float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
2009-01-07 04:38:30 +00:00
|
|
|
|
2006-07-31 15:53:03 +00:00
|
|
|
/* sampling */
|
2012-01-14 23:54:51 +00:00
|
|
|
void brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread);
|
|
|
|
void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
|
2011-06-06 22:10:05 +00:00
|
|
|
struct ImBuf **imbuf, int use_color_correction);
|
2006-07-31 15:53:03 +00:00
|
|
|
|
|
|
|
/* painting */
|
|
|
|
struct BrushPainter;
|
|
|
|
typedef struct BrushPainter BrushPainter;
|
|
|
|
typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos);
|
|
|
|
|
2012-01-12 21:48:08 +00:00
|
|
|
BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush);
|
2006-08-27 13:29:00 +00:00
|
|
|
void brush_painter_require_imbuf(BrushPainter *painter, short flt,
|
|
|
|
short texonly, int size);
|
|
|
|
int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos,
|
2011-06-06 22:10:05 +00:00
|
|
|
double time, float pressure, void *user, int use_color_correction);
|
2006-08-27 13:29:00 +00:00
|
|
|
void brush_painter_break_stroke(BrushPainter *painter);
|
2006-07-31 15:53:03 +00:00
|
|
|
void brush_painter_free(BrushPainter *painter);
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
|
2009-01-25 07:28:11 +00:00
|
|
|
/* texture */
|
|
|
|
unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
|
|
|
|
|
|
|
|
/* radial control */
|
2011-05-12 01:57:47 +00:00
|
|
|
struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br);
|
2009-01-25 07:28:11 +00:00
|
|
|
|
2010-07-14 14:11:03 +00:00
|
|
|
/* unified strength and size */
|
|
|
|
|
2012-01-14 23:54:51 +00:00
|
|
|
int brush_size(const struct Scene *scene, struct Brush *brush);
|
|
|
|
void brush_set_size(struct Scene *scene, struct Brush *brush, int value);
|
|
|
|
|
|
|
|
float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush);
|
|
|
|
void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value);
|
|
|
|
|
|
|
|
float brush_alpha(const struct Scene *scene, struct Brush *brush);
|
2010-07-22 18:56:46 +00:00
|
|
|
|
2012-01-12 21:48:08 +00:00
|
|
|
int brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
|
|
|
|
int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
|
|
|
|
int brush_use_size_pressure(const struct Scene *scene, struct Brush *brush);
|
2010-07-22 18:56:46 +00:00
|
|
|
|
2012-01-14 23:54:51 +00:00
|
|
|
/* scale unprojected radius to reflect a change in the brush's 2D size */
|
|
|
|
void brush_scale_unprojected_radius(float *unprojected_radius,
|
|
|
|
int new_brush_size,
|
|
|
|
int old_brush_size);
|
2010-07-22 18:56:46 +00:00
|
|
|
|
2012-01-14 23:54:51 +00:00
|
|
|
/* scale brush size to reflect a change in the brush's unprojected radius */
|
|
|
|
void brush_scale_size(int *brush_size,
|
|
|
|
float new_unprojected_radius,
|
|
|
|
float old_unprojected_radius);
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2011-02-14 03:15:55 +00:00
|
|
|
/* debugging only */
|
|
|
|
void brush_debug_print_state(struct Brush *br);
|
|
|
|
|
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
|
|
|
#endif
|
|
|
|
|