69 const bool include_first_point)
71 if (include_first_point) {
78 const float step = 1.0f /
float(dst.
size());
95 if (num_handles == 1) {
98 const int64_t num_segments = num_handles - 1;
99 const int64_t num_points = num_segments * resolution;
104 for (
const int64_t segment_i : range) {
105 IndexRange segment_range(segment_i * resolution, resolution);
107 curve_segments[segment_i * 3 + 1],
108 curve_segments[segment_i * 3 + 2],
109 curve_segments[segment_i * 3 + 3],
132 accumulated_lengths_target, accumulated_lengths_src, segment_indices, segment_factors);
135 target, segment_indices, segment_factors, dst.
drop_back(1));
146 const int num_old_points =
curves.points_num();
148 curves.offsets_for_write().last(1) = num_old_points;
157 for (
int i =
curves.curves_num() - 2; i >= 0; i--) {
158 offsets[i + 1] = offsets[i] + 1;
168 using T = decltype(dummy);
169 MutableSpan<T> span_data = attribute_data.typed<T>();
172 for (int i = span_data.size() - 2; i >= 0; i--) {
173 span_data[i + 1] = span_data[i];
188 curves.offsets_for_write().last() =
curves.points_num();
192 const int last_active_point =
curves.points_by_curve()[0].last();
197 for (
const int src_curve :
curves.curves_range().drop_front(1)) {
198 offsets[src_curve] = offsets[src_curve] + new_points_num;
213 using T = decltype(dummy);
214 MutableSpan<T> span_data = attribute_data.typed<T>();
217 for (int i = (span_data.size() - 1) - new_points_num; i >= last_active_point; i--) {
218 span_data[i + new_points_num] = span_data[i];
224 curves.tag_topology_changed();
244 int active_smooth_start_index_ = 0;
254 float accum_distance_ = 0.0f;
258 float stroke_random_radius_factor_;
259 float stroke_random_opacity_factor_;
260 float stroke_random_rotation_factor_;
262 float stroke_random_hue_factor_;
263 float stroke_random_sat_factor_;
264 float stroke_random_val_factor_;
283 temp_draw_ = temp_draw;
332 BLI_assert(grease_pencil->has_active_layer());
333 drawing_ = grease_pencil->get_editable_drawing_at(*grease_pencil->get_active_layer(),
341 const float pressure)
346 float random_factor = 0.0f;
349 constexpr float noise_scale = 1 / 20.0f;
354 random_factor =
self.stroke_random_radius_factor_;
367 const float pressure)
372 float random_factor = 0.0f;
375 constexpr float noise_scale = 1 / 20.0f;
380 random_factor =
self.stroke_random_opacity_factor_;
395 float random_factor = 0.0f;
397 random_factor =
self.rng_.get_float();
400 random_factor =
self.stroke_random_rotation_factor_;
414 const float pressure)
423 constexpr float noise_scale = 1 / 20.0f;
425 float random_hue = 0.0f;
430 random_hue =
self.stroke_random_hue_factor_;
433 float random_saturation = 0.0f;
439 random_saturation =
self.stroke_random_sat_factor_;
442 float random_value = 0.0f;
447 random_value =
self.stroke_random_val_factor_;
455 settings_->curve_rand_saturation, 0, pressure);
469 else if (hsv[0] < 0.0f) {
484 const int material_index,
491 const float3 start_location =
self.placement_.project(start_coords);
498 self.placement_.to_world_space(),
507 const float fill_opacity = (!
self.temp_draw_) ? start_opacity : 1.0f;
517 self.screen_space_coords_orig_.append(start_coords);
519 self.screen_space_jitter_offsets_.append(
float2(0.0f));
520 self.screen_space_smoothed_coords_.append(start_coords);
521 self.screen_space_final_coords_.append(start_coords);
527 const int active_curve = on_back ?
curves.curves_range().first() :
528 curves.curves_range().last();
530 const int last_active_point = curve_points.
last();
535 curves.positions_for_write()[last_active_point] = start_location;
536 drawing_->radii_for_write()[last_active_point] = start_radius;
537 drawing_->opacities_for_write()[last_active_point] = start_opacity;
538 point_attributes_to_skip.
add_multiple({
"position",
"radius",
"opacity"});
541 point_attributes_to_skip.
add(
"vertex_color");
543 if (use_fill || attributes.
contains(
"fill_color")) {
545 curve_attributes_to_skip.
add(
"fill_color");
549 delta_times.
span[last_active_point] = 0.0f;
550 point_attributes_to_skip.
add(
"delta_time");
561 cyclic.
span[active_curve] =
false;
562 materials.
span[active_curve] = material_index;
564 u_scale.span[active_curve] = 1.0f;
565 curve_attributes_to_skip.
add_multiple({
"material_index",
"cyclic",
"softness",
"u_scale"});
574 rotations.
span[last_active_point] = start_rotation;
575 point_attributes_to_skip.
add(
"rotation");
584 curve_attributes_to_skip.
add(
"start_cap");
592 curve_attributes_to_skip.
add(
"end_cap");
596 if (use_fill && (start_opacity < 1.0f || attributes.
contains(
"fill_opacity"))) {
602 fill_opacities.
span[active_curve] = fill_opacity;
603 curve_attributes_to_skip.
add(
"fill_opacity");
611 curve_attributes_to_skip.
add(
"init_time");
615 curve_attributes_to_skip.
add(
"curve_type");
616 curves.update_curve_types();
635 const Span<float2> coords_to_smooth =
self.screen_space_coords_orig_.as_span().slice(
639 const float corner_min_radius_px = 5.0f;
640 const float corner_max_radius_px = 30.0f;
641 const int64_t corner_max_samples = 64;
642 const float corner_angle_threshold = 0.6f;
646 corner_min_radius_px,
647 corner_max_radius_px,
649 corner_angle_threshold,
655 const int pre_blur_iterations = 3;
666 const float max_error_threshold_px = 5.0f;
668 coords_pre_blur, max_error_threshold_px *
settings_->active_smooth, corner_mask);
671 const int64_t sample_resolution = 32;
680 const float converging_threshold_px = 0.1f;
681 bool stop_counting_converged =
false;
682 int num_converged = 0;
685 self.screen_space_curve_fitted_coords_[window_i].append(coords_smoothed[window_i]);
691 if (!stop_counting_converged) {
692 float2 prev_pos = window_coords[window_i];
693 if (
math::distance(new_pos, prev_pos) < converging_threshold_px) {
697 stop_counting_converged =
true;
702 window_coords[window_i] = new_pos;
706 if (num_converged > 0) {
707 self.active_smooth_start_index_ += num_converged;
708 self.screen_space_curve_fitted_coords_.remove(0, num_converged);
713 const int new_points_num,
714 const float brush_radius_px,
715 const float pressure,
719 float jitter_factor = 1.0f;
725 for ([[maybe_unused]]
const int _ :
IndexRange(new_points_num)) {
726 const float rand =
self.rng_.get_float() * 2.0f - 1.0f;
727 const float factor = rand *
settings_->draw_jitter * jitter_factor;
728 self.screen_space_jitter_offsets_.append(cotangent * factor * brush_radius_px);
730 const Span<float2> jitter_slice =
self.screen_space_jitter_offsets_.as_mutable_span().slice(
733 self.screen_space_smoothed_coords_.as_mutable_span().slice(active_window);
738 final_coords[window_i] = smoothed_coords[window_i] + jitter_slice[window_i];
739 positions_slice[window_i] =
self.placement_.project(final_coords[window_i]);
753 float3 position =
self.placement_.project(coords);
759 self.placement_.to_world_space(),
771 const int active_curve = on_back ?
curves.curves_range().first() :
772 curves.curves_range().last();
773 const IndexRange curve_points = points_by_curve[active_curve];
774 const int last_active_point = curve_points.
last();
776 const float2 prev_coords =
self.screen_space_coords_orig_.last();
777 float prev_radius =
drawing_->radii()[last_active_point];
778 const float prev_opacity =
drawing_->opacities()[last_active_point];
781 const bool is_first_sample = (curve_points.
size() == 1);
786 if (is_first_sample) {
787 self.smoothed_pen_direction_ =
self.screen_space_coords_orig_.last() - coords;
794 constexpr float smoothing_rate_factor = 0.3f;
796 self.screen_space_coords_orig_.last() -
798 smoothing_rate_factor);
802 float radius_factor = 1.0f;
803 if (
settings_->draw_angle_factor > 0.0f) {
815 radius *= radius_factor;
820 constexpr float point_override_threshold_px = 2.0f;
821 if (distance_px < point_override_threshold_px) {
822 self.accum_distance_ += distance_px;
824 if (!is_first_sample) {
825 curves.positions_for_write()[last_active_point] = position;
835 drawing_->opacities_for_write()[last_active_point] =
math::max(opacity, prev_opacity);
840 if (is_first_sample &&
settings_->draw_angle_factor > 0.0f) {
841 drawing_->radii_for_write()[last_active_point] *= radius_factor;
842 prev_radius =
drawing_->radii()[last_active_point];
846 constexpr int max_points_per_pixel = 4;
848 const float max_spacing_px =
math::max((
float(
brush_->spacing) / 100.0f) *
849 float(brush_radius_px),
850 1.0f /
float(max_points_per_pixel));
852 const int new_points_num = (distance_px > max_spacing_px) ?
860 const IndexRange new_points =
curves.points_by_curve()[active_curve].take_back(new_points_num);
869 point_attributes_to_skip.
add_multiple({
"position",
"radius",
"opacity"});
873 for (
const int i :
IndexRange(new_points_num)) {
875 self,
self.accum_distance_ + max_spacing_px * i, radius, extension_sample.
pressure);
884 for (
const int i :
IndexRange(new_points_num)) {
886 self,
self.accum_distance_ + max_spacing_px * i, opacity, extension_sample.
pressure);
898 for (
const int i :
IndexRange(new_points_num)) {
901 point_attributes_to_skip.
add(
"rotation");
910 for (
const int i :
IndexRange(new_points_num)) {
912 self.accum_distance_ + max_spacing_px * i,
919 prev_vertex_color,
vertex_color_, new_vertex_colors, is_first_sample);
921 point_attributes_to_skip.
add(
"vertex_color");
928 float(new_delta_time),
929 delta_times.
span.slice(new_points),
931 point_attributes_to_skip.
add(
"delta_time");
935 self.accum_distance_ += distance_px;
938 self.delta_time_ = new_delta_time;
941 self.screen_space_coords_orig_.extend(new_screen_space_coords);
942 self.screen_space_smoothed_coords_.extend(new_screen_space_coords);
943 self.screen_space_final_coords_.extend(new_screen_space_coords);
944 for (
float2 new_position : new_screen_space_coords) {
949 constexpr int64_t min_active_smoothing_points_num = 8;
950 const IndexRange smooth_window =
self.screen_space_coords_orig_.index_range().drop_front(
951 self.active_smooth_start_index_);
952 if (smooth_window.
size() < min_active_smoothing_points_num) {
953 self.placement_.project(new_screen_space_coords, new_positions);
971 self.screen_space_smoothed_coords_.as_mutable_span().slice(smooth_window);
978 curve_positions_slice[window_i] =
self.placement_.project(final_coords[window_i]);
987 curves.points_range().take_back(1));
1000 const int active_curve = on_back ?
curves.curves_range().first() :
1001 curves.curves_range().last();
1037 if (placement_.use_project_to_surface()) {
1040 else if (placement_.use_project_to_nearest_stroke()) {
1042 placement_.set_origin_to_nearest_stroke(start_sample.
mouse_position);
1055 stroke_random_radius_factor_ = rng_.get_float();
1056 stroke_random_opacity_factor_ = rng_.get_float();
1057 stroke_random_rotation_factor_ = rng_.get_float();
1059 stroke_random_hue_factor_ = rng_.get_float();
1060 stroke_random_sat_factor_ = rng_.get_float();
1061 stroke_random_val_factor_ = rng_.get_float();
1070 grease_pencil->
runtime->is_drawing_stroke =
true;
1090 executor.
execute(*
this,
C, extension_sample);
1097 const float influence,
1098 const int iterations,
1099 const int active_curve)
1150 const float epsilon,
1151 const int active_curve)
1157 ".draw_tool_screen_space_positions");
1166 curves.cyclic()[active_curve],
1168 screen_space_positions,
1173 if (!points_to_delete.
is_empty()) {
1180 const int active_curve,
1187 ".draw_tool_screen_space_positions");
1196 rcti screen_space_bounds;
1207 screen_space_positions,
1208 {screen_space_bounds},
1224 std::array<bke::GeometrySet, 2> geometry_sets;
1239 const int active_curve,
1242 const float outline_radius,
1243 const int material_index,
1265 std::array<bke::GeometrySet, 2> geometry_sets;
1280 const float epsilon,
1282 const int active_curve)
1289 int64_t num_points_to_remove = 0;
1291 if (radii[index] < epsilon) {
1292 num_points_to_remove++;
1299 if (num_points_to_remove <= 0) {
1304 if (points.
size() - num_points_to_remove < 1) {
1305 num_points_to_remove = points.
size() - 1;
1310 curves.offsets_for_write().last() =
curves.points_num();
1311 return num_points_to_remove;
1315 const int last_active_point =
curves.points_by_curve()[0].last();
1327 using T = decltype(dummy);
1328 MutableSpan<T> span_data = attribute_data.typed<T>();
1330 for (int i = last_active_point - num_points_to_remove + 1;
1331 i < curves.points_num() - num_points_to_remove;
1334 span_data[i] = span_data[i + num_points_to_remove];
1342 for (
const int src_curve :
curves.curves_range().drop_front(1)) {
1343 offsets[src_curve] = offsets[src_curve] - num_points_to_remove;
1347 return num_points_to_remove;
1352 const int active_curve)
1377 const int active_curve)
1402 Object *ob_arm =
nullptr;
1415 if (amd ==
nullptr) {
1426 if (channel ==
nullptr) {
1435 if (channel ==
nullptr) {
1441 const float4x4 postmat = obinv * ob_arm->object_to_world();
1449 for (float3 &position : positions.slice(range)) {
1450 position = math::transform_point(matrix, position);
1473 BLI_assert(grease_pencil.has_active_layer());
1481 const IndexRange points = points_by_curve[active_curve];
1489 screen_space_positions.
span.slice(points).copy_from(this->screen_space_final_coords_);
1490 screen_space_positions.
finish();
1498 if (do_post_processing) {
1513 const int material_index = [&]() {
1518 return active_index;
1521 return (alt_index > -1) ? alt_index - 1 : active_index;
1533 attributes.
remove(
".draw_tool_screen_space_positions");
1537 if (do_automerge_endpoints) {
1538 constexpr float merge_distance = 20.0f;
1542 *region, drawing.
strokes(), layer_to_world, merge_distance,
selection, {});
1548 grease_pencil.
runtime->is_drawing_stroke =
false;
1556 return std::make_unique<PaintOperation>(temp_draw);
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void BKE_brush_init_gpencil_settings(Brush *brush)
Depsgraph * CTX_data_depsgraph_pointer(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)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
Low-level operations for curves.
Low-level operations for grease pencil.
Material * BKE_grease_pencil_object_material_ensure_from_active_input_brush(Main *bmain, Object *ob, Brush *brush)
Utility functions for vertex groups in grease pencil objects.
General operations, lookup, etc. for materials.
short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma)
int BKE_object_material_index_get(Object *ob, const Material *ma)
Brush * BKE_paint_brush(Paint *paint)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Platform independent time functions.
double BLI_time_now_seconds(void)
void DEG_id_tag_update(ID *id, unsigned int flags)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ GP_BRUSH_USE_SAT_RAND_PRESS
@ GP_BRUSH_USE_STRENGTH_RAND_PRESS
@ GP_BRUSH_USE_VAL_RAND_PRESS
@ GP_BRUSH_USE_HUE_RAND_PRESS
@ GP_BRUSH_USE_STRENGTH_AT_STROKE
@ GP_BRUSH_USE_UV_RAND_PRESS
@ GP_BRUSH_USE_HUE_AT_STROKE
@ GP_BRUSH_USE_VAL_AT_STROKE
@ GP_BRUSH_USE_SAT_AT_STROKE
@ GP_BRUSH_USE_PRESS_AT_STROKE
@ GP_BRUSH_USE_UV_AT_STROKE
@ GP_BRUSH_USE_PRESSURE_RAND_PRESS
@ GP_BRUSH_OUTLINE_STROKE
@ GP_BRUSH_GROUP_SETTINGS
@ GP_BRUSH_USE_JITTER_PRESSURE
@ GP_STROKE_CAP_TYPE_ROUND
@ eModifierType_GreasePencilArmature
@ GP_TOOL_FLAG_PAINT_ONBACK
@ GP_TOOL_FLAG_AUTOMERGE_STROKE
@ GP_TOOL_FLAG_CREATE_WEIGHTS
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
BPy_StructRNA * depsgraph
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
static constexpr IndexRange from_single(const int64_t index)
static RandomNumberGenerator from_random_seed()
static VArray ForSingle(T value, const int64_t size)
MutableSpan< T > as_mutable_span()
const CPPType & type() const
constexpr int64_t first() const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
static constexpr IndexRange from_single(const int64_t index)
constexpr IndexRange index_range() const
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr MutableSpan drop_back(const int64_t n) const
constexpr T & first() const
constexpr IndexRange index_range() const
constexpr void copy_from(Span< T > values) const
constexpr T & last(const int64_t n=0) const
void add_multiple(Span< Key > keys)
constexpr Span drop_front(int64_t n) const
constexpr Span drop_back(int64_t n) const
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) const
constexpr const T * end() const
constexpr const T * begin() const
constexpr const char * data() const
Span< T > get_internal_span() const
static VArray ForSingle(T value, const int64_t size)
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
GAttributeReader lookup(const StringRef attribute_id) const
bool contains(const StringRef attribute_id) const
MutableSpan< float3 > positions_for_write()
OffsetIndices< int > points_by_curve() const
IndexRange curves_range() const
MutableAttributeAccessor attributes_for_write()
Span< float3 > positions() const
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
bool remove(const StringRef attribute_id)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type)
GSpanAttributeWriter lookup_for_write_span(StringRef attribute_id)
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
VArray< float > radii() const
void tag_positions_changed()
void tag_topology_changed()
VArray< float > opacities() const
void set_texture_matrices(Span< float4x2 > matrices, const IndexMask &selection)
float4x4 to_world_space(const Object &object) const
float4x4 to_object_space(const Object &object) const
float3 reproject(float3 pos) const
friend struct PaintOperationExecutor
PaintOperation(const bool temp_draw=false)
void on_stroke_done(const bContext &C) override
void on_stroke_extended(const bContext &C, const InputSample &extension_sample) override
void on_stroke_begin(const bContext &C, const InputSample &start_sample) override
local_group_size(16, 16) .push_constant(Type b
VecBase< float, 2 > float2
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
blender::bke::AttrDomain ED_grease_pencil_edit_selection_domain_get(const ToolSettings *tool_settings)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
T mix2(float factor, const T &a, const T &b)
void evaluate_segment(const T &point_0, const T &point_1, const T &point_2, const T &point_3, MutableSpan< T > result)
void assign_to_vertex_group_from_mask(CurvesGeometry &curves, const IndexMask &mask, StringRef name, float weight)
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void fill_attribute_range_default(MutableAttributeAccessor dst_attributes, AttrDomain domain, const AttributeFilter &attribute_filter, IndexRange range)
Curves * curves_new_nomain(int points_num, int curves_num)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
void fill_selection_false(GMutableSpan selection)
bke::GSpanAttributeWriter ensure_selection_attribute(bke::CurvesGeometry &curves, bke::AttrDomain selection_domain, eCustomDataType create_type, StringRef attribute_name)
bke::CurvesGeometry trim_curve_segments(const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const Span< rcti > screen_space_curve_bounds, const IndexMask &curve_selection, const Vector< Vector< int > > &selected_points_in_curves, const bool keep_caps)
float opacity_from_input_sample(const float pressure, const Brush *brush, const BrushGpencilSettings *settings)
float radius_from_input_sample(const RegionView3D *rv3d, const ARegion *region, const Brush *brush, const float pressure, const float3 location, const float4x4 to_world, const BrushGpencilSettings *settings)
IndexMask polyline_detect_corners(Span< float2 > points, const float radius_min, const float radius_max, const int samples_max, const float angle_threshold, IndexMaskMemory &memory)
bke::CurvesGeometry curves_merge_endpoints_by_distance(const ARegion ®ion, const bke::CurvesGeometry &src_curves, const float4x4 &layer_to_world, const float merge_distance, const IndexMask &selection, const bke::AttributeFilter &attribute_filter)
Array< float2 > polyline_fit_curve(Span< float2 > points, const float error_threshold, const IndexMask &corner_mask)
float4x2 calculate_texture_space(const Scene *scene, const ARegion *region, const float2 &mouse, const DrawingPlacement &placement)
bke::CurvesGeometry create_curves_outline(const bke::greasepencil::Drawing &drawing, const IndexMask &strokes, const float4x4 &transform, const int corner_subdivisions, const float outline_radius, const float outline_offset, const int material_index)
static void linear_interpolation(const T &a, const T &b, MutableSpan< T > dst, const bool include_first_point)
static void deselect_stroke(const bContext &C, bke::greasepencil::Drawing &drawing, const int active_curve)
static void create_blank_curve(bke::CurvesGeometry &curves, const bool on_back)
static void trim_stroke_ends(bke::greasepencil::Drawing &drawing, const int active_curve, const bool on_back)
static float2 arithmetic_mean(Span< float2 > values)
static void extend_curve(bke::CurvesGeometry &curves, const bool on_back, const int new_points_num)
static int trim_end_points(bke::greasepencil::Drawing &drawing, const float epsilon, const bool on_back, const int active_curve)
static float brush_radius_to_pixel_radius(const RegionView3D *rv3d, const Brush *brush, const float3 pos)
bool brush_using_vertex_color(const GpPaint *gp_paint, const Brush *brush)
static void morph_points_to_curve(Span< float2 > src, Span< float2 > target, MutableSpan< float2 > dst)
static void simplify_stroke(bke::greasepencil::Drawing &drawing, const float epsilon, const int active_curve)
static void process_stroke_weights(const Scene &scene, const Object &object, bke::greasepencil::Drawing &drawing, const int active_curve)
static void smooth_stroke(bke::greasepencil::Drawing &drawing, const float influence, const int iterations, const int active_curve)
static Array< float2 > sample_curve_2d(Span< float2 > positions, const int64_t resolution)
static void outline_stroke(bke::greasepencil::Drawing &drawing, const int active_curve, const float4x4 &viewmat, const ed::greasepencil::DrawingPlacement &placement, const float outline_radius, const int material_index, const bool on_back)
std::unique_ptr< GreasePencilStrokeOperation > new_paint_operation(bool temp_draw=false)
void smooth_curve_attribute(const IndexMask &curves_to_smooth, const OffsetIndices< int > points_by_curve, const VArray< bool > &point_selection, const VArray< bool > &cyclic, int iterations, float influence, bool smooth_ends, bool keep_shape, GMutableSpan attribute_data)
bke::GeometrySet join_geometries(Span< bke::GeometrySet > geometries, const bke::AttributeFilter &attribute_filter, const std::optional< Span< bke::GeometryComponent::Type > > &component_types_to_join=std::nullopt)
void curve_simplify(const Span< float3 > positions, const bool cyclic, const float epsilon, const GSpan attribute_data, MutableSpan< bool > points_to_delete)
void gaussian_blur_1D(const GSpan src, int iterations, const VArray< float > &influence_by_point, const bool smooth_ends, const bool keep_shape, const bool is_cyclic, GMutableSpan dst)
void accumulate_lengths(const Span< T > values, const bool cyclic, MutableSpan< float > lengths)
void sample_at_lengths(Span< float > accumulated_segment_lengths, Span< float > sample_lengths, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors)
void interpolate(const Span< T > src, const Span< int > indices, const Span< float > factors, MutableSpan< T > dst)
T cos(const AngleRadianBase< T > &a)
T distance(const T &a, const T &b)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
CartesianBasis invert(const CartesianBasis &basis)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T sin(const AngleRadianBase< T > &a)
T max(const T &a, const T &b)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
float perlin(float position)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
MatBase< float, 4, 2 > float4x2
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
float distance(float a, float b)
MatBase< float, 4, 4 > float4x4
GPU_SHADER_INTERFACE_INFO(overlay_edit_curve_handle_iface, "vert").flat(Type pos vertex_in(1, Type::UINT, "data") .vertex_out(overlay_edit_curve_handle_iface) .geometry_layout(PrimitiveIn Frequency::GEOMETRY storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) .push_constant(Type Frequency::GEOMETRY selection[]
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
unsigned __int64 uint64_t
struct CurveMapping * curve_sensitivity
struct CurveMapping * curve_strength
struct CurveMapping * curve_jitter
struct CurveMapping * curve_rand_pressure
struct CurveMapping * curve_rand_strength
struct CurveMapping * curve_rand_saturation
struct CurveMapping * curve_rand_hue
struct CurveMapping * curve_rand_uv
struct Material * material_alt
struct CurveMapping * curve_rand_value
struct BrushGpencilSettings * gpencil_settings
GreasePencilRuntimeHandle * runtime
struct MaterialGPencilStyle * gp_style
struct ToolSettings * toolsettings
static MatBase identity()
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
MutableVArraySpan< T > span
float randomize_radius(PaintOperation &self, const float distance, const float radius, const float pressure)
GreasePencil * grease_pencil_
void active_smoothing(PaintOperation &self, const IndexRange smooth_window)
void process_extension_sample(PaintOperation &self, const bContext &C, const InputSample &extension_sample)
ColorGeometry4f vertex_color_
ColorGeometry4f fill_color_
bke::greasepencil::Drawing * drawing_
BrushGpencilSettings * settings_
float randomize_rotation(PaintOperation &self, const float pressure)
bool use_settings_random_
void active_jitter(PaintOperation &self, const int new_points_num, const float brush_radius_px, const float pressure, const IndexRange active_window, MutableSpan< float3 > curve_positions)
float randomize_opacity(PaintOperation &self, const float distance, const float opacity, const float pressure)
void execute(PaintOperation &self, const bContext &C, const InputSample &extension_sample)
ColorGeometry4f randomize_color(PaintOperation &self, const float distance, const ColorGeometry4f color, const float pressure)
PaintOperationExecutor(const bContext &C)
void process_start_sample(PaintOperation &self, const bContext &C, const InputSample &start_sample, const int material_index, const bool use_fill)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)