49#include "RNA_prototypes.hh"
70 const float bb_min[3],
71 const float bb_max[3],
81 if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2]) {
87 for (i = 0; i < 2; i++) {
88 for (j = 0; j < 2; j++) {
89 for (k = 0; k < 2; k++) {
92 vec[0] = i ? bb_min[0] : bb_max[0];
93 vec[1] = j ? bb_min[1] : bb_max[1];
94 vec[2] = k ? bb_min[2] : bb_max[2];
115 const rcti &screen_rect)
132 const float pixel_radius)
135 float delta[3], scale, loc[3];
136 const float xy_delta[2] = {pixel_radius, 0.0f};
138 mul_v3_m4v3(loc, ob->object_to_world().ptr(), center);
144 scale = (scale == 0.0f) ? 1.0f : scale;
146 return len_v3(delta) / scale;
158 const float co[3] = {u,
v, 0.0f};
161 mtex, co,
thread, pool,
false,
false, &intensity, r_rgba);
162 *r_intensity = intensity;
165 r_rgba[0] = intensity;
166 r_rgba[1] = intensity;
167 r_rgba[2] = intensity;
182 "Invert action of brush for duration of stroke"},
187 "Switch brush to smooth mode for duration of stroke"},
192 "Switch brush to erase mode for duration of stroke"},
206 "Action taken when a paint stroke is made");
228 const int face_i = tri_faces[tri_index];
230 const float(*mloopuv)[2];
237 material_indices ==
nullptr ? 1 : material_indices[face_i] + 1);
240 if (!(slot && slot->
uvname &&
244 mloopuv =
static_cast<const float(*)[2]
>(
249 mloopuv =
static_cast<const float(*)[2]
>(
272 float3 start_world, end_world;
276 const float4x4 &world_to_object = vc->
obact->world_to_object();
294 if (ray_hit.index == -1) {
299 mesh.vert_positions(), mesh.corner_verts(), mesh.corner_tris()[ray_hit.index], ray_hit.co);
301 *r_tri_index = ray_hit.index;
302 *r_face_index = mesh.corner_tri_faces()[ray_hit.index];
333 if (v3d && texpaint_proj) {
350 const int mval[2] = {
x,
y};
361 ob_eval, material_indices ? material_indices[faceindex] + 1 : 1);
394 float u = uv[0] * ibuf->
x;
395 float v = uv[1] * ibuf->
y;
434 else if (sima !=
nullptr) {
488 return br && br->
curve;
498 {0,
nullptr, 0,
nullptr,
nullptr},
504 ot->description =
"Set brush shape";
505 ot->idname =
"BRUSH_OT_curve_preset";
535 ot->name =
"Curve Falloff Preset";
536 ot->description =
"Set Curve Falloff Preset";
537 ot->idname =
"BRUSH_OT_sculpt_curves_falloff_preset";
558 ot->name =
"Select Linked";
559 ot->description =
"Select linked faces";
560 ot->idname =
"PAINT_OT_face_select_linked";
579 ot->name =
"Select Linked Pick";
580 ot->description =
"Select linked faces under the cursor";
581 ot->idname =
"PAINT_OT_face_select_linked_pick";
588 RNA_def_boolean(
ot->srna,
"deselect",
false,
"Deselect",
"Deselect rather than select items");
603 ot->name =
"(De)select All";
604 ot->description =
"Change selection for all faces";
605 ot->idname =
"PAINT_OT_face_select_all";
619 if (mesh ==
nullptr || mesh->
faces_num == 0) {
633 ot->name =
"Select More";
634 ot->description =
"Select Faces connected to existing selection";
635 ot->idname =
"PAINT_OT_face_select_more";
643 ot->srna,
"face_step",
true,
"Face Step",
"Also select faces that only touch on a corner");
650 if (mesh ==
nullptr || mesh->
faces_num == 0) {
664 ot->name =
"Select Less";
665 ot->description =
"Deselect Faces connected to existing selection";
666 ot->idname =
"PAINT_OT_face_select_less";
674 ot->srna,
"face_step",
true,
"Face Step",
"Also deselect faces that only touch on a corner");
692 ot->name =
"Select Loop";
693 ot->description =
"Select face loop under the cursor";
694 ot->idname =
"PAINT_OT_face_select_loop";
701 RNA_def_boolean(
ot->srna,
"select",
true,
"Select",
"If false, faces will be deselected");
716 ot->name =
"(De)select All";
717 ot->description =
"Change selection for all vertices";
718 ot->idname =
"PAINT_OT_vert_select_all";
747 ot->name =
"Select Ungrouped";
748 ot->idname =
"PAINT_OT_vert_select_ungrouped";
749 ot->description =
"Select vertices without a group";
770 ot->name =
"Select Linked Vertices";
771 ot->description =
"Select linked vertices";
772 ot->idname =
"PAINT_OT_vert_select_linked";
792 ot->name =
"Select Linked Vertices Pick";
793 ot->description =
"Select linked vertices under the cursor";
794 ot->idname =
"PAINT_OT_vert_select_linked_pick";
805 "Whether to select or deselect linked vertices under the cursor");
812 if (mesh ==
nullptr || mesh->
faces_num == 0) {
828 ot->name =
"Select More";
829 ot->description =
"Select Vertices connected to existing selection";
830 ot->idname =
"PAINT_OT_vert_select_more";
838 ot->srna,
"face_step",
true,
"Face Step",
"Also select faces that only touch on a corner");
845 if (mesh ==
nullptr || mesh->
faces_num == 0) {
861 ot->name =
"Select Less";
862 ot->description =
"Deselect Vertices connected to existing selection";
863 ot->idname =
"PAINT_OT_vert_select_less";
871 ot->srna,
"face_step",
true,
"Face Step",
"Also deselect faces that only touch on a corner");
885 ot->name =
"Face Select Hide";
886 ot->description =
"Hide selected faces";
887 ot->idname =
"PAINT_OT_face_select_hide";
895 ot->srna,
"unselected",
false,
"Unselected",
"Hide unselected rather than selected objects");
909 ot->name =
"Vertex Select Hide";
910 ot->description =
"Hide selected vertices";
911 ot->idname =
"PAINT_OT_vert_select_hide";
922 "Hide unselected rather than selected vertices");
951 ot->name =
"Reveal Faces/Vertices";
952 ot->description =
"Reveal hidden faces and vertices";
953 ot->idname =
"PAINT_OT_face_vert_reveal";
964 "Specifies whether the newly revealed geometry should be selected");
void BKE_brush_curve_preset(Brush *b, enum eCurveMappingPreset preset)
void BKE_brush_color_set(Scene *scene, const Paint *paint, Brush *brush, const float color[3])
void BKE_brush_tag_unsaved_changes(Brush *brush)
void free_bvhtree_from_mesh(BVHTreeFromMesh *data)
BVHTree * BKE_bvhtree_from_mesh_get(BVHTreeFromMesh *data, const Mesh *mesh, BVHCacheType bvh_cache_type, int tree_type)
@ BVHTREE_FROM_CORNER_TRIS
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.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma, const struct Object *ob)
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 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])
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
#define BLI_SCOPED_DEFER(function_to_defer)
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
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
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)
void view3d_operator_needs_opengl(const bContext *C)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
draw_view in_light_buf[] float
ccl_device_inline float2 interp(const float2 a, const float2 b, float t)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
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
MatBase< float, 4, 4 > float4x4
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 int paintface_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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 int face_vert_reveal_exec(bContext *C, wmOperator *op)
static int paintvert_select_linked_exec(bContext *C, wmOperator *)
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)
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
void PAINT_OT_vert_select_linked_pick(wmOperatorType *ot)
static int vert_select_hide_exec(bContext *C, wmOperator *op)
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
static int paint_select_more_exec(bContext *C, wmOperator *op)
void BRUSH_OT_sculpt_curves_falloff_preset(wmOperatorType *ot)
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 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 paintvert_select_less_exec(bContext *C, wmOperator *op)
void PAINT_OT_face_select_linked(wmOperatorType *ot)
static int paint_select_less_exec(bContext *C, wmOperator *op)
static bool face_vert_reveal_poll(bContext *C)
static int paintvert_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int vert_select_ungrouped_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 int paintvert_select_more_exec(bContext *C, wmOperator *op)
static int paint_select_linked_exec(bContext *C, wmOperator *)
static int vert_select_all_exec(bContext *C, wmOperator *op)
void PAINT_OT_vert_select_hide(wmOperatorType *ot)
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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])
void PAINT_OT_face_vert_reveal(wmOperatorType *ot)
void paint_stroke_operator_properties(wmOperatorType *ot)
static int brush_sculpt_curves_falloff_preset_exec(bContext *C, wmOperator *op)
float paint_calc_object_space_radius(const ViewContext &vc, const blender::float3 ¢er, const float pixel_radius)
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)
BVHTree_RayCastCallback raycast_callback
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
struct ReportList * reports
VecBase< float, 4 > float4
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)