67#include <fmt/format.h>
195 new_operation->on_stroke_begin(*C,
sample);
212 if (operation !=
nullptr) {
240 const bool use_duplicate_previous_key = [&]() ->
bool {
265 C, op, use_duplicate_previous_key);
279 return_value = op->
type->
modal(C, op, event);
300 ot->
name =
"Grease Pencil Draw";
301 ot->
idname =
"GREASE_PENCIL_OT_brush_stroke";
302 ot->
description =
"Draw a new stroke in the active Grease Pencil object";
340 if (!grease_pencil.has_active_layer()) {
347 if (brush ==
nullptr) {
352 if (!active_layer.is_editable()) {
358 bool inserted_keyframe =
false;
361 const bool use_duplicate_previous_key =
true;
364 *scene, grease_pencil, *layer, use_duplicate_previous_key, inserted_keyframe))
366 inserted_keyframe =
true;
369 if (!inserted_keyframe) {
384 const int return_value = op->
type->
modal(C, op, event);
405 ot->
name =
"Grease Pencil Sculpt";
406 ot->
idname =
"GREASE_PENCIL_OT_sculpt_paint";
407 ot->
description =
"Sculpt strokes in the active Grease Pencil object";
449 if (brush ==
nullptr) {
475 const int return_value = op->
type->
modal(C, op, event);
498 ot->
name =
"Grease Pencil Paint Weight";
499 ot->
idname =
"GREASE_PENCIL_OT_weight_brush_stroke";
500 ot->
description =
"Draw weight on stroke points in the active Grease Pencil object";
540 if (!grease_pencil.has_active_layer()) {
546 if (!active_layer.is_editable()) {
553 if (brush ==
nullptr) {
558 bool inserted_keyframe =
false;
561 const bool use_duplicate_previous_key =
true;
563 *scene, grease_pencil, active_layer, use_duplicate_previous_key, inserted_keyframe))
568 if (inserted_keyframe) {
581 const int return_value = op->
type->
modal(C, op, event);
604 ot->
name =
"Grease Pencil Paint Vertex";
605 ot->
idname =
"GREASE_PENCIL_OT_vertex_brush_stroke";
606 ot->
description =
"Draw on vertex colors in the active Grease Pencil object";
675 const bool combined_invert = (
invert != brush_invert);
708 bvh_curve_offsets_data[i] = drawings[i].drawing.strokes().points_num();
711 bvh_curve_offsets_data, bvh_extension_range.
size());
715 const int max_bvh_lines = bvh_curve_offsets.
data().last();
725 for (
const int i_line : bvh_extension_range.
index_range()) {
730 const int bvh_index = bvh_extension_range[i_line];
731 view_starts[bvh_index] = start;
732 view_ends[bvh_index] = end;
734 const float bb[6] = {start.x, start.y, 0.0f, end.x, end.y, 0.0f};
739 for (
const int i_drawing : drawings.
index_range()) {
742 const OffsetIndices points_by_curve = curves.points_by_curve();
746 const float4x4 layer_to_view = view_matrix * layer.to_world_space(
object);
748 for (
const int i_curve : curves.curves_range()) {
750 const IndexRange points = points_by_curve[i_curve];
752 for (
const int i_point : points.drop_back(1)) {
756 const int bvh_index = bvh_curve_offsets[i_drawing][i_point];
757 view_starts[bvh_index] = start;
758 view_ends[bvh_index] = end;
760 const float bb[6] = {start.x, start.y, 0.0f, end.x, end.y, 0.0f};
768 const int bvh_index = bvh_curve_offsets[i_drawing][points.last()];
769 view_starts[bvh_index] = start;
770 view_ends[bvh_index] = end;
772 const float bb[6] = {start.x, start.y, 0.0f, end.x, end.y, 0.0f};
791 const RaycastArgs &args = *
static_cast<const RaycastArgs *
>(userdata);
792 if (
ELEM(index, args.ignore_index1, args.ignore_index2)) {
797 const float2 ray_end = ray_start +
float2(ray->direction) * ray->radius;
798 const float2 &line_start = args.starts[index];
799 const float2 &line_end = args.ends[index];
801 if (result.kind <= 0) {
804 const float dist = result.lambda *
math::distance(ray_start, ray_end);
805 if (dist >= hit->dist) {
812 hit->no[0] = result.lambda;
818 for (
const int i_line : extension_data.
lines.
starts.index_range()) {
825 const int bvh_index = i_line;
826 const int origin_drawing = origin_drawings[i_line];
827 const int origin_point = origin_points[i_line];
828 const int bvh_origin_index = bvh_curve_offsets[origin_drawing][origin_point];
830 RaycastArgs args = {view_starts, view_ends, bvh_index, bvh_origin_index};
837 if (hit.index >= 0) {
838 const float lambda = hit.no[0];
843 new_extension_ends[i_line] = extension_data.
lines.
ends[i_line];
847 extension_data.
lines.
ends = std::move(new_extension_ends);
871 feature_points_range.
size());
875 const int max_kd_entries = kd_points_range.
size();
880 KDTree_2d *kdtree = BLI_kdtree_2d_new(max_kd_entries);
883 for (
const int point_i : circles_range.
index_range()) {
889 const int kd_index = circles_range[point_i];
890 view_centers[kd_index] = center;
891 view_radii[kd_index] = radius;
893 BLI_kdtree_2d_insert(kdtree, kd_index, center);
895 for (
const int i_point : feature_points_range.
index_range()) {
899 BLI_kdtree_2d_balance(kdtree);
909 for (
const int point_i : circles_range.
index_range()) {
910 const int kd_index = circles_range[point_i];
911 const float2 center = view_centers[kd_index];
912 const float radius = view_radii[kd_index];
915 BLI_kdtree_2d_range_search_cb_cpp(
919 [&](
const int other_point_i,
const float * ,
float ) {
920 if (other_point_i == kd_index) {
925 connection_lines.starts.append(extension_data.
circles.
centers[point_i]);
926 if (circles_range.
contains(other_point_i)) {
927 connection_lines.ends.append(extension_data.
circles.
centers[other_point_i]);
929 else if (feature_points_range.
contains(other_point_i)) {
931 connection_lines.ends.append(
float3(0));
940 keep_circle_indices.
append(point_i);
944 BLI_kdtree_2d_free(kdtree);
947 extension_data.
lines.
starts.extend(connection_lines.starts);
948 extension_data.
lines.
ends.extend(connection_lines.ends);
975 for (
const int i_drawing : drawings.
index_range()) {
978 const OffsetIndices points_by_curve = curves.points_by_curve();
981 const float4x4 layer_to_world = grease_pencil.layer(info.
layer_index).to_world_space(
object);
983 for (
const int i_curve : curves.curves_range()) {
984 const IndexRange points = points_by_curve[i_curve];
986 if (cyclic[i_curve]) {
990 if (points.size() < 2) {
998 positions[points.last(1)]);
1007 extension_data.
lines.
ends.append(pos_head + dir_head * length);
1008 origin_drawings.
append(i_drawing);
1009 origin_points.
append(points.first());
1012 extension_data.
lines.
ends.append(pos_tail + dir_tail * length);
1013 origin_drawings.
append(i_drawing);
1015 origin_points.
append(points.last() - 1);
1020 origin_drawings.
append(i_drawing);
1021 origin_points.
append(points.first());
1025 origin_drawings.
append(i_drawing);
1027 origin_points.
append(points.last() - 1);
1042 C, extension_data, origin_drawings, origin_points);
1046 return extension_data;
1054 const std::string status_str = fmt::format(
1055 IFACE_(
"Fill: ESC/RMB cancel, LMB Fill, MMB Adjust Extension, S: "
1056 "Switch Mode, D: Stroke Collision | Mode: {}, Collision {}, Length: {:.3f}"),
1085 if (op_data.show_boundaries) {
1090 const IndexMask curve_mask = info.drawing.strokes().curves_range();
1092 stroke_curves_color, info.drawing.strokes().points_num());
1093 const float4x4 layer_to_world = grease_pencil.layer(info.layer_index).to_world_space(
object);
1094 const bool use_xray =
false;
1095 const float radius_scale = 1.0f;
1098 int2(region.winx, region.winy),
1109 if (op_data.show_extension) {
1113 const float line_width = 2.0f;
1118 extension_lines_color, lines_range.
size());
1130 extension_circles_color, circles_range.
size());
1138 float2(region.winx, region.winy),
1150 if (needs_overlay) {
1175 BLI_assert(grease_pencil.has_active_layer());
1176 const IndexRange all_layers = grease_pencil.layers().index_range();
1177 const int active_layer_index = *grease_pencil.get_layer_index(*grease_pencil.get_active_layer());
1179 switch (fill_layer_mode) {
1182 return index != active_layer_index;
1186 return index != active_layer_index + 1;
1190 return index != active_layer_index - 1;
1194 return index <= active_layer_index;
1198 return index >= active_layer_index;
1202 return !grease_pencil.layers()[index]->is_visible();
1219 using namespace bke::greasepencil;
1224 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
1228 const int target_layer_index = *grease_pencil.get_layer_index(target_layer);
1232 target_frames.
add(scene.r.cfra);
1234 if (use_multi_frame_editing) {
1235 for (
const Layer *layer : grease_pencil.layers()) {
1236 for (
const auto [frame_number, frame] : layer->frames().items()) {
1237 if (frame.is_selected()) {
1238 target_frames.
add(frame_number);
1246 for (
const int frame_number : target_frames) {
1248 if (use_duplicate_frame) {
1249 grease_pencil.insert_duplicate_frame(
1250 target_layer, *target_layer.
start_frame_at(frame_number), frame_number,
false);
1253 grease_pencil.insert_frame(target_layer, frame_number);
1260 for (
const int frame_number : target_frames) {
1261 if (
Drawing *target_drawing = grease_pencil.get_editable_drawing_at(target_layer,
1264 MutableDrawingInfo target = {*target_drawing, target_layer_index, frame_number, 1.0f};
1267 for (
const Layer *source_layer : grease_pencil.layers()) {
1268 if (
const Drawing *source_drawing = grease_pencil.get_drawing_at(*source_layer,
1271 const int source_layer_index = *grease_pencil.get_layer_index(*source_layer);
1272 sources.
append({*source_drawing, source_layer_index, frame_number, 0});
1276 drawings.
append({std::move(target), std::move(sources)});
1285 const int iterations = 20;
1286 if (curves.points_num() == 0) {
1294 const OffsetIndices points_by_curve = curves.points_by_curve();
1309 curves.tag_positions_changed();
1314 const OffsetIndices points_by_curve = curves.points_by_curve();
1315 const Array<int> point_to_curve_map = curves.point_to_curve_map();
1320 const int curve_i = point_to_curve_map[i];
1321 const IndexRange points = points_by_curve[curve_i];
1322 if (points.size() <= 2) {
1325 const int local_i = i - points.start();
1326 return (local_i %
int(
math::pow(2.0f,
float(step))) == 0) || points.last() == i;
1341 constexpr const bool keep_images =
false;
1360 const std::optional<float> alpha_threshold =
1366 if (!grease_pencil.has_active_layer()) {
1371 scene, grease_pencil, *grease_pencil.get_active_layer());
1377 const Layer &layer = *grease_pencil.layers()[info.target.layer_index];
1393 op_data.material_index,
1398 if (simplify_levels > 0) {
1416 Curves *dst_curves_id = curves_new_nomain(dst_curves);
1417 Curves *fill_curves_id = curves_new_nomain(fill_curves);
1421 const int num_new_curves = fill_curves.
curves_num();
1422 const IndexRange new_curves_range = (on_back ?
1433 scene, region, *view_context.
v3d,
object, &layer);
1435 &scene, ®ion, mouse_position, placement);
1437 info.target.drawing.set_texture_matrices(texture_matrices, new_curves_range);
1459 Paint &paint = scene.toolsettings->gp_paint->paint;
1462 Layer *layer = grease_pencil.get_active_layer();
1464 if (layer && layer->is_locked()) {
1467 if (layer ==
nullptr) {
1468 layer = &grease_pencil.add_layer(
"GP_Layer");
1485 &bmain, &ob, &brush);
1491 op.
customdata = MEM_new<GreasePencilFillOpData>(
1508 if (op_data.overlay_cb_handle) {
1510 op_data.overlay_cb_handle =
nullptr;
1580 const float extension_delta = (op_data.precision ? 0.002f : 0.02f);
1582 switch (event->
val) {
1588 if (op_data.is_extension_drag_active) {
1592 op_data.fill_mouse_pos =
float2(event->
mval);
1597 if (op_data.show_extension) {
1610 op_data.extension_length = std::max(op_data.extension_length - extension_delta, 0.0f);
1615 op_data.extension_length = std::min(op_data.extension_length + extension_delta, 10.0f);
1622 op_data.is_extension_drag_active =
true;
1626 constexpr const float gap = 300.0f;
1627 op_data.extension_mouse_pos = (
math::distance(base_pos, op_data.fill_mouse_pos) >= gap ?
1629 base_pos -
float2(gap, 0));
1634 op_data.is_extension_drag_active =
false;
1643 if (op_data.show_extension) {
1644 op_data.extension_cut = !op_data.extension_cut;
1650 op_data.invert = !op_data.invert;
1654 op_data.precision = !op_data.precision;
1671 switch (event->
type) {
1676 if (!op_data.is_extension_drag_active) {
1683 const float initial_dist =
math::distance(op_data.extension_mouse_pos,
1684 op_data.fill_mouse_pos);
1685 const float current_dist =
math::distance(mouse_pos, op_data.fill_mouse_pos);
1687 float delta = (current_dist - initial_dist) * pixel_size * 0.5f;
1688 op_data.extension_length = std::clamp(op_data.extension_length + delta, 0.0f, 10.0f);
1727 ot->
name =
"Grease Pencil Fill";
1728 ot->
idname =
"GREASE_PENCIL_OT_fill";
1729 ot->
description =
"Fill with color the shape formed by strokes";
1739 ot->
srna,
"invert",
false,
"Invert",
"Find boundary of unfilled instead of filled regions");
1743 ot->
srna,
"precision",
false,
"Precision",
"Use precision movement for extension lines");
1771 {
int(FillToolModalKey::Cancel),
"CANCEL", 0,
"Cancel",
""},
1772 {
int(FillToolModalKey::Confirm),
"CONFIRM", 0,
"Confirm",
""},
1773 {
int(FillToolModalKey::ExtensionModeToggle),
1774 "EXTENSION_MODE_TOGGLE",
1776 "Toggle Extension Mode",
1778 {
int(FillToolModalKey::ExtensionLengthen),
1779 "EXTENSION_LENGTHEN",
1781 "Lengthen Extensions",
1783 {
int(FillToolModalKey::ExtensionShorten),
"EXTENSION_SHORTEN", 0,
"Shorten Extensions",
""},
1784 {
int(FillToolModalKey::ExtensionDrag),
"EXTENSION_DRAG", 0,
"Drag Extensions",
""},
1785 {
int(FillToolModalKey::ExtensionCollide),
"EXTENSION_COLLIDE", 0,
"Collide Extensions",
""},
1786 {
int(FillToolModalKey::Invert),
"INVERT", 0,
"Invert",
""},
1787 {
int(FillToolModalKey::Precision),
"PRECISION", 0,
"Precision",
""},
1788 {0,
nullptr, 0,
nullptr,
nullptr},
Functions to insert, delete or modify keyframes.
void BKE_brush_init_gpencil_settings(Brush *brush)
void BKE_brush_tag_unsaved_changes(Brush *brush)
wmWindow * CTX_wm_window(const bContext *C)
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)
ToolSettings * CTX_data_tool_settings(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(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)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
int BKE_object_material_index_get(Object *ob, const Material *ma)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_unreachable()
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_free(BVHTree *tree)
void(* BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
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)
A KD-tree for nearest neighbor search.
#define BLI_SCOPED_DEFER(function_to_defer)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
void DEG_id_tag_update(ID *id, unsigned int flags)
@ GPVERTEX_BRUSH_TYPE_BLUR
@ GPVERTEX_BRUSH_TYPE_DRAW
@ GPVERTEX_BRUSH_TYPE_TINT
@ GPVERTEX_BRUSH_TYPE_REPLACE
@ GPVERTEX_BRUSH_TYPE_AVERAGE
@ GPVERTEX_BRUSH_TYPE_SMEAR
@ GPAINT_BRUSH_TYPE_ERASE
@ GP_BRUSH_FILL_SHOW_HELPLINES
@ GP_BRUSH_FILL_STROKE_COLLIDE
@ GP_BRUSH_MATERIAL_PINNED
@ GP_BRUSH_FILL_SHOW_EXTENDLINES
@ GPWEIGHT_BRUSH_TYPE_AVERAGE
@ GPWEIGHT_BRUSH_TYPE_DRAW
@ GPWEIGHT_BRUSH_TYPE_SMEAR
@ GPWEIGHT_BRUSH_TYPE_BLUR
@ GPSCULPT_BRUSH_TYPE_SMOOTH
@ GPSCULPT_BRUSH_TYPE_PUSH
@ GPSCULPT_BRUSH_TYPE_CLONE
@ GPSCULPT_BRUSH_TYPE_TWIST
@ GPSCULPT_BRUSH_TYPE_RANDOMIZE
@ GPSCULPT_BRUSH_TYPE_GRAB
@ GPSCULPT_BRUSH_TYPE_PINCH
@ GPSCULPT_BRUSH_TYPE_THICKNESS
@ GPSCULPT_BRUSH_TYPE_STRENGTH
@ GP_FILL_GPLMODE_ALL_ABOVE
@ GP_FILL_GPLMODE_VISIBLE
@ GP_FILL_GPLMODE_ALL_BELOW
@ GP_TOOL_FLAG_RETAIN_LAST
@ GP_TOOL_FLAG_PAINT_ONBACK
@ GP_USE_MULTI_FRAME_EDITING
void ED_workspace_status_text(bContext *C, const char *str)
void ED_region_tag_redraw(ARegion *region)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
#define REGION_DRAW_POST_VIEW
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr IndexRange after(int64_t n) const
constexpr bool contains(int64_t value) const
constexpr IndexRange index_range() const
bool contains(const Key &key) const
static VArray ForSingle(T value, const int64_t size)
static VArray ForFunc(const int64_t size, GetFunc get_func)
void append(const T &value)
IndexRange index_range() const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
void reserve(const int64_t min_capacity)
Span< T > as_span() const
bool contains(const StringRef attribute_id) const
IndexRange curves_range() const
MutableAttributeAccessor attributes_for_write()
void tag_topology_changed()
AttributeAccessor attributes() const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
const bke::CurvesGeometry & strokes() const
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
std::optional< int > start_frame_at(int frame_number) const
virtual void on_stroke_extended(const bContext &C, const InputSample &extension_sample)=0
virtual void on_stroke_done(const bContext &C)=0
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
DEGForeachIDComponentCallback callback
static bool is_cyclic(const Nurb *nu)
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
void ED_filltool_modal_keymap(wmKeyConfig *keyconf)
void ED_operatortypes_grease_pencil_draw()
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
bool is_autokey_on(const Scene *scene)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
constexpr float LEGACY_RADIUS_CONVERSION_FACTOR
CurvesGeometry curves_copy_point_selection(const CurvesGeometry &curves, const IndexMask &points_to_copy, const AttributeFilter &attribute_filter)
void draw_lines(const float4x4 &transform, IndexRange indices, Span< float3 > start_positions, Span< float3 > end_positions, const VArray< ColorGeometry4f > &colors, float line_width)
void draw_grease_pencil_strokes(const RegionView3D &rv3d, const int2 &win_size, const Object &object, const bke::greasepencil::Drawing &drawing, const float4x4 &transform, const IndexMask &strokes_mask, const VArray< ColorGeometry4f > &colors, const bool use_xray, const float radius_scale)
void draw_circles(const float4x4 &transform, const IndexRange indices, Span< float3 > centers, const VArray< float > &radii, const VArray< ColorGeometry4f > &colors, const float2 &viewport_size, const float line_width, const bool fill)
int grease_pencil_draw_operator_invoke(bContext *C, wmOperator *op, const bool use_duplicate_previous_key)
bool ensure_active_keyframe(const Scene &scene, GreasePencil &grease_pencil, bke::greasepencil::Layer &layer, const bool duplicate_previous_key, bool &r_inserted_keyframe)
bool grease_pencil_vertex_painting_poll(bContext *C)
Vector< DrawingInfo > retrieve_visible_drawings(const Scene &scene, const GreasePencil &grease_pencil, const bool do_onion_skinning)
bool grease_pencil_sculpting_poll(bContext *C)
bool grease_pencil_weight_painting_poll(bContext *C)
Vector< MutableDrawingInfo > retrieve_editable_drawings(const Scene &scene, GreasePencil &grease_pencil)
float4x2 calculate_texture_space(const Scene *scene, const ARegion *region, const float2 &mouse, const DrawingPlacement &placement)
bool grease_pencil_painting_poll(bContext *C)
std::unique_ptr< GreasePencilStrokeOperation > new_vertex_replace_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_erase_operation(const bool temp_eraser)
std::unique_ptr< GreasePencilStrokeOperation > new_weight_paint_average_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_strength_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_grab_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_weight_paint_blur_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_vertex_paint_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_clone_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_randomize_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_paint_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_vertex_blur_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_tint_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_thickness_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_pinch_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_weight_paint_draw_operation(const BrushStrokeMode &brush_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_push_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_weight_paint_smear_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_vertex_average_operation()
std::unique_ptr< GreasePencilStrokeOperation > new_twist_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_smooth_operation(BrushStrokeMode stroke_mode)
std::unique_ptr< GreasePencilStrokeOperation > new_vertex_smear_operation()
static void grease_pencil_fill_extension_lines_from_circles(const bContext &C, ed::greasepencil::ExtensionData &extension_data, Span< int >, Span< int >)
static bool stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
static bool grease_pencil_weight_brush_stroke_poll(bContext *C)
static void grease_pencil_sculpt_paint_cancel(bContext *C, wmOperator *op)
static int grease_pencil_vertex_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void grease_pencil_fill_exit(bContext &C, wmOperator &op)
static int grease_pencil_weight_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void stroke_update_step(bContext *C, wmOperator *op, PaintStroke *, PointerRNA *stroke_element)
static bool grease_pencil_sculpt_paint_poll(bContext *C)
static int grease_pencil_weight_brush_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void grease_pencil_fill_cancel(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_weight_brush_stroke(wmOperatorType *ot)
static int grease_pencil_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool stroke_get_location(bContext *C, float out[3], const float mouse[2], bool)
static void grease_pencil_brush_stroke_cancel(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_brush_stroke(wmOperatorType *ot)
void paint_stroke_cancel(bContext *C, wmOperator *op, PaintStroke *stroke)
static int grease_pencil_vertex_brush_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void GREASE_PENCIL_OT_vertex_brush_stroke(wmOperatorType *ot)
static int grease_pencil_sculpt_paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void stroke_done(const bContext *C, PaintStroke *stroke)
static void GREASE_PENCIL_OT_sculpt_paint(wmOperatorType *ot)
static void grease_pencil_fill_status_indicators(bContext &C, const GreasePencilFillOpData &op_data)
static bool grease_pencil_vertex_brush_stroke_poll(bContext *C)
static void grease_pencil_vertex_brush_stroke_cancel(bContext *C, wmOperator *op)
static bke::CurvesGeometry simplify_fixed(bke::CurvesGeometry &curves, const int step)
static int grease_pencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int grease_pencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void stroke_redraw(const bContext *C, PaintStroke *, bool)
int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintStroke **stroke_p)
static VArray< bool > get_fill_boundary_layers(const GreasePencil &grease_pencil, eGP_FillLayerModes fill_layer_mode)
static Vector< FillToolTargetInfo > ensure_editable_drawings(const Scene &scene, GreasePencil &grease_pencil, bke::greasepencil::Layer &target_layer)
static void grease_pencil_weight_brush_stroke_cancel(bContext *C, wmOperator *op)
static int grease_pencil_fill_event_modal_map(bContext *C, wmOperator *op, const wmEvent *event)
static void GREASE_PENCIL_OT_fill(wmOperatorType *ot)
static void grease_pencil_fill_overlay_cb(const bContext *C, ARegion *, void *arg)
void * paint_stroke_mode_data(PaintStroke *stroke)
static bool grease_pencil_apply_fill(bContext &C, wmOperator &op, const wmEvent &event)
static void grease_pencil_fill_update_overlay(const ARegion ®ion, GreasePencilFillOpData &op_data)
PaintStroke * paint_stroke_new(bContext *C, wmOperator *op, StrokeGetLocation get_location, StrokeTestStart test_start, StrokeUpdateStep update_step, StrokeRedraw redraw, StrokeDone done, int event_type)
static ed::greasepencil::ExtensionData grease_pencil_fill_get_extension_data(const bContext &C, const GreasePencilFillOpData &op_data)
static int grease_pencil_brush_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void grease_pencil_fill_extension_cut(const bContext &C, ed::greasepencil::ExtensionData &extension_data, Span< int > origin_drawings, Span< int > origin_points)
static void smooth_fill_strokes(bke::CurvesGeometry &curves, const IndexMask &stroke_mask)
static std::unique_ptr< GreasePencilStrokeOperation > get_stroke_operation(bContext &C, wmOperator *op)
static bool grease_pencil_brush_stroke_poll(bContext *C)
static void grease_pencil_update_extend(bContext &C, GreasePencilFillOpData &op_data)
static int grease_pencil_sculpt_paint_modal(bContext *C, wmOperator *op, const wmEvent *event)
void paint_stroke_set_mode_data(PaintStroke *stroke, std::unique_ptr< PaintModeData > mode_data)
static bool grease_pencil_fill_init(bContext &C, wmOperator &op)
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)
T pow(const T &x, const T &power)
isect_result< VecBase< T, Size > > isect_seg_seg(const VecBase< T, Size > &v1, const VecBase< T, Size > &v2, const VecBase< T, Size > &v3, const VecBase< T, Size > &v4)
T distance(const T &a, const T &b)
QuaternionBase< T > normalize_and_get_length(const QuaternionBase< T > &q, T &out_length)
T average(const VecBase< T, Size > &a)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
void paint_stroke_operator_properties(wmOperatorType *ot)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
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_flag(PropertyRNA *prop, PropertyFlag flag)
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
struct CurveMapping * curve_rand_value
char gpencil_sculpt_brush_type
char gpencil_weight_brush_type
struct BrushGpencilSettings * gpencil_settings
char gpencil_vertex_brush_type
VecBase< T, 2 > xy() const
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Curves * get_curves_for_write()
const bke::greasepencil::Drawing & drawing
struct blender::ed::greasepencil::ExtensionData::@346 circles
struct blender::ed::greasepencil::ExtensionData::@345 lines
blender::bke::greasepencil::Layer & layer
bool is_extension_drag_active
eGP_FillExtendModes extension_mode
static GreasePencilFillOpData from_context(bContext &C, blender::bke::greasepencil::Layer &layer, const int material_index, const bool invert, const bool precision)
float2 extension_mouse_pos
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
struct ReportList * reports
struct wmOperatorType * type
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_set(wmWindow *win, int curs)
void WM_cursor_modal_restore(wmWindow *win)
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))