Blender  V2.59
Classes | Defines | Typedefs | Functions
paint_vertex.c File Reference
#include <math.h>
#include <string.h>
#include <unistd.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "BKE_DerivedMesh.h"
#include "BKE_action.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "paint_intern.h"

Go to the source code of this file.

Classes

struct  WPaintData
struct  VPaintData

Defines

#define VP_MIX   0
#define VP_ADD   1
#define VP_SUB   2
#define VP_MUL   3
#define VP_BLUR   4
#define VP_LIGHTEN   5
#define VP_DARKEN   6

Typedefs

typedef struct VPaintData VPaintData

Functions

int vertex_paint_mode_poll (bContext *C)
int vertex_paint_poll (bContext *C)
int weight_paint_mode_poll (bContext *C)
int weight_paint_poll (bContext *C)
static VPaintnew_vpaint (int wpaint)
static int * get_indexarray (Mesh *me)
static unsigned int rgba_to_mcol (float r, float g, float b, float a)
unsigned int vpaint_get_current_col (VPaint *vp)
static void do_shared_vertexcol (Mesh *me)
static void make_vertexcol (Object *ob)
static void wpaint_mirror_vgroup_ensure (Object *ob, int *vgroup_mirror)
static void copy_vpaint_prev (VPaint *vp, unsigned int *mcol, int tot)
static void copy_wpaint_prev (VPaint *wp, MDeformVert *dverts, int dcount)
void vpaint_fill (Object *ob, unsigned int paintcol)
void wpaint_fill (VPaint *wp, Object *ob, float paintweight)
static unsigned int mcol_blend (unsigned int col1, unsigned int col2, int fac)
static unsigned int mcol_add (unsigned int col1, unsigned int col2, int fac)
static unsigned int mcol_sub (unsigned int col1, unsigned int col2, int fac)
static unsigned int mcol_mul (unsigned int col1, unsigned int col2, int fac)
static unsigned int mcol_lighten (unsigned int col1, unsigned int col2, int fac)
static unsigned int mcol_darken (unsigned int col1, unsigned int col2, int fac)
static void vpaint_blend (VPaint *vp, unsigned int *col, unsigned int *colorig, unsigned int paintcol, int alpha)
static int sample_backbuf_area (ViewContext *vc, int *indexar, int totface, int x, int y, float size)
static float calc_vp_alpha_dl (VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, const float mval[2], float pressure)
static void wpaint_blend (VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float alpha, float paintval, int flip)
static int weight_sample_invoke (bContext *C, wmOperator *op, wmEvent *event)
void PAINT_OT_weight_sample (wmOperatorType *ot)
static EnumPropertyItemweight_paint_sample_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
static int weight_sample_group_exec (bContext *C, wmOperator *op)
void PAINT_OT_weight_sample_group (wmOperatorType *ot)
static void do_weight_paint_auto_normalize (MDeformVert *dvert, int paint_nr, char *map)
static void do_weight_paint_vertex (VPaint *wp, Object *ob, int index, float alpha, float paintweight, int flip, int vgroup_mirror, char *validmap)
static int set_wpaint (bContext *C, wmOperator *UNUSED(op))
static int paint_poll_test (bContext *C)
void PAINT_OT_weight_paint_toggle (wmOperatorType *ot)
static char * wpaint_make_validmap (Object *ob)
static int wpaint_stroke_test_start (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
static void wpaint_stroke_update_step (bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
static void wpaint_stroke_done (bContext *C, struct PaintStroke *stroke)
static int wpaint_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int wpaint_cancel (bContext *C, wmOperator *op)
void PAINT_OT_weight_paint (wmOperatorType *ot)
static int weight_paint_set_exec (bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_weight_set (wmOperatorType *ot)
static int set_vpaint (bContext *C, wmOperator *op)
void PAINT_OT_vertex_paint_toggle (wmOperatorType *ot)
static int vpaint_stroke_test_start (bContext *C, struct wmOperator *op, wmEvent *UNUSED(event))
static void vpaint_paint_face (VPaint *vp, VPaintData *vpd, Object *ob, int index, const float mval[2], float pressure, int UNUSED(flip))
static void vpaint_stroke_update_step (bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
static void vpaint_stroke_done (bContext *C, struct PaintStroke *stroke)
static int vpaint_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int vpaint_cancel (bContext *C, wmOperator *op)
void PAINT_OT_vertex_paint (wmOperatorType *ot)
static int weight_from_bones_poll (bContext *C)
static int weight_from_bones_exec (bContext *C, wmOperator *op)
void PAINT_OT_weight_from_bones (wmOperatorType *ot)

Detailed Description

Definition in file paint_vertex.c.


Define Documentation

#define VP_ADD   1

Definition at line 91 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().

#define VP_BLUR   4
#define VP_DARKEN   6

Definition at line 96 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().

#define VP_LIGHTEN   5

Definition at line 95 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().

#define VP_MIX   0

Definition at line 90 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().

#define VP_MUL   3

Definition at line 93 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().

#define VP_SUB   2

Definition at line 92 of file paint_vertex.c.

Referenced by vpaint_blend(), and wpaint_blend().


Typedef Documentation

typedef struct VPaintData VPaintData

Function Documentation

static float calc_vp_alpha_dl ( VPaint vp,
ViewContext vc,
float  vpimat[][3],
float *  vert_nor,
const float  mval[2],
float  pressure 
) [static]
static void copy_vpaint_prev ( VPaint vp,
unsigned int *  mcol,
int  tot 
) [static]
static void copy_wpaint_prev ( VPaint wp,
MDeformVert dverts,
int  dcount 
) [static]
static void do_shared_vertexcol ( Mesh me) [static]
static void do_weight_paint_auto_normalize ( MDeformVert dvert,
int  paint_nr,
char *  map 
) [static]
static void do_weight_paint_vertex ( VPaint wp,
Object ob,
int  index,
float  alpha,
float  paintweight,
int  flip,
int  vgroup_mirror,
char *  validmap 
) [static]
static int* get_indexarray ( Mesh me) [static]

Definition at line 161 of file paint_vertex.c.

References MEM_mallocN(), and Mesh::totface.

Referenced by vpaint_stroke_test_start(), wpaint_fill(), and wpaint_stroke_test_start().

static void make_vertexcol ( Object ob) [static]
static unsigned int mcol_add ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 547 of file paint_vertex.c.

Referenced by vpaint_blend().

static unsigned int mcol_blend ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 524 of file paint_vertex.c.

Referenced by vpaint_blend(), and vpaint_paint_face().

static unsigned int mcol_darken ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 645 of file paint_vertex.c.

Referenced by vpaint_blend().

static unsigned int mcol_lighten ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 617 of file paint_vertex.c.

Referenced by vpaint_blend().

static unsigned int mcol_mul ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 593 of file paint_vertex.c.

Referenced by vpaint_blend().

static unsigned int mcol_sub ( unsigned int  col1,
unsigned int  col2,
int  fac 
) [static]

Definition at line 570 of file paint_vertex.c.

Referenced by vpaint_blend().

static VPaint* new_vpaint ( int  wpaint) [static]

Definition at line 149 of file paint_vertex.c.

References VPaint::flag, MEM_callocN(), VP_AREA, and VP_SPRAY.

Referenced by set_vpaint(), and set_wpaint().

void PAINT_OT_vertex_paint ( wmOperatorType ot)
void PAINT_OT_vertex_paint_toggle ( wmOperatorType ot)
void PAINT_OT_weight_from_bones ( wmOperatorType ot)
void PAINT_OT_weight_paint ( wmOperatorType ot)
void PAINT_OT_weight_paint_toggle ( wmOperatorType ot)
void PAINT_OT_weight_sample ( wmOperatorType ot)
void PAINT_OT_weight_sample_group ( wmOperatorType ot)
void PAINT_OT_weight_set ( wmOperatorType ot)
static int paint_poll_test ( bContext C) [static]
static unsigned int rgba_to_mcol ( float  r,
float  g,
float  b,
float  a 
) [static]

Definition at line 170 of file paint_vertex.c.

Referenced by vpaint_get_current_col().

static int sample_backbuf_area ( ViewContext vc,
int *  indexar,
int  totface,
int  x,
int  y,
float  size 
) [static]
static int set_vpaint ( bContext C,
wmOperator op 
) [static]
static int set_wpaint ( bContext C,
wmOperator UNUSEDop 
) [static]
int vertex_paint_mode_poll ( bContext C)
int vertex_paint_poll ( bContext C)
static void vpaint_blend ( VPaint vp,
unsigned int *  col,
unsigned int *  colorig,
unsigned int  paintcol,
int  alpha 
) [static]
static int vpaint_cancel ( bContext C,
wmOperator op 
) [static]

Definition at line 1903 of file paint_vertex.c.

References OPERATOR_CANCELLED, and paint_stroke_cancel().

Referenced by PAINT_OT_vertex_paint().

void vpaint_fill ( Object ob,
unsigned int  paintcol 
)
unsigned int vpaint_get_current_col ( VPaint vp)
static int vpaint_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void vpaint_paint_face ( VPaint vp,
VPaintData vpd,
Object ob,
int  index,
const float  mval[2],
float  pressure,
int   UNUSEDflip 
) [static]
static void vpaint_stroke_done ( bContext C,
struct PaintStroke stroke 
) [static]
static int vpaint_stroke_test_start ( bContext C,
struct wmOperator op,
wmEvent UNUSEDevent 
) [static]
static void vpaint_stroke_update_step ( bContext C,
struct PaintStroke stroke,
PointerRNA itemptr 
) [static]
static int weight_from_bones_exec ( bContext C,
wmOperator op 
) [static]
static int weight_from_bones_poll ( bContext C) [static]
int weight_paint_mode_poll ( bContext C)
int weight_paint_poll ( bContext C)
static EnumPropertyItem* weight_paint_sample_enum_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
int *  free 
) [static]
static int weight_paint_set_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int weight_sample_group_exec ( bContext C,
wmOperator op 
) [static]
static int weight_sample_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void wpaint_blend ( VPaint wp,
MDeformWeight dw,
MDeformWeight uw,
float  alpha,
float  paintval,
int  flip 
) [static]
static int wpaint_cancel ( bContext C,
wmOperator op 
) [static]

Definition at line 1603 of file paint_vertex.c.

References OPERATOR_CANCELLED, and paint_stroke_cancel().

Referenced by PAINT_OT_weight_paint().

void wpaint_fill ( VPaint wp,
Object ob,
float  paintweight 
)
static int wpaint_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static char* wpaint_make_validmap ( Object ob) [static]
static void wpaint_mirror_vgroup_ensure ( Object ob,
int *  vgroup_mirror 
) [static]
static void wpaint_stroke_done ( bContext C,
struct PaintStroke stroke 
) [static]
static int wpaint_stroke_test_start ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static void wpaint_stroke_update_step ( bContext C,
struct PaintStroke stroke,
PointerRNA itemptr 
) [static]