Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

brush.c File Reference

#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
#include "DNA_color_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_windowmanager_types.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_texture.h"
#include "BKE_icons.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "RE_render_ext.h"
#include "RE_shader_ext.h"

Go to the source code of this file.

Classes

struct  BrushPainterCache
struct  BrushPainter

Defines

#define BR_TEST(field, t)
#define BR_TEST_FLAG(_f)

Typedefs

typedef struct BrushPainterCache BrushPainterCache

Functions

static void brush_set_defaults (Brush *brush)
Brushadd_brush (const char *name)
Brushcopy_brush (Brush *brush)
void free_brush (Brush *brush)
static void extern_local_brush (Brush *brush)
void make_local_brush (Brush *brush)
void brush_debug_print_state (Brush *br)
void brush_reset_sculpt (Brush *br)
void brush_curve_preset (Brush *b, int preset)
int brush_texture_set_nr (Brush *brush, int nr)
int brush_texture_delete (Brush *brush)
int brush_clone_image_set_nr (Brush *brush, int nr)
int brush_clone_image_delete (Brush *brush)
void brush_sample_tex (const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread)
void brush_imbuf_new (const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction)
void brush_set_size (Scene *scene, Brush *brush, int size)
int brush_size (const Scene *scene, Brush *brush)
int brush_use_locked_size (const Scene *scene, Brush *brush)
int brush_use_size_pressure (const Scene *scene, Brush *brush)
int brush_use_alpha_pressure (const Scene *scene, Brush *brush)
void brush_set_unprojected_radius (Scene *scene, Brush *brush, float unprojected_radius)
float brush_unprojected_radius (const Scene *scene, Brush *brush)
static void brush_set_alpha (Scene *scene, Brush *brush, float alpha)
float brush_alpha (const Scene *scene, Brush *brush)
void brush_scale_unprojected_radius (float *unprojected_radius, int new_brush_size, int old_brush_size)
void brush_scale_size (int *brush_size, float new_unprojected_radius, float old_unprojected_radius)
BrushPainterbrush_painter_new (Scene *scene, Brush *brush)
void brush_painter_require_imbuf (BrushPainter *painter, short flt, short texonly, int size)
void brush_painter_free (BrushPainter *painter)
static void brush_painter_do_partial (BrushPainter *painter, ImBuf *oldtexibuf, int x, int y, int w, int h, int xt, int yt, float *pos)
static void brush_painter_fixed_tex_partial_update (BrushPainter *painter, float *pos)
static void brush_painter_refresh_cache (BrushPainter *painter, float *pos, int use_color_correction)
void brush_painter_break_stroke (BrushPainter *painter)
static void brush_apply_pressure (BrushPainter *painter, Brush *brush, float pressure)
void brush_jitter_pos (const Scene *scene, Brush *brush, float pos[2], float jitterpos[2])
int brush_painter_paint (BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user, int use_color_correction)
float brush_curve_strength_clamp (Brush *br, float p, const float len)
float brush_curve_strength (Brush *br, float p, const float len)
unsigned int * brush_gen_texture_cache (Brush *br, int half_side)
struct ImBufbrush_gen_radial_control_imbuf (Brush *br)

Detailed Description

Definition in file brush.c.


Define Documentation

#define BR_TEST (   field,
 
)
Value:
if(br->field != def.field)              \
        printf("br->" #field " = %" #t ";\n", br->field)

Referenced by brush_debug_print_state().

#define BR_TEST_FLAG (   _f)
Value:
if((br->flag & _f) && !(def.flag & _f))     \
        printf("br->flag |= " #_f ";\n");   \
    else if(!(br->flag & _f) && (def.flag & _f))    \
        printf("br->flag &= ~" #_f ";\n")

Referenced by brush_debug_print_state().


Typedef Documentation


Function Documentation

Brush* add_brush ( const char *  name) [read]
float brush_alpha ( const Scene scene,
Brush brush 
)
static void brush_apply_pressure ( BrushPainter painter,
Brush brush,
float  pressure 
) [static]
int brush_clone_image_delete ( Brush brush)

Definition at line 478 of file brush.c.

References Brush::clone, Image::id, BrushClone::image, NULL, and ID::us.

Referenced by brush_clone_image_set_nr().

int brush_clone_image_set_nr ( Brush brush,
int  nr 
)
void brush_curve_preset ( Brush b,
int  preset 
)
float brush_curve_strength ( Brush br,
float  p,
const float  len 
)

Definition at line 1249 of file brush.c.

References Brush::curve, curvemapping_evaluateF(), and len().

Referenced by brush_imbuf_new(), load_tex(), overlapped_curve(), and tex_strength().

float brush_curve_strength_clamp ( Brush br,
float  p,
const float  len 
)
void brush_debug_print_state ( Brush br)
struct ImBuf* brush_gen_radial_control_imbuf ( Brush br) [read]
unsigned int* brush_gen_texture_cache ( Brush br,
int  half_side 
)
void brush_imbuf_new ( const Scene scene,
Brush brush,
short  flt,
short  texfall,
int  bufsize,
ImBuf **  outbuf,
int  use_color_correction 
)
void brush_jitter_pos ( const Scene scene,
Brush brush,
float  pos[2],
float  jitterpos[2] 
)
void brush_painter_break_stroke ( BrushPainter painter)

Definition at line 1035 of file brush.c.

References BrushPainter::firsttouch.

Referenced by imapaint_paint_stroke().

static void brush_painter_do_partial ( BrushPainter painter,
ImBuf oldtexibuf,
int  x,
int  y,
int  w,
int  h,
int  xt,
int  yt,
float *  pos 
) [static]
static void brush_painter_fixed_tex_partial_update ( BrushPainter painter,
float *  pos 
) [static]
void brush_painter_free ( BrushPainter painter)
BrushPainter* brush_painter_new ( Scene scene,
Brush brush 
)
int brush_painter_paint ( BrushPainter painter,
BrushFunc  func,
float *  pos,
double  time,
float  pressure,
void *  user,
int  use_color_correction 
)
static void brush_painter_refresh_cache ( BrushPainter painter,
float *  pos,
int  use_color_correction 
) [static]
void brush_painter_require_imbuf ( BrushPainter painter,
short  flt,
short  texonly,
int  size 
)
void brush_reset_sculpt ( Brush br)
void brush_sample_tex ( const Scene scene,
Brush brush,
const float  xy[2],
float  rgba[4],
const int  thread 
)

Definition at line 490 of file brush.c.

References brush_size(), co, externtex(), Brush::mtex, and MTex::tex.

void brush_scale_size ( int *  brush_size,
float  new_unprojected_radius,
float  old_unprojected_radius 
)

Definition at line 732 of file brush.c.

void brush_scale_unprojected_radius ( float *  unprojected_radius,
int  new_brush_size,
int  old_brush_size 
)

Definition at line 720 of file brush.c.

static void brush_set_alpha ( Scene scene,
Brush brush,
float  alpha 
) [static]
static void brush_set_defaults ( Brush brush) [static]
void brush_set_size ( Scene scene,
Brush brush,
int  size 
)
void brush_set_unprojected_radius ( Scene scene,
Brush brush,
float  unprojected_radius 
)
int brush_size ( const Scene scene,
Brush brush 
)
int brush_texture_delete ( Brush brush)

Definition at line 452 of file brush.c.

References Tex::id, Brush::mtex, MTex::tex, and ID::us.

Referenced by brush_texture_set_nr().

int brush_texture_set_nr ( Brush brush,
int  nr 
)
float brush_unprojected_radius ( const Scene scene,
Brush brush 
)
int brush_use_alpha_pressure ( const Scene scene,
Brush brush 
)
int brush_use_locked_size ( const Scene scene,
Brush brush 
)
int brush_use_size_pressure ( const Scene scene,
Brush brush 
)
Brush* copy_brush ( Brush brush) [read]
static void extern_local_brush ( Brush brush) [static]

Definition at line 182 of file brush.c.

References Brush::clone, id_lib_extern(), BrushClone::image, Brush::mtex, and MTex::tex.

Referenced by make_local_brush().

void free_brush ( Brush brush)
void make_local_brush ( Brush brush)