Blender  V3.3
Functions
paint_utils.c File Reference
#include <math.h>
#include <stdlib.h>
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_brush_types.h"
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_mesh_runtime.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "GPU_framebuffer.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "GPU_texture.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "RE_texture.h"
#include "ED_image.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "BLI_sys_types.h"
#include "ED_mesh.h"
#include "DRW_select_buffer.h"
#include "WM_api.h"
#include "WM_types.h"
#include "paint_intern.h"

Go to the source code of this file.

Functions

bool paint_convert_bb_to_rect (rcti *rect, const float bb_min[3], const float bb_max[3], const ARegion *region, RegionView3D *rv3d, Object *ob)
 
void paint_calc_redraw_planes (float planes[4][4], const ARegion *region, Object *ob, const rcti *screen_rect)
 
float paint_calc_object_space_radius (ViewContext *vc, const float center[3], float pixel_radius)
 
float paint_get_tex_pixel (const MTex *mtex, float u, float v, struct ImagePool *pool, int thread)
 
void paint_get_tex_pixel_col (const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert_to_linear, struct ColorSpace *colorspace)
 
void paint_stroke_operator_properties (wmOperatorType *ot)
 
static void imapaint_project (const float matrix[4][4], const float co[3], float pco[4])
 
static void imapaint_tri_weights (float matrix[4][4], const int view[4], const float v1[3], const float v2[3], const float v3[3], const float co[2], float w[3])
 
static void imapaint_pick_uv (Mesh *me_eval, Scene *scene, Object *ob_eval, uint faceindex, const int xy[2], float uv[2])
 
static int imapaint_pick_face (ViewContext *vc, const int mval[2], uint *r_index, uint totpoly)
 
void paint_sample_color (bContext *C, ARegion *region, int x, int y, bool texpaint_proj, bool use_palette)
 
static int brush_curve_preset_exec (bContext *C, wmOperator *op)
 
static bool brush_curve_preset_poll (bContext *C)
 
void BRUSH_OT_curve_preset (wmOperatorType *ot)
 
static int paint_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
 
void PAINT_OT_face_select_linked (wmOperatorType *ot)
 
static int paint_select_linked_pick_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void PAINT_OT_face_select_linked_pick (wmOperatorType *ot)
 
static int face_select_all_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_face_select_all (wmOperatorType *ot)
 
static int vert_select_all_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_vert_select_all (wmOperatorType *ot)
 
static int vert_select_ungrouped_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_vert_select_ungrouped (wmOperatorType *ot)
 
static int face_select_hide_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_face_select_hide (wmOperatorType *ot)
 
static int vert_select_hide_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_vert_select_hide (wmOperatorType *ot)
 
static int face_vert_reveal_exec (bContext *C, wmOperator *op)
 
static bool face_vert_reveal_poll (bContext *C)
 
void PAINT_OT_face_vert_reveal (wmOperatorType *ot)
 

Function Documentation

◆ brush_curve_preset_exec()

static int brush_curve_preset_exec ( bContext C,
wmOperator op 
)
static

◆ brush_curve_preset_poll()

static bool brush_curve_preset_poll ( bContext C)
static

Definition at line 573 of file paint_utils.c.

References BKE_paint_brush(), BKE_paint_get_active_from_context(), C, and Brush::curve.

Referenced by BRUSH_OT_curve_preset().

◆ BRUSH_OT_curve_preset()

void BRUSH_OT_curve_preset ( wmOperatorType ot)

◆ face_select_all_exec()

static int face_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ face_select_hide_exec()

static int face_select_hide_exec ( bContext C,
wmOperator op 
)
static

◆ face_vert_reveal_exec()

static int face_vert_reveal_exec ( bContext C,
wmOperator op 
)
static

◆ face_vert_reveal_poll()

static bool face_vert_reveal_poll ( bContext C)
static

◆ imapaint_pick_face()

static int imapaint_pick_face ( ViewContext vc,
const int  mval[2],
uint r_index,
uint  totpoly 
)
static

◆ imapaint_pick_uv()

static void imapaint_pick_uv ( Mesh me_eval,
Scene scene,
Object ob_eval,
uint  faceindex,
const int  xy[2],
float  uv[2] 
)
static

◆ imapaint_project()

static void imapaint_project ( const float  matrix[4][4],
const float  co[3],
float  pco[4] 
)
static

Definition at line 220 of file paint_utils.c.

References copy_v3_v3(), and mul_m4_v4().

Referenced by imapaint_tri_weights().

◆ imapaint_tri_weights()

static void imapaint_tri_weights ( float  matrix[4][4],
const int  view[4],
const float  v1[3],
const float  v2[3],
const float  v3[3],
const float  co[2],
float  w[3] 
)
static

Definition at line 228 of file paint_utils.c.

References copy_v3_v3(), imapaint_project(), invert_m3_m3(), mul_m3_v3(), mul_v3_fl(), v1, v2, view, and w().

Referenced by imapaint_pick_uv().

◆ paint_calc_object_space_radius()

float paint_calc_object_space_radius ( ViewContext vc,
const float  center[3],
float  pixel_radius 
)

◆ paint_calc_redraw_planes()

void paint_calc_redraw_planes ( float  planes[4][4],
const ARegion region,
Object ob,
const rcti screen_rect 
)

Definition at line 112 of file paint_utils.c.

References ED_view3d_clipping_calc(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

◆ paint_convert_bb_to_rect()

bool paint_convert_bb_to_rect ( rcti rect,
const float  bb_min[3],
const float  bb_max[3],
const ARegion region,
RegionView3D rv3d,
Object ob 
)

◆ paint_get_tex_pixel()

float paint_get_tex_pixel ( const MTex mtex,
float  u,
float  v,
struct ImagePool pool,
int  thread 
)

Definition at line 147 of file paint_utils.c.

References blender::compositor::pool, RE_texture_evaluate(), and v.

◆ paint_get_tex_pixel_col()

void paint_get_tex_pixel_col ( const MTex mtex,
float  u,
float  v,
float  rgba[4],
struct ImagePool pool,
int  thread,
bool  convert_to_linear,
struct ColorSpace colorspace 
)

◆ PAINT_OT_face_select_all()

void PAINT_OT_face_select_all ( wmOperatorType ot)

◆ PAINT_OT_face_select_hide()

void PAINT_OT_face_select_hide ( wmOperatorType ot)

◆ PAINT_OT_face_select_linked()

void PAINT_OT_face_select_linked ( wmOperatorType ot)

◆ PAINT_OT_face_select_linked_pick()

void PAINT_OT_face_select_linked_pick ( wmOperatorType ot)

◆ PAINT_OT_face_vert_reveal()

void PAINT_OT_face_vert_reveal ( wmOperatorType ot)

◆ PAINT_OT_vert_select_all()

void PAINT_OT_vert_select_all ( wmOperatorType ot)

◆ PAINT_OT_vert_select_hide()

void PAINT_OT_vert_select_hide ( wmOperatorType ot)

◆ PAINT_OT_vert_select_ungrouped()

void PAINT_OT_vert_select_ungrouped ( wmOperatorType ot)

◆ paint_sample_color()

void paint_sample_color ( struct bContext C,
struct ARegion region,
int  x,
int  y,
bool  texpaint_proj,
bool  palette 
)

Used for both 3D view and image window.

Definition at line 374 of file paint_utils.c.

References Palette::active_color, bilinear_interpolation_color_wrap(), BKE_brush_color_set(), BKE_image_acquire_ibuf(), BKE_image_get_tile_from_pos(), BKE_image_release_ibuf(), BKE_imageuser_default(), BKE_object_material_get(), BKE_paint_brush(), BKE_paint_get_active_from_context(), BKE_paint_palette(), BKE_paint_palette_set(), BKE_palette_add(), BKE_palette_color_add(), BKE_texpaint_slot_refresh_cache(), BLI_listbase_count(), C, ImagePaintSettings::canvas, CD_MASK_BAREMESH, CD_MASK_ORIGINDEX, CD_MLOOPUV, CLAMP, color, Palette::colors, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_space_image(), CTX_wm_view3d(), CustomData_has_layer(), Object::data, DEG_get_evaluated_object(), depsgraph, ED_space_image_color_sample(), ED_view3d_viewcontext_init(), fmodf, ImageUser::framenr, GPU_DATA_FLOAT, GPU_frontbuffer_read_pixels(), TexPaintSlot::ima, IMA_SRC_TILED, image(), IMAGEPAINT_MODE_MATERIAL, ToolSettings::imapaint, imapaint_pick_face(), imapaint_pick_uv(), interp(), TexPaintSlot::interp, ImagePaintSettings::interp, linearrgb_to_srgb_v3_v3(), MPoly::mat_nr, mesh_get_eval_final(), ImagePaintSettings::mode, nearest_interpolation_color_wrap(), NULL, OBACT, Material::paint_active_slot, CustomData_MeshMasks::pmask, ImBuf::rect, ImBuf::rect_float, rgb_uchar_to_float(), usdtokens::rgba(), scene, SHD_INTERP_CLOSEST, SHD_INTERP_LINEAR, straight_to_premul_v4(), Material::texpaintslot, ImageUser::tile, Scene::toolsettings, Mesh::totpoly, v, view3d_operator_needs_opengl(), ARegion::winrct, ARegion::winx, ARegion::winy, x, ImBuf::x, rcti::xmin, y, ImBuf::y, and rcti::ymin.

Referenced by sample_color_exec(), sample_color_invoke(), and sample_color_modal().

◆ paint_select_linked_exec()

static int paint_select_linked_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ paint_select_linked_pick_invoke()

static int paint_select_linked_pick_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ paint_stroke_operator_properties()

void paint_stroke_operator_properties ( wmOperatorType ot)

◆ vert_select_all_exec()

static int vert_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ vert_select_hide_exec()

static int vert_select_hide_exec ( bContext C,
wmOperator op 
)
static

◆ vert_select_ungrouped_exec()

static int vert_select_ungrouped_exec ( bContext C,
wmOperator op 
)
static