69 const bool include_first_point)
71 if (include_first_point) {
78 const float step = 1.0f /
float(dst.
size());
87 return std::accumulate(values.begin(), values.end(),
float2(0)) / values.size();
94 const int64_t num_handles = positions.size() / 3;
95 if (num_handles == 1) {
98 const int64_t num_segments = num_handles - 1;
99 const int64_t num_points = num_segments * resolution;
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],
110 points.as_mutable_span().
slice(segment_range));
126 Array<float> accumulated_lengths_target(target.size() - 1);
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();
147 curves.resize(curves.points_num() + 1, curves.curves_num() + 1);
148 curves.offsets_for_write().last(1) = num_old_points;
152 curves.resize(curves.points_num() + 1, curves.curves_num() + 1);
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];
187 curves.resize(curves.points_num() + new_points_num, curves.curves_num());
188 curves.offsets_for_write().last() = curves.points_num();
192 const int last_active_point = curves.points_by_curve()[0].last();
194 curves.resize(curves.points_num() + new_points_num, curves.curves_num());
197 for (
const int src_curve : curves.curves_range().drop_front(1)) {
198 offsets[src_curve] = offsets[src_curve] + new_points_num;
200 offsets.
last() = curves.points_num();
205 if (iter.
domain != bke::AttrDomain::Point) {
212 bke::attribute_math::convert_to_static_type(attribute_data.
type(), [&](
auto dummy) {
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_;
276 void on_stroke_done(
const bContext &C)
override;
311 if (use_vertex_color_) {
316 vertex_color_ = color_base;
319 fill_color_ = color_base;
322 softness_ = 1.0f - settings_->
hardness;
324 BLI_assert(grease_pencil->has_active_layer());
325 drawing_ = grease_pencil->get_editable_drawing_at(*grease_pencil->get_active_layer(),
331 const float distance,
333 const float pressure)
338 float random_factor = 0.0f;
341 constexpr float noise_scale = 1 / 20.0f;
342 random_factor = noise::perlin(
343 float2(distance * noise_scale,
self.stroke_random_radius_factor_));
346 random_factor =
self.stroke_random_radius_factor_;
357 const float distance,
359 const float pressure)
364 float random_factor = 0.0f;
367 constexpr float noise_scale = 1 / 20.0f;
368 random_factor = noise::perlin(
369 float2(distance * noise_scale,
self.stroke_random_opacity_factor_));
372 random_factor =
self.stroke_random_opacity_factor_;
384 if (!use_settings_random_ || !(settings_->
uv_random > 0.0f)) {
387 float random_factor = 0.0f;
389 random_factor =
self.rng_.get_float();
392 random_factor =
self.stroke_random_rotation_factor_;
399 const float random_rotation = (random_factor * 2.0f - 1.0f) * math::numbers::pi;
404 const float distance,
406 const float pressure)
408 if (!use_settings_random_ ||
415 constexpr float noise_scale = 1 / 20.0f;
417 float random_hue = 0.0f;
419 random_hue = noise::perlin(
float2(distance * noise_scale,
self.stroke_random_hue_factor_));
422 random_hue =
self.stroke_random_hue_factor_;
425 float random_saturation = 0.0f;
427 random_saturation = noise::perlin(
428 float2(distance * noise_scale,
self.stroke_random_sat_factor_));
431 random_saturation =
self.stroke_random_sat_factor_;
434 float random_value = 0.0f;
436 random_value = noise::perlin(
float2(distance * noise_scale,
self.stroke_random_val_factor_));
439 random_value =
self.stroke_random_val_factor_;
461 else if (hsv[0] < 0.0f) {
469 random_color.
a = color.a;
476 const int material_index,
483 const float3 start_location =
self.placement_.project(start_coords);
484 float start_radius = ed::greasepencil::radius_from_input_sample(
490 self.placement_.to_world_space(),
492 start_radius = randomize_radius(
self, 0.0f, start_radius, start_sample.
pressure);
494 float start_opacity = ed::greasepencil::opacity_from_input_sample(
495 start_sample.
pressure, brush_, settings_);
496 start_opacity = randomize_opacity(
self, 0.0f, start_opacity, start_sample.
pressure);
498 const float start_rotation = randomize_rotation(
self, start_sample.
pressure);
499 if (use_vertex_color_) {
500 vertex_color_ = randomize_color(
self, 0.0f, vertex_color_, start_sample.
pressure);
506 self.screen_space_coords_orig_.append(start_coords);
508 self.screen_space_jitter_offsets_.append(
float2(0.0f));
509 self.screen_space_smoothed_coords_.append(start_coords);
510 self.screen_space_final_coords_.append(start_coords);
516 const int active_curve = on_back ? curves.curves_range().first() :
517 curves.curves_range().last();
518 const IndexRange curve_points = curves.points_by_curve()[active_curve];
519 const int last_active_point = curve_points.
last();
524 curves.positions_for_write()[last_active_point] = start_location;
527 point_attributes_to_skip.
add_multiple({
"position",
"radius",
"opacity"});
528 if (use_vertex_color_ || attributes.contains(
"vertex_color")) {
530 point_attributes_to_skip.
add(
"vertex_color");
532 if (use_fill || attributes.contains(
"fill_color")) {
534 curve_attributes_to_skip.
add(
"fill_color");
537 "delta_time", bke::AttrDomain::Point);
538 delta_times.
span[last_active_point] = 0.0f;
539 point_attributes_to_skip.
add(
"delta_time");
543 "material_index", bke::AttrDomain::Curve);
545 "cyclic", bke::AttrDomain::Curve);
547 "softness", bke::AttrDomain::Curve);
549 "u_scale", bke::AttrDomain::Curve);
550 cyclic.
span[active_curve] =
false;
551 materials.span[active_curve] = material_index;
552 softness.span[active_curve] = softness_;
553 u_scale.span[active_curve] = 1.0f;
554 curve_attributes_to_skip.
add_multiple({
"material_index",
"cyclic",
"softness",
"u_scale"});
560 if (settings_->
uv_random > 0.0f || attributes.contains(
"rotation")) {
562 "rotation", bke::AttrDomain::Point);
563 rotations.
span[last_active_point] = start_rotation;
564 point_attributes_to_skip.
add(
"rotation");
571 attributes.lookup_or_add_for_write_span<
int8_t>(
"start_cap", bke::AttrDomain::Curve);
573 curve_attributes_to_skip.
add(
"start_cap");
579 "end_cap", bke::AttrDomain::Curve);
581 curve_attributes_to_skip.
add(
"end_cap");
585 if (use_fill && (start_opacity < 1.0f || attributes.contains(
"fill_opacity"))) {
587 attributes.lookup_or_add_for_write_span<
float>(
589 bke::AttrDomain::Curve,
591 fill_opacities.
span[active_curve] = start_opacity;
592 curve_attributes_to_skip.
add(
"fill_opacity");
597 "init_time", bke::AttrDomain::Curve);
600 curve_attributes_to_skip.
add(
"init_time");
604 curve_attributes_to_skip.
add(
"curve_type");
605 curves.update_curve_types();
608 bke::fill_attribute_range_default(
610 bke::AttrDomain::Point,
611 bke::attribute_filter_from_skip_ref(point_attributes_to_skip),
613 bke::fill_attribute_range_default(
615 bke::AttrDomain::Curve,
616 bke::attribute_filter_from_skip_ref(curve_attributes_to_skip),
628 const float corner_min_radius_px = 5.0f;
629 const float corner_max_radius_px = 30.0f;
630 const int64_t corner_max_samples = 64;
631 const float corner_angle_threshold = 0.6f;
633 const IndexMask corner_mask = ed::greasepencil::polyline_detect_corners(
635 corner_min_radius_px,
636 corner_max_radius_px,
638 corner_angle_threshold,
644 const int pre_blur_iterations = 3;
645 geometry::gaussian_blur_1D(
655 const float max_error_threshold_px = 5.0f;
656 Array<float2> curve_points = ed::greasepencil::polyline_fit_curve(
657 coords_pre_blur, max_error_threshold_px * settings_->
active_smooth, corner_mask);
660 const int64_t sample_resolution = 32;
669 const float converging_threshold_px = 0.1f;
670 bool stop_counting_converged =
false;
671 int num_converged = 0;
674 self.screen_space_curve_fitted_coords_[window_i].append(coords_smoothed[window_i]);
680 if (!stop_counting_converged) {
681 float2 prev_pos = window_coords[window_i];
682 if (
math::distance(new_pos, prev_pos) < converging_threshold_px) {
686 stop_counting_converged =
true;
691 window_coords[window_i] = new_pos;
695 if (num_converged > 0) {
696 self.active_smooth_start_index_ += num_converged;
697 self.screen_space_curve_fitted_coords_.remove(0, num_converged);
702 const int new_points_num,
703 const float brush_radius_px,
704 const float pressure,
708 float jitter_factor = 1.0f;
714 for ([[maybe_unused]]
const int _ :
IndexRange(new_points_num)) {
715 const float rand =
self.rng_.get_float() * 2.0f - 1.0f;
716 const float factor = rand * settings_->
draw_jitter * jitter_factor;
717 self.screen_space_jitter_offsets_.append(cotangent * factor * brush_radius_px);
722 self.screen_space_smoothed_coords_.as_mutable_span().
slice(active_window);
727 final_coords[window_i] = smoothed_coords[window_i] + jitter_slice[window_i];
728 positions_slice[window_i] =
self.placement_.project(final_coords[window_i]);
742 float3 position =
self.placement_.project(coords);
743 float radius = ed::greasepencil::radius_from_input_sample(rv3d,
748 self.placement_.to_world_space(),
750 float opacity = ed::greasepencil::opacity_from_input_sample(
751 extension_sample.
pressure, brush_, settings_);
760 const int active_curve = on_back ? curves.curves_range().first() :
761 curves.curves_range().last();
762 const IndexRange curve_points = points_by_curve[active_curve];
763 const int last_active_point = curve_points.
last();
765 const float2 prev_coords =
self.screen_space_coords_orig_.last();
766 float prev_radius = drawing_->
radii()[last_active_point];
767 const float prev_opacity = drawing_->
opacities()[last_active_point];
770 const bool is_first_sample = (curve_points.
size() == 1);
775 if (is_first_sample) {
776 self.smoothed_pen_direction_ =
self.screen_space_coords_orig_.last() - coords;
783 constexpr float smoothing_rate_factor = 0.3f;
785 self.screen_space_coords_orig_.last() -
787 smoothing_rate_factor);
791 float radius_factor = 1.0f;
804 radius *= radius_factor;
809 constexpr float point_override_threshold_px = 2.0f;
810 if (distance_px < point_override_threshold_px) {
811 self.accum_distance_ += distance_px;
813 if (!is_first_sample) {
814 curves.positions_for_write()[last_active_point] = position;
817 radius = randomize_radius(
self,
self.accum_distance_, radius, extension_sample.
pressure);
820 opacity = randomize_opacity(
831 prev_radius = drawing_->
radii()[last_active_point];
835 constexpr int max_points_per_pixel = 4;
838 float(brush_radius_px),
839 1.0f /
float(max_points_per_pixel));
841 const int new_points_num = (distance_px > max_spacing_px) ?
849 const IndexRange new_points = curves.points_by_curve()[active_curve].
take_back(new_points_num);
857 linear_interpolation<float2>(prev_coords, coords, new_screen_space_coords, is_first_sample);
858 point_attributes_to_skip.
add_multiple({
"position",
"radius",
"opacity"});
862 for (
const int i :
IndexRange(new_points_num)) {
863 new_radii[i] = randomize_radius(
864 self,
self.accum_distance_ + max_spacing_px * i, radius, extension_sample.
pressure);
868 linear_interpolation<float>(prev_radius, radius, new_radii, is_first_sample);
873 for (
const int i :
IndexRange(new_points_num)) {
874 new_opacities[i] = randomize_opacity(
875 self,
self.accum_distance_ + max_spacing_px * i, opacity, extension_sample.
pressure);
879 linear_interpolation<float>(prev_opacity, opacity, new_opacities, is_first_sample);
883 if (use_settings_random_ && (settings_->
uv_random > 0.0f || attributes.contains(
"rotation"))) {
885 "rotation", bke::AttrDomain::Point);
887 for (
const int i :
IndexRange(new_points_num)) {
888 new_rotations[i] = randomize_rotation(
self, extension_sample.
pressure);
890 point_attributes_to_skip.
add(
"rotation");
895 if (use_vertex_color_ || attributes.contains(
"vertex_color")) {
898 if (use_settings_random_ || attributes.contains(
"vertex_color")) {
899 for (
const int i :
IndexRange(new_points_num)) {
900 new_vertex_colors[i] = randomize_color(
self,
901 self.accum_distance_ + max_spacing_px * i,
907 linear_interpolation<ColorGeometry4f>(
908 prev_vertex_color, vertex_color_, new_vertex_colors, is_first_sample);
910 point_attributes_to_skip.
add(
"vertex_color");
914 "delta_time", bke::AttrDomain::Point);
916 linear_interpolation<float>(
float(
self.delta_time_),
917 float(new_delta_time),
918 delta_times.
span.slice(new_points),
920 point_attributes_to_skip.
add(
"delta_time");
924 self.accum_distance_ += distance_px;
927 self.delta_time_ = new_delta_time;
930 self.screen_space_coords_orig_.extend(new_screen_space_coords);
931 self.screen_space_smoothed_coords_.extend(new_screen_space_coords);
932 self.screen_space_final_coords_.extend(new_screen_space_coords);
933 for (
float2 new_position : new_screen_space_coords) {
938 constexpr int64_t min_active_smoothing_points_num = 8;
940 self.active_smooth_start_index_);
941 if (smooth_window.
size() < min_active_smoothing_points_num) {
942 self.placement_.project(new_screen_space_coords, new_positions);
946 this->active_smoothing(
self, smooth_window);
950 if (use_settings_random_ && settings_->
draw_jitter > 0.0f) {
951 this->active_jitter(
self,
960 self.screen_space_smoothed_coords_.as_mutable_span().
slice(smooth_window);
967 curve_positions_slice[window_i] =
self.placement_.project(final_coords[window_i]);
972 bke::fill_attribute_range_default(
974 bke::AttrDomain::Point,
975 bke::attribute_filter_from_skip_ref(point_attributes_to_skip),
976 curves.points_range().take_back(1));
986 this->process_extension_sample(
self, C, extension_sample);
990 curves.curves_range().last();
1005 Paint *paint = &scene->toolsettings->gp_paint->paint;
1026 if (placement_.use_project_to_surface()) {
1027 placement_.cache_viewport_depths(
depsgraph, region, view3d);
1029 else if (placement_.use_project_to_nearest_stroke()) {
1030 placement_.cache_viewport_depths(
depsgraph, region, view3d);
1031 placement_.set_origin_to_nearest_stroke(start_sample.
mouse_position);
1034 texture_space_ = ed::greasepencil::calculate_texture_space(
1039 texture_space_ = texture_space_ * layer.to_object_space(*
object);
1042 rng_ = RandomNumberGenerator::from_random_seed();
1044 stroke_random_radius_factor_ = rng_.get_float();
1045 stroke_random_opacity_factor_ = rng_.get_float();
1046 stroke_random_rotation_factor_ = rng_.get_float();
1048 stroke_random_hue_factor_ = rng_.get_float();
1049 stroke_random_sat_factor_ = rng_.get_float();
1050 stroke_random_val_factor_ = rng_.get_float();
1059 grease_pencil->
runtime->is_drawing_stroke =
true;
1079 executor.
execute(*
this, C, extension_sample);
1086 const float influence,
1087 const int iterations,
1088 const int active_curve)
1091 const IndexRange stroke = IndexRange::from_single(active_curve);
1098 geometry::smooth_curve_attribute(stroke,
1112 geometry::smooth_curve_attribute(stroke,
1125 geometry::smooth_curve_attribute(stroke,
1139 const float epsilon,
1140 const int active_curve)
1144 const IndexRange points = curves.points_by_curve()[active_curve];
1146 ".draw_tool_screen_space_positions");
1154 geometry::curve_simplify(curves.positions().slice(points),
1155 curves.cyclic()[active_curve],
1157 screen_space_positions,
1161 const IndexMask points_to_delete = IndexMask::from_bools(points_to_delete_arr, memory);
1162 if (!points_to_delete.
is_empty()) {
1169 const int active_curve,
1173 const IndexRange points = curves.points_by_curve()[active_curve];
1176 ".draw_tool_screen_space_positions");
1183 drawing.
strokes(), IndexRange::from_single(active_curve), {});
1184 auto bounds = bounds::min_max(screen_space_positions);
1185 rcti screen_space_bounds;
1196 screen_space_positions,
1197 {screen_space_bounds},
1198 IndexRange::from_single(0),
1211 Curves *trimmed_curve = bke::curves_new_nomain(std::move(stroke_trimmed));
1213 std::array<bke::GeometrySet, 2> geometry_sets;
1215 geometry_sets = {bke::GeometrySet::from_curves(trimmed_curve),
1216 bke::GeometrySet::from_curves(other_curves)};
1219 geometry_sets = {bke::GeometrySet::from_curves(other_curves),
1220 bke::GeometrySet::from_curves(trimmed_curve)};
1223 geometry::join_geometries(geometry_sets, {}).get_curves_for_write()->geometry.wrap());
1228 const int active_curve,
1231 const float outline_radius,
1232 const int material_index,
1238 IndexRange::from_single(active_curve),
1252 Curves *outline_curve = bke::curves_new_nomain(std::move(outline));
1254 std::array<bke::GeometrySet, 2> geometry_sets;
1256 geometry_sets = {bke::GeometrySet::from_curves(outline_curve),
1257 bke::GeometrySet::from_curves(other_curves)};
1260 geometry_sets = {bke::GeometrySet::from_curves(other_curves),
1261 bke::GeometrySet::from_curves(outline_curve)};
1264 geometry::join_geometries(geometry_sets, {}).get_curves_for_write()->geometry.wrap());
1269 const float epsilon,
1271 const int active_curve)
1278 int64_t num_points_to_remove = 0;
1279 for (
int64_t index = points.last(); index >= points.first(); index--) {
1280 if (radii[index] < epsilon) {
1281 num_points_to_remove++;
1288 if (num_points_to_remove <= 0) {
1293 if (points.size() - num_points_to_remove < 1) {
1294 num_points_to_remove = points.
size() - 1;
1298 curves.resize(curves.points_num() - num_points_to_remove, curves.curves_num());
1299 curves.offsets_for_write().last() = curves.points_num();
1300 return num_points_to_remove;
1304 const int last_active_point = curves.points_by_curve()[0].last();
1308 if (iter.
domain != bke::AttrDomain::Point) {
1315 bke::attribute_math::convert_to_static_type(attribute_data.
type(), [&](
auto dummy) {
1316 using T = decltype(dummy);
1317 MutableSpan<T> span_data = attribute_data.typed<T>();
1319 for (int i = last_active_point - num_points_to_remove + 1;
1320 i < curves.points_num() - num_points_to_remove;
1323 span_data[i] = span_data[i + num_points_to_remove];
1329 curves.resize(curves.points_num() - num_points_to_remove, curves.curves_num());
1331 for (
const int src_curve : curves.curves_range().drop_front(1)) {
1332 offsets[src_curve] = offsets[src_curve] - num_points_to_remove;
1334 offsets.
last() = curves.points_num();
1336 return num_points_to_remove;
1341 const int active_curve)
1348 scene->toolsettings);
1353 if (selection_domain == bke::AttrDomain::Curve) {
1354 ed::curves::fill_selection_false(selection.span.slice(IndexRange::from_single(active_curve)));
1356 else if (selection_domain == bke::AttrDomain::Point) {
1357 ed::curves::fill_selection_false(selection.span.slice(points));
1366 const int active_curve)
1369 const IndexRange points = curves.points_by_curve()[active_curve];
1383 curves,
IndexMask(points), vertex_group_name, scene.toolsettings->vgroup_weight);
1385 if (scene.toolsettings->vgroup_weight == 0.0f) {
1391 Object *ob_arm =
nullptr;
1404 if (amd ==
nullptr) {
1415 if (channel ==
nullptr) {
1424 if (channel ==
nullptr) {
1430 const float4x4 postmat = obinv * ob_arm->object_to_world();
1437 threading::parallel_for(positions.index_range(), 1024, [&](
const IndexRange range) {
1438 for (float3 &position : positions.slice(range)) {
1439 position = math::transform_point(matrix, position);
1453 Paint *paint = &scene->toolsettings->gp_paint->paint;
1458 const bool do_automerge_endpoints = (scene->toolsettings->gpencil_flags &
1462 BLI_assert(grease_pencil.has_active_layer());
1470 const IndexRange points = points_by_curve[active_curve];
1476 attributes.lookup_or_add_for_write_only_span<
float2>(
".draw_tool_screen_space_positions",
1477 bke::AttrDomain::Point);
1478 screen_space_positions.
span.slice(points).copy_from(this->screen_space_final_coords_);
1479 screen_space_positions.
finish();
1487 if (do_post_processing) {
1488 if (settings->draw_smoothfac > 0.0f) {
1489 smooth_stroke(drawing, settings->draw_smoothfac, settings->draw_smoothlvl, active_curve);
1491 if (settings->simplify_px > 0.0f) {
1502 const int material_index = [&]() {
1506 if (settings->material_alt ==
nullptr) {
1507 return active_index;
1510 return (alt_index > -1) ? alt_index - 1 : active_index;
1522 attributes.remove(
".draw_tool_screen_space_positions");
1526 if (do_automerge_endpoints) {
1527 constexpr float merge_distance = 20.0f;
1529 const IndexMask selection = IndexRange::from_single(active_curve);
1530 drawing.
strokes_for_write() = ed::greasepencil::curves_merge_endpoints_by_distance(
1531 *region, drawing.
strokes(), layer_to_world, merge_distance, selection, {});
1537 grease_pencil.
runtime->is_drawing_stroke =
false;
1545 return std::make_unique<PaintOperation>();
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
@ GPPAINT_FLAG_USE_VERTEXCOLOR
@ 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])
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
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
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
constexpr IndexRange take_back(int64_t n) const
constexpr IndexRange index_range() const
constexpr IndexRange drop_front(int64_t n) 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 slice(int64_t start, int64_t size) 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 char * data() const
Span< T > get_internal_span() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) 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)
VArray< ColorGeometry4f > vertex_colors() const
MutableSpan< float > opacities_for_write()
MutableSpan< float > radii_for_write()
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
MutableSpan< ColorGeometry4f > fill_colors_for_write()
MutableSpan< ColorGeometry4f > vertex_colors_for_write()
void set_texture_matrices(Span< float4x2 > matrices, const IndexMask &selection)
float4x4 to_world_space(const Object &object) const
float3 reproject(float3 pos) const
local_group_size(16, 16) .push_constant(Type b
const Depsgraph * depsgraph
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)
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)
std::unique_ptr< GreasePencilStrokeOperation > new_paint_operation()
static float brush_radius_to_pixel_radius(const RegionView3D *rv3d, const Brush *brush, const float3 pos)
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)
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)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
unsigned __int64 uint64_t
struct CurveMapping * curve_jitter
struct CurveMapping * curve_rand_pressure
struct CurveMapping * curve_rand_strength
struct CurveMapping * curve_rand_saturation
struct CurveMapping * curve_rand_hue
float draw_random_strength
struct CurveMapping * curve_rand_uv
struct CurveMapping * curve_rand_value
struct BrushGpencilSettings * gpencil_settings
GreasePencilRuntimeHandle * runtime
struct ToolSettings * toolsettings
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)
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)