48#include "RNA_prototypes.hh"
68 const float bb_min[3],
69 const float bb_max[3],
79 if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2]) {
85 for (
i = 0;
i < 2;
i++) {
86 for (j = 0; j < 2; j++) {
87 for (k = 0; k < 2; k++) {
90 vec[0] =
i ? bb_min[0] : bb_max[0];
91 vec[1] = j ? bb_min[1] : bb_max[1];
92 vec[2] = k ? bb_min[2] : bb_max[2];
113 const rcti &screen_rect)
130 const float pixel_radius)
133 float delta[3], scale, loc[3];
134 const float xy_delta[2] = {pixel_radius, 0.0f};
136 mul_v3_m4v3(loc, ob->object_to_world().ptr(), center);
142 scale = (scale == 0.0f) ? 1.0f : scale;
144 return len_v3(delta) / scale;
156 const float co[3] = {u,
v, 0.0f};
159 mtex, co,
thread, pool,
false,
false, &intensity, r_rgba);
160 *r_intensity = intensity;
163 r_rgba[0] = intensity;
164 r_rgba[1] = intensity;
165 r_rgba[2] = intensity;
180 "Invert action of brush for duration of stroke"},
185 "Switch brush to smooth mode for duration of stroke"},
190 "Switch brush to erase mode for duration of stroke"},
204 "Action taken when a paint stroke is made");
211 ot->srna,
"pen_flip",
false,
"Pen Flip",
"Whether a tablet's eraser mode is being used");
233 const int face_i = tri_faces[tri_index];
235 const float(*mloopuv)[2];
242 material_indices ==
nullptr ? 1 : material_indices[face_i] + 1);
245 if (!(slot && slot->
uvname &&
249 mloopuv =
static_cast<const float(*)[2]
>(
254 mloopuv =
static_cast<const float(*)[2]
>(
277 float3 start_world, end_world;
281 const float4x4 &world_to_object = vc->
obact->world_to_object();
297 if (ray_hit.
index == -1) {
302 mesh.vert_positions(), mesh.corner_verts(), mesh.corner_tris()[ray_hit.
index], ray_hit.
co);
304 *r_tri_index = ray_hit.
index;
305 *r_face_index = mesh.corner_tri_faces()[ray_hit.
index];
336 if (v3d && texpaint_proj) {
353 const int mval[2] = {
x,
y};
360 &vc, mval, &tri_index, &faceindex, &bary_coord, *mesh_eval) &&
361 !hide_poly[faceindex];
364 Image *image =
nullptr;
370 ob_eval, material_indices ? material_indices[faceindex] + 1 : 1);
403 float u = uv[0] * ibuf->
x;
404 float v = uv[1] * ibuf->
y;
443 else if (sima !=
nullptr) {
497 return br && br->
curve;
507 {0,
nullptr, 0,
nullptr,
nullptr},
513 ot->description =
"Set brush shape";
514 ot->idname =
"BRUSH_OT_curve_preset";
544 ot->name =
"Curve Falloff Preset";
545 ot->description =
"Set Curve Falloff Preset";
546 ot->idname =
"BRUSH_OT_sculpt_curves_falloff_preset";
567 ot->name =
"Select Linked";
568 ot->description =
"Select linked faces";
569 ot->idname =
"PAINT_OT_face_select_linked";
590 ot->name =
"Select Linked Pick";
591 ot->description =
"Select linked faces under the cursor";
592 ot->idname =
"PAINT_OT_face_select_linked_pick";
599 RNA_def_boolean(
ot->srna,
"deselect",
false,
"Deselect",
"Deselect rather than select items");
614 ot->name =
"(De)select All";
615 ot->description =
"Change selection for all faces";
616 ot->idname =
"PAINT_OT_face_select_all";
630 if (mesh ==
nullptr || mesh->
faces_num == 0) {
644 ot->name =
"Select More";
645 ot->description =
"Select Faces connected to existing selection";
646 ot->idname =
"PAINT_OT_face_select_more";
654 ot->srna,
"face_step",
true,
"Face Step",
"Also select faces that only touch on a corner");
661 if (mesh ==
nullptr || mesh->
faces_num == 0) {
675 ot->name =
"Select Less";
676 ot->description =
"Deselect Faces connected to existing selection";
677 ot->idname =
"PAINT_OT_face_select_less";
685 ot->srna,
"face_step",
true,
"Face Step",
"Also deselect faces that only touch on a corner");
705 ot->name =
"Select Loop";
706 ot->description =
"Select face loop under the cursor";
707 ot->idname =
"PAINT_OT_face_select_loop";
714 RNA_def_boolean(
ot->srna,
"select",
true,
"Select",
"If false, faces will be deselected");
729 ot->name =
"(De)select All";
730 ot->description =
"Change selection for all vertices";
731 ot->idname =
"PAINT_OT_vert_select_all";
760 ot->name =
"Select Ungrouped";
761 ot->idname =
"PAINT_OT_vert_select_ungrouped";
762 ot->description =
"Select vertices without a group";
783 ot->name =
"Select Linked Vertices";
784 ot->description =
"Select linked vertices";
785 ot->idname =
"PAINT_OT_vert_select_linked";
807 ot->name =
"Select Linked Vertices Pick";
808 ot->description =
"Select linked vertices under the cursor";
809 ot->idname =
"PAINT_OT_vert_select_linked_pick";
820 "Whether to select or deselect linked vertices under the cursor");
827 if (mesh ==
nullptr || mesh->
faces_num == 0) {
843 ot->name =
"Select More";
844 ot->description =
"Select Vertices connected to existing selection";
845 ot->idname =
"PAINT_OT_vert_select_more";
853 ot->srna,
"face_step",
true,
"Face Step",
"Also select faces that only touch on a corner");
860 if (mesh ==
nullptr || mesh->
faces_num == 0) {
876 ot->name =
"Select Less";
877 ot->description =
"Deselect Vertices connected to existing selection";
878 ot->idname =
"PAINT_OT_vert_select_less";
886 ot->srna,
"face_step",
true,
"Face Step",
"Also deselect faces that only touch on a corner");
900 ot->name =
"Face Select Hide";
901 ot->description =
"Hide selected faces";
902 ot->idname =
"PAINT_OT_face_select_hide";
910 ot->srna,
"unselected",
false,
"Unselected",
"Hide unselected rather than selected objects");
924 ot->name =
"Vertex Select Hide";
925 ot->description =
"Hide selected vertices";
926 ot->idname =
"PAINT_OT_vert_select_hide";
937 "Hide unselected rather than selected vertices");
966 ot->name =
"Reveal Faces/Vertices";
967 ot->description =
"Reveal hidden faces and vertices";
968 ot->idname =
"PAINT_OT_face_vert_reveal";
979 "Specifies whether the newly revealed geometry should be selected");
void BKE_brush_color_set(Scene *scene, const Paint *paint, Brush *brush, const float color[3])
void BKE_brush_curve_preset(Brush *b, eCurveMappingPreset preset)
void BKE_brush_tag_unsaved_changes(Brush *brush)
SpaceImage * CTX_wm_space_image(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_imageuser_default(ImageUser *iuser)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
General operations, lookup, etc. for materials.
void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const Object *ob)
Material * BKE_object_material_get(Object *ob, short act)
Mesh * BKE_mesh_from_object(Object *ob)
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
PaletteColor * BKE_palette_color_add(Palette *palette)
void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *view_layer, CurveMapping *curve)
bool BKE_paint_always_hide_test(const Object *ob)
bool BKE_paint_select_elem_test(const Object *ob)
bool BKE_paint_select_vert_test(const Object *ob)
Paint * BKE_paint_get_active_from_context(const bContext *C)
Palette * BKE_palette_add(Main *bmain, const char *name)
Brush * BKE_paint_brush(Paint *paint)
Palette * BKE_paint_palette(Paint *paint)
void BKE_paint_palette_set(Paint *paint, Palette *palette)
void BKE_report(ReportList *reports, eReportType type, const char *message)
int BLI_bvhtree_ray_cast(const BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void straight_to_premul_v4(float color[4])
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])
float mat4_to_scale(const float mat[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
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_LEGACY
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Object is a sort of wrapper for general info.
#define IMAGEPAINT_MODE_MATERIAL
@ PAINT_CANVAS_SOURCE_MATERIAL
bool ED_space_image_color_sample(SpaceImage *sima, ARegion *region, const int mval[2], float r_col[3], bool *r_is_data)
void paintvert_reveal(bContext *C, Object *ob, bool select)
void paintvert_select_more(Mesh *mesh, bool face_step)
void paintvert_select_less(Mesh *mesh, bool face_step)
void paintvert_flush_flags(Object *ob)
void paintface_select_less(Mesh *mesh, bool face_step)
void paintvert_tag_select_update(bContext *C, Object *ob)
void paintvert_hide(bContext *C, Object *ob, bool unselected)
void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
void paintface_reveal(bContext *C, Object *ob, bool select)
void paintface_flush_flags(bContext *C, Object *ob, bool flush_selection, bool flush_hidden)
bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
void paintvert_select_linked(bContext *C, Object *ob)
void paintvert_select_linked_pick(bContext *C, Object *ob, const int region_coordinates[2], bool select)
void paintface_select_linked(bContext *C, Object *ob, const int mval[2], bool select)
void paintface_select_loop(bContext *C, Object *ob, const int mval[2], bool select)
void paintface_hide(bContext *C, Object *ob, bool unselected)
bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool flush_flags)
void paintface_select_more(Mesh *mesh, bool face_step)
void ED_region_tag_redraw(ARegion *region)
blender::float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const blender::float4x4 &mat)
void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
bool ED_view3d_win_to_segment_clipped(const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_end[3], bool do_clip_planes)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
void view3d_operator_needs_gpu(const bContext *C)
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
VecBase< float, 4 > float4
ccl_device_inline float interp(const float a, const float b, const float t)
static BMFace * face_step(BMEdge *edge, BMFace *f)
float3 compute_bary_coord_in_triangle(Span< float3 > vert_positions, Span< int > corner_verts, const int3 &corner_tri, const float3 &position)
T sample_corner_attribute_with_bary_coords(const float3 &bary_weights, const int3 &corner_tri, const Span< T > corner_attribute)
uchar4 interpolate_nearest_wrap_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_bilinear_wrap_byte(const ImBuf *in, float u, float v)
float4 interpolate_nearest_wrap_fl(const ImBuf *in, float u, float v)
float4 interpolate_bilinear_wrap_fl(const ImBuf *in, float u, float v)
T clamp(const T &a, const T &min, const T &max)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3
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)
static blender::float2 imapaint_pick_uv(const Mesh *mesh_eval, Scene *scene, Object *ob_eval, const int tri_index, const blender::float3 &bary_coord)
void PAINT_OT_face_select_more(wmOperatorType *ot)
void PAINT_OT_vert_select_less(wmOperatorType *ot)
static bool brush_sculpt_curves_falloff_preset_poll(bContext *C)
static wmOperatorStatus paintface_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool paint_convert_bb_to_rect(rcti *rect, const float bb_min[3], const float bb_max[3], const ARegion ®ion, const RegionView3D &rv3d, const Object &ob)
void PAINT_OT_face_select_hide(wmOperatorType *ot)
void PAINT_OT_face_select_loop(wmOperatorType *ot)
static int imapaint_pick_face(ViewContext *vc, const int mval[2], int *r_tri_index, int *r_face_index, blender::float3 *r_bary_coord, const Mesh &mesh)
void PAINT_OT_vert_select_linked(wmOperatorType *ot)
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
static wmOperatorStatus face_select_all_exec(bContext *C, wmOperator *op)
static wmOperatorStatus face_select_hide_exec(bContext *C, wmOperator *op)
void PAINT_OT_vert_select_linked_pick(wmOperatorType *ot)
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
static wmOperatorStatus paintvert_select_less_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paint_select_less_exec(bContext *C, wmOperator *op)
void BRUSH_OT_sculpt_curves_falloff_preset(wmOperatorType *ot)
static wmOperatorStatus vert_select_ungrouped_exec(bContext *C, wmOperator *op)
void BRUSH_OT_curve_preset(wmOperatorType *ot)
static const EnumPropertyItem prop_shape_items[]
void PAINT_OT_face_select_less(wmOperatorType *ot)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
static wmOperatorStatus brush_curve_preset_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paintvert_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void PAINT_OT_face_select_all(wmOperatorType *ot)
static wmOperatorStatus paintvert_select_more_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_linked(wmOperatorType *ot)
static bool face_vert_reveal_poll(bContext *C)
static wmOperatorStatus brush_sculpt_curves_falloff_preset_exec(bContext *C, wmOperator *op)
void paint_calc_redraw_planes(float planes[4][4], const ARegion ®ion, const Object &ob, const rcti &screen_rect)
static wmOperatorStatus paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus vert_select_hide_exec(bContext *C, wmOperator *op)
static wmOperatorStatus vert_select_all_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paintvert_select_linked_exec(bContext *C, wmOperator *)
void PAINT_OT_vert_select_hide(wmOperatorType *ot)
void PAINT_OT_vert_select_more(wmOperatorType *ot)
bool paint_get_tex_pixel(const MTex *mtex, float u, float v, ImagePool *pool, int thread, float *r_intensity, float r_rgba[4])
static wmOperatorStatus face_vert_reveal_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_vert_reveal(wmOperatorType *ot)
void paint_stroke_operator_properties(wmOperatorType *ot)
static wmOperatorStatus paint_select_more_exec(bContext *C, wmOperator *op)
float paint_calc_object_space_radius(const ViewContext &vc, const blender::float3 ¢er, const float pixel_radius)
static wmOperatorStatus paint_select_linked_exec(bContext *C, wmOperator *)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int 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)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, 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)
struct CurveMapping * curve_parameter_falloff
struct CurveMapping * curve
struct BrushCurvesSculptSettings * curves_sculpt_settings
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
struct TexPaintSlot * texpaintslot
ListBase vertex_group_names
struct ToolSettings * toolsettings
BVHTree_RayCastCallback raycast_callback
struct ReportList * reports
bool RE_texture_evaluate(const MTex *mtex, const float vec[3], const int thread, ImagePool *pool, const bool skip_load_image, const bool texnode_preview, float *r_intensity, float r_rgba[4])
bool WM_window_pixels_read_sample(bContext *C, wmWindow *win, const int pos[2], float r_col[3])
void WM_operator_properties_select_all(wmOperatorType *ot)