Blender V5.3
mesh/sculpt_intern.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 by Nicholas Bishop. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <optional>
12
13#include "BKE_brush.hh"
14#include "BKE_bvhutils.hh"
15#include "BKE_image_wrappers.hh"
16#include "BKE_paint.hh"
17#include "BKE_paint_bvh.hh"
18#include "BKE_subdiv_ccg.hh"
19
20#include "BLI_array.hh"
24#include "BLI_set.hh"
25#include "BLI_span.hh"
26#include "BLI_vector.hh"
27
29
30#include "DNA_brush_enums.h"
31#include "DNA_brush_types.h"
32
33#include "ED_view3d.hh"
34
35namespace blender {
36
37namespace ed::sculpt_paint {
38namespace auto_mask {
39struct Cache;
40}
41namespace boundary {
42struct SculptBoundary;
43}
44namespace cloth {
45struct SimulationData;
46}
47namespace pose {
48struct IKChain;
49}
50namespace undo {
51struct Node;
52enum class Type : int8_t;
53} // namespace undo
54} // namespace ed::sculpt_paint
55struct bContext;
56struct BMLog;
57struct Dial;
59struct Image;
60struct ImageUser;
61struct Key;
62struct KeyBlock;
63struct Object;
65struct ReportList;
66struct wmKeyConfig;
67struct wmKeyMap;
68struct wmOperatorType;
69namespace bke::bvh {
70class Tree;
71}
72
73/* -------------------------------------------------------------------- */
76
77namespace ed::sculpt_paint {
78
87
93 public:
100
101 private:
107 std::optional<MutableSpan<float3>> eval_mut_;
108
113 std::optional<Span<float3x3>> deform_imats_;
114
119
120 std::optional<ShapeKeyData> shape_key_data_;
121
122 public:
123 PositionDeformData(const Depsgraph &depsgraph, Object &object_orig);
124 void deform(MutableSpan<float3> translations, Span<int> verts) const;
125};
126
127enum class UpdateType {
131 Color,
132 FaceSet,
133};
134
135static constexpr int face_set_none_id = 0;
136
137/* Factor of brush to have rake point following behind
138 * (could be configurable but this is reasonable default). */
139#define SCULPT_RAKE_BRUSH_FACTOR 0.25f
140
142 float follow_dist = 0.0f;
144 float angle = 0.0f;
145};
146
148 /* Displaces the elements from their original coordinates. */
150 /* Displaces the elements incrementally from their previous position. */
152};
153/* Defines how transform tools are going to apply its displacement. */
154
155static constexpr int plane_brush_max_rolling_average_num = 20;
156
161
189
195 /* Invariants */
196 float initial_radius = 0.0f;
205
214
216
217 /* Variants */
218 float radius = 0.0f;
219 float radius_squared = 0.0f;
224 float stroke_distance = 0.0f;
225
231
232 /* Original pixel radius with the pressure curve applied for dyntopo detail size */
234
235 bool is_last_valid = false;
236
237 float pressure = 0.0f;
238 float hardness = 0.0f;
239
247
251 float feather = 0.0f;
252
253 /* TODO: Remove storage and usage in most dependent code */
254 float bstrength = 0.0f;
256
262 /* Position of the mouse event in screen space, not modified by the stroke type. */
264
269
270 /* The rest is temporary storage that isn't saved as a property */
271
272 /* Store initial starting points for perlin noise on the beginning of each stroke when using
273 * color jitter. */
274 std::optional<float3> initial_hsv_jitter;
275 /* Beginning of stroke may do some things special. */
276 bool first_time = false;
277
278 /* from ED_view3d_ob_project_mat_get(). */
280
281 /* TODO: Clean this up! */
282 ViewContext *vc = nullptr;
283 const Brush *brush = nullptr;
284 const Paint *paint = nullptr;
285
292
293 /* Screen-space rotation defined by mouse motion. */
294 std::optional<math::Quaternion> rake_rotation;
295 std::optional<math::Quaternion> rake_rotation_symm;
297
298 /* The face set being painted. */
300
301 /* The symmetry pass we are currently on between 0 and 7. */
305
316
328
329 /* used to shift the plane around when doing tiled strokes */
331 int tile_pass = 0;
332
337
342 bool accum = false;
343
344 /* Paint Brush. */
345 struct {
346 float flow = 0.0f;
347
349 float wet_mix = 0.0f;
350 float wet_persistence = 0.0f;
351
352 std::optional<float> density_seed;
353 float density = 0.0f;
354
362
363 /* Pose brush */
364 std::unique_ptr<pose::IKChain> pose_ik_chain;
365
366 /* Enhance Details. */
368
369 /* Clay Thumb brush */
370 struct {
371 /* Angle of the front tilting plane of the brush to simulate clay accumulation. */
372 float front_angle = 0.0f;
373 /* Stores the last 10 pressure samples to get a stabilized strength and radius variation. */
374 std::array<float, 10> pressure_stabilizer;
375 int stabilizer_index = 0;
376
378
379 /* Plane Brush */
380 struct {
381 std::optional<float3> last_normal;
382 std::optional<float3> last_center;
385 int normal_index = 0;
386 int center_index = 0;
387
396 bool first_time = false;
398
399 /* Scene Project brush */
401
402 /* Cloth brush */
403 std::unique_ptr<cloth::SimulationData> cloth_sim;
408
409 /* Boundary brush */
410 std::array<std::unique_ptr<boundary::SculptBoundary>, PAINT_SYMM_AREAS> boundaries;
411
412 /* Surface Smooth Brush */
413 /* Stores the displacement produced by the laplacian step of HC smooth. */
415
416 /* Layer brush */
418
419 /* Amount to rotate the vertices when using rotate brush. */
420 float vertex_rotation = 0.0f;
421 Dial *dial = nullptr;
422
423 float plane_trim_squared = 0.0f;
424
425 bool supports_gravity = false;
428
429 std::unique_ptr<auto_mask::Cache> automasking;
430
433
435 ~StrokeCache();
436};
437
439
440/* -------------------------------------------------------------------- */
443
450
455
463bool color_supported_check(const Scene &scene, Object &object, ReportList *reports);
464
466
467/* -------------------------------------------------------------------- */
470
474void flush_update_step(bContext *C, UpdateType update_type);
475void flush_update_step(ViewContext &vc, Object &object, UpdateType update_type);
479void flush_update_done(bContext *C, Object &ob, UpdateType update_type);
481 const wmWindowManager &wm,
482 Object &ob,
483 UpdateType update_type);
484
490
491/* -------------------------------------------------------------------- */
494
501std::optional<float3> stroke_get_location_bvh(bContext *C, float2 mval, bool force_original);
502std::optional<float3> stroke_get_location_bvh(Depsgraph &depsgraph,
503 ViewContext &vc,
504 const Sculpt &sd,
505 const Brush *brush,
506 const float mval[2],
507 bool force_original);
508std::optional<float3> stroke_get_location_bvh(Depsgraph &depsgraph,
509 ViewContext &vc,
510 const Paint &paint,
511 const Brush *brush,
512 float2 mval,
513 bool force_original);
514
520
525std::optional<ActiveElementInfo> active_element_info_get(ViewContext &vc, const float2 &mval);
526
531
536std::optional<CursorGeometryInfo> cursor_geometry_info_update(bContext *C,
537 const float2 &mval,
538 bool use_sampled_normal);
539std::optional<CursorGeometryInfo> cursor_geometry_info_update(Depsgraph &depsgraph,
540 const Paint &paint,
541 const Sculpt *sd,
542 ViewContext &vc,
543 const Base *base,
544 const float2 &mval,
545 bool use_sampled_normal);
546
547void geometry_preview_lines_update(Depsgraph &depsgraph,
548 Object &object,
549 SculptSession &ss,
550 float radius);
551
552void stroke_modifiers_check(Depsgraph &depsgraph, Object &ob, const Brush *brush);
553float raycast_init(ViewContext *vc,
554 const float2 &mval,
555 float3 &ray_start,
556 float3 &ray_end,
557 float3 &ray_normal,
558 bool original);
559/* Symmetry */
561
579
580float3 grab_delta_get(const Brush &brush, const StrokeCache &cache);
581
583
584/* -------------------------------------------------------------------- */
587
590
591int vertex_count_get(const Object &object);
592
593bool vertex_is_occluded(const Depsgraph &depsgraph,
594 const Object &object,
595 const float3 &position,
596 bool original);
597
601Span<float3> vert_positions_for_grab_active_get(const Depsgraph &depsgraph, const Object &object);
602
606
608 Span<int> corner_verts,
609 GroupedSpan<int> vert_to_face,
610 Span<bool> hide_poly,
611 int vert,
612 Vector<int> &r_neighbors);
613
614/* Fake Neighbors */
615
616#define FAKE_NEIGHBOR_NONE -1
617
623Span<int> fake_neighbors_ensure(const Depsgraph &depsgraph, Object &ob, float max_dist);
625
627
628/* -------------------------------------------------------------------- */
631
641void calc_brush_local_mat(const float3 &tip_normal,
642 const float3 &motion_normal_local,
643 const float3 &tip_location,
644 const float radius,
645 float local_mat[4][4],
646 float local_mat_inv[4][4]);
647
651float3 calc_motion_normal_from_angle(const ViewContext &vc,
652 const float3 &tip_location,
653 const float angle);
654
655float brush_plane_offset_get(const Brush &brush, const SculptSession &ss);
656
663void calc_brush_plane(const Depsgraph &depsgraph,
664 const Brush &brush,
665 Object &ob,
666 const IndexMask &node_mask,
667 float3 &r_area_no,
668 float3 &r_area_co);
669
670std::optional<float3> calc_area_normal(const Depsgraph &depsgraph,
671 const Brush &brush,
672 const Object &ob,
673 const IndexMask &node_mask);
674
679void calc_area_normal_and_center(const Depsgraph &depsgraph,
680 const Brush &brush,
681 const Object &ob,
682 const IndexMask &node_mask,
683 float r_area_no[3],
684 float r_area_co[3]);
685void calc_area_center(const Depsgraph &depsgraph,
686 const Brush &brush,
687 const Object &ob,
688 const IndexMask &node_mask,
689 float r_area_co[3]);
690
691std::optional<int> nearest_vert_calc_mesh(const bke::pbvh::Tree &pbvh,
692 Span<float3> vert_positions,
693 Span<bool> hide_vert,
694 const float3 &location,
695 float max_distance,
696 bool use_original);
697std::optional<SubdivCCGCoord> nearest_vert_calc_grids(const bke::pbvh::Tree &pbvh,
698 const SubdivCCG &subdiv_ccg,
699 const float3 &location,
700 float max_distance,
701 bool use_original);
702std::optional<BMVert *> nearest_vert_calc_bmesh(const bke::pbvh::Tree &pbvh,
703 const float3 &location,
704 float max_distance,
705 bool use_original);
706
708bool check_vertex_pivot_symmetry(const float vco[3], const float pco[3], char symm);
713 const float br_co[3],
714 float radius,
715 char symm);
718 ePaintSymmetryAreas symmarea,
719 const float3 &pivot);
720void flip_quat_by_symm_area(float quat[4],
722 ePaintSymmetryAreas symmarea,
723 const float pivot[3]);
724
729Vector<int> find_symm_verts_mesh(const Depsgraph &depsgraph,
730 const Object &object,
731 int original_vert,
732 float max_distance = std::numeric_limits<float>::max());
733Vector<int> find_symm_verts_grids(const Object &object,
734 int original_vert,
735 float max_distance = std::numeric_limits<float>::max());
736Vector<int> find_symm_verts_bmesh(const Object &object,
737 int original_vert,
738 float max_distance = std::numeric_limits<float>::max());
739Vector<int> find_symm_verts(const Depsgraph &depsgraph,
740 const Object &object,
741 int original_vert,
742 float max_distance = std::numeric_limits<float>::max());
743
749std::array<int, PAINT_SYMM_AREAS> find_all_symm_verts_mesh(
750 const Depsgraph &depsgraph,
751 const Object &object,
752 int original_vert,
753 float max_distance = std::numeric_limits<float>::max());
754std::array<int, PAINT_SYMM_AREAS> find_all_symm_verts_grids(
755 const Object &object,
756 int original_vert,
757 float max_distance = std::numeric_limits<float>::max());
758std::array<int, PAINT_SYMM_AREAS> find_all_symm_verts_bmesh(
759 const Object &object,
760 int original_vert,
761 float max_distance = std::numeric_limits<float>::max());
762std::array<int, PAINT_SYMM_AREAS> find_all_symm_verts(
763 const Depsgraph &depsgraph,
764 const Object &object,
765 int original_vert,
766 float max_distance = std::numeric_limits<float>::max());
767
768bool node_fully_masked_or_hidden(const bke::pbvh::Node &node);
769bool node_in_sphere(const bke::pbvh::Node &node,
770 const float3 &location,
771 float radius_sq,
772 bool original);
773bool node_in_cylinder(const DistRayAABB_Precalc &ray_dist_precalc,
774 const bke::pbvh::Node &node,
775 float radius_sq,
776 bool original);
784bool node_in_box(const float4x4 &mat,
785 const Bounds<float3> &bounds,
786 const float3 &brush_center = float3(0.0f, 0.0f, 0.0f),
787 const float3 &brush_half_lengths = float3(1.0f, 1.0f, 1.0f),
788 const bool test_z_axis = true);
797bool node_in_box_positive_z(const float4x4 &mat, const Bounds<float3> &bounds);
798IndexMask gather_nodes(const bke::pbvh::Tree &pbvh,
799 eBrushFalloffShape falloff_shape,
800 bool use_original,
801 const float3 &location,
802 float radius_sq,
803 const std::optional<float3> &ray_direction,
804 IndexMaskMemory &memory);
805
806const float *brush_frontface_normal_from_falloff_shape(const SculptSession &ss,
807 char falloff_shape);
808float4x4 cube_tip_init(const Object &ob, const Brush &brush);
809
811void apply_brush_texture(PaintMode paint_mode,
812 const SculptSession &ss,
813 const Brush &brush,
814 const float brush_point[3],
815 int thread_id,
816 float *r_value,
817 float4 &r_rgba);
818
823void calc_vertex_displacement(const SculptSession &ss, const Brush &brush, float translation[3]);
824
829 const float4x4 &view_inverse,
830 const float3 &normal,
831 const float2 &tilt,
832 float tilt_strength);
833float3 tilt_apply_to_normal(const float3 &normal, const StrokeCache &cache, float tilt_strength);
834
838float3 tilt_effective_normal_get(const SculptSession &ss, const Brush &brush);
839
846void calc_smooth_translations(const Depsgraph &depsgraph,
847 const Object &object,
848 const IndexMask &node_mask,
849 MutableSpan<float3> translations);
850
855void cache_calc_brushdata_symm(ed::sculpt_paint::StrokeCache &cache,
857 char axis,
858 float angle);
859
864
868std::optional<OrigPositionData> orig_position_data_lookup_mesh_all_verts(
869 const Object &object, const bke::pbvh::MeshNode &node);
870std::optional<OrigPositionData> orig_position_data_lookup_mesh(const Object &object,
874{
875 const std::optional<OrigPositionData> result = orig_position_data_lookup_mesh(object, node);
876 BLI_assert(result.has_value());
877 return *result;
878}
879
880std::optional<OrigPositionData> orig_position_data_lookup_grids(const Object &object,
884{
885 const std::optional<OrigPositionData> result = orig_position_data_lookup_grids(object, node);
886 BLI_assert(result.has_value());
887 return *result;
888}
889
890void orig_position_data_gather_bmesh(const BMLog &bm_log,
891 const Set<BMVert *, 0> &verts,
892 MutableSpan<float3> positions,
893 MutableSpan<float3> normals);
894
895std::optional<Span<float4>> orig_color_data_lookup_mesh(const Object &object,
898{
899 return *orig_color_data_lookup_mesh(object, node);
900}
901
902std::optional<Span<int>> orig_face_set_data_lookup_mesh(const Object &object,
904
905std::optional<Span<int>> orig_face_set_data_lookup_grids(const Object &object,
907
908std::optional<Span<float>> orig_mask_data_lookup_mesh(const Object &object,
910
911std::optional<Span<float>> orig_mask_data_lookup_grids(const Object &object,
913
914inline bool brush_type_is_paint(const int tool)
915{
917}
918
919inline bool brush_type_is_mask(const int tool)
920{
921 return ELEM(tool, SCULPT_BRUSH_TYPE_MASK);
922}
923
925{
926 return brush_type_is_paint(tool) || brush_type_is_mask(tool) ||
928}
929
931{
932 return brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_DRAW &&
934 brush.mtex.brush_map_mode == MTEX_MAP_MODE_AREA;
935}
936
939 const Paint &paint,
940 const Brush &brush,
941 const float3 &location,
942 float scale_factor = 1.0);
943} // namespace ed::sculpt_paint
944
946
947/* -------------------------------------------------------------------- */
950
951namespace ed::sculpt_paint {
952
954
955}
956
957namespace ed::sculpt_paint::expand {
958
959void SCULPT_OT_expand(wmOperatorType *ot);
960void modal_keymap(wmKeyConfig *keyconf);
961
962} // namespace ed::sculpt_paint::expand
963
967
974
976
982
987
988} // namespace ed::sculpt_paint::face_set
989
990namespace ed::sculpt_paint {
991
994
999
1000} // namespace ed::sculpt_paint
1001
1002namespace ed::sculpt_paint::filter {
1003
1006
1007} // namespace ed::sculpt_paint::filter
1008
1009namespace ed::sculpt_paint::cloth {
1010void SCULPT_OT_cloth_filter(wmOperatorType *ot);
1011}
1012
1013namespace ed::sculpt_paint::color {
1014void SCULPT_OT_color_filter(wmOperatorType *ot);
1015}
1016
1017namespace ed::sculpt_paint::mask {
1018
1019void SCULPT_OT_mask_filter(wmOperatorType *ot);
1020void SCULPT_OT_mask_init(wmOperatorType *ot);
1021
1022} // namespace ed::sculpt_paint::mask
1023
1024namespace ed::sculpt_paint::dyntopo {
1025
1026void SCULPT_OT_detail_flood_fill(wmOperatorType *ot);
1027void SCULPT_OT_sample_detail_size(wmOperatorType *ot);
1028void SCULPT_OT_dyntopo_detail_size_edit(wmOperatorType *ot);
1029void SCULPT_OT_dynamic_topology_toggle(wmOperatorType *ot);
1030
1031} // namespace ed::sculpt_paint::dyntopo
1032
1034
1035} // namespace blender
#define PAINT_SYMM_AREAS
Definition BKE_paint.hh:109
A BVH for high poly meshes.
#define C
Definition RandGen.cpp:29
#define BLI_INLINE
#define ELEM(...)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
void deform(MutableSpan< float3 > translations, Span< int > verts) const
Definition sculpt.cc:7793
PositionDeformData(const Depsgraph &depsgraph, Object &object_orig)
Definition sculpt.cc:7775
#define position
#define vertex
MatBase< 4, 4 > float4x4
void SCULPT_OT_cloth_filter(wmOperatorType *ot)
void SCULPT_OT_color_filter(wmOperatorType *ot)
void SCULPT_OT_detail_flood_fill(wmOperatorType *ot)
void SCULPT_OT_sample_detail_size(wmOperatorType *ot)
void SCULPT_OT_dynamic_topology_toggle(wmOperatorType *ot)
void SCULPT_OT_dyntopo_detail_size_edit(wmOperatorType *ot)
void modal_keymap(wmKeyConfig *keyconf)
void SCULPT_OT_expand(wmOperatorType *ot)
void SCULPT_OT_face_set_lasso_gesture(wmOperatorType *ot)
void SCULPT_OT_face_set_line_gesture(wmOperatorType *ot)
void SCULPT_OT_face_set_polyline_gesture(wmOperatorType *ot)
void SCULPT_OT_face_sets_init(wmOperatorType *ot)
void SCULPT_OT_face_sets_create(wmOperatorType *ot)
void SCULPT_OT_face_set_change_visibility(wmOperatorType *ot)
void SCULPT_OT_face_sets_randomize_colors(wmOperatorType *ot)
void SCULPT_OT_face_sets_edit(wmOperatorType *ot)
void SCULPT_OT_face_set_box_gesture(wmOperatorType *ot)
void SCULPT_OT_mesh_filter(wmOperatorType *ot)
wmKeyMap * modal_keymap(wmKeyConfig *keyconf)
void SCULPT_OT_mask_filter(wmOperatorType *ot)
void SCULPT_OT_mask_init(wmOperatorType *ot)
void SCULPT_OT_project_line_gesture(wmOperatorType *ot)
void SCULPT_OT_trim_lasso_gesture(wmOperatorType *ot)
void SCULPT_OT_trim_box_gesture(wmOperatorType *ot)
void SCULPT_OT_trim_line_gesture(wmOperatorType *ot)
void SCULPT_OT_trim_polyline_gesture(wmOperatorType *ot)
std::optional< Span< float > > orig_mask_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
void SCULPT_OT_paint_mask_slice(wmOperatorType *ot)
std::array< int, PAINT_SYMM_AREAS > find_all_symm_verts_bmesh(const Object &object, const int original_vert, const float max_distance)
void face_set_overlay_check(bContext &C, wmOperator &op)
Definition sculpt.cc:8320
void calc_smooth_translations(const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask, const MutableSpan< float3 > translations)
bool node_in_sphere(const bke::pbvh::Node &node, const float3 &location, const float radius_sq, const bool original)
Definition sculpt.cc:2511
bool node_in_cylinder(const DistRayAABB_Precalc &ray_dist_precalc, const bke::pbvh::Node &node, const float radius_sq, const bool original)
Definition sculpt.cc:2521
float4x4 cube_tip_init(const Object &ob, const Brush &brush)
Definition sculpt.cc:6459
bool brush_cursor_poll(bContext *C)
Definition sculpt.cc:3855
bool check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm)
Definition sculpt.cc:672
std::optional< Span< int > > orig_face_set_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
void vert_random_access_ensure(Object &object)
Definition sculpt.cc:154
std::optional< int > nearest_vert_calc_mesh(const bke::pbvh::Tree &pbvh, const Span< float3 > vert_positions, const Span< bool > hide_vert, const float3 &location, const float max_distance, const bool use_original)
Definition sculpt.cc:730
Vector< int > find_symm_verts_grids(const Object &object, const int original_vert, const float max_distance)
bool node_fully_masked_or_hidden(const bke::pbvh::Node &node)
Definition sculpt.cc:2500
float3 tilt_effective_normal_get(const SculptSession &ss, const Brush &brush)
Definition sculpt.cc:2904
Vector< BMVert *, 64 > BMeshNeighborVerts
int vertex_count_get(const Object &object)
Definition sculpt.cc:163
std::optional< OrigPositionData > orig_position_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
ePaintSymmetryAreas get_vertex_symm_area(const float co[3])
Definition sculpt.cc:2979
void stroke_modifiers_check(Depsgraph &depsgraph, Object &ob, const Brush *brush)
Definition sculpt.cc:4309
bool node_in_box_positive_z(const float4x4 &mat, const Bounds< float3 > &bounds)
Definition sculpt.cc:2606
bool stroke_is_first_brush_step_of_symmetry_pass(const StrokeCache &cache)
Definition sculpt.cc:667
void orig_position_data_gather_bmesh(const BMLog &bm_log, const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions, MutableSpan< float3 > normals)
bool stroke_is_first_brush_step(const StrokeCache &cache)
Definition sculpt.cc:661
ePaintSymmetryFlags mesh_symmetry_xyz_get(const Object &object)
Definition sculpt.cc:192
Vector< int > find_symm_verts_mesh(const Depsgraph &depsgraph, const Object &object, const int original_vert, const float max_distance)
bool sculpt_mode_poll(bContext *C)
Definition sculpt.cc:3800
static constexpr int face_set_none_id
void calc_vertex_displacement(const SculptSession &ss, const Brush &brush, float translation[3])
Definition sculpt.cc:2476
void fake_neighbors_free(Object &ob)
Definition sculpt.cc:6249
float3 calc_motion_normal_from_angle(const ViewContext &vc, const float3 &tip_location, const float angle)
Definition sculpt.cc:2812
bool color_supported_check(const Scene &scene, Object &object, ReportList *reports)
Definition sculpt.cc:5432
float raycast_init(ViewContext *vc, const float2 &mval, float3 &r_ray_start, float3 &r_ray_end, float3 &r_ray_normal, bool original)
Definition sculpt.cc:4471
float3 flip_v3_by_symm_area(const float3 &vector, const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float3 &pivot)
Definition sculpt.cc:3022
bool brush_type_is_paint(const int tool)
std::array< int, PAINT_SYMM_AREAS > find_all_symm_verts_grids(const Object &object, const int original_vert, const float max_distance)
IndexMask gather_nodes(const bke::pbvh::Tree &pbvh, const eBrushFalloffShape falloff_shape, const bool use_original, const float3 &location, const float radius_sq, const std::optional< float3 > &ray_direction, IndexMaskMemory &memory)
Definition sculpt.cc:2696
std::optional< float3 > stroke_get_location_bvh(Depsgraph &depsgraph, ViewContext &vc, const Sculpt &sd, const Brush *brush, const float mval[2], const bool force_original)
Definition sculpt.cc:4855
std::optional< Span< float4 > > orig_color_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
Span< float4 > orig_color_data_get_mesh(const Object &object, const bke::pbvh::MeshNode &node)
bool sculpt_mode_poll_view3d(bContext *C)
Definition sculpt.cc:3806
void SCULPT_OT_brush_stroke(wmOperatorType *ot)
Definition sculpt.cc:5926
std::optional< ActiveElementInfo > active_element_info_get(ViewContext &vc, const float2 &mval)
Definition sculpt.cc:4512
void calc_brush_plane(const Depsgraph &depsgraph, const Brush &brush, Object &ob, const IndexMask &node_mask, float3 &r_area_no, float3 &r_area_co)
Definition sculpt.cc:3062
Span< BMVert * > vert_neighbors_get_interior_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
Definition sculpt.cc:505
std::optional< float3 > calc_area_normal(const Depsgraph &depsgraph, const Brush &brush, const Object &ob, const IndexMask &node_mask)
Definition sculpt.cc:1926
Span< BMVert * > vert_neighbors_get_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
Definition sculpt.cc:490
OrigPositionData orig_position_data_get_mesh(const Object &object, const bke::pbvh::MeshNode &node)
bool node_in_box(const float4x4 &mat, const Bounds< float3 > &bounds, const float3 &brush_center, const float3 &brush_half_lengths, const bool test_z_axis)
Definition sculpt.cc:2536
const float * brush_frontface_normal_from_falloff_shape(const SculptSession &ss, char falloff_shape)
Definition sculpt.cc:1341
bool vertex_is_occluded(const Depsgraph &depsgraph, const Object &object, const float3 &position, bool original)
Definition sculpt.cc:6255
void flush_update_step(bContext *C, const UpdateType update_type)
Definition sculpt.cc:5090
OrigPositionData orig_position_data_get_grids(const Object &object, const bke::pbvh::GridsNode &node)
void flush_update_done(bContext *C, Object &ob, const UpdateType update_type)
Definition sculpt.cc:5131
void calc_area_center(const Depsgraph &depsgraph, const Brush &brush, const Object &ob, const IndexMask &node_mask, float r_area_co[3])
Definition sculpt.cc:1825
float object_space_radius_get(const ViewContext &vc, const Paint &paint, const Brush &brush, const float3 &location, const float scale_factor)
Definition sculpt.cc:121
BLI_INLINE bool brush_type_is_attribute_only(const int tool)
static constexpr int plane_brush_max_rolling_average_num
float brush_plane_offset_get(const Brush &brush, const SculptSession &ss)
Definition sculpt.cc:3145
bool stroke_is_main_symmetry_pass(const StrokeCache &cache)
Definition sculpt.cc:655
float3 grab_delta_get(const Brush &brush, const StrokeCache &cache)
Definition sculpt.cc:718
bool is_vertex_inside_brush_radius_symm(const float vertex[3], const float br_co[3], float radius, char symm)
Definition sculpt.cc:878
std::optional< BMVert * > nearest_vert_calc_bmesh(const bke::pbvh::Tree &pbvh, const float3 &location, const float max_distance, const bool use_original)
Definition sculpt.cc:831
bool sculpt_mode_and_brush_poll(bContext *C)
Definition sculpt.cc:3811
Span< int > fake_neighbors_ensure(const Depsgraph &depsgraph, Object &ob, const float max_dist)
Definition sculpt.cc:6230
std::optional< CursorGeometryInfo > cursor_geometry_info_update(bContext *C, const float2 &mval, const bool use_sampled_normal)
Definition sculpt.cc:4584
void flip_quat_by_symm_area(float quat[4], const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float pivot[3])
Definition sculpt.cc:3043
std::optional< Span< float > > orig_mask_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
std::optional< SubdivCCGCoord > nearest_vert_calc_grids(const bke::pbvh::Tree &pbvh, const SubdivCCG &subdiv_ccg, const float3 &location, const float max_distance, const bool use_original)
Definition sculpt.cc:777
std::optional< OrigPositionData > orig_position_data_lookup_mesh_all_verts(const Object &object, const bke::pbvh::MeshNode &node)
void calc_area_normal_and_center(const Depsgraph &depsgraph, const Brush &brush, const Object &ob, const IndexMask &node_mask, float r_area_no[3], float r_area_co[3])
Definition sculpt.cc:2120
void apply_brush_texture(const PaintMode paint_mode, const SculptSession &ss, const Brush &brush, const float brush_point[3], const int thread_id, float *r_value, float4 &r_rgba)
Definition sculpt.cc:2410
void calc_brush_local_mat(const float3 &tip_normal, const float3 &motion_normal_local, const float3 &tip_location, const float radius, float local_mat[4][4], float local_mat_inv[4][4])
Definition sculpt.cc:2830
std::optional< OrigPositionData > orig_position_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
Vector< int > find_symm_verts(const Depsgraph &depsgraph, const Object &object, const int original_vert, const float max_distance)
std::optional< Span< int > > orig_face_set_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
Span< int > vert_neighbors_get_mesh(const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face, const Span< bool > hide_poly, const int vert, Vector< int > &r_neighbors)
Definition sculpt.cc:534
void SCULPT_OT_paint_mask_extract(wmOperatorType *ot)
void mask_overlay_check(bContext &C, wmOperator &op)
Definition sculpt.cc:8298
bool brush_uses_vector_displacement(const Brush &brush)
std::array< int, PAINT_SYMM_AREAS > find_all_symm_verts_mesh(const Depsgraph &depsgraph, const Object &object, const int original_vert, const float max_distance)
void SCULPT_OT_face_set_extract(wmOperatorType *ot)
void cache_calc_brushdata_symm(StrokeCache &cache, const ePaintSymmetryFlags symm, const char axis, const float angle)
Definition sculpt.cc:3725
bool brush_type_is_mask(const int tool)
void SCULPT_OT_set_pivot_position(wmOperatorType *ot)
void tag_update_overlays(bContext *C)
Definition sculpt.cc:895
void geometry_preview_lines_update(Depsgraph &depsgraph, Object &object, SculptSession &ss, float radius)
Definition grab.cc:232
Span< float3 > vert_positions_for_grab_active_get(const Depsgraph &depsgraph, const Object &object)
Definition sculpt.cc:179
float3 tilt_apply_to_normal(const Object &object, const float4x4 &view_inverse, const float3 &normal, const float2 &tilt, const float tilt_strength)
Definition sculpt.cc:2876
std::array< int, PAINT_SYMM_AREAS > find_all_symm_verts(const Depsgraph &depsgraph, const Object &object, const int original_vert, const float max_distance)
Vector< int > find_symm_verts_bmesh(const Object &object, const int original_vert, const float max_distance)
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
std::variant< std::monostate, int, BMVert * > ActiveVert
Definition BKE_paint.hh:357
ePaintSymmetryAreas
Definition BKE_paint.hh:102
@ BRUSH_USE_COLOR_AS_DISPLACEMENT
MatBase< float, 4, 4 > float4x4
@ SCULPT_BRUSH_TYPE_SMEAR
@ SCULPT_BRUSH_TYPE_DRAW_FACE_SETS
@ SCULPT_BRUSH_TYPE_BLUR
@ SCULPT_BRUSH_TYPE_PAINT
@ SCULPT_BRUSH_TYPE_MASK
@ SCULPT_BRUSH_TYPE_DRAW
VecBase< float, 4 > float4
VecBase< float, 2 > float2
unsigned char uint8_t
Definition BKE_text.h:79
VecBase< float, 3 > float3
signed char int8_t
Definition BKE_text.h:76
static std::optional< ShapeKeyData > from_object(Object &object)
Definition sculpt.cc:7747
Vector< MutableSpan< float3 > > dependent_keys
std::optional< math::Quaternion > rake_rotation
struct blender::ed::sculpt_paint::StrokeCache::@152245166116023055361007250031254315334135310141 mirror_modifier_clip
std::unique_ptr< pose::IKChain > pose_ik_chain
Vector< ProjectBrushTarget > project_targets
struct blender::ed::sculpt_paint::StrokeCache::@225223164012065274011166026353012314236244015262 plane_brush
std::unique_ptr< auto_mask::Cache > automasking
struct blender::ed::sculpt_paint::StrokeCache::@210266372035032112040136174225236171214246130144 displacement_smear
struct blender::ed::sculpt_paint::StrokeCache::@211256062006232337057366306324060315203271114371 clay_thumb_brush
struct blender::ed::sculpt_paint::StrokeCache::@346250254335162214324031351310170235363204044376 paint_brush
std::optional< math::Quaternion > rake_rotation_symm
std::unique_ptr< cloth::SimulationData > cloth_sim
std::array< std::unique_ptr< boundary::SculptBoundary >, PAINT_SYMM_AREAS > boundaries