107 if (!(smooth_position || smooth_radius || smooth_opacity)) {
112 bool changed =
false;
133 if (smooth_position) {
189 ot->name =
"Smooth Stroke";
190 ot->idname =
"GREASE_PENCIL_OT_stroke_smooth";
191 ot->description =
"Smooth selected strokes";
198 prop =
RNA_def_int(
ot->srna,
"iterations", 10, 1, 100,
"Iterations",
"", 1, 30);
200 RNA_def_float(
ot->srna,
"factor", 1.0f, 0.0f, 1.0f,
"Factor",
"", 0.0f, 1.0f);
227 "Delete alternating vertices in the stroke, except extremes"},
232 "Use a Ramer-Douglas-Peucker algorithm to simplify the stroke preserving main shape"},
237 "Re-sample the stroke with segments of the specified length"},
242 "Simplify the stroke by merging vertices closer than a given distance"},
243 {0,
nullptr, 0,
nullptr,
nullptr},
255 points_by_curve, stroke_selection, memory);
260 const int curve_i = point_to_curve_map[
i];
261 const IndexRange points = points_by_curve[curve_i];
262 if (points.
size() <= 2) {
265 const int local_i =
i - points.
start();
271 {selected_to_keep, selected_points.
complement(
curves.points_range(), memory)}, memory);
282 bool changed =
false;
305 if (points_to_keep.
size() ==
curves.points_num()) {
309 curves, points_to_keep, {});
344 const int curve_i = point_to_curve_map[
i];
345 const IndexRange points = points_by_curve[curve_i];
352 curves, merge_distance, filtered_points, {});
405 ot->name =
"Simplify Stroke";
406 ot->idname =
"GREASE_PENCIL_OT_stroke_simplify";
407 ot->description =
"Simplify selected strokes";
416 prop =
RNA_def_float(
ot->srna,
"factor", 0.01f, 0.0f, 100.0f,
"Factor",
"", 0.0f, 100.0f);
418 prop =
RNA_def_float(
ot->srna,
"length", 0.05f, 0.01f, 100.0f,
"Length",
"", 0.01f, 1.0f);
420 prop =
RNA_def_float(
ot->srna,
"distance", 0.01f, 0.0f, 100.0f,
"Distance",
"", 0.0f, 1.0f);
422 prop =
RNA_def_int(
ot->srna,
"steps", 1, 0, 50,
"Steps",
"", 0.0f, 10);
429 "Method used for simplifying stroke points");
449 bool changed =
false;
461 curves.remove_curves(strokes, {});
485 ot->idname =
"GREASE_PENCIL_OT_delete";
486 ot->description =
"Delete selected strokes or points";
515 "Dissolve points between selected points"},
520 "Dissolve all unselected points"},
521 {0,
nullptr, 0,
nullptr,
nullptr},
529 mask.to_bools(points_to_dissolve);
532 return points_to_dissolve;
544 for (const int64_t curve_i : range) {
545 const IndexRange points = points_by_curve[curve_i];
546 const Span<bool> curve_selection = points_to_dissolve.as_span().slice(points);
548 if (!curve_selection.contains(true)) {
549 points_to_keep.slice(points).fill(true);
555 if (mode != DissolveMode::BETWEEN) {
559 const Vector<IndexRange> deselection_ranges = array_utils::find_all_ranges(curve_selection,
562 if (deselection_ranges.size() != 0) {
563 const IndexRange first_range = deselection_ranges.first().shift(points.first());
564 const IndexRange last_range = deselection_ranges.last().shift(points.first());
568 if (first_range.first() == points.first()) {
569 points_to_keep.slice(first_range).fill(true);
571 if (last_range.last() == points.last()) {
572 points_to_keep.slice(last_range).fill(true);
580 return points_to_dissolve;
592 bool changed =
false;
608 if (points_to_dissolve.
as_span().contains(
true)) {
626 ot->name =
"Dissolve";
627 ot->idname =
"GREASE_PENCIL_OT_dissolve";
628 ot->description =
"Delete selected points without splitting strokes";
641 "Method used for dissolving stroke points");
664 "Deletes current frame in the active layer"},
669 "Delete active frames for all layers"},
670 {0,
nullptr, 0,
nullptr,
nullptr},
678 const int current_frame = scene->
r.
cfra;
682 bool changed =
false;
686 changed |= grease_pencil.remove_frames(layer, {*layer.
start_frame_at(current_frame)});
691 if (layer->is_editable() && layer->start_frame_at(current_frame)) {
692 changed |= grease_pencil.remove_frames(*layer, {*layer->start_frame_at(current_frame)});
710 ot->name =
"Delete Frame";
711 ot->idname =
"GREASE_PENCIL_OT_delete_frame";
712 ot->description =
"Delete Grease Pencil Frame(s)";
725 "Method used for deleting Grease Pencil frames");
745 int material_index =
object->actcol - 1;
747 if (
name[0] !=
'\0') {
758 if (material_index == -1) {
773 curves.attributes_for_write().lookup_or_add_for_write_span<
int>(
"material_index",
787 ot->name =
"Assign Material";
788 ot->idname =
"GREASE_PENCIL_OT_stroke_material_set";
789 ot->description =
"Assign the active material slot to the selected strokes";
797 ot->srna,
"material",
nullptr,
MAX_ID_NAME - 2,
"Material",
"Name of the material");
819 {0,
nullptr, 0,
nullptr,
nullptr},
827 curves.ensure_evaluated_lengths();
833 if (cyclic[curve_i]) {
834 const IndexRange points = points_by_curve[curve_i];
836 positions[points.
last()]);
839 const float curve_length =
curves.evaluated_length_total_for_curve(curve_i,
true) -
843 const float point_density =
float(points.
size()) / curve_length;
844 use_cuts[points.
last()] = int(point_density * end_distance);
860 const bool subdivide_cyclic_segment =
RNA_boolean_get(op->
ptr,
"subdivide_cyclic_segment");
862 bool changed =
false;
894 curves.attributes_for_write().remove(
"cyclic");
898 if (subdivide_cyclic_segment) {
900 curves.tag_topology_changed();
919 ot->name =
"Set Cyclical State";
920 ot->idname =
"GREASE_PENCIL_OT_cyclical_set";
921 ot->description =
"Close or open the selected stroke adding a segment from last to first point";
933 "subdivide_cyclic_segment",
935 "Match Point Density",
936 "Add point in the new segment to keep the same density");
951 if (
object->totcol == 0) {
959 *
object, info.drawing, info.layer_index, memory);
967 object->actcol = materials[strokes.
first()] + 1;
978 ot->name =
"Set Active Material";
979 ot->idname =
"GREASE_PENCIL_OT_set_active_material";
980 ot->description =
"Set the selected stroke material as the active material";
1002 bool changed =
false;
1029 ot->name =
"Set Uniform Thickness";
1030 ot->idname =
"GREASE_PENCIL_OT_set_uniform_thickness";
1031 ot->description =
"Set all stroke points to same thickness";
1039 ot->srna,
"thickness", 0.1f, 0.0f, 1000.0f,
"Thickness",
"Thickness", 0.0f, 1000.0f);
1058 bool changed =
false;
1080 fill_opacities.span[curve] = opacity_fill;
1082 fill_opacities.finish();
1098 ot->name =
"Set Uniform Opacity";
1099 ot->idname =
"GREASE_PENCIL_OT_set_uniform_opacity";
1100 ot->description =
"Set all stroke points to same opacity";
1109 RNA_def_float(
ot->srna,
"opacity_stroke", 1.0f, 0.0f, 1.0f,
"Stroke Opacity",
"", 0.0f, 1.0f);
1110 RNA_def_float(
ot->srna,
"opacity_fill", 0.5f, 0.0f, 1.0f,
"Fill Opacity",
"", 0.0f, 1.0f);
1126 bool changed =
false;
1138 curves.reverse_curves(strokes);
1154 ot->name =
"Switch Direction";
1155 ot->idname =
"GREASE_PENCIL_OT_stroke_switch_direction";
1156 ot->description =
"Change direction of the points of the selected strokes";
1187 for (const int curve_i : range) {
1188 const IndexRange points = points_by_curve[curve_i];
1189 const Span<bool> curve_i_selected_points = start_set_points.as_span().slice(points);
1190 const int first_selected = curve_i_selected_points.first_index_try(true);
1192 MutableSpan<int> dst_to_src_slice = dst_to_src_point.as_mutable_span().slice(points);
1194 array_utils::fill_index_range<int>(dst_to_src_slice, points.start());
1196 if (first_selected == -1 || src_cyclic[curve_i] == false) {
1200 std::rotate(dst_to_src_slice.begin(),
1201 dst_to_src_slice.begin() + first_selected,
1202 dst_to_src_slice.end());
1230 dst_curves.update_curve_types();
1232 if (
curves.nurbs_has_custom_knots()) {
1246 std::atomic<bool> changed =
false;
1271 ot->name =
"Set Start Point";
1272 ot->idname =
"GREASE_PENCIL_OT_set_start_point";
1273 ot->description =
"Select which point is the beginning of the curve";
1318 bool changed =
false;
1338 start_caps.finish();
1389 {int(
CapsMode::ROUND),
"ROUND", 0,
"Rounded",
"Set as default rounded"},
1394 {0,
nullptr, 0,
nullptr,
nullptr},
1397 ot->name =
"Set Curve Caps";
1398 ot->idname =
"GREASE_PENCIL_OT_caps_set";
1399 ot->description =
"Change curve caps mode (rounded or flat)";
1426 if (ob ==
nullptr) {
1433 item_tmp.identifier = ma->id.name + 2;
1434 item_tmp.name = ma->id.name + 2;
1435 item_tmp.value =
i + 1;
1436 item_tmp.icon = ma->preview ? ma->preview->runtime->icon_id : ICON_NONE;
1454 if ((slot < 1) || (slot >
object->totcol)) {
1459 object->actcol = slot;
1468 ot->name =
"Set Active Material";
1469 ot->idname =
"GREASE_PENCIL_OT_set_material";
1470 ot->description =
"Set active material";
1497 std::atomic<bool> changed =
false;
1520 changed.store(
true, std::memory_order_relaxed);
1532 ot->name =
"Duplicate";
1533 ot->idname =
"GREASE_PENCIL_OT_duplicate";
1534 ot->description =
"Duplicate the selected points";
1560 editable_strokes,
GrainSize(4096), memory, [&](
const int i) {
1561 return points_by_curve[
i].
size() <= limit;
1564 curves.remove_curves(curves_to_delete, {});
1578 C, op, event,
IFACE_(
"Remove Loose Points"),
IFACE_(
"Delete"));
1583 ot->name =
"Clean Loose Points";
1584 ot->idname =
"GREASE_PENCIL_OT_clean_loose";
1585 ot->description =
"Remove loose points";
1599 "Number of points to consider stroke as loose",
1615 std::atomic<bool> changed =
false;
1653 auto is_selected = [&](
const int point_i,
const int curve_i) {
1654 if (selection[point_i]) {
1661 return selection_left[point_i] || selection_right[point_i];
1672 for (
const int curve :
curves.curves_range()) {
1675 for (
const int point : points_by_curve[curve].drop_back(1)) {
1677 if (!is_selected(point, curve)) {
1681 if (is_selected(point + 1, curve)) {
1682 use_cuts[point] = cuts;
1686 if (cyclic[curve]) {
1687 const int first_point = points_by_curve[curve].first();
1688 const int last_point = points_by_curve[curve].last();
1689 if (is_selected(first_point, curve) && is_selected(last_point, curve)) {
1690 use_cuts[last_point] = cuts;
1699 changed.store(
true, std::memory_order_relaxed);
1714 ot->name =
"Subdivide Stroke";
1715 ot->idname =
"GREASE_PENCIL_OT_stroke_subdivide";
1717 "Subdivide between continuous selected points of the stroke adding a point half way "
1726 prop =
RNA_def_int(
ot->srna,
"number_cuts", 1, 1, 32,
"Number of Cuts",
"", 1, 5);
1734 "Smooth only selected points in the stroke");
1793 A.to_indices(
indices.as_mutable_span().take_front(
A.size()));
1794 B.to_indices(
indices.as_mutable_span().take_back(
B.size()));
1799 if (curve_i !=
pos) {
1813 const int curve_i = selected_indices[
pos];
1816 if (curve_i != universe.
last(
i)) {
1834 std::atomic<bool> changed =
false;
1854 changed.store(
true, std::memory_order_relaxed);
1873 {0,
nullptr, 0,
nullptr,
nullptr},
1876 ot->name =
"Reorder";
1877 ot->idname =
"GREASE_PENCIL_OT_reorder";
1878 ot->description =
"Change the display order of the selected strokes";
1899 bool changed =
false;
1908 if (add_new_layer) {
1909 target_node = &grease_pencil.add_layer(target_layer_name).as_node();
1912 target_node = grease_pencil.find_node_by_name(target_layer_name);
1915 if (target_node ==
nullptr || !target_node->
is_layer()) {
1921 if (layer_dst.is_locked()) {
1937 bool is_key_inserted =
false;
1939 *scene, grease_pencil, layer_dst,
false, is_key_inserted);
1940 if (has_active_key && is_key_inserted) {
1942 Drawing &drawing_dst = *grease_pencil.get_drawing_at(layer_dst, info.frame_number);
1944 curves_src, selected_strokes, {});
1949 else if (
Drawing *drawing_dst = grease_pencil.get_drawing_at(layer_dst, info.frame_number)) {
1952 curves_src, selected_strokes, {});
1955 std::array<bke::GeometrySet, 2> geometry_sets{
1963 drawing_dst->tag_topology_changed();
1966 info.drawing.tag_topology_changed();
1984 if (add_new_layer) {
1988 const std::string
unique_name = grease_pencil.unique_layer_name(
"Layer");
1992 C, op, event,
IFACE_(
"Move to New Layer"),
IFACE_(
"Create"));
2010 ot->name =
"Move to Layer";
2011 ot->idname =
"GREASE_PENCIL_OT_move_to_layer";
2012 ot->description =
"Move selected strokes to another layer";
2021 ot->srna,
"target_layer_name",
nullptr,
INT16_MAX,
"Name",
"Target Grease Pencil Layer");
2024 ot->srna,
"add_new_layer",
false,
"New Layer",
"Move selection to a new layer");
2047 {0,
nullptr, 0,
nullptr,
nullptr},
2052 int actcol =
object->actcol;
2053 for (
int slot = 1; slot <=
object->totcol; slot++) {
2055 object->actcol = slot;
2060 if (actcol >= slot) {
2065 object->actcol = actcol;
2080 object_dst->
data = grease_pencil_dst;
2086 const int layer_index,
2094 const Layer &layer_src = grease_pencil_src.layer(layer_index);
2095 if (
TreeNode *node = grease_pencil_dst.find_node_by_name(layer_src.name())) {
2096 return node->as_layer();
2100 Layer &new_layer = grease_pencil_dst.add_layer(layer_src.name());
2102 src_to_dst_layer_indices.
append(layer_index);
2115 bool changed =
false;
2119 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2136 info.layer_index, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2138 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2143 curves_src, selected_points, {});
2146 info.drawing.tag_topology_changed();
2158 src_to_dst_layer_indices.
as_span(),
2159 grease_pencil_dst.attributes_for_write());
2162 if (grease_pencil_src.has_active_layer()) {
2163 const Layer &active_layer_src = *grease_pencil_src.get_active_layer();
2164 TreeNode *active_layer_dst = grease_pencil_dst.find_node_by_name(active_layer_src.name());
2165 if (active_layer_dst && active_layer_dst->
is_layer()) {
2166 grease_pencil_dst.set_active_layer(&active_layer_dst->
as_layer());
2192 bool changed =
false;
2197 for (
const int layer_i : grease_pencil_src.layers().index_range()) {
2198 Layer &layer_src = grease_pencil_src.layer(layer_i);
2199 if (layer_src.is_locked()) {
2204 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2208 layer_i, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2212 scene, grease_pencil_src, layer_src);
2217 object_src, info.drawing, info.layer_index, memory);
2230 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2236 info.drawing.strokes(), strokes, {});
2239 info.drawing.tag_topology_changed();
2250 src_to_dst_layer_indices.
as_span(),
2251 grease_pencil_dst.attributes_for_write());
2271 bool changed =
false;
2282 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2300 object_src, info.drawing, mat_i, memory);
2307 info.layer_index, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2309 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2317 info.drawing.tag_topology_changed();
2328 src_to_dst_layer_indices.
as_span(),
2329 grease_pencil_dst.attributes_for_write());
2355 bool changed =
false;
2364 const bool has_selection = std::any_of(
2366 return ed::curves::has_anything_selected(info.drawing.strokes());
2368 if (!has_selection) {
2375 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2380 if (object_src->
totcol == 1) {
2387 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2392 if (grease_pencil_src.layers().size() == 1) {
2398 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2415 ot->name =
"Separate";
2416 ot->idname =
"GREASE_PENCIL_OT_separate";
2417 ot->description =
"Separate the selected geometry into a new Grease Pencil object";
2450} *grease_pencil_clipboard =
nullptr;
2482 scene_materials.
add(material->id.session_uid, material);
2495 clipboard_material_remap[clipboard.
materials[
i].second] = target_index;
2501 clipboard_material_remap[clipboard.
materials[
i].second] = target_index;
2504 return clipboard_material_remap;
2512 std::unique_ptr<bke::Instances> instances = std::make_unique<bke::Instances>();
2513 instances->resize(geometries.
size());
2514 transforms.
materialize(instances->transforms_for_write());
2521 options.keep_original_ids =
true;
2522 options.realize_instance_attributes =
false;
2545 int num_elements_copied = 0;
2552 const Layer &layer = grease_pencil.layer(drawing_info.layer_index);
2568 num_elements_copied += copied_curves.
curves_num();
2574 num_elements_copied += copied_curves.
points_num();
2582 if (copied_curves_per_layer.
is_empty()) {
2583 clipboard.
layers.reinitialize(0);
2587 clipboard.
layers.reinitialize(copied_curves_per_layer.
size());
2590 for (
auto const &[layer, geometries] : copied_curves_per_layer.
items()) {
2591 const float4x4 layer_to_object = layer->to_object_space(*
object);
2597 cliplayer.
name = layer->name();
2607 const auto is_material_index_used = [&](
const int material_index) ->
bool {
2612 if (material_indices.
contains(material_index)) {
2620 if (!is_material_index_used(material_index)) {
2640 ot->name =
"Copy Strokes";
2641 ot->idname =
"GREASE_PENCIL_OT_copy";
2642 ot->description =
"Copy the selected Grease Pencil points or strokes to the internal clipboard";
2653 const float4x4 &object_to_paste_layer,
2654 const float4x4 &clipboard_to_world,
2655 const bool keep_world_transform,
2656 const bool paste_back,
2677 (keep_world_transform ?
2678 object.world_to_object() * clipboard_to_world :
2687 if (!clipboard_material_remap.
is_empty()) {
2692 if (material_indices) {
2693 for (
const int i : pasted_curves_range) {
2694 material_indices.
span[
i] = clipboard_material_remap[material_indices.
span[
i]];
2696 material_indices.
finish();
2702 return pasted_curves_range;
2726 if (clipboard.
layers.is_empty()) {
2732 bke::GSpanAttributeWriter selection = ed::curves::ensure_selection_attribute(
2733 layer.curves, selection_domain, bke::AttrType::Bool);
2738 Layer *active_layer = grease_pencil.get_active_layer();
2739 if (!active_layer) {
2743 if (!active_layer->is_editable()) {
2755 selection_in_target.
finish();
2761 bool inserted_keyframe =
false;
2769 scene, grease_pencil, *active_layer);
2772 *bmain, *
object, object_to_layer, keep_world_transform, paste_on_back, info.
drawing);
2775 if (inserted_keyframe) {
2780 Layer *active_layer = grease_pencil.get_active_layer();
2783 for (
const int clip_layer_i : clipboard.
layers.index_range()) {
2786 const bool found_layer = node && node->
is_layer() && node->
as_layer().is_editable();
2788 layers_to_paste_into[clip_layer_i] = &node->
as_layer();
2791 if (active_layer && active_layer->is_editable()) {
2794 op->
reports,
RPT_WARNING,
"Couldn't find matching layer, pasting into active layer");
2795 layers_to_paste_into[clip_layer_i] = active_layer;
2799 if (!active_layer) {
2802 if (!active_layer->is_editable()) {
2815 selection_in_target.
finish();
2818 for (
const int clip_layer_i : clipboard.
layers.index_range()) {
2822 BLI_assert(layers_to_paste_into[clip_layer_i] !=
nullptr);
2823 Layer &paste_layer = *layers_to_paste_into[clip_layer_i];
2827 bool inserted_keyframe =
false;
2835 scene, grease_pencil, paste_layer);
2840 object_to_paste_layer,
2842 keep_world_transform,
2847 if (inserted_keyframe) {
2880 {0,
nullptr, 0,
nullptr,
nullptr},
2883 ot->name =
"Paste Strokes";
2884 ot->idname =
"GREASE_PENCIL_OT_paste";
2886 "Paste Grease Pencil points or strokes from the internal clipboard to the active layer";
2896 ot->srna,
"paste_back",
false,
"Paste on Back",
"Add pasted strokes behind all strokes");
2900 "keep_world_transform",
2902 "Keep World Transform",
2903 "Keep the world transform of strokes from the clipboard unchanged");
2911 const float4x4 &object_to_paste_layer,
2912 const bool keep_world_transform,
2913 const bool paste_back,
2917 if (clipboard.
layers.is_empty()) {
2933 joined_clipboard_curves,
2934 object_to_paste_layer,
2936 keep_world_transform,
2953 std::atomic<bool> changed =
false;
2959 const IndexMask points = use_unselected ?
2968 drawing.
strokes(), threshold, points, {});
2970 changed.store(
true, std::memory_order_relaxed);
2983 ot->name =
"Merge by Distance";
2984 ot->idname =
"GREASE_PENCIL_OT_stroke_merge_by_distance";
2985 ot->description =
"Merge points by distance";
2992 prop =
RNA_def_float(
ot->srna,
"threshold", 0.001f, 0.0f, 100.0f,
"Threshold",
"", 0.0f, 100.0f);
3000 "Use whole stroke, not only selected points");
3033 int point_offset = 0;
3035 const IndexRange curve_points = points_by_curve[curve_index];
3037 const bool curve_cyclic = src_cyclic[curve_index];
3039 curve_points_to_extrude.
foreach_index([&](
const int src_point_index) {
3040 if (!curve_cyclic && (src_point_index == curve_points.
first())) {
3043 dst_to_src_points.
insert(src_point_index + point_offset, src_point_index);
3044 dst_selected.
insert(src_point_index + point_offset,
true);
3045 ++dst_curve_counts[curve_index];
3049 if (!curve_cyclic && (src_point_index == curve_points.
last())) {
3052 dst_to_src_points.
insert(src_point_index + point_offset + 1, src_point_index);
3053 dst_selected.
insert(src_point_index + point_offset + 1,
true);
3054 ++dst_curve_counts[curve_index];
3062 dst_to_src_points.
append(src_point_index);
3063 dst_selected.
append(
false);
3064 dst_to_src_points.
append(src_point_index);
3065 dst_selected.
append(
true);
3066 dst_to_src_curves.
append(curve_index);
3067 dst_curve_counts.
append(2);
3071 const int new_points_num = dst_to_src_points.
size();
3072 const int new_curves_num = dst_to_src_curves.
size();
3092 for (
const StringRef selection_attribute_name :
3115 {
".selection",
".selection_handle_left",
".selection_handle_right"}),
3129 points_by_curve[curve_index].
size() == dst_points_by_curve[curve_index].
size();
3148 std::atomic<bool> changed =
false;
3155 if (points_to_extrude.
is_empty()) {
3163 changed.store(
true, std::memory_order_relaxed);
3176 ot->name =
"Extrude Stroke Points";
3177 ot->idname =
"GREASE_PENCIL_OT_extrude";
3178 ot->description =
"Extrude the selected points";
3236 if (keep_original) {
3260 std::atomic<bool> changed =
false;
3264 if (drawings.is_empty()) {
3267 const int current_frame_number = drawings.first().frame_number;
3270 scene.
r.
cfra = current_frame_number;
3289 curves, selection_name, bezier_points, memory);
3291 editable_points, selected_points, memory);
3293 if (points_to_reproject.
is_empty()) {
3298 if (selection_name ==
".selection_handle_left") {
3299 positions =
curves.handle_positions_left_for_write();
3301 else if (selection_name ==
".selection_handle_right") {
3302 positions =
curves.handle_positions_right_for_write();
3310 float3 &position = positions[point_i];
3319 float3 ray_start, ray_direction;
3321 depsgraph, region, v3d, screen_co, ray_start, ray_direction,
true))
3326 float hit_depth = std::numeric_limits<float>::max();
3327 float3 hit_position(0.0f);
3345 world_space_to_layer_space,
3348 if (selection_name ==
".selection") {
3357 scene, *region, *v3d, *
object, &layer, mode, offset,
nullptr);
3359 const float3 new_pos = drawing_placement.
reproject(positions[point_i]);
3360 if (selection_name ==
".selection") {
3362 rv3d, positions[point_i], new_pos);
3364 positions[point_i] = new_pos;
3369 changed.store(
true, std::memory_order_relaxed);
3375 if (snap_context !=
nullptr) {
3381 scene.
r.
cfra = oldframe;
3402 row = &layout->
row(
true);
3406 row = &layout->
row(
true);
3409 row = &layout->
row(
true);
3420 "Reproject the strokes using the X-Z plane"},
3421 {int(
ReprojectMode::Side),
"SIDE", 0,
"Side",
"Reproject the strokes using the Y-Z plane"},
3422 {int(
ReprojectMode::Top),
"TOP", 0,
"Top",
"Reproject the strokes using the X-Y plane"},
3427 "Reproject the strokes to end up on the same plane, as if drawn from the current "
3429 "using 'Cursor' Stroke Placement"},
3434 "Reproject the strokes on to the scene geometry, as if drawn using 'Surface' placement"},
3439 "Reproject the strokes using the orientation of 3D cursor"},
3440 {0,
nullptr, 0,
nullptr,
nullptr},
3444 ot->name =
"Reproject Strokes";
3445 ot->idname =
"GREASE_PENCIL_OT_reproject";
3447 "Reproject the selected strokes from the current viewpoint as if they had been newly "
3449 "(e.g. to fix problems from accidental 3D cursor movement or accidental viewport changes, "
3450 "or for matching deforming geometry)";
3470 "Keep original strokes and create a copy before reprojecting");
3473 RNA_def_float(
ot->srna,
"offset", 0.0f, 0.0f, 10.0f,
"Surface Offset",
"", 0.0f, 10.0f);
3531 curves, selection_name, bezier_points, memory);
3533 const Layer &layer = grease_pencil.layer(drawing_info.layer_index);
3538 if (selection_name ==
".selection_handle_left") {
3539 positions =
curves.handle_positions_left_for_write();
3541 else if (selection_name ==
".selection_handle_right") {
3542 positions =
curves.handle_positions_right_for_write();
3546 const float3 pos_snapped = grid_size *
math::floor(pos_world / grid_size + 0.5f);
3551 drawing_info.drawing.tag_positions_changed();
3563 ot->name =
"Snap Selection to Grid";
3564 ot->idname =
"GREASE_PENCIL_OT_snap_to_grid";
3565 ot->description =
"Snap selected points to the nearest grid points";
3601 selected_points_memory);
3603 const Layer &layer = grease_pencil.layer(drawing_info.layer_index);
3613 curves, selected_curves_memory);
3616 const IndexRange points = points_by_curve[curve_i];
3619 const float3 offset = cursor_layer - positions[points.
first()];
3621 GrainSize(4096), [&](
const int point_i) { positions[point_i] += offset; });
3629 curves.calculate_bezier_auto_handles();
3630 drawing_info.drawing.tag_positions_changed();
3643 ot->name =
"Snap Selection to Cursor";
3644 ot->idname =
"GREASE_PENCIL_OT_snap_to_cursor";
3645 ot->description =
"Snap selected points/strokes to the cursor";
3659 "Offset the entire stroke instead of selected points only");
3677 int num_selected = 0;
3678 r_centroid =
float3(0.0f);
3679 r_min =
float3(std::numeric_limits<float>::max());
3680 r_max =
float3(std::numeric_limits<float>::lowest());
3683 for (
const DrawingInfo &drawing_info : drawings) {
3684 const Layer &layer = grease_pencil.layer(drawing_info.layer_index);
3685 if (layer.is_locked()) {
3698 selected_points_memory);
3704 r_centroid += pos_world;
3707 num_selected += selected_points.
size();
3709 if (num_selected == 0) {
3710 r_min = r_max =
float3(0.0f);
3714 r_centroid /= num_selected;
3725 float3 centroid, points_min, points_max;
3727 scene,
object, grease_pencil, centroid, points_min, points_max))
3755 ot->name =
"Snap Cursor to Selected Points";
3756 ot->idname =
"GREASE_PENCIL_OT_snap_cursor_to_selected";
3757 ot->description =
"Snap cursor to center of selected points";
3781 strokemat4x3[2][2] = 0.0f;
3782 strokemat4x3[3][2] = 1.0f;
3784 return strokemat4x3;
3794 std::atomic<bool> changed =
false;
3810 const float2 screen_direction = screen_end - screen_start;
3811 const float2 screen_tangent = screen_start +
float2(-screen_direction[1], screen_direction[0]);
3823 const int material_index = materials[curve_i];
3826 material_index + 1);
3837 positions[points_by_curve[curve_i].first()]);
3850 const float3 origin = start;
3856 if (
math::dot(tangent - start, v_dir) < 0.0f) {
3868 offset_matrix *= 0.5f;
3869 offset_matrix[2] +=
float2(0.5f, 0.5f);
3873 offset_matrix[2] -=
float2(0.5f, 0.5f);
3876 offset_matrix = texture_rotation * offset_matrix;
3877 offset_matrix[2] -= texture_offset;
3880 layer_space_to_world_space;
3885 changed.store(
true, std::memory_order_relaxed);
3936 ot->name =
"Texture Gradient";
3937 ot->idname =
"GREASE_PENCIL_OT_texture_gradient";
3938 ot->description =
"Draw a line to set the fill material gradient for the selected strokes";
3968 bool changed =
false;
3980 options.convert_bezier_handles_to_poly_points = use_handles;
3981 options.convert_bezier_handles_to_catmull_rom_points = use_handles;
3982 options.keep_bezier_shape_as_nurbs = use_handles;
3983 options.keep_catmull_rom_shape_as_nurbs = use_handles;
4001 ot->name =
"Set Curve Type";
4002 ot->idname =
"GREASE_PENCIL_OT_set_curve_type";
4003 ot->description =
"Set type of selected curves";
4018 "Take handle information into account in the conversion");
4034 const SetHandleType dst_type = SetHandleType(
RNA_enum_get(op->
ptr,
"type"));
4036 auto new_handle_type = [&](
const int8_t handle_type) {
4038 case SetHandleType::Free:
4040 case SetHandleType::Auto:
4042 case SetHandleType::Vector:
4044 case SetHandleType::Align:
4046 case SetHandleType::Toggle:
4054 bool changed =
false;
4079 const IndexRange points = points_by_curve[curve_i];
4080 for (
const int point_i : points) {
4081 if (selection_left[point_i] || selection[point_i]) {
4082 handle_types_left[point_i] = new_handle_type(handle_types_left[point_i]);
4084 if (selection_right[point_i] || selection[point_i]) {
4085 handle_types_right[point_i] = new_handle_type(handle_types_right[point_i]);
4090 curves.calculate_bezier_auto_handles();
4091 curves.tag_topology_changed();
4107 ot->name =
"Set Handle Type";
4108 ot->idname =
"GREASE_PENCIL_OT_set_handle_type";
4109 ot->description =
"Set the handle type for Bézier curves";
4139 bool changed =
false;
4169 ot->name =
"Set Curve Resolution";
4170 ot->idname =
"GREASE_PENCIL_OT_set_curve_resolution";
4171 ot->description =
"Set resolution of selected curves";
4184 "The resolution to use for each curve segment",
4201 bool changed =
false;
4213 if (attributes.
contains(
"uv_rotation")) {
4214 if (editable_strokes.
size() ==
curves.curves_num()) {
4215 attributes.
remove(
"uv_rotation");
4225 if (attributes.
contains(
"uv_translation")) {
4226 if (editable_strokes.
size() ==
curves.curves_num()) {
4227 attributes.
remove(
"uv_translation");
4233 uv_translations.
finish();
4237 if (attributes.
contains(
"uv_scale")) {
4238 if (editable_strokes.
size() ==
curves.curves_num()) {
4239 attributes.
remove(
"uv_scale");
4249 if (attributes.
contains(
"uv_shear")) {
4250 if (editable_strokes.
size() ==
curves.curves_num()) {
4251 attributes.
remove(
"uv_shear");
4276 ot->name =
"Reset UVs";
4277 ot->idname =
"GREASE_PENCIL_OT_reset_uvs";
4278 ot->description =
"Reset UV transformation to default values";
4292 std::atomic<bool> changed =
false;
4308 changed.store(
true, std::memory_order_relaxed);
4323 ot->name =
"Split stroke";
4324 ot->idname =
"GREASE_PENCIL_OT_stroke_split";
4325 ot->description =
"Split selected points to a new stroke";
4351 std::atomic<bool> changed =
false;
4354 for (
const int layer_i : grease_pencil.layers().index_range()) {
4355 const Layer &layer = grease_pencil.layer(layer_i);
4356 if (
Drawing *drawing = grease_pencil.get_drawing_at(layer, scene.
r.
cfra)) {
4357 drawings.
append({*drawing, layer_i, scene.
r.
cfra, 1.0f});
4362 for (
const int layer_i : grease_pencil.layers().index_range()) {
4363 const Layer &layer = grease_pencil.layer(layer_i);
4364 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
4365 if (
Drawing *drawing = grease_pencil.get_drawing_at(layer, frame_number)) {
4366 drawings.
append({*drawing, layer_i, frame_number, 1.0f});
4374 changed.store(
true, std::memory_order_relaxed);
4392 {0,
nullptr, 0,
nullptr,
nullptr},
4396 ot->name =
"Remove Fill Guides";
4397 ot->idname =
"GREASE_PENCIL_OT_remove_fill_guides";
4398 ot->description =
"Remove all the strokes that were created from the fill tool as guides";
4430 {0,
nullptr, 0,
nullptr,
nullptr},
4443 const int corner_subdivisions =
RNA_int_get(op->
ptr,
"corner_subdivisions");
4444 const float outline_offset = radius * offset_factor;
4445 const int mat_nr = -1;
4457 viewinv =
float4x4({1.0f, 0.0f, 0.0f, 0.0f},
4458 {0.0f, 0.0f, 1.0f, 0.0f},
4459 {0.0f, 1.0f, 0.0f, 0.0f},
4460 {0.0f, 0.0f, 0.0f, 1.0f});
4463 viewinv =
float4x4({0.0f, 0.0f, 1.0f, 0.0f},
4464 {0.0f, 1.0f, 0.0f, 0.0f},
4465 {1.0f, 0.0f, 0.0f, 0.0f},
4466 {0.0f, 0.0f, 0.0f, 1.0f});
4476 viewinv = scene->
camera->world_to_object();
4483 bool changed =
false;
4499 corner_subdivisions,
4510 const std::array<bke::GeometrySet, 2> geometry_sets = {
4531 ot->name =
"Outline";
4532 ot->idname =
"GREASE_PENCIL_OT_outline";
4533 ot->description =
"Convert selected strokes to perimeter";
4546 ot->srna,
"offset_factor", -1.0f, -1.0f, 1.0f,
"Offset Factor",
"", -1.0f, 1.0f);
4547 RNA_def_int(
ot->srna,
"corner_subdivisions", 2, 0, 10,
"Corner Subdivisions",
"", 0, 5);
4558 const float threshold)
4569 const float threshold)
4575 const IndexMask non_catmull_rom_curves_selection =
4577 .complement(selection, memory);
4578 if (non_catmull_rom_curves_selection.
is_empty()) {
4589 non_catmull_rom_curves_selection,
4590 curves.points_by_curve(),
4595 curves.remove_points(points_to_remove, {});
4598 options.convert_bezier_handles_to_poly_points =
false;
4599 options.convert_bezier_handles_to_catmull_rom_points =
false;
4600 options.keep_bezier_shape_as_nurbs =
true;
4601 options.keep_catmull_rom_shape_as_nurbs =
true;
4613 .indices_for_curve_type(
4615 .complement(selection, memory);
4616 if (non_poly_curves_selection.
is_empty()) {
4625 const float threshold)
4631 const IndexMask poly_curves_selection =
curves.indices_for_curve_type(
4633 if (!poly_curves_selection.
is_empty()) {
4638 options.convert_bezier_handles_to_poly_points =
false;
4639 options.convert_bezier_handles_to_catmull_rom_points =
false;
4640 options.keep_bezier_shape_as_nurbs =
true;
4641 options.keep_catmull_rom_shape_as_nurbs =
true;
4647 const float threshold)
4654 const IndexMask poly_curves_selection =
curves.indices_for_curve_type(
4656 if (!poly_curves_selection.
is_empty()) {
4661 options.convert_bezier_handles_to_poly_points =
false;
4662 options.convert_bezier_handles_to_catmull_rom_points =
false;
4663 options.keep_bezier_shape_as_nurbs =
true;
4664 options.keep_catmull_rom_shape_as_nurbs =
true;
4677 std::atomic<bool> changed =
false;
4704 changed.store(
true, std::memory_order_relaxed);
4738 ot->name =
"Convert Curve Type";
4739 ot->idname =
"GREASE_PENCIL_OT_convert_curve_type";
4740 ot->description =
"Convert type of selected curves";
4760 "The distance that the resulting points are allowed to be within",
4782 {0,
nullptr, 0,
nullptr,
nullptr},
4805 if (miter_angle == 0.0f) {
4810 std::atomic<bool> changed =
false;
4830 attributes.
remove(
"miter_angle");
4831 changed.store(
true, std::memory_order_relaxed);
4843 miter_angles.finish();
4844 changed.store(
true, std::memory_order_relaxed);
4880 ot->name =
"Set Corner Type";
4881 ot->idname =
"GREASE_PENCIL_OT_set_corner_type";
4882 ot->description =
"Set the corner type of the selected points";
4900 "All corners sharper than the Miter angle will be cut flat",
4968 Layer &layer_dst = grease_pencil_dst.add_layer(group_dst, layer_src.name());
4991 switch (child->type) {
4994 Layer &layer_dst =
copy_layer(grease_pencil_dst, group_dst, layer_src);
4995 layer_name_map.
add_new(layer_src.name(), layer_dst.name());
5027 if (material !=
nullptr) {
5031 material_index_map[
i] = 0;
5034 return material_index_map;
5046 for (const int curve_i : range) {
5047 material_writer.span[curve_i] = material_index_map[material_writer.span[curve_i]];
5050 material_writer.
finish();
5055 const ListBase &vertex_group_names)
5064 return vertex_group_map;
5089 *value = bke::attribute_data_type_highest_complexity({*value, iter.data_type});
5093 add_or_upgrade_types(a);
5094 add_or_upgrade_types(
b);
5098 for (
const auto &[
name, type] : new_types.items()) {
5132 const int orig_layers_num = grease_pencil_dst.layers().size();
5154 grease_pencil_dst.resize_drawings(0);
5162 grease_pencil_dst.root_group(),
5163 grease_pencil_src.root_group(),
5167 grease_pencil_dst.attributes(),
5168 grease_pencil_dst.layers().size());
5171 for (
const int layer_index : grease_pencil_dst.layers().index_range()) {
5172 Layer &layer = *grease_pencil_dst.layers_for_write()[layer_index];
5173 const bool is_orig_layer = (layer_index < orig_layers_num);
5178 if (!is_orig_layer) {
5182 if (new_mask_name) {
5190 drawing_index = new_drawings_src[drawing_index];
5215 if (!is_orig_layer) {
5224 if (
id == &grease_pencil_src.
id && fcu->
rna_path && strstr(fcu->
rna_path,
"layers[")) {
5226 for (
auto [name_src, name_dst] : layer_name_map.
items()) {
5227 if (name_dst != name_src) {
5228 const char *old_path = fcu->
rna_path;
5230 id, fcu->
rna_path,
"layers", name_src.c_str(), name_dst.c_str(), 0, 0,
false);
5243 if (dtar->id != &grease_pencil_src.
id) {
5246 dtar->id = &grease_pencil_dst.
id;
5248 if (dtar->rna_path && strstr(dtar->rna_path,
"layers[")) {
5249 for (
auto [name_src, name_dst] : layer_name_map.
items()) {
5250 if (name_dst != name_src) {
5251 const char *old_path = fcu->
rna_path;
5253 id, dtar->rna_path,
"layers", name_src.c_str(), name_dst.c_str(), 0, 0,
false);
5254 if (old_path != dtar->rna_path) {
5268 if (ob_dst.
adt ==
nullptr) {
5279 if (grease_pencil_src.
adt) {
5280 if (grease_pencil_dst.
adt ==
nullptr) {
5309 if (ob_iter == ob_active) {
5321 Object *ob_dst = ob_active;
5326 *ob_dst, materials);
void BKE_animdata_merge_copy(Main *bmain, ID *dst_id, ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers)
AnimData * BKE_animdata_copy(Main *bmain, AnimData *adt, int flag)
void BKE_fcurves_main_cb(struct Main *bmain, blender::FunctionRef< void(ID *, FCurve *)> func)
char * BKE_animsys_fix_rna_path_rename(struct ID *owner_id, char *old_path, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
#define CTX_DATA_BEGIN(C, Type, instance, member)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Base * CTX_data_active_base(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)
wmWindowManager * CTX_wm_manager(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
Low-level operations for grease pencil.
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
Material * BKE_grease_pencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
void BKE_grease_pencil_copy_layer_parameters(const blender::bke::greasepencil::Layer &src, blender::bke::greasepencil::Layer &dst)
void BKE_grease_pencil_copy_layer_group_parameters(const blender::bke::greasepencil::LayerGroup &src, blender::bke::greasepencil::LayerGroup &dst)
ID * BKE_libblock_find_name(Main *bmain, short type, const char *name, const std::optional< Library * > lib=std::nullopt) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
General operations, lookup, etc. for materials.
short * BKE_object_material_len_p(Object *ob)
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
void BKE_object_material_array_assign(Main *bmain, Object *ob, Material ***matar, int totcol, bool to_object_only)
bool BKE_object_material_slot_used(Object *object, short actcol)
int BKE_object_material_ensure(Main *bmain, Object *ob, Material *material)
Material * BKE_object_material_get(Object *ob, short act)
int BKE_object_material_index_get(Object *ob, const Material *ma)
Material *** BKE_object_material_array_p(Object *ob)
bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define STRNCPY_UTF8(dst, src)
#define POINTER_OFFSET(v, ofs)
#define BLT_I18NCONTEXT_ID_GPENCIL
#define BLT_I18NCONTEXT_ID_MOVIECLIP
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
float DEG_get_ctime(const Depsgraph *graph)
T * DEG_get_original(T *id)
@ ID_RECALC_ANIMATION_NO_FLUSH
@ NURBS_KNOT_MODE_ENDPOINT
@ GP_STROKE_CAP_TYPE_FLAT
@ GP_STROKE_CAP_TYPE_ROUND
#define GP_STROKE_MITER_ANGLE_BEVEL
#define GP_STROKE_MITER_ANGLE_ROUND
@ GP_MATERIAL_GRADIENT_RADIAL
Object is a sort of wrapper for general info.
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_CENTER_MEDIAN
@ V3D_AROUND_LOCAL_ORIGINS
bool ED_view3d_win_to_ray_clipped(Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_normal[3], bool do_clip_planes)
float ED_view3d_grid_view_scale(const Scene *scene, const View3D *v3d, const ARegion *region, const char **r_grid_unit)
bool ED_view3d_win_to_3d_on_plane(const ARegion *region, const float plane[4], const float mval[2], bool do_clip, float r_out[3])
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
#define RNA_ENUM_ITEM_SEPR
BPy_StructRNA * depsgraph
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_intersection(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
static constexpr IndexRange from_begin_size(const int64_t begin, const int64_t size)
const Value & lookup(const Key &key) const
KeyIterator keys() const &
ItemIterator items() const &
constexpr MutableSpan drop_front(const int64_t n) const
static VArray from_single(T value, const int64_t size)
static VArray from_span(Span< T > values)
static VArray from_container(ContainerT container)
void append(const T &value)
IndexRange index_range() const
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
IndexRange index_range() const
void copy_from(GSpan values)
void materialize_to_uninitialized(void *dst) const
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_union(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
static IndexMask from_ranges(OffsetIndices< T > offsets, const IndexMask &mask, IndexMaskMemory &memory)
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
constexpr int64_t first() const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr int64_t start() const
constexpr bool contains(int64_t value) const
constexpr IndexRange drop_front(int64_t n) const
const Value * lookup_ptr(const Key &key) const
Value & lookup_or_add_default(const Key &key)
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
Value lookup_default(const Key &key, const Value &default_value) const
void add_new(const Key &key, const Value &value)
auto add_or_modify(const Key &key, const CreateValueF &create_value, const ModifyValueF &modify_value) -> decltype(create_value(nullptr))
ItemIterator items() const &
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr MutableSpan drop_back(const int64_t n) const
constexpr void fill(const T &value) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool contains(const T &value) const
constexpr const char * c_str() const
void materialize(MutableSpan< T > r_span) const
static VArray from_single(T value, const int64_t size)
static VArray from_container(ContainerT container)
int64_t index_of_or_add(const Key &key)
void append(const T &value)
void insert(const int64_t insert_index, const T &value)
MutableSpan< T > as_mutable_span()
Span< T > as_span() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef attribute_id) const
Attribute & add(std::string name, bke::AttrDomain domain, bke::AttrType data_type, Attribute::DataVariant data)
OffsetIndices< int > points_by_curve() const
IndexRange curves_range() const
void update_curve_types()
MutableAttributeAccessor attributes_for_write()
VArray< int8_t > nurbs_knots_modes() const
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
AttributeAccessor attributes() const
MutableSpan< int > offsets_for_write()
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
bool nurbs_has_custom_knots() const
VArray< int8_t > curve_types() const
VArray< bool > cyclic() const
MutableSpan< bool > cyclic_for_write()
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
bool remove(const StringRef attribute_id)
GSpanAttributeWriter lookup_for_write_span(StringRef attribute_id)
Span< float3 > curve_plane_normals() 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
void set_texture_matrices(Span< float4x2 > matrices, const IndexMask &selection)
float4x4 to_world_space(const Object &object) const
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
void tag_frames_map_changed()
std::optional< int > start_frame_at(int frame_number) const
float4x4 to_object_space(const Object &object) const
Map< FramesMapKeyT, GreasePencilFrame > & frames_for_write()
const Layer & as_layer() const
float3 reproject(float3 pos) const
void to_indices(MutableSpan< T > r_indices) const
IndexMask slice_content(IndexRange range) const
void foreach_index_optimized(Fn &&fn) const
IndexMask complement(const IndexMask &universe, IndexMaskMemory &memory) const
void foreach_index(Fn &&fn) const
CCL_NAMESPACE_BEGIN struct Options options
static float normals[][3]
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, 2 > float2
VecBase< float, 4 > float4
VecBase< float, 3 > float3
void ED_operatortypes_grease_pencil_edit()
wmOperatorStatus ED_grease_pencil_join_objects_exec(bContext *C, wmOperator *op)
blender::bke::AttrDomain ED_grease_pencil_edit_selection_domain_get(const ToolSettings *tool_settings)
void GREASE_PENCIL_OT_stroke_trim(wmOperatorType *ot)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void invert_booleans(MutableSpan< bool > span)
void copy(const GVArray &src, GMutableSpan dst, int64_t grain_size=4096)
BooleanMix booleans_mix_calc(const VArray< bool > &varray, IndexRange range_to_check)
void fill_index_range(MutableSpan< T > span, const T start=0)
void gather_custom_knots(const bke::CurvesGeometry &src, const IndexMask &src_curves, int dst_curve_offset, bke::CurvesGeometry &dst)
void update_custom_knot_modes(const IndexMask &mask, const KnotsMode mode_for_regular, const KnotsMode mode_for_cyclic, bke::CurvesGeometry &curves)
IndexMask curve_type_point_selection(const bke::CurvesGeometry &curves, CurveType curve_type, IndexMaskMemory &memory)
void fill_points(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, GPointer value, GMutableSpan dst)
void copy_drawing_array(Span< const GreasePencilDrawingBase * > src_drawings, MutableSpan< GreasePencilDrawingBase * > dst_drawings)
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
CurvesGeometry curves_copy_point_selection(const CurvesGeometry &curves, const IndexMask &points_to_copy, const AttributeFilter &attribute_filter)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void copy_attributes(const AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, MutableAttributeAccessor dst_attributes)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
const CPPType & attribute_type_to_cpp_type(AttrType type)
Curves * curves_new_nomain(int points_num, int curves_num)
const EnumPropertyItem rna_enum_set_handle_type_items[]
static bool has_anything_selected(const Span< Curves * > curves_ids)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
void duplicate_curves(bke::CurvesGeometry &curves, const IndexMask &mask)
void duplicate_points(bke::CurvesGeometry &curves, const IndexMask &mask)
bke::CurvesGeometry split_points(const bke::CurvesGeometry &curves, const IndexMask &points_to_split)
void fill_selection_false(GMutableSpan selection)
Span< StringRef > get_curves_selection_attribute_names(const bke::CurvesGeometry &curves)
bke::GSpanAttributeWriter ensure_selection_attribute(bke::CurvesGeometry &curves, bke::AttrDomain selection_domain, bke::AttrType create_type, StringRef attribute_name)
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
static void convert_to_nurbs(bke::CurvesGeometry &curves, const IndexMask &selection, const float threshold)
IndexMask retrieve_editable_and_selected_elements(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, const bke::AttrDomain selection_domain, IndexMaskMemory &memory)
static void GREASE_PENCIL_OT_extrude(wmOperatorType *ot)
static bke::GeometrySet join_geometries_with_transforms(Span< bke::GeometrySet > geometries, const VArray< float4x4 > &transforms)
static void GREASE_PENCIL_OT_texture_gradient(wmOperatorType *ot)
bool active_grease_pencil_poll(bContext *C)
IndexMask retrieve_editable_and_selected_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static wmOperatorStatus grease_pencil_set_corner_type_exec(bContext *C, wmOperator *op)
static wmOperatorStatus grease_pencil_convert_curve_type_exec(bContext *C, wmOperator *op)
static wmOperatorStatus grease_pencil_set_active_material_exec(bContext *C, wmOperator *)
static void GREASE_PENCIL_OT_caps_set(wmOperatorType *ot)
blender::bke::CurvesGeometry curves_merge_by_distance(const bke::CurvesGeometry &src_curves, const float merge_distance, const IndexMask &selection, const bke::AttributeFilter &attribute_filter)
static bke::greasepencil::Layer & copy_layer(GreasePencil &grease_pencil_dst, bke::greasepencil::LayerGroup &group_dst, const bke::greasepencil::Layer &layer_src)
static void grease_pencil_reproject_ui(bContext *, wmOperator *op)
static bke::greasepencil::Layer & find_or_create_layer_in_dst_by_name(const int layer_index, const GreasePencil &grease_pencil_src, GreasePencil &grease_pencil_dst, Vector< int > &src_to_dst_layer_indices)
static wmOperatorStatus grease_pencil_delete_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_stroke_material_set_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_stroke_simplify(wmOperatorType *ot)
static void convert_to_catmull_rom(bke::CurvesGeometry &curves, const IndexMask &selection, const float threshold)
static wmOperatorStatus grease_pencil_set_curve_type_exec(bContext *C, wmOperator *op)
blender::Mutex grease_pencil_clipboard_lock
static wmOperatorStatus grease_pencil_extrude_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_outline_exec(bContext *C, wmOperator *op)
static void join_object_with_active(Main &bmain, Object &ob_src, Object &ob_dst, VectorSet< Material * > &materials)
IndexMask retrieve_editable_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static wmOperatorStatus grease_pencil_stroke_smooth_exec(bContext *C, wmOperator *op)
static wmOperatorStatus grease_pencil_move_to_layer_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool ensure_active_keyframe(const Scene &scene, GreasePencil &grease_pencil, bke::greasepencil::Layer &layer, const bool duplicate_previous_key, bool &r_inserted_keyframe)
static void convert_to_bezier(bke::CurvesGeometry &curves, const IndexMask &selection, const float threshold)
static wmOperatorStatus grease_pencil_duplicate_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_dissolve_exec(bContext *C, wmOperator *op)
static void convert_to_poly(bke::CurvesGeometry &curves, const IndexMask &selection)
static bke::CurvesGeometry set_start_point(const bke::CurvesGeometry &curves, const IndexMask &mask)
static float calculate_radius_projection_factor(const RegionView3D *rv3d, const float3 &old_pos, const float3 &new_pos)
static bke::AttributeStorage merge_attributes(const bke::AttributeAccessor &a, const bke::AttributeAccessor &b, const int dst_size)
static wmOperatorStatus grease_pencil_texture_gradient_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void GREASE_PENCIL_OT_set_curve_type(wmOperatorType *ot)
IndexMask retrieve_editable_and_all_selected_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, int handle_display, IndexMaskMemory &memory)
static void toggle_caps(MutableSpan< int8_t > caps, const IndexMask &strokes)
static void GREASE_PENCIL_OT_snap_cursor_to_selected(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_copy_strokes_exec(bContext *C, wmOperator *op)
static void grease_pencil_convert_curve_type_ui(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_outline_modes[]
static Array< int > clipboard_materials_remap(Main &bmain, Object &object)
static wmOperatorStatus grease_pencil_stroke_merge_by_distance_exec(bContext *C, wmOperator *op)
static bool grease_pencil_paste_strokes_poll(bContext *C)
bool editable_grease_pencil_point_selection_poll(bContext *C)
static bke::CurvesGeometry extrude_grease_pencil_curves(const bke::CurvesGeometry &src, const IndexMask &points_to_extrude)
static void GREASE_PENCIL_OT_set_start_point(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_reproject_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_delete(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_stroke_switch_direction_exec(bContext *C, wmOperator *)
static IndexMask simplify_fixed(const bke::CurvesGeometry &curves, const int step, const IndexMask &stroke_selection, IndexMaskMemory &memory)
bool editable_grease_pencil_with_region_view3d_poll(bContext *C)
static wmOperatorStatus grease_pencil_snap_to_cursor_exec(bContext *C, wmOperator *op)
static bool grease_pencil_separate_material(bContext &C, Main &bmain, Scene &scene, ViewLayer &view_layer, Base &base_prev, Object &object_src)
static IndexRange clipboard_paste_strokes_ex(Main &bmain, Object &object, const bke::CurvesGeometry &curves_to_paste, const float4x4 &object_to_paste_layer, const float4x4 &clipboard_to_world, const bool keep_world_transform, const bool paste_back, bke::greasepencil::Drawing &drawing)
static wmOperatorStatus grease_pencil_set_handle_type_exec(bContext *C, wmOperator *op)
static void remove_unused_materials(Main *bmain, Object *object)
static void GREASE_PENCIL_OT_stroke_switch_direction(wmOperatorType *ot)
Vector< DrawingInfo > retrieve_visible_drawings(const Scene &scene, const GreasePencil &grease_pencil, const bool do_onion_skinning)
static void GREASE_PENCIL_OT_set_active_material(wmOperatorType *ot)
static Clipboard & ensure_grease_pencil_clipboard()
static void GREASE_PENCIL_OT_outline(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_set_material_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_simplify_modes[]
static void remap_material_indices(bke::greasepencil::Drawing &drawing, const Span< int > material_index_map)
IndexMask retrieve_editable_strokes_by_material(Object &object, const bke::greasepencil::Drawing &drawing, const int mat_i, IndexMaskMemory &memory)
static wmOperatorStatus grease_pencil_reset_uvs_exec(bContext *C, wmOperator *)
static wmOperatorStatus grease_pencil_clean_loose_exec(bContext *C, wmOperator *op)
static wmOperatorStatus grease_pencil_set_curve_resolution_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_separate_modes[]
static void GREASE_PENCIL_OT_copy(wmOperatorType *ot)
static void GREASE_PENCIL_OT_separate(wmOperatorType *ot)
static bool grease_pencil_separate_layer(bContext &C, Main &bmain, Scene &scene, ViewLayer &view_layer, Base &base_prev, Object &object_src)
static void GREASE_PENCIL_OT_delete_frame(wmOperatorType *ot)
static bke::greasepencil::LayerGroup & copy_layer_group_recursive(GreasePencil &grease_pencil_dst, bke::greasepencil::LayerGroup &parent_dst, const bke::greasepencil::LayerGroup &group_src, Map< StringRefNull, StringRefNull > &layer_name_map)
static void GREASE_PENCIL_OT_set_curve_resolution(wmOperatorType *ot)
static float4x3 expand_4x2_mat(float4x2 strokemat)
static wmOperatorStatus grease_pencil_cyclical_set_exec(bContext *C, wmOperator *op)
bool editable_grease_pencil_poll(bContext *C)
static void remap_vertex_groups(bke::greasepencil::Drawing &drawing, const Map< StringRefNull, StringRefNull > &vertex_group_map)
static const EnumPropertyItem prop_corner_types[]
static wmOperatorStatus grease_pencil_set_start_point_exec(bContext *C, wmOperator *)
static void GREASE_PENCIL_OT_set_uniform_opacity(wmOperatorType *ot)
static Array< int > add_materials_to_map(Object &object, VectorSet< Material * > &materials)
static void GREASE_PENCIL_OT_move_to_layer(wmOperatorType *ot)
static void GREASE_PENCIL_OT_snap_to_grid(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_remove_fill_guides_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_clean_loose(wmOperatorType *ot)
static void GREASE_PENCIL_OT_stroke_smooth(wmOperatorType *ot)
IndexMask retrieve_editable_and_selected_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static wmOperatorStatus grease_pencil_move_to_layer_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_remove_fill_guides(wmOperatorType *ot)
static void GREASE_PENCIL_OT_stroke_split(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_snap_cursor_to_sel_exec(bContext *C, wmOperator *)
static void GREASE_PENCIL_OT_set_handle_type(wmOperatorType *ot)
static void GREASE_PENCIL_OT_stroke_reorder(wmOperatorType *ot)
static void GREASE_PENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot)
static bool grease_pencil_snap_compute_centroid(const Scene &scene, const Object &object, const GreasePencil &grease_pencil, float3 &r_centroid, float3 &r_min, float3 &r_max)
static const EnumPropertyItem prop_dissolve_types[]
static wmOperatorStatus grease_pencil_set_uniform_opacity_exec(bContext *C, wmOperator *op)
Vector< MutableDrawingInfo > retrieve_editable_drawings_from_layer(const Scene &scene, GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &layer)
static wmOperatorStatus grease_pencil_clean_loose_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void GREASE_PENCIL_OT_stroke_subdivide(wmOperatorType *ot)
static bool grease_pencil_snap_poll(bContext *C)
static wmOperatorStatus grease_pencil_caps_set_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_set_corner_type(wmOperatorType *ot)
static wmOperatorStatus gpencil_stroke_subdivide_exec(bContext *C, wmOperator *op)
IndexRange paste_all_strokes_from_clipboard(Main &bmain, Object &object, const float4x4 &object_to_paste_layer, const bool keep_world_transform, const bool paste_back, bke::greasepencil::Drawing &drawing)
static wmOperatorStatus grease_pencil_paste_strokes_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_reproject(wmOperatorType *ot)
static Map< StringRefNull, StringRefNull > add_vertex_groups(Object &object, GreasePencil &grease_pencil, const ListBase &vertex_group_names)
static bke::CurvesGeometry subdivide_last_segement(const bke::CurvesGeometry &curves, const IndexMask &strokes)
static bke::CurvesGeometry fit_poly_curves(bke::CurvesGeometry &curves, const IndexMask &selection, const float threshold)
static void copy_layer_group_content(GreasePencil &grease_pencil_dst, bke::greasepencil::LayerGroup &group_dst, const bke::greasepencil::LayerGroup &group_src, Map< StringRefNull, StringRefNull > &layer_name_map)
static wmOperatorStatus grease_pencil_texture_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void GREASE_PENCIL_OT_convert_curve_type(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_snap_to_grid_exec(bContext *C, wmOperator *)
static void GREASE_PENCIL_OT_snap_to_cursor(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_set_uniform_thickness_exec(bContext *C, wmOperator *op)
IndexMask retrieve_editable_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
bool remove_fill_guides(bke::CurvesGeometry &curves)
static wmOperatorStatus grease_pencil_stroke_split_exec(bContext *C, wmOperator *)
Vector< MutableDrawingInfo > retrieve_editable_drawings(const Scene &scene, GreasePencil &grease_pencil)
static struct blender::ed::greasepencil::Clipboard * grease_pencil_clipboard
static void GREASE_PENCIL_OT_stroke_material_set(wmOperatorType *ot)
static void GREASE_PENCIL_OT_set_uniform_thickness(wmOperatorType *ot)
static void GREASE_PENCIL_OT_reset_uvs(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_texture_gradient_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_duplicate(wmOperatorType *ot)
static const EnumPropertyItem * material_enum_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static Object * duplicate_grease_pencil_object(Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base_prev, const GreasePencil &grease_pencil_src)
static void GREASE_PENCIL_OT_paste(wmOperatorType *ot)
static bke::GeometrySet join_geometries_with_transform(Span< bke::GeometrySet > geometries, const float4x4 &transform)
static void GREASE_PENCIL_OT_cyclical_set(wmOperatorType *ot)
Array< Vector< MutableDrawingInfo > > retrieve_editable_drawings_grouped_per_frame(const Scene &scene, GreasePencil &grease_pencil)
static wmOperatorStatus grease_pencil_stroke_simplify_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_cyclical_types[]
static wmOperatorStatus grease_pencil_delete_frame_exec(bContext *C, wmOperator *op)
static void grease_pencil_set_corner_type_ui(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_dissolve(wmOperatorType *ot)
bool active_grease_pencil_layer_poll(bContext *C)
static wmOperatorStatus grease_pencil_separate_exec(bContext *C, wmOperator *op)
static bool grease_pencil_separate_selected(bContext &C, Main &bmain, Scene &scene, ViewLayer &view_layer, Base &base_prev, Object &object_src)
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 wmOperatorStatus grease_pencil_stroke_reorder_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_greasepencil_deleteframe_types[]
static void grease_pencil_simplify_ui(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_set_material(wmOperatorType *ot)
static Array< bool > get_points_to_dissolve(bke::CurvesGeometry &curves, const IndexMask &mask, const DissolveMode mode)
static Array< int > get_reordered_indices(const IndexRange universe, const IndexMask &selected, const ReorderDirection direction)
Base * add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base, eDupli_ID_Flags dupflag)
void base_free_and_unlink(Main *bmain, Scene *scene, Object *ob)
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, bool allow_merging_instance_references=true)
bke::CurvesGeometry remove_points_and_split(const bke::CurvesGeometry &curves, const IndexMask &mask)
bke::CurvesGeometry reorder_curves_geometry(const bke::CurvesGeometry &src_curves, Span< int > old_by_new_map, const bke::AttributeFilter &attribute_filter)
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)
IndexMask simplify_curve_attribute(const Span< float3 > positions, const IndexMask &curves_selection, const OffsetIndices< int > points_by_curve, const VArray< bool > &cyclic, float epsilon, GSpan attribute_data, IndexMaskMemory &memory)
bke::CurvesGeometry fit_poly_to_bezier_curves(const bke::CurvesGeometry &src_curves, const IndexMask &curve_selection, const VArray< float > &thresholds, const VArray< bool > &corners, FitMethod method, const bke::AttributeFilter &attribute_filter)
CurvesGeometry resample_to_evaluated(const CurvesGeometry &src_curves, const IndexMask &selection, const ResampleCurvesOutputAttributeIDs &output_ids={})
CurvesGeometry resample_to_length(const CurvesGeometry &src_curves, const IndexMask &selection, const VArray< float > &sample_lengths, const ResampleCurvesOutputAttributeIDs &output_ids={}, bool keep_last_segment=false)
bke::CurvesGeometry subdivide_curves(const bke::CurvesGeometry &src_curves, const IndexMask &selection, const VArray< int > &cuts, const bke::AttributeFilter &attribute_filter={})
bke::CurvesGeometry convert_curves(const bke::CurvesGeometry &src_curves, const IndexMask &selection, CurveType dst_type, const bke::AttributeFilter &attribute_filter, const ConvertCurvesOptions &options={})
void masked_fill(MutableSpan< T > data, const T &value, const IndexMask &mask)
AngleRadianBase< float > AngleRadian
T length_squared(const VecBase< T, Size > &a)
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
T pow(const T &x, const T &power)
T distance(const T &a, const T &b)
T length(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
CartesianBasis invert(const CartesianBasis &basis)
T midpoint(const T &a, const T &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
void min_max(const T &value, T &min, T &max)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
MatT from_rotation(const RotationT &rotation)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void copy_group_sizes(OffsetIndices< int > offsets, const IndexMask &mask, MutableSpan< int > sizes)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
void parallel_for_each(Range &&range, const Function &function)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< float, 2 > float2
MatBase< float, 4, 2 > float4x2
MatBase< float, 3, 2 > float3x2
MatBase< float, 4, 3 > float4x3
VecBase< float, 3 > float3
float wrap(float value, float max, float min)
static void unique_name(bNode *node)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_curves_type_items[]
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_distance(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
ListBase vertex_group_names
GreasePencilLayerTreeNode base
ListBase vertex_group_names
GreasePencilDrawingBase ** drawing_array
struct AttributeStorage attribute_storage
struct ToolSettings * toolsettings
static MatBase identity()
static ArrayData from_uninitialized(const CPPType &type, int64_t domain_size)
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Curves * get_curves_for_write()
const Curves * get_curves() const
MutableVArraySpan< T > span
bke::CurvesGeometry curves
Vector< std::pair< uint, int > > materials
Array< ClipboardLayer > layers
int materials_in_source_num
bke::greasepencil::Drawing & drawing
bke::GeometrySet geometry
void use_property_decorate_set(bool is_sep)
uiLayout & row(bool align)
void use_property_split_set(bool value)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
struct ReportList * reports
struct wmOperatorType * type
void WM_cursor_wait(bool val)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_menu_name_call(bContext *C, const char *menu_name, blender::wm::OpCallContext context)
void WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
wmOperatorStatus WM_operator_props_popup_confirm_ex(bContext *C, wmOperator *op, const wmEvent *, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message)