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

paint_image.c File Reference

#include <float.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "DNA_brush_types.h"
#include "DNA_camera_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_idprop.h"
#include "BKE_brush.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_view2d.h"
#include "ED_image.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "GPU_draw.h"
#include "paint_intern.h"

Go to the source code of this file.

Classes

struct  ImagePaintState
struct  ImagePaintPartialRedraw
struct  ImagePaintRegion
struct  ProjPaintImage
struct  ProjPaintState
union  pixelPointer
union  pixelStore
struct  ProjPixel
struct  ProjPixelClone
struct  UndoImageTile
struct  ProjectHandle
struct  PaintOperation
struct  GrabClone

Defines

#define IMAPAINT_CHAR_TO_FLOAT(c)   ((c)/255.0f)
#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f)
#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f)
#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c)
#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c)
#define IMAPAINT_FLOAT_RGB_COPY(a, b)   copy_v3_v3(a, b)
#define IMAPAINT_TILE_BITS   6
#define IMAPAINT_TILE_SIZE   (1 << IMAPAINT_TILE_BITS)
#define IMAPAINT_TILE_NUMBER(size)   (((size)+IMAPAINT_TILE_SIZE-1) >> IMAPAINT_TILE_BITS)
#define PROJ_BUCKET_BRUSH_DIV   4
#define PROJ_BUCKET_RECT_MIN   4
#define PROJ_BUCKET_RECT_MAX   256
#define PROJ_BOUNDBOX_DIV   8
#define PROJ_BOUNDBOX_SQUARED   (PROJ_BOUNDBOX_DIV * PROJ_BOUNDBOX_DIV)
#define PROJ_DEBUG_WINCLIP   1
#define PROJ_FACE_SEAM1   (1<<0)
#define PROJ_FACE_SEAM2   (1<<1)
#define PROJ_FACE_SEAM3   (1<<2)
#define PROJ_FACE_SEAM4   (1<<3)
#define PROJ_FACE_NOSEAM1   (1<<4)
#define PROJ_FACE_NOSEAM2   (1<<5)
#define PROJ_FACE_NOSEAM3   (1<<6)
#define PROJ_FACE_NOSEAM4   (1<<7)
#define PROJ_SRC_VIEW   1
#define PROJ_SRC_IMAGE_CAM   2
#define PROJ_SRC_IMAGE_VIEW   3
#define PROJ_VIEW_DATA_ID   "view_data"
#define PROJ_VIEW_DATA_SIZE   (4*4 + 4*4 + 3)
#define PROJ_FACE_SCALE_SEAM   0.99f
#define PROJ_BUCKET_NULL   0
#define PROJ_BUCKET_INIT   (1<<0)
#define PROJ_GEOM_TOLERANCE   0.00075f
#define PROJ_VERT_CULL   1
#define PI_80_DEG   ((M_PI_2 / 9) * 8)
#define ISECT_TRUE   1
#define ISECT_TRUE_P1   2
#define ISECT_TRUE_P2   3
#define ISECT_1   (1)
#define ISECT_2   (1<<1)
#define ISECT_3   (1<<2)
#define ISECT_4   (1<<3)
#define ISECT_ALL3   ((1<<3)-1)
#define ISECT_ALL4   ((1<<4)-1)
#define PX_SIZE_FADE_MAX   12.0f
#define PX_SIZE_FADE_MIN   4.0f

Typedefs

typedef struct ImagePaintState ImagePaintState
typedef struct
ImagePaintPartialRedraw 
ImagePaintPartialRedraw
typedef struct ImagePaintRegion ImagePaintRegion
typedef struct ProjPaintImage ProjPaintImage
typedef struct ProjPaintState ProjPaintState
typedef union pixelPointer PixelPointer
typedef union pixelStore PixelStore
typedef struct ProjPixel ProjPixel
typedef struct ProjPixelClone ProjPixelClone
typedef struct UndoImageTile UndoImageTile
typedef struct ProjectHandle ProjectHandle
typedef enum PaintMode PaintMode
typedef struct PaintOperation PaintOperation
typedef struct GrabClone GrabClone

Enumerations

enum  PaintMode { PAINT_MODE_2D, PAINT_MODE_3D, PAINT_MODE_3D_PROJECT }

Functions

static void imapaint_image_update (SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
static void undo_copy_tile (UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int restore)
static void * image_undo_push_tile (Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int x_tile, int y_tile)
static void image_undo_restore (bContext *C, ListBase *lb)
static void image_undo_free (ListBase *lb)
static Imageimapaint_face_image (const ImagePaintState *s, int face_index)
static Imageproject_paint_face_image (const ProjPaintState *ps, MTFace *dm_mtface, int face_index)
static int project_bucket_offset (const ProjPaintState *ps, const float projCoSS[2])
static int project_bucket_offset_safe (const ProjPaintState *ps, const float projCoSS[2])
static void barycentric_weights_v2_persp (float v1[4], float v2[4], float v3[4], float co[2], float w[3])
static float VecZDepthOrtho (float pt[2], float v1[3], float v2[3], float v3[3], float w[3])
static float VecZDepthPersp (float pt[2], float v1[4], float v2[4], float v3[4], float w[3])
static int project_paint_PickFace (const ProjPaintState *ps, float pt[2], float w[3], int *side)
static void uvco_to_wrapped_pxco (float uv[2], int ibuf_x, int ibuf_y, float *x, float *y)
static int project_paint_PickColor (const ProjPaintState *ps, float pt[2], float *rgba_fp, unsigned char *rgba, const int interp)
static int project_paint_occlude_ptv (float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho)
static int project_paint_occlude_ptv_clip (const ProjPaintState *ps, const MFace *mf, float pt[3], float v1[4], float v2[4], float v3[4], const int side)
static int project_bucket_point_occluded (const ProjPaintState *ps, LinkNode *bucketFace, const int orig_face, float pixelScreenCo[4])
static int line_isect_y (const float p1[2], const float p2[2], const float y_level, float *x_isect)
static int line_isect_x (const float p1[2], const float p2[2], const float x_level, float *y_isect)
static int cmp_uv (const float vec2a[2], const float vec2b[2])
static int pixel_bounds_uv (const float uv1[2], const float uv2[2], const float uv3[2], const float uv4[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int is_quad)
static int pixel_bounds_array (float(*uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
static int check_seam (const ProjPaintState *ps, const int orig_face, const int orig_i1_fidx, const int orig_i2_fidx, int *other_face, int *orig_fidx)
static void uv_image_outset (float(*orig_uv)[2], float(*outset_uv)[2], const float scaler, const int ibuf_x, const int ibuf_y, const int is_quad)
static void project_face_seams_init (const ProjPaintState *ps, const int face_index, const int is_quad)
static void screen_px_from_ortho (float uv[2], float v1co[3], float v2co[3], float v3co[3], float uv1co[2], float uv2co[2], float uv3co[2], float pixelScreenCo[4], float w[3])
static void screen_px_from_persp (float uv[2], float v1co[4], float v2co[4], float v3co[4], float uv1co[2], float uv2co[2], float uv3co[2], float pixelScreenCo[4], float w[3])
static void project_face_pixel (const MTFace *tf_other, ImBuf *ibuf_other, const float w[3], int side, unsigned char rgba_ub[4], float rgba_f[4])
static float project_paint_uvpixel_mask (const ProjPaintState *ps, const int face_index, const int side, const float w[3])
static ProjPixelproject_paint_uvpixel_init (const ProjPaintState *ps, MemArena *arena, const ImBuf *ibuf, short x_px, short y_px, const float mask, const int face_index, const int image_index, const float pixelScreenCo[4], const int side, const float w[3])
static int line_clip_rect2f (rctf *rect, const float l1[2], const float l2[2], float l1_clip[2], float l2_clip[2])
static void scale_quad (float insetCos[4][3], float *origCos[4], const float inset)
static void scale_tri (float insetCos[4][3], float *origCos[4], const float inset)
static float len_squared_v2v2_alt (const float *v1, const float v2_1, const float v2_2)
static int project_bucket_isect_circle (const float cent[2], const float radius_squared, rctf *bucket_bounds)
static void rect_to_uvspace_ortho (rctf *bucket_bounds, float *v1coSS, float *v2coSS, float *v3coSS, float *uv1co, float *uv2co, float *uv3co, float bucket_bounds_uv[4][2], const int flip)
static void rect_to_uvspace_persp (rctf *bucket_bounds, float *v1coSS, float *v2coSS, float *v3coSS, float *uv1co, float *uv2co, float *uv3co, float bucket_bounds_uv[4][2], const int flip)
static int IsectPT2Df_limit (float pt[2], float v1[2], float v2[2], float v3[2], float limit)
static int float_z_sort_flip (const void *p1, const void *p2)
static int float_z_sort (const void *p1, const void *p2)
static void project_bucket_clip_face (const int is_ortho, rctf *bucket_bounds, float *v1coSS, float *v2coSS, float *v3coSS, float *uv1co, float *uv2co, float *uv3co, float bucket_bounds_uv[8][2], int *tot)
static int IsectPoly2Df (const float pt[2], float uv[][2], const int tot)
static int IsectPoly2Df_twoside (const float pt[2], float uv[][2], const int tot)
static void project_paint_face_init (const ProjPaintState *ps, const int thread_index, const int bucket_index, const int face_index, const int image_index, rctf *bucket_bounds, const ImBuf *ibuf, const short clamp_u, const short clamp_v)
static void project_paint_bucket_bounds (const ProjPaintState *ps, const float min[2], const float max[2], int bucketMin[2], int bucketMax[2])
static void project_bucket_bounds (const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
static void project_bucket_init (const ProjPaintState *ps, const int thread_index, const int bucket_index, rctf *bucket_bounds)
static int project_bucket_face_isect (ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf)
static void project_paint_delayed_face_init (ProjPaintState *ps, const MFace *mf, const int face_index)
static int project_paint_view_clip (View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
static void project_paint_begin (ProjPaintState *ps)
static void project_paint_begin_clone (ProjPaintState *ps, int mouse[2])
static void project_paint_end (ProjPaintState *ps)
static void partial_redraw_array_init (ImagePaintPartialRedraw *pr)
static int partial_redraw_array_merge (ImagePaintPartialRedraw *pr, ImagePaintPartialRedraw *pr_other, int tot)
static int project_image_refresh_tagged (ProjPaintState *ps)
static int project_bucket_iter_init (ProjPaintState *ps, const float mval_f[2])
static int project_bucket_iter_next (ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
static void blend_color_mix (unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
static void blend_color_mix_float (float *cp, const float *cp1, const float *cp2, const float fac)
static void blend_color_mix_accum (unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
static void do_projectpaint_clone (ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
static void do_projectpaint_clone_f (ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
static void do_projectpaint_smear (ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2])
static void do_projectpaint_smear_f (ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2])
static void do_projectpaint_draw (ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
static void do_projectpaint_draw_f (ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, int use_color_correction)
static void * do_projectpaint_thread (void *ph_v)
static int project_paint_op (void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos)
static int project_paint_sub_stroke (ProjPaintState *ps, BrushPainter *painter, const int UNUSED(prevmval_i[2]), const int mval_i[2], double time, float pressure)
static int project_paint_stroke (ProjPaintState *ps, BrushPainter *painter, const int prevmval_i[2], const int mval_i[2], double time, float pressure)
static void imapaint_clear_partial_redraw (void)
static void imapaint_dirty_region (Image *ima, ImBuf *ibuf, int x, int y, int w, int h)
static void imapaint_ibuf_get_set_rgb (ImBuf *ibuf, int x, int y, short torus, short set, float *rgb)
static int imapaint_ibuf_add_if (ImBuf *ibuf, unsigned int x, unsigned int y, float *outrgb, short torus)
static void imapaint_lift_soften (ImBuf *ibuf, ImBuf *ibufb, int *pos, short torus)
static void imapaint_set_region (ImagePaintRegion *region, int destx, int desty, int srcx, int srcy, int width, int height)
static int imapaint_torus_split_region (ImagePaintRegion region[4], ImBuf *dbuf, ImBuf *sbuf)
static void imapaint_lift_smear (ImBuf *ibuf, ImBuf *ibufb, int *pos)
static ImBufimapaint_lift_clone (ImBuf *ibuf, ImBuf *ibufb, int *pos)
static void imapaint_convert_brushco (ImBuf *ibufb, float *pos, int *ipos)
static int imapaint_paint_op (void *state, ImBuf *ibufb, float *lastpos, float *pos)
static int texpaint_break_stroke (float *prevuv, float *fwuv, float *bkuv, float *uv)
static int imapaint_canvas_set (ImagePaintState *s, Image *ima)
static void imapaint_canvas_free (ImagePaintState *s)
static int imapaint_paint_sub_stroke (ImagePaintState *s, BrushPainter *painter, Image *image, short texpaint, float *uv, double time, int update, float pressure)
static int imapaint_paint_stroke (ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, const int prevmval[2], const int mval[2], double time, float pressure)
static Brushimage_paint_brush (bContext *C)
static int image_paint_poll (bContext *C)
static int image_paint_3d_poll (bContext *C)
static int image_paint_2d_clone_poll (bContext *C)
static void paint_redraw (bContext *C, ImagePaintState *s, int final)
static void project_state_init (bContext *C, Object *ob, ProjPaintState *ps)
static void paint_brush_init_tex (Brush *brush)
static int texture_paint_init (bContext *C, wmOperator *op)
static void paint_apply (bContext *C, wmOperator *op, PointerRNA *itemptr)
static void paint_brush_exit_tex (Brush *brush)
static void paint_exit (bContext *C, wmOperator *op)
static int paint_exec (bContext *C, wmOperator *op)
static void paint_apply_event (bContext *C, wmOperator *op, wmEvent *event)
static int paint_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int paint_modal (bContext *C, wmOperator *op, wmEvent *event)
static int paint_cancel (bContext *C, wmOperator *op)
void PAINT_OT_image_paint (wmOperatorType *ot)
static int get_imapaint_zoom (bContext *C, float *zoomx, float *zoomy)
static void brush_drawcursor (bContext *C, int x, int y, void *UNUSED(customdata))
static void toggle_paint_cursor (bContext *C, int enable)
void ED_space_image_paint_update (wmWindowManager *wm, ToolSettings *settings)
static void grab_clone_apply (bContext *C, wmOperator *op)
static int grab_clone_exec (bContext *C, wmOperator *op)
static int grab_clone_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int grab_clone_modal (bContext *C, wmOperator *op, wmEvent *event)
static int grab_clone_cancel (bContext *UNUSED(C), wmOperator *op)
void PAINT_OT_grab_clone (wmOperatorType *ot)
static int sample_color_exec (bContext *C, wmOperator *op)
static int sample_color_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int sample_color_modal (bContext *C, wmOperator *op, wmEvent *event)
static int image_paint_sample_color_poll (bContext *C)
void PAINT_OT_sample_color (wmOperatorType *ot)
static int set_clone_cursor_exec (bContext *C, wmOperator *op)
static int set_clone_cursor_invoke (bContext *C, wmOperator *op, wmEvent *event)
void PAINT_OT_clone_cursor_set (wmOperatorType *ot)
static int texture_paint_toggle_poll (bContext *C)
static int texture_paint_toggle_exec (bContext *C, wmOperator *op)
void PAINT_OT_texture_paint_toggle (wmOperatorType *ot)
static int texture_paint_poll (bContext *C)
int image_texture_paint_poll (bContext *C)
int facemask_paint_poll (bContext *C)
int vert_paint_poll (bContext *C)
int mask_paint_poll (bContext *C)
static int texture_paint_camera_project_exec (bContext *C, wmOperator *op)
void PAINT_OT_project_image (wmOperatorType *ot)
static int texture_paint_image_from_view_exec (bContext *C, wmOperator *op)
void PAINT_OT_image_from_view (wmOperatorType *ot)

Variables

static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0}

Detailed Description

Definition in file paint_image.c.


Define Documentation

#define IMAPAINT_CHAR_RGB_TO_FLOAT (   f,
 
)
Value:
{                                   \
    (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
    (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
    (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
}

Definition at line 121 of file paint_image.c.

Referenced by imapaint_ibuf_get_set_rgb().

#define IMAPAINT_CHAR_RGBA_TO_FLOAT (   f,
 
)
Value:
{                                  \
    (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]);                                   \
    (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]);                                   \
    (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]);                                   \
    (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]);                                   \
}

Definition at line 126 of file paint_image.c.

Referenced by do_projectpaint_thread(), project_paint_PickColor(), and project_paint_uvpixel_init().

#define IMAPAINT_CHAR_TO_FLOAT (   c)    ((c)/255.0f)

Definition at line 108 of file paint_image.c.

#define IMAPAINT_FLOAT_RGB_COPY (   a,
 
)    copy_v3_v3(a, b)

Definition at line 133 of file paint_image.c.

Referenced by imapaint_ibuf_get_set_rgb().

#define IMAPAINT_FLOAT_RGB_TO_CHAR (   c,
 
)
Value:
{                                   \
    (c)[0]= FTOCHAR((f)[0]);                                                  \
    (c)[1]= FTOCHAR((f)[1]);                                                  \
    (c)[2]= FTOCHAR((f)[2]);                                                  \
}

Definition at line 110 of file paint_image.c.

Referenced by do_projectpaint_draw(), and imapaint_ibuf_get_set_rgb().

#define IMAPAINT_FLOAT_RGBA_TO_CHAR (   c,
 
)
Value:
{                                  \
    (c)[0]= FTOCHAR((f)[0]);                                                  \
    (c)[1]= FTOCHAR((f)[1]);                                                  \
    (c)[2]= FTOCHAR((f)[2]);                                                  \
    (c)[3]= FTOCHAR((f)[3]);                                                  \
}

Definition at line 115 of file paint_image.c.

Referenced by do_projectpaint_smear_f(), project_paint_PickColor(), and project_paint_uvpixel_init().

#define IMAPAINT_TILE_BITS   6

Definition at line 135 of file paint_image.c.

Referenced by imapaint_dirty_region(), and project_paint_end().

#define IMAPAINT_TILE_NUMBER (   size)    (((size)+IMAPAINT_TILE_SIZE-1) >> IMAPAINT_TILE_BITS)

Definition at line 137 of file paint_image.c.

Referenced by project_paint_end().

#define IMAPAINT_TILE_SIZE   (1 << IMAPAINT_TILE_BITS)
#define ISECT_1   (1)

Definition at line 1930 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_2   (1<<1)

Definition at line 1931 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_3   (1<<2)

Definition at line 1932 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_4   (1<<3)

Definition at line 1933 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_ALL3   ((1<<3)-1)

Definition at line 1934 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_ALL4   ((1<<4)-1)

Definition at line 1935 of file paint_image.c.

Referenced by project_bucket_clip_face().

#define ISECT_TRUE   1

Definition at line 909 of file paint_image.c.

Referenced by line_isect_x(), and line_isect_y().

#define ISECT_TRUE_P1   2

Definition at line 910 of file paint_image.c.

Referenced by line_isect_x(), and line_isect_y().

#define ISECT_TRUE_P2   3

Definition at line 911 of file paint_image.c.

Referenced by line_isect_x(), and line_isect_y().

#define PI_80_DEG   ((M_PI_2 / 9) * 8)

Definition at line 232 of file paint_image.c.

#define PROJ_BOUNDBOX_DIV   8

Definition at line 188 of file paint_image.c.

Referenced by project_paint_uvpixel_init().

#define PROJ_BOUNDBOX_SQUARED   (PROJ_BOUNDBOX_DIV * PROJ_BOUNDBOX_DIV)
#define PROJ_BUCKET_BRUSH_DIV   4

Definition at line 183 of file paint_image.c.

Referenced by project_paint_begin().

#define PROJ_BUCKET_INIT   (1<<0)

Definition at line 223 of file paint_image.c.

Referenced by project_bucket_init().

#define PROJ_BUCKET_NULL   0

Definition at line 222 of file paint_image.c.

Referenced by do_projectpaint_thread().

#define PROJ_BUCKET_RECT_MAX   256

Definition at line 186 of file paint_image.c.

Referenced by project_paint_begin().

#define PROJ_BUCKET_RECT_MIN   4

Definition at line 185 of file paint_image.c.

Referenced by project_paint_begin().

#define PROJ_DEBUG_WINCLIP   1

Definition at line 194 of file paint_image.c.

#define PROJ_FACE_NOSEAM1   (1<<4)

Definition at line 204 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_NOSEAM2   (1<<5)

Definition at line 205 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_NOSEAM3   (1<<6)

Definition at line 206 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_NOSEAM4   (1<<7)

Definition at line 207 of file paint_image.c.

Referenced by project_paint_delayed_face_init(), and project_paint_face_init().

#define PROJ_FACE_SCALE_SEAM   0.99f

Definition at line 220 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_SEAM1   (1<<0)

Definition at line 199 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_SEAM2   (1<<1)

Definition at line 200 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_SEAM3   (1<<2)

Definition at line 201 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_FACE_SEAM4   (1<<3)

Definition at line 202 of file paint_image.c.

Referenced by project_paint_face_init().

#define PROJ_GEOM_TOLERANCE   0.00075f
#define PROJ_SRC_IMAGE_CAM   2

Definition at line 210 of file paint_image.c.

Referenced by project_paint_begin(), and texture_paint_camera_project_exec().

#define PROJ_SRC_IMAGE_VIEW   3

Definition at line 211 of file paint_image.c.

Referenced by project_paint_begin(), and texture_paint_camera_project_exec().

#define PROJ_SRC_VIEW   1
#define PROJ_VERT_CULL   1

Definition at line 230 of file paint_image.c.

Referenced by project_paint_begin().

#define PROJ_VIEW_DATA_ID   "view_data"
#define PROJ_VIEW_DATA_SIZE   (4*4 + 4*4 + 3)
#define PX_SIZE_FADE_MAX   12.0f

Referenced by brush_drawcursor().

#define PX_SIZE_FADE_MIN   4.0f

Referenced by brush_drawcursor().


Typedef Documentation

typedef struct GrabClone GrabClone
typedef enum PaintMode PaintMode
typedef union pixelPointer PixelPointer
typedef union pixelStore PixelStore
typedef struct ProjectHandle ProjectHandle
typedef struct ProjPixel ProjPixel
typedef struct UndoImageTile UndoImageTile

Enumeration Type Documentation

enum PaintMode
Enumerator:
PAINT_MODE_2D 
PAINT_MODE_3D 
PAINT_MODE_3D_PROJECT 

Definition at line 4655 of file paint_image.c.


Function Documentation

static void barycentric_weights_v2_persp ( float  v1[4],
float  v2[4],
float  v3[4],
float  co[2],
float  w[3] 
) [static]
static void blend_color_mix ( unsigned char *  cp,
const unsigned char *  cp1,
const unsigned char *  cp2,
const int  fac 
) [static]
static void blend_color_mix_accum ( unsigned char *  cp,
const unsigned char *  cp1,
const unsigned char *  cp2,
const int  fac 
) [static]

Definition at line 3690 of file paint_image.c.

Referenced by do_projectpaint_thread().

static void blend_color_mix_float ( float *  cp,
const float *  cp1,
const float *  cp2,
const float  fac 
) [static]

Definition at line 3681 of file paint_image.c.

Referenced by do_projectpaint_clone_f(), and do_projectpaint_draw_f().

static void brush_drawcursor ( bContext C,
int  x,
int  y,
void *  UNUSEDcustomdata 
) [static]
static int check_seam ( const ProjPaintState ps,
const int  orig_face,
const int  orig_i1_fidx,
const int  orig_i2_fidx,
int *  other_face,
int *  orig_fidx 
) [static]
static int cmp_uv ( const float  vec2a[2],
const float  vec2b[2] 
) [static]

Definition at line 983 of file paint_image.c.

References fabsf, fmodf, and PROJ_GEOM_TOLERANCE.

Referenced by check_seam().

static void do_projectpaint_clone ( ProjPaintState ps,
ProjPixel projPixel,
float  alpha,
float  mask 
) [static]
static void do_projectpaint_clone_f ( ProjPaintState ps,
ProjPixel projPixel,
float  alpha,
float  mask 
) [static]
static void do_projectpaint_draw ( ProjPaintState ps,
ProjPixel projPixel,
float *  rgba,
float  alpha,
float  mask 
) [static]
static void do_projectpaint_draw_f ( ProjPaintState ps,
ProjPixel projPixel,
float *  rgba,
float  alpha,
float  mask,
int  use_color_correction 
) [static]
static void do_projectpaint_smear ( ProjPaintState ps,
ProjPixel projPixel,
float  alpha,
float  mask,
MemArena smearArena,
LinkNode **  smearPixels,
float  co[2] 
) [static]
static void do_projectpaint_smear_f ( ProjPaintState ps,
ProjPixel projPixel,
float  alpha,
float  mask,
MemArena smearArena,
LinkNode **  smearPixels_f,
float  co[2] 
) [static]
static void* do_projectpaint_thread ( void *  ph_v) [static]

Definition at line 3816 of file paint_image.c.

References ProjPixel::bb_cell_index, bicubic_interpolation_color(), Brush::blend, blend_color_mix_accum(), BLI_memarena_free(), BLI_memarena_new(), ProjPaintState::brush, brush_alpha(), brush_curve_strength_clamp(), BRUSH_LOCK_ALPHA, brush_sample_tex(), brush_size(), ProjPaintState::bucketFlags, ProjPaintState::bucketRect, pixelStore::ch, pixelPointer::ch_pt, co, do_projectpaint_clone(), do_projectpaint_clone_f(), do_projectpaint_draw(), do_projectpaint_draw_f(), do_projectpaint_smear(), do_projectpaint_smear_f(), ELEM, pixelStore::f, pixelPointer::f_pt, Brush::flag, IB_PROFILE_LINEAR_RGB, ProjPaintImage::ibuf, ProjPixel::image_index, IMAPAINT_CHAR_RGBA_TO_FLOAT, IMB_BLEND_ADD_ALPHA, IMB_BLEND_ERASE_ALPHA, ProjPaintState::is_airbrush, ProjPaintState::is_texbrush, len_squared_v2v2(), LinkNode::link, ProjPixel::mask, ProjPixel::mask_max, MAX2, MIN2, ProjPixel::newColor, LinkNode::next, NULL, ProjPixel::origColor, PAINT_TOOL_CLONE, PAINT_TOOL_SMEAR, ProjPaintImage::partRedrawRect, ProjPixel::pixel, ImBuf::profile, PROJ_BUCKET_NULL, PROJ_SRC_VIEW, ProjPixel::projCoSS, project_bucket_init(), project_bucket_iter_next(), ImBuf::rect_float, ProjPaintState::reproject_ibuf, ProjPaintState::scene, ProjPaintState::source, sqrtf, sub_v2_v2v2(), ProjPaintState::tool, ProjPaintImage::touch, pixelPointer::uint_pt, ImagePaintPartialRedraw::x1, ImagePaintPartialRedraw::x2, ProjPixel::x_px, ImagePaintPartialRedraw::y1, ImagePaintPartialRedraw::y2, and ProjPixel::y_px.

Referenced by project_paint_op().

void ED_space_image_paint_update ( wmWindowManager wm,
ToolSettings settings 
)
int facemask_paint_poll ( bContext C)
static int float_z_sort ( const void *  p1,
const void *  p2 
) [static]

Definition at line 1951 of file paint_image.c.

Referenced by project_bucket_clip_face().

static int float_z_sort_flip ( const void *  p1,
const void *  p2 
) [static]

Definition at line 1946 of file paint_image.c.

Referenced by project_bucket_clip_face().

static int get_imapaint_zoom ( bContext C,
float *  zoomx,
float *  zoomy 
) [static]
static void grab_clone_apply ( bContext C,
wmOperator op 
) [static]
static int grab_clone_cancel ( bContext UNUSEDC,
wmOperator op 
) [static]

Definition at line 5253 of file paint_image.c.

References wmOperator::customdata, MEM_freeN(), and OPERATOR_CANCELLED.

Referenced by PAINT_OT_grab_clone().

static int grab_clone_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 5198 of file paint_image.c.

References grab_clone_apply(), and OPERATOR_FINISHED.

Referenced by PAINT_OT_grab_clone().

static int grab_clone_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int grab_clone_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int image_paint_2d_clone_poll ( bContext C) [static]
static int image_paint_3d_poll ( bContext C) [static]

Definition at line 4633 of file paint_image.c.

References CTX_wm_region_view3d(), and image_paint_poll().

Referenced by PAINT_OT_clone_cursor_set().

static Brush* image_paint_brush ( bContext C) [static]
static int image_paint_poll ( bContext C) [static]
static int image_paint_sample_color_poll ( bContext C) [static]
int image_texture_paint_poll ( bContext C)

Definition at line 5497 of file paint_image.c.

References image_paint_poll(), and texture_paint_poll().

Referenced by ED_keymap_paint().

static void image_undo_free ( ListBase lb) [static]
static void* image_undo_push_tile ( Image ima,
ImBuf ibuf,
ImBuf **  tmpibuf,
int  x_tile,
int  y_tile 
) [static]
static void image_undo_restore ( bContext C,
ListBase lb 
) [static]
static void imapaint_canvas_free ( ImagePaintState s) [static]
static int imapaint_canvas_set ( ImagePaintState s,
Image ima 
) [static]
static void imapaint_clear_partial_redraw ( void  ) [static]

Definition at line 4114 of file paint_image.c.

Referenced by imapaint_paint_stroke().

static void imapaint_convert_brushco ( ImBuf ibufb,
float *  pos,
int *  ipos 
) [static]

Definition at line 4355 of file paint_image.c.

References floorf, ImBuf::x, and ImBuf::y.

Referenced by imapaint_paint_op().

static void imapaint_dirty_region ( Image ima,
ImBuf ibuf,
int  x,
int  y,
int  w,
int  h 
) [static]
static Image* imapaint_face_image ( const ImagePaintState s,
int  face_index 
) [static]
static int imapaint_ibuf_add_if ( ImBuf ibuf,
unsigned int  x,
unsigned int  y,
float *  outrgb,
short  torus 
) [static]

Definition at line 4205 of file paint_image.c.

References imapaint_ibuf_get_set_rgb(), ImBuf::x, and ImBuf::y.

Referenced by imapaint_lift_soften().

static void imapaint_ibuf_get_set_rgb ( ImBuf ibuf,
int  x,
int  y,
short  torus,
short  set,
float *  rgb 
) [static]
static void imapaint_image_update ( SpaceImage sima,
Image image,
ImBuf ibuf,
short  texpaint 
) [static]
static ImBuf* imapaint_lift_clone ( ImBuf ibuf,
ImBuf ibufb,
int *  pos 
) [static]
static void imapaint_lift_smear ( ImBuf ibuf,
ImBuf ibufb,
int *  pos 
) [static]
static void imapaint_lift_soften ( ImBuf ibuf,
ImBuf ibufb,
int *  pos,
short  torus 
) [static]
static int imapaint_paint_op ( void *  state,
ImBuf ibufb,
float *  lastpos,
float *  pos 
) [static]
static int imapaint_paint_stroke ( ViewContext vc,
ImagePaintState s,
BrushPainter painter,
short  texpaint,
const int  prevmval[2],
const int  mval[2],
double  time,
float  pressure 
) [static]
static int imapaint_paint_sub_stroke ( ImagePaintState s,
BrushPainter painter,
Image image,
short  texpaint,
float *  uv,
double  time,
int  update,
float  pressure 
) [static]
static void imapaint_set_region ( ImagePaintRegion region,
int  destx,
int  desty,
int  srcx,
int  srcy,
int  width,
int  height 
) [static]
static int imapaint_torus_split_region ( ImagePaintRegion  region[4],
ImBuf dbuf,
ImBuf sbuf 
) [static]
static int IsectPoly2Df ( const float  pt[2],
float  uv[][2],
const int  tot 
) [static]

Definition at line 2249 of file paint_image.c.

References i, and line_point_side_v2().

Referenced by project_paint_face_init().

static int IsectPoly2Df_twoside ( const float  pt[2],
float  uv[][2],
const int  tot 
) [static]

Definition at line 2263 of file paint_image.c.

References i, and line_point_side_v2().

Referenced by project_paint_face_init().

static int IsectPT2Df_limit ( float  pt[2],
float  v1[2],
float  v2[2],
float  v3[2],
float  limit 
) [static]

Definition at line 1938 of file paint_image.c.

References area_tri_v2().

Referenced by project_bucket_clip_face().

static float len_squared_v2v2_alt ( const float *  v1,
const float  v2_1,
const float  v2_2 
) [static]

Definition at line 1787 of file paint_image.c.

References UndoImageTile::x, and UndoImageTile::y.

Referenced by project_bucket_isect_circle().

static int line_clip_rect2f ( rctf rect,
const float  l1[2],
const float  l2[2],
float  l1_clip[2],
float  l2_clip[2] 
) [static]
static int line_isect_x ( const float  p1[2],
const float  p2[2],
const float  x_level,
float *  y_isect 
) [static]

Definition at line 945 of file paint_image.c.

References fabsf, ISECT_TRUE, ISECT_TRUE_P1, and ISECT_TRUE_P2.

Referenced by line_clip_rect2f().

static int line_isect_y ( const float  p1[2],
const float  p2[2],
const float  y_level,
float *  x_isect 
) [static]

Definition at line 912 of file paint_image.c.

References fabsf, ISECT_TRUE, ISECT_TRUE_P1, and ISECT_TRUE_P2.

Referenced by line_clip_rect2f().

int mask_paint_poll ( bContext C)

Definition at line 5512 of file paint_image.c.

References CTX_data_active_object(), paint_facesel_test(), and paint_vertsel_test().

Referenced by PAINT_OT_weight_set().

static void paint_apply ( bContext C,
wmOperator op,
PointerRNA itemptr 
) [static]
static void paint_apply_event ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void paint_brush_exit_tex ( Brush brush) [static]

Definition at line 4897 of file paint_image.c.

References bNodeTree::execdata, Brush::mtex, Tex::nodetree, ntreeTexEndExecTree(), and MTex::tex.

Referenced by paint_exit().

static void paint_brush_init_tex ( Brush brush) [static]

Definition at line 4754 of file paint_image.c.

References Brush::mtex, Tex::nodetree, ntreeTexBeginExecTree(), and MTex::tex.

Referenced by texture_paint_init().

static int paint_cancel ( bContext C,
wmOperator op 
) [static]

Definition at line 5062 of file paint_image.c.

References OPERATOR_CANCELLED, and paint_exit().

Referenced by PAINT_OT_image_paint().

static int paint_exec ( bContext C,
wmOperator op 
) [static]
static void paint_exit ( bContext C,
wmOperator op 
) [static]
static int paint_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int paint_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
void PAINT_OT_clone_cursor_set ( wmOperatorType ot)
void PAINT_OT_grab_clone ( wmOperatorType ot)
void PAINT_OT_image_from_view ( wmOperatorType ot)
void PAINT_OT_image_paint ( wmOperatorType ot)
void PAINT_OT_project_image ( wmOperatorType ot)
void PAINT_OT_sample_color ( wmOperatorType ot)
void PAINT_OT_texture_paint_toggle ( wmOperatorType ot)
static void paint_redraw ( bContext C,
ImagePaintState s,
int  final 
) [static]
static void partial_redraw_array_init ( ImagePaintPartialRedraw pr) [static]
static int partial_redraw_array_merge ( ImagePaintPartialRedraw pr,
ImagePaintPartialRedraw pr_other,
int  tot 
) [static]
static int pixel_bounds_array ( float(*)  uv[2],
rcti bounds_px,
const int  ibuf_x,
const int  ibuf_y,
int  tot 
) [static]

Definition at line 1034 of file paint_image.c.

References DO_MINMAX2, INIT_MINMAX2, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by project_paint_face_init().

static int pixel_bounds_uv ( const float  uv1[2],
const float  uv2[2],
const float  uv3[2],
const float  uv4[2],
rcti bounds_px,
const int  ibuf_x,
const int  ibuf_y,
int  is_quad 
) [static]

Definition at line 1005 of file paint_image.c.

References DO_MINMAX2, INIT_MINMAX2, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by project_paint_face_init().

static void project_bucket_bounds ( const ProjPaintState ps,
const int  bucket_x,
const int  bucket_y,
rctf bucket_bounds 
) [static]
static void project_bucket_clip_face ( const int  is_ortho,
rctf bucket_bounds,
float *  v1coSS,
float *  v2coSS,
float *  v3coSS,
float *  uv1co,
float *  uv2co,
float *  uv3co,
float  bucket_bounds_uv[8][2],
int *  tot 
) [static]
static int project_bucket_face_isect ( ProjPaintState ps,
int  bucket_x,
int  bucket_y,
const MFace mf 
) [static]
static void project_bucket_init ( const ProjPaintState ps,
const int  thread_index,
const int  bucket_index,
rctf bucket_bounds 
) [static]
static int project_bucket_isect_circle ( const float  cent[2],
const float  radius_squared,
rctf bucket_bounds 
) [static]

Definition at line 1799 of file paint_image.c.

References len_squared_v2v2_alt(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by project_bucket_iter_next().

static int project_bucket_iter_init ( ProjPaintState ps,
const float  mval_f[2] 
) [static]
static int project_bucket_iter_next ( ProjPaintState ps,
int *  bucket_index,
rctf bucket_bounds,
const float  mval[2] 
) [static]
static int project_bucket_offset ( const ProjPaintState ps,
const float  projCoSS[2] 
) [static]
static int project_bucket_offset_safe ( const ProjPaintState ps,
const float  projCoSS[2] 
) [static]
static int project_bucket_point_occluded ( const ProjPaintState ps,
LinkNode bucketFace,
const int  orig_face,
float  pixelScreenCo[4] 
) [static]
static void project_face_pixel ( const MTFace tf_other,
ImBuf ibuf_other,
const float  w[3],
int  side,
unsigned char  rgba_ub[4],
float  rgba_f[4] 
) [static]
static void project_face_seams_init ( const ProjPaintState ps,
const int  face_index,
const int  is_quad 
) [static]

Definition at line 1243 of file paint_image.c.

References check_seam(), ProjPaintState::faceSeamFlags, and other_face().

Referenced by project_paint_face_init().

static int project_image_refresh_tagged ( ProjPaintState ps) [static]
static void project_paint_begin ( ProjPaintState ps) [static]

Definition at line 2913 of file paint_image.c.

References add_v3_v3(), angle_normalized_v3v3(), ProjPaintState::ar, ProjPaintState::arena_mt, BKE_image_get_ibuf(), BLI_linklist_append(), BLI_linklist_free(), BLI_linklist_index(), BLI_linklist_prepend_arena(), BLI_memarena_alloc(), BLI_memarena_new(), BLI_system_thread_count(), ProjPaintState::brush, brush_size(), ProjPaintState::bucketFaces, ProjPaintState::bucketFlags, ProjPaintState::bucketRect, ProjPaintState::buckets_x, ProjPaintState::buckets_y, Scene::camera, camera_params_compute_matrix(), camera_params_compute_viewplane(), camera_params_from_object(), camera_params_init(), CD_MASK_MTFACE, CD_MTFACE, CLAMP(), CameraParams::clipend, ProjPaintState::clipend, CameraParams::clipsta, ProjPaintState::clipsta, MVert::co, copy_m3_m4(), copy_m4_m4(), copy_v3_v3(), CustomData_get_clone_layer(), CustomData_get_layer_n(), CustomData_get_stencil_layer(), CustomData_has_layer(), Scene::customdata_mask, Object::data, Object::derivedFinal, ProjPaintState::dm, ProjPaintState::dm_mface, ProjPaintState::dm_mtface, ProjPaintState::dm_mtface_clone, ProjPaintState::dm_mtface_stencil, ProjPaintState::dm_mvert, ProjPaintState::dm_release, ProjPaintState::dm_totface, ProjPaintState::dm_totvert, DM_TYPE_CDDM, ProjPaintState::do_backfacecull, ProjPaintState::do_layer_clone, ProjPaintState::do_layer_stencil, ProjPaintState::do_mask_normal, DO_MINMAX2, ED_view3d_local_clipping(), ED_view3d_ob_project_mat_get(), DerivedMesh::faceData, ProjPaintState::faceSeamFlags, ProjPaintState::faceSeamUVs, FALSE, MFace::flag, FLT_MAX, DerivedMesh::getFaceArray, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, i, ProjPaintImage::ibuf, Image::id, IDP_Array, IDP_GetProperties(), IDP_GetPropertyFromGroup(), ProjPaintImage::ima, ProjPaintState::image_tot, Object::imat, INIT_MINMAX2, invert_m4_m4(), CameraParams::is_ortho, ProjPaintState::is_ortho, line_point_side_v2(), LinkNode::link, ME_EDIT_PAINT_MASK, ME_FACE_SEL, MEM_callocN(), MEM_dupallocN(), MEM_mallocN(), mesh_create_derived_render(), mesh_get_derived_final(), RenderData::mode, mul_m3_v3(), mul_m4_v4(), mul_v3_m4v3(), mult_m4_m4m4(), LinkNode::next, MVert::no, ProjPaintState::normal_angle, normal_short_to_float_v3(), normalize_m4(), normalize_v3(), NULL, ProjPaintState::ob, Object::obmat, ProjPaintImage::partRedrawRect, PROJ_BOUNDBOX_SQUARED, PROJ_BUCKET_BRUSH_DIV, PROJ_BUCKET_RECT_MAX, PROJ_BUCKET_RECT_MIN, PROJ_SRC_IMAGE_CAM, PROJ_SRC_IMAGE_VIEW, PROJ_SRC_VIEW, PROJ_VERT_CULL, PROJ_VIEW_DATA_ID, project_paint_delayed_face_init(), project_paint_face_image(), project_paint_view_clip(), ProjPaintState::projectMat, ProjPaintState::projImages, Scene::r, R_FIXED_THREADS, DerivedMesh::release, ProjPaintState::reproject_ibuf, ProjPaintState::reproject_image, ProjPaintState::rv3d, ProjPaintState::scene, ProjPaintState::screen_height, ProjPaintState::screen_width, ProjPaintState::screenCoords, ProjPaintState::screenMax, ProjPaintState::screenMin, ProjPaintState::seam_bleed_px, SET_INT_IN_POINTER, ProjPaintState::source, sub_v3_v3v3(), ProjPaintState::thread_tot, RenderData::threads, ProjPaintImage::touch, TRUE, DerivedMesh::type, MFace::v1, MFace::v2, MFace::v3, ProjPaintState::v3d, MFace::v4, ProjPaintState::vertFaces, ProjPaintState::vertFlags, ProjPaintState::viewDir, RegionView3D::viewinv, RegionView3D::viewmat, ProjPaintState::viewPos, CameraParams::winmat, ARegion::winx, ProjPaintState::winx, ARegion::winy, ProjPaintState::winy, ImBuf::x, and ImBuf::y.

Referenced by texture_paint_camera_project_exec(), and texture_paint_init().

static void project_paint_begin_clone ( ProjPaintState ps,
int  mouse[2] 
) [static]
static void project_paint_bucket_bounds ( const ProjPaintState ps,
const float  min[2],
const float  max[2],
int  bucketMin[2],
int  bucketMax[2] 
) [static]
static void project_paint_delayed_face_init ( ProjPaintState ps,
const MFace mf,
const int  face_index 
) [static]
static void project_paint_end ( ProjPaintState ps) [static]
static Image* project_paint_face_image ( const ProjPaintState ps,
MTFace dm_mtface,
int  face_index 
) [static]
static void project_paint_face_init ( const ProjPaintState ps,
const int  thread_index,
const int  bucket_index,
const int  face_index,
const int  image_index,
rctf bucket_bounds,
const ImBuf ibuf,
const short  clamp_u,
const short  clamp_v 
) [static]

Definition at line 2279 of file paint_image.c.

References ProjPaintState::arena_mt, barycentric_weights_v2(), BLI_linklist_prepend_arena(), BLI_lock_thread(), BLI_unlock_thread(), ProjPaintState::bucketFaces, ProjPaintState::bucketRect, CLAMP(), closest_to_line_v2(), MVert::co, copy_v2_v2(), copy_v3_v3(), ProjPaintState::dm_mface, ProjPaintState::dm_mtface, ProjPaintState::dm_mtface_clone, ProjPaintState::dm_mvert, ProjPaintState::do_backfacecull, ProjPaintState::do_mask_normal, ProjPaintState::do_occlude, ED_view3d_test_clipping(), ProjPaintState::faceSeamFlags, ProjPaintState::faceSeamUVs, FLT_MAX, interp_v2_v2v2(), interp_v3_v3v3(), interp_v3_v3v3v3(), ProjPaintState::is_ortho, isect_point_quad_v2(), IsectPoly2Df(), IsectPoly2Df_twoside(), len_v2v2(), line_clip_rect2f(), line_point_factor_v2(), LOCK_CUSTOM1, mul_m4_v4(), pixel_bounds_array(), pixel_bounds_uv(), PROJ_FACE_NOSEAM1, PROJ_FACE_NOSEAM2, PROJ_FACE_NOSEAM3, PROJ_FACE_NOSEAM4, PROJ_FACE_SCALE_SEAM, PROJ_FACE_SEAM1, PROJ_FACE_SEAM2, PROJ_FACE_SEAM3, PROJ_FACE_SEAM4, PROJ_GEOM_TOLERANCE, project_bucket_clip_face(), project_bucket_point_occluded(), project_face_seams_init(), project_paint_uvpixel_init(), project_paint_uvpixel_mask(), ProjPaintState::projectMat, RegionView3D::rflag, ProjPaintState::rv3d, RV3D_CLIPPING, scale_quad(), scale_tri(), screen_px_from_ortho(), screen_px_from_persp(), ProjPaintState::screenCoords, ProjPaintState::seam_bleed_px, ProjPaintState::thread_tot, MTFace::uv, uv_image_outset(), MFace::v1, MFace::v2, MFace::v3, MFace::v4, simple_enum_gen::w, ProjPaintState::winx, ProjPaintState::winy, ImBuf::x, UndoImageTile::x, rcti::xmax, rcti::xmin, ImBuf::y, UndoImageTile::y, rcti::ymax, and rcti::ymin.

Referenced by project_bucket_init().

static int project_paint_occlude_ptv ( float  pt[3],
float  v1[4],
float  v2[4],
float  v3[4],
float  w[3],
int  is_ortho 
) [static]
static int project_paint_occlude_ptv_clip ( const ProjPaintState ps,
const MFace mf,
float  pt[3],
float  v1[4],
float  v2[4],
float  v3[4],
const int  side 
) [static]
static int project_paint_op ( void *  state,
ImBuf UNUSEDibufb,
float *  lastpos,
float *  pos 
) [static]
static int project_paint_PickColor ( const ProjPaintState ps,
float  pt[2],
float *  rgba_fp,
unsigned char *  rgba,
const int  interp 
) [static]
static int project_paint_PickFace ( const ProjPaintState ps,
float  pt[2],
float  w[3],
int *  side 
) [static]
static int project_paint_stroke ( ProjPaintState ps,
BrushPainter painter,
const int  prevmval_i[2],
const int  mval_i[2],
double  time,
float  pressure 
) [static]
static int project_paint_sub_stroke ( ProjPaintState ps,
BrushPainter painter,
const int   UNUSEDprevmval_i[2],
const int  mval_i[2],
double  time,
float  pressure 
) [static]

Definition at line 4078 of file paint_image.c.

References brush_painter_paint(), and project_paint_op().

Referenced by project_paint_stroke().

static ProjPixel* project_paint_uvpixel_init ( const ProjPaintState ps,
MemArena arena,
const ImBuf ibuf,
short  x_px,
short  y_px,
const float  mask,
const int  face_index,
const int  image_index,
const float  pixelScreenCo[4],
const int  side,
const float  w[3] 
) [static]
static float project_paint_uvpixel_mask ( const ProjPaintState ps,
const int  face_index,
const int  side,
const float  w[3] 
) [static]
static int project_paint_view_clip ( View3D v3d,
RegionView3D rv3d,
float *  clipsta,
float *  clipend 
) [static]

Definition at line 2899 of file paint_image.c.

References ED_view3d_clip_range_get(), and orth().

Referenced by project_paint_begin(), and texture_paint_image_from_view_exec().

static void project_state_init ( bContext C,
Object ob,
ProjPaintState ps 
) [static]
static void rect_to_uvspace_ortho ( rctf bucket_bounds,
float *  v1coSS,
float *  v2coSS,
float *  v3coSS,
float *  uv1co,
float *  uv2co,
float *  uv3co,
float  bucket_bounds_uv[4][2],
const int  flip 
) [static]
static void rect_to_uvspace_persp ( rctf bucket_bounds,
float *  v1coSS,
float *  v2coSS,
float *  v3coSS,
float *  uv1co,
float *  uv2co,
float *  uv3co,
float  bucket_bounds_uv[4][2],
const int  flip 
) [static]
static int sample_color_exec ( bContext C,
wmOperator op 
) [static]
static int sample_color_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int sample_color_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void scale_quad ( float  insetCos[4][3],
float *  origCos[4],
const float  inset 
) [static]

Definition at line 1742 of file paint_image.c.

References add_v3_v3(), mul_v3_fl(), and sub_v3_v3v3().

Referenced by project_paint_face_init().

static void scale_tri ( float  insetCos[4][3],
float *  origCos[4],
const float  inset 
) [static]

Definition at line 1766 of file paint_image.c.

References add_v3_v3(), mul_v3_fl(), and sub_v3_v3v3().

Referenced by project_paint_face_init().

static void screen_px_from_ortho ( float  uv[2],
float  v1co[3],
float  v2co[3],
float  v3co[3],
float  uv1co[2],
float  uv2co[2],
float  uv3co[2],
float  pixelScreenCo[4],
float  w[3] 
) [static]

Definition at line 1273 of file paint_image.c.

References barycentric_weights_v2(), and interp_v3_v3v3v3().

Referenced by project_paint_face_init().

static void screen_px_from_persp ( float  uv[2],
float  v1co[4],
float  v2co[4],
float  v3co[4],
float  uv1co[2],
float  uv2co[2],
float  uv3co[2],
float  pixelScreenCo[4],
float  w[3] 
) [static]

Definition at line 1286 of file paint_image.c.

References barycentric_weights_v2(), and interp_v3_v3v3v3().

Referenced by project_paint_face_init().

static int set_clone_cursor_exec ( bContext C,
wmOperator op 
) [static]
static int set_clone_cursor_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int texpaint_break_stroke ( float *  prevuv,
float *  fwuv,
float *  bkuv,
float *  uv 
) [static]

Definition at line 4426 of file paint_image.c.

References dot_v2v2(), len_v2v2(), MAX2, and sub_v2_v2v2().

Referenced by imapaint_paint_stroke().

static int texture_paint_camera_project_exec ( bContext C,
wmOperator op 
) [static]
static int texture_paint_image_from_view_exec ( bContext C,
wmOperator op 
) [static]
static int texture_paint_init ( bContext C,
wmOperator op 
) [static]

Definition at line 4765 of file paint_image.c.

References BKE_report(), Brush::blend, ImagePaintState::blend, ProjPaintState::brush, ImagePaintState::brush, brush_painter_new(), brush_set_size(), brush_size(), CTX_data_scene(), CTX_wm_region(), CTX_wm_region_view3d(), CTX_wm_screen(), CTX_wm_space_image(), wmOperator::customdata, ProjPaintState::dm, PaintOperation::first, ImagePaintSettings::flag, get_mesh(), SpaceImage::image, ImagePaintState::image, image_undo_free(), image_undo_restore(), IMAGEPAINT_DRAWING, IMAGEPAINT_PROJECT_DISABLE, Brush::imagepaint_tool, ToolSettings::imapaint, imapaint_canvas_set(), View3D::lay, Object::lay, ImagePaintState::me, MEM_callocN(), PaintOperation::mode, wmOperatorType::name, NULL, ProjPaintState::ob, ImagePaintState::ob, OBACT, PaintOperation::orig_brush_size, ImagePaintSettings::paint, paint_brush(), paint_brush_init_tex(), PAINT_MODE_2D, PAINT_MODE_3D, PAINT_MODE_3D_PROJECT, PAINT_TOOL_CLONE, PAINT_TOOL_DRAW, PAINT_TOOL_SOFTEN, PaintOperation::painter, PROJ_SRC_VIEW, project_paint_begin(), project_state_init(), PaintOperation::ps, wmOperator::reports, PaintOperation::restore_projection, RPT_WARNING, PaintOperation::s, ImagePaintState::scene, ImagePaintState::screen, ImagePaintState::sima, ProjPaintState::source, ImagePaintState::tool, Scene::toolsettings, wmOperator::type, UNDO_PAINT_IMAGE, undo_paint_push_begin(), ARegion::v2d, ImagePaintState::v2d, ProjPaintState::v3d, PaintOperation::vc, view3d_set_viewcontext(), ImagePaintState::warnmultifile, and ImagePaintState::warnpackedfile.

Referenced by paint_exec(), and paint_invoke().

static int texture_paint_poll ( bContext C) [static]
static int texture_paint_toggle_exec ( bContext C,
wmOperator op 
) [static]
static int texture_paint_toggle_poll ( bContext C) [static]
static void toggle_paint_cursor ( bContext C,
int  enable 
) [static]
static void undo_copy_tile ( UndoImageTile tile,
ImBuf tmpibuf,
ImBuf ibuf,
int  restore 
) [static]
static void uv_image_outset ( float(*)  orig_uv[2],
float(*)  outset_uv[2],
const float  scaler,
const int  ibuf_x,
const int  ibuf_y,
const int  is_quad 
) [static]
static void uvco_to_wrapped_pxco ( float  uv[2],
int  ibuf_x,
int  ibuf_y,
float *  x,
float *  y 
) [static]

Definition at line 698 of file paint_image.c.

References fmodf.

Referenced by project_face_pixel(), and project_paint_PickColor().

static float VecZDepthOrtho ( float  pt[2],
float  v1[3],
float  v2[3],
float  v3[3],
float  w[3] 
) [static]

Definition at line 596 of file paint_image.c.

References barycentric_weights_v2().

Referenced by project_paint_occlude_ptv(), and project_paint_PickFace().

static float VecZDepthPersp ( float  pt[2],
float  v1[4],
float  v2[4],
float  v3[4],
float  w[3] 
) [static]

Definition at line 602 of file paint_image.c.

References barycentric_weights_v2_persp().

Referenced by project_paint_occlude_ptv(), and project_paint_PickFace().

int vert_paint_poll ( bContext C)

Variable Documentation

ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0} [static]

Definition at line 390 of file paint_image.c.