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

gpencil_paint.c File Reference

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_gpencil.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_report.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_windowmanager_types.h"
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "gpencil_intern.h"

Go to the source code of this file.

Classes

struct  tGPsdata
struct  tGpSmoothCo

Defines

#define GP_STROKE_BUFFER_MAX   5000
#define MIN_MANHATTEN_PX   (U.gp_manhattendist)
#define MIN_EUCLIDEAN_PX   (U.gp_euclideandist)
#define GP_SIMPLIFY_AVPOINT(offs, sfac)

Typedefs

typedef struct tGPsdata tGPsdata
typedef struct tGpSmoothCo tGpSmoothCo

Enumerations

enum  { GP_STATUS_IDLING = 0, GP_STATUS_PAINTING, GP_STATUS_ERROR, GP_STATUS_DONE }
enum  { GP_STROKEADD_INVALID = -2, GP_STROKEADD_OVERFLOW = -1, GP_STROKEADD_NORMAL, GP_STROKEADD_FULL }
enum  { GP_PAINTFLAG_FIRSTRUN = (1<<0), GP_PAINTFLAG_STROKEADDED = (1<<1) }

Functions

static void gp_session_validatebuffer (tGPsdata *p)
static int gpencil_draw_poll (bContext *C)
static int gpencil_project_check (tGPsdata *p)
static void gp_get_3d_reference (tGPsdata *p, float *vec)
static short gp_stroke_filtermval (tGPsdata *p, const int mval[2], int pmval[2])
static void gp_stroke_convertcoords (tGPsdata *p, const int mval[2], float out[3], float *depth)
static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
static void gp_stroke_smooth (tGPsdata *p)
static void gp_stroke_simplify (tGPsdata *p)
static void gp_stroke_newfrombuffer (tGPsdata *p)
static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i)
static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1)
static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], short rad, rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
static void gp_stroke_doeraser (tGPsdata *p)
static int gp_session_initdata (bContext *C, tGPsdata *p)
static tGPsdatagp_session_initpaint (bContext *C)
static void gp_session_cleanup (tGPsdata *p)
static void gp_paint_initstroke (tGPsdata *p, short paintmode)
static void gp_paint_strokeend (tGPsdata *p)
static void gp_paint_cleanup (tGPsdata *p)
static void gpencil_draw_exit (bContext *C, wmOperator *op)
static int gpencil_draw_cancel (bContext *C, wmOperator *op)
static int gpencil_draw_init (bContext *C, wmOperator *op)
static void gpencil_draw_status_indicators (tGPsdata *p)
static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
static int gpencil_draw_exec (bContext *C, wmOperator *op)
static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int gpencil_area_exists (bContext *C, ScrArea *satest)
static tGPsdatagpencil_stroke_begin (bContext *C, wmOperator *op)
static void gpencil_stroke_end (wmOperator *op)
static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
void GPENCIL_OT_draw (wmOperatorType *ot)

Variables

static EnumPropertyItem prop_gpencil_drawmodes []

Detailed Description

Definition in file gpencil_paint.c.


Define Documentation

#define GP_SIMPLIFY_AVPOINT (   offs,
  sfac 
)
Value:
{ \
        co[0] += (float)(old_points[offs].x * sfac); \
        co[1] += (float)(old_points[offs].y * sfac); \
        pressure += old_points[offs].pressure * sfac; \
    }

Referenced by gp_stroke_simplify().

#define GP_STROKE_BUFFER_MAX   5000

Definition at line 138 of file gpencil_paint.c.

Referenced by gp_session_validatebuffer(), and gp_stroke_addpoint().

#define MIN_EUCLIDEAN_PX   (U.gp_euclideandist)

Definition at line 144 of file gpencil_paint.c.

Referenced by gp_stroke_filtermval().

#define MIN_MANHATTEN_PX   (U.gp_manhattendist)

Definition at line 142 of file gpencil_paint.c.

Referenced by gp_stroke_filtermval().


Typedef Documentation

typedef struct tGPsdata tGPsdata
typedef struct tGpSmoothCo tGpSmoothCo

Enumeration Type Documentation

anonymous enum
Enumerator:
GP_STATUS_IDLING 
GP_STATUS_PAINTING 
GP_STATUS_ERROR 
GP_STATUS_DONE 

Definition at line 114 of file gpencil_paint.c.

anonymous enum
Enumerator:
GP_STROKEADD_INVALID 
GP_STROKEADD_OVERFLOW 
GP_STROKEADD_NORMAL 
GP_STROKEADD_FULL 

Definition at line 122 of file gpencil_paint.c.

anonymous enum
Enumerator:
GP_PAINTFLAG_FIRSTRUN 
GP_PAINTFLAG_STROKEADDED 

Definition at line 130 of file gpencil_paint.c.


Function Documentation

static void gp_get_3d_reference ( tGPsdata p,
float *  vec 
) [static]
static void gp_paint_cleanup ( tGPsdata p) [static]
static void gp_paint_initstroke ( tGPsdata p,
short  paintmode 
) [static]
static void gp_paint_strokeend ( tGPsdata p) [static]
static void gp_session_cleanup ( tGPsdata p) [static]
static int gp_session_initdata ( bContext C,
tGPsdata p 
) [static]
static tGPsdata* gp_session_initpaint ( bContext C) [static]

Definition at line 1176 of file gpencil_paint.c.

References gp_session_initdata(), MEM_callocN(), NULL, and p.

Referenced by gpencil_draw_init().

static void gp_session_validatebuffer ( tGPsdata p) [static]
static short gp_stroke_addpoint ( tGPsdata p,
const int  mval[2],
float  pressure 
) [static]
static void gp_stroke_convertcoords ( tGPsdata p,
const int  mval[2],
float  out[3],
float *  depth 
) [static]
static void gp_stroke_doeraser ( tGPsdata p) [static]
static void gp_stroke_eraser_dostroke ( tGPsdata p,
int  mval[],
int  mvalo[],
short  rad,
rcti rect,
bGPDframe gpf,
bGPDstroke gps 
) [static]
static short gp_stroke_eraser_splitdel ( bGPDframe gpf,
bGPDstroke gps,
int  i 
) [static]
static short gp_stroke_eraser_strokeinside ( int  mval[],
int   UNUSEDmvalo[],
short  rad,
short  x0,
short  y0,
short  x1,
short  y1 
) [static]

Definition at line 794 of file gpencil_paint.c.

References edge_inside_circle().

Referenced by gp_stroke_eraser_dostroke().

static short gp_stroke_filtermval ( tGPsdata p,
const int  mval[2],
int  pmval[2] 
) [static]
static void gp_stroke_newfrombuffer ( tGPsdata p) [static]
static void gp_stroke_simplify ( tGPsdata p) [static]
static void gp_stroke_smooth ( tGPsdata p) [static]
static int gpencil_area_exists ( bContext C,
ScrArea satest 
) [static]

Definition at line 1736 of file gpencil_paint.c.

References bScreen::areabase, CTX_wm_screen(), ListBase::first, and ScrArea::next.

Referenced by gpencil_draw_modal().

static void gpencil_draw_apply ( wmOperator op,
tGPsdata p 
) [static]
static void gpencil_draw_apply_event ( wmOperator op,
wmEvent event 
) [static]
static int gpencil_draw_cancel ( bContext C,
wmOperator op 
) [static]

Definition at line 1422 of file gpencil_paint.c.

References gpencil_draw_exit(), and OPERATOR_CANCELLED.

Referenced by GPENCIL_OT_draw().

static int gpencil_draw_exec ( bContext C,
wmOperator op 
) [static]
static void gpencil_draw_exit ( bContext C,
wmOperator op 
) [static]
static int gpencil_draw_init ( bContext C,
wmOperator op 
) [static]
static int gpencil_draw_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int gpencil_draw_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int gpencil_draw_poll ( bContext C) [static]
static void gpencil_draw_status_indicators ( tGPsdata p) [static]
void GPENCIL_OT_draw ( wmOperatorType ot)
static int gpencil_project_check ( tGPsdata p) [static]
static tGPsdata* gpencil_stroke_begin ( bContext C,
wmOperator op 
) [static]
static void gpencil_stroke_end ( wmOperator op) [static]

Variable Documentation

Initial value:
 {
    {GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""},
    {GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""},
    {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""},
    {GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""},
    {0, NULL, 0, NULL, NULL}
}

Definition at line 1923 of file gpencil_paint.c.