87 const float bb_min[3],
88 const float bb_max[3],
93 float projection_mat[4][4];
99 if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2]) {
105 for (i = 0; i < 2; i++) {
106 for (j = 0; j < 2; j++) {
107 for (k = 0; k < 2; k++) {
108 float vec[3], proj[2];
110 vec[0] = i ? bb_min[0] : bb_max[0];
111 vec[1] = j ? bb_min[1] : bb_max[1];
112 vec[2] = k ? bb_min[2] : bb_max[2];
136 const rcti *screen_rect)
154 float delta[3], scale, loc[3];
155 const float mval_f[2] = {pixel_radius, 0.0f};
164 scale = (scale == 0.0f) ? 1.0f : scale;
166 return len_v3(delta) / scale;
173 const float co[3] = {u,
v, 0.0f};
186 bool convert_to_linear,
189 const float co[3] = {u,
v, 0.0f};
201 if (convert_to_linear) {
218 "Invert action of brush for duration of stroke"},
223 "Switch brush to smooth mode for duration of stroke"},
237 "Action taken when a paint stroke is made");
258 float pv1[4], pv2[4], pv3[4], h[3], divw;
259 float wmat[3][3], invwmat[3][3];
269 h[0] = (co[0] -
view[0]) * 2.0f /
view[2] - 1.0f;
270 h[1] = (co[1] -
view[1]) * 2.0f /
view[3] - 1.0f;
292 divw =
w[0] +
w[1] +
w[2];
303 float p[2],
w[3], absw, minabsw;
304 float matrix[4][4], proj[4][4];
329 for (i = 0; i < tottri; i++, lt++) {
330 findex = index_mp_to_orig ? index_mp_to_orig[lt->
poly] : lt->
poly;
332 if (findex == faceindex) {
338 for (
int j = 3; j--;) {
349 if (!(slot && slot->
uvname &&
358 tri_uv[0] = &mloopuv[lt->
tri[0]];
359 tri_uv[1] = &mloopuv[lt->
tri[1]];
360 tri_uv[2] = &mloopuv[lt->
tri[2]];
367 if (absw < minabsw) {
368 uv[0] = tri_uv[0]->
uv[0] *
w[0] + tri_uv[1]->
uv[0] *
w[1] + tri_uv[2]->
uv[0] *
w[2];
369 uv[1] = tri_uv[0]->
uv[1] *
w[0] + tri_uv[1]->
uv[1] *
w[1] + tri_uv[2]->
uv[1] *
w[2];
387 if ((*r_index) == 0 || (*r_index) > (
uint)totpoly) {
431 float axis[3],
angle;
479 if (v3d && texpaint_proj) {
494 const int mval[2] = {
x,
y};
530 u =
fmodf(uv[0], 1.0f);
580 else if (sima !=
NULL) {
633 return br && br->
curve;
651 ot->
idname =
"BRUSH_OT_curve_preset";
670 ot->
name =
"Select Linked";
672 ot->
idname =
"PAINT_OT_face_select_linked";
691 ot->
name =
"Select Linked Pick";
693 ot->
idname =
"PAINT_OT_face_select_linked_pick";
715 ot->
name =
"(De)select All";
717 ot->
idname =
"PAINT_OT_face_select_all";
738 ot->
name =
"(De)select All";
740 ot->
idname =
"PAINT_OT_vert_select_all";
769 ot->
name =
"Select Ungrouped";
770 ot->
idname =
"PAINT_OT_vert_select_ungrouped";
794 ot->
name =
"Face Select Hide";
796 ot->
idname =
"PAINT_OT_face_select_hide";
804 ot->
srna,
"unselected", 0,
"Unselected",
"Hide unselected rather than selected objects");
818 ot->
name =
"Face Select Reveal";
820 ot->
idname =
"PAINT_OT_face_select_reveal";
void BKE_brush_curve_preset(struct Brush *b, enum eCurveMappingPreset preset)
void BKE_brush_color_set(struct Scene *scene, struct Brush *brush, const float color[3])
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
bool CustomData_has_layer(const struct CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_BAREMESH
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
void * CustomData_get_layer(const struct CustomData *data, int type)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
void BKE_imageuser_default(struct ImageUser *iuser)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
struct Mesh * mesh_get_eval_final(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh)
struct Palette * BKE_paint_palette(struct Paint *paint)
struct Palette * BKE_palette_add(struct Main *bmain, const char *name)
void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct ViewLayer *view_layer, struct CurveMapping *curve)
struct Brush * BKE_paint_brush(struct Paint *paint)
void BKE_paint_palette_set(struct Paint *p, struct Palette *palette)
struct Paint * BKE_paint_get_active_from_context(const struct bContext *C)
struct PaletteColor * BKE_palette_color_add(struct Palette *palette)
void BKE_report(ReportList *reports, ReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void straight_to_premul_v4(float color[4])
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_m4_v4(const float M[4][4], float r[4])
bool invert_m3_m3(float R[3][3], const float A[3][3])
float mat4_to_scale(const float M[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void axis_angle_normalized_to_quat(float r[4], const float axis[3], const float angle)
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void clamp_v4(float vec[4], const float min, const float max)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void BLI_rcti_init_minmax(struct rcti *rect)
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
#define BLT_I18NCONTEXT_ID_CURVE
struct Depsgraph Depsgraph
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define CD_MASK_ORIGINDEX
Object is a sort of wrapper for general info.
@ IMAGEPAINT_MODE_MATERIAL
#define OBACT(_view_layer)
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2])
bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *region, int mval[2], float r_col[3], bool *r_is_data)
bool paintvert_deselect_all_visible(struct Object *ob, int action, bool flush_flags)
void paintface_hide(struct bContext *C, struct Object *ob, const bool unselected)
void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select)
bool paintface_deselect_all_visible(struct bContext *C, struct Object *ob, int action, bool flush_flags)
void paintvert_tag_select_update(struct bContext *C, struct Object *ob)
void paintvert_select_ungrouped(struct Object *ob, bool extend, bool flush_flags)
void paintface_reveal(struct bContext *C, struct Object *ob, const bool select)
void ED_region_tag_redraw(struct ARegion *region)
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float r_pmat[4][4])
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc, struct Depsgraph *depsgraph)
void ED_view3d_win_to_delta(const struct ARegion *region, const float mval[2], float out[3], const float zfac)
void ED_view3d_select_id_validate(struct ViewContext *vc)
void ED_view3d_project_float_v2_m4(const struct ARegion *region, const float co[3], float r_co[2], float mat[4][4])
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], const struct ARegion *region, const struct Object *ob, const struct rcti *rect)
void view3d_operator_needs_opengl(const struct bContext *C)
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip)
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
#define GPU_matrix_model_view_get(x)
#define GPU_matrix_projection_get(x)
void GPU_viewport_size_get_i(int coords[4])
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace)
void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Contains defines and structs used throughout the imbuf module.
Group RGB to Bright Vector Camera CLAMP
StructRNA RNA_OperatorStrokeElement
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
const Depsgraph * depsgraph
void GPU_frontbuffer_read_pixels(int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data)
bool vert_paint_poll(bContext *C)
bool facemask_paint_poll(bContext *C)
void paint_sample_color(bContext *C, ARegion *region, int x, int y, bool texpaint_proj, bool use_palette)
static bool brush_curve_preset_poll(bContext *C)
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)
static int face_select_reveal_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_hide(wmOperatorType *ot)
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
float paint_calc_object_space_radius(ViewContext *vc, const float center[3], float pixel_radius)
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
void flip_qt_qt(float out[4], const float in[4], const ePaintSymmetryFlags symm)
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
float paint_get_tex_pixel(const MTex *mtex, float u, float v, struct ImagePool *pool, int thread)
void BRUSH_OT_curve_preset(wmOperatorType *ot)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
static int face_select_hide_exec(bContext *C, wmOperator *op)
static int face_select_all_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_all(wmOperatorType *ot)
static int imapaint_pick_face(ViewContext *vc, const int mval[2], uint *r_index, uint totpoly)
void PAINT_OT_face_select_linked(wmOperatorType *ot)
void flip_v3_v3(float out[3], const float in[3], const ePaintSymmetryFlags symm)
static int vert_select_ungrouped_exec(bContext *C, wmOperator *op)
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])
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_OT_face_select_reveal(wmOperatorType *ot)
static void imapaint_pick_uv(Mesh *me_eval, Scene *scene, Object *ob_eval, uint faceindex, const int xy[2], float uv[2])
static Image * imapaint_face_image(Object *ob, Mesh *me, int face_index)
static void imapaint_project(const float matrix[4][4], const float co[3], float pco[4])
void paint_calc_redraw_planes(float planes[4][4], const ARegion *region, Object *ob, const rcti *screen_rect)
static int vert_select_all_exec(bContext *C, wmOperator *op)
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void paint_stroke_operator_properties(wmOperatorType *ot)
static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct CurveMapping * curve
struct TexPaintSlot * texpaintslot
struct MLoopTri_Store looptris
struct CustomData pdata ldata
struct MDeformVert * dvert
struct ToolSettings * toolsettings
struct Depsgraph * depsgraph
struct RegionView3D * rv3d
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
bool RE_texture_evaluate(const MTex *mtex, const float vec[3], const int thread, struct ImagePool *pool, const bool skip_load_image, const bool texnode_preview, float *r_intensity, float r_rgba[4])
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
void WM_operator_properties_select_all(wmOperatorType *ot)