110 if (!(smooth_position || smooth_radius || smooth_opacity)) {
115 bool changed =
false;
136 if (smooth_position) {
192 ot->
name =
"Smooth Stroke";
193 ot->
idname =
"GREASE_PENCIL_OT_stroke_smooth";
201 prop =
RNA_def_int(ot->
srna,
"iterations", 10, 1, 100,
"Iterations",
"", 1, 30);
230 "Delete alternating vertices in the stroke, except extremes"},
235 "Use a Ramer-Douglas-Peucker algorithm to simplify the stroke preserving main shape"},
240 "Re-sample the stroke with segments of the specified length"},
245 "Simplify the stroke by merging vertices closer than a given distance"},
246 {0,
nullptr, 0,
nullptr,
nullptr},
258 points_by_curve, stroke_selection, memory);
262 selected_points, memory, [&](
const int64_t i) {
263 const int curve_i = point_to_curve_map[i];
264 const IndexRange points = points_by_curve[curve_i];
265 if (points.
size() <= 2) {
268 const int local_i = i - points.
start();
274 {selected_to_keep, selected_points.
complement(
curves.points_range(), memory)}, memory);
285 bool changed =
false;
308 if (points_to_keep.
size() ==
curves.points_num()) {
312 curves, points_to_keep, {});
335 if (resample_length == 0.0f) {
350 selected_points, memory, [&](
const int64_t i) {
351 const int curve_i = point_to_curve_map[i];
352 const IndexRange points = points_by_curve[curve_i];
359 curves, merge_distance, filtered_points, {});
412 ot->
name =
"Simplify Stroke";
413 ot->
idname =
"GREASE_PENCIL_OT_stroke_simplify";
423 prop =
RNA_def_float(ot->
srna,
"factor", 0.01f, 0.0f, 100.0f,
"Factor",
"", 0.0f, 100.0f);
425 prop =
RNA_def_float(ot->
srna,
"length", 0.05f, 0.0f, 100.0f,
"Length",
"", 0.01f, 1.0f);
427 prop =
RNA_def_float(ot->
srna,
"distance", 0.01f, 0.0f, 100.0f,
"Distance",
"", 0.0f, 1.0f);
429 prop =
RNA_def_int(ot->
srna,
"steps", 1, 0, 50,
"Steps",
"", 0.0f, 10);
436 "Method used for simplifying stroke points");
454 const int layer_index,
459 object, drawing, layer_index, memory);
473 return fill_ids[
index] == 0 && !hidden_strokes[
index];
479 return hidden_strokes[
index] && fill_ids[
index] != 0;
485 if (!strokes_to_delete.is_empty()) {
486 curves.remove_curves(strokes_to_delete, {});
495 const int layer_index,
501 if (!attributes.
contains(
"fill_id")) {
505 object, drawing, layer_index, memory);
510 editable_strokes, memory, [&](
const int index) {
511 return fill_ids[
index] != 0 && !hidden_strokes[
index];
513 if (fills_with_stroke.is_empty()) {
541 bool changed =
false;
548 if (elements_to_delete.
is_empty()) {
553 curves.remove_curves(elements_to_delete, {});
585 {int(
DeleteMode::All),
"ALL", 0,
"All",
"Delete all selected strokes or points"},
590 "Delete only strokes and not fills"},
592 {0,
nullptr, 0,
nullptr,
nullptr},
596 ot->
idname =
"GREASE_PENCIL_OT_delete";
597 ot->
description =
"Delete selected strokes or points";
605 ot->
srna,
"mode", prop_delete_modes, 0,
"Mode",
"The kind of strokes or fills to delete");
630 "Dissolve points between selected points"},
635 "Dissolve all unselected points"},
636 {0,
nullptr, 0,
nullptr,
nullptr},
644 mask.to_bools(points_to_dissolve);
647 return points_to_dissolve;
659 for (const int64_t curve_i : range) {
660 const IndexRange points = points_by_curve[curve_i];
661 const Span<bool> curve_selection = points_to_dissolve.as_span().slice(points);
663 if (!curve_selection.contains(true)) {
664 points_to_keep.slice(points).fill(true);
670 if (mode != DissolveMode::BETWEEN) {
674 const Vector<IndexRange> deselection_ranges = array_utils::find_all_ranges(curve_selection,
677 if (deselection_ranges.size() != 0) {
678 const IndexRange first_range = deselection_ranges.first().shift(points.first());
679 const IndexRange last_range = deselection_ranges.last().shift(points.first());
683 if (first_range.first() == points.first()) {
684 points_to_keep.slice(first_range).fill(true);
686 if (last_range.last() == points.last()) {
687 points_to_keep.slice(last_range).fill(true);
695 return points_to_dissolve;
708 bool changed =
false;
724 if (points_to_dissolve.
as_span().contains(
true)) {
742 ot->
name =
"Dissolve";
743 ot->
idname =
"GREASE_PENCIL_OT_dissolve";
744 ot->
description =
"Delete selected points without splitting strokes";
757 "Method used for dissolving stroke points");
780 "Deletes current frame in the active layer"},
785 "Delete active frames for all layers"},
786 {0,
nullptr, 0,
nullptr,
nullptr},
794 const int current_frame = scene->
r.
cfra;
798 bool changed =
false;
801 if (
layer.is_editable() &&
layer.start_frame_at(current_frame)) {
807 if (
layer->is_editable() &&
layer->start_frame_at(current_frame)) {
826 ot->
name =
"Delete Frame";
827 ot->
idname =
"GREASE_PENCIL_OT_delete_frame";
841 "Method used for deleting Grease Pencil frames");
860 int material_index =
object->actcol - 1;
862 if (name[0] !=
'\0') {
873 if (material_index == -1) {
906 ot->
name =
"Assign Material";
907 ot->
idname =
"GREASE_PENCIL_OT_stroke_material_set";
908 ot->
description =
"Assign the active material slot to the selected strokes";
916 ot->
srna,
"material",
nullptr,
MAX_ID_NAME - 2,
"Material",
"Name of the material");
938 {0,
nullptr, 0,
nullptr,
nullptr},
946 curves.ensure_evaluated_lengths();
952 [&](
const int curve_i) {
953 if (cyclic[curve_i]) {
954 const IndexRange points = points_by_curve[curve_i];
956 positions[points.
last()]);
959 const float curve_length =
curves.evaluated_length_total_for_curve(curve_i,
true) -
963 const float point_density =
float(points.
size()) / curve_length;
964 use_cuts[points.
last()] = int(point_density * end_distance);
981 const bool subdivide_cyclic_segment =
RNA_boolean_get(op->
ptr,
"subdivide_cyclic_segment");
983 bool changed =
false;
1015 curves.attributes_for_write().remove(
"cyclic");
1019 if (subdivide_cyclic_segment) {
1021 curves.tag_topology_changed();
1040 ot->
name =
"Set Cyclical State";
1041 ot->
idname =
"GREASE_PENCIL_OT_cyclical_set";
1042 ot->
description =
"Close or open the selected stroke adding a segment from last to first point";
1054 "subdivide_cyclic_segment",
1056 "Match Point Density",
1057 "Add point in the new segment to keep the same density");
1072 if (
object->totcol == 0) {
1080 *
object, info.drawing, info.layer_index, memory);
1088 object->actcol = materials[strokes.
first()] + 1;
1100 ot->
name =
"Set Active Material";
1101 ot->
idname =
"GREASE_PENCIL_OT_set_active_material";
1102 ot->
description =
"Set the selected stroke material as the active material";
1124 bool changed =
false;
1151 ot->
name =
"Set Uniform Thickness";
1152 ot->
idname =
"GREASE_PENCIL_OT_set_uniform_thickness";
1153 ot->
description =
"Set all stroke points to same thickness";
1161 ot->
srna,
"thickness", 0.1f, 0.0f, 1000.0f,
"Thickness",
"Thickness", 0.0f, 1000.0f);
1180 bool changed =
false;
1200 fill_opacities.finish();
1216 ot->
name =
"Set Uniform Opacity";
1217 ot->
idname =
"GREASE_PENCIL_OT_set_uniform_opacity";
1218 ot->
description =
"Set all stroke points to same opacity";
1227 RNA_def_float(ot->
srna,
"opacity_stroke", 1.0f, 0.0f, 1.0f,
"Stroke Opacity",
"", 0.0f, 1.0f);
1228 RNA_def_float(ot->
srna,
"opacity_fill", 0.5f, 0.0f, 1.0f,
"Fill Opacity",
"", 0.0f, 1.0f);
1244 bool changed =
false;
1256 curves.reverse_curves(strokes);
1272 ot->
name =
"Switch Direction";
1273 ot->
idname =
"GREASE_PENCIL_OT_stroke_switch_direction";
1274 ot->
description =
"Change direction of the points of the selected strokes";
1305 for (const int curve_i : range) {
1306 const IndexRange points = points_by_curve[curve_i];
1307 const Span<bool> curve_i_selected_points = start_set_points.as_span().slice(points);
1308 const int first_selected = curve_i_selected_points.first_index_try(true);
1310 MutableSpan<int> dst_to_src_slice = dst_to_src_point.as_mutable_span().slice(points);
1312 array_utils::fill_index_range<int>(dst_to_src_slice, points.start());
1314 if (first_selected == -1 || src_cyclic[curve_i] == false) {
1318 std::rotate(dst_to_src_slice.begin(),
1319 dst_to_src_slice.begin() + first_selected,
1320 dst_to_src_slice.end());
1348 dst_curves.update_curve_types();
1350 if (
curves.nurbs_has_custom_knots()) {
1364 std::atomic<bool> changed =
false;
1389 ot->
name =
"Set Start Point";
1390 ot->
idname =
"GREASE_PENCIL_OT_set_start_point";
1391 ot->
description =
"Select which point is the beginning of the curve";
1436 bool changed =
false;
1456 start_caps.finish();
1507 {int(
CapsMode::ROUND),
"ROUND", ICON_GP_CAPS_ROUND,
"Rounded",
"Set as default rounded"},
1512 {0,
nullptr, 0,
nullptr,
nullptr},
1515 ot->
name =
"Set Curve Caps";
1516 ot->
idname =
"GREASE_PENCIL_OT_caps_set";
1517 ot->
description =
"Change curve caps mode (rounded or flat)";
1544 if (ob ==
nullptr) {
1551 item_tmp.identifier = ma->id.name + 2;
1552 item_tmp.name = ma->id.name + 2;
1553 item_tmp.value = i + 1;
1554 item_tmp.icon = ma->preview ? ma->preview->runtime->icon_id : ICON_NONE;
1572 if ((slot < 1) || (slot >
object->totcol)) {
1577 object->actcol = slot;
1586 ot->
name =
"Set Active Material";
1587 ot->
idname =
"GREASE_PENCIL_OT_set_material";
1616 std::atomic<bool> changed =
false;
1622 const int num_old_curves =
curves.curves_num();
1642 changed.store(
true, std::memory_order_relaxed);
1654 ot->
name =
"Duplicate";
1655 ot->
idname =
"GREASE_PENCIL_OT_duplicate";
1656 ot->
description =
"Duplicate the selected points";
1682 editable_strokes, memory, [&](
const int i) {
return points_by_curve[i].
size() <= limit; });
1684 curves.remove_curves(curves_to_delete, {});
1698 C, op, event,
IFACE_(
"Remove Loose Points"),
IFACE_(
"Delete"));
1703 ot->
name =
"Clean Loose Points";
1704 ot->
idname =
"GREASE_PENCIL_OT_clean_loose";
1719 "Number of points to consider stroke as loose",
1735 std::atomic<bool> changed =
false;
1774 auto is_selected = [&](
const int point_i,
const int curve_i) {
1775 if (selection[point_i]) {
1782 return selection_left[point_i] || selection_right[point_i];
1793 for (
const int curve :
curves.curves_range()) {
1796 for (
const int point : points_by_curve[curve].drop_back(1)) {
1798 if (!is_selected(point, curve)) {
1802 if (is_selected(point + 1, curve)) {
1803 use_cuts[point] = cuts;
1807 if (cyclic[curve]) {
1808 const int first_point = points_by_curve[curve].first();
1809 const int last_point = points_by_curve[curve].last();
1810 if (is_selected(first_point, curve) && is_selected(last_point, curve)) {
1811 use_cuts[last_point] = cuts;
1820 changed.store(
true, std::memory_order_relaxed);
1835 ot->
name =
"Subdivide Stroke";
1836 ot->
idname =
"GREASE_PENCIL_OT_stroke_subdivide";
1838 "Subdivide between continuous selected points of the stroke adding a point half way "
1847 prop =
RNA_def_int(ot->
srna,
"number_cuts", 1, 1, 32,
"Number of Cuts",
"", 1, 5);
1855 "Smooth only selected points in the stroke");
1920 if (curve_i != pos) {
1922 std::swap(indices[curve_i], indices[curve_i - 1]);
1932 for (
const int i : selected_indices.
index_range()) {
1934 const int curve_i = selected_indices[pos];
1937 if (curve_i != universe.
last(i)) {
1939 std::swap(indices[curve_i], indices[curve_i + 1]);
1955 std::atomic<bool> changed =
false;
1975 changed.store(
true, std::memory_order_relaxed);
1994 {0,
nullptr, 0,
nullptr,
nullptr},
1997 ot->
name =
"Reorder";
1998 ot->
idname =
"GREASE_PENCIL_OT_reorder";
1999 ot->
description =
"Change the display order of the selected strokes";
2020 bool changed =
false;
2030 if (add_new_layer) {
2031 target_node = &
grease_pencil.add_layer(target_layer_name).as_node();
2033 if (!target_group_name.empty()) {
2036 if (group_node && group_node->
is_group()) {
2042 target_node =
grease_pencil.find_node_by_name(target_layer_name);
2045 if (target_node ==
nullptr || !target_node->
is_layer()) {
2051 if (layer_dst.is_locked()) {
2067 bool is_key_inserted =
false;
2068 bool has_active_key =
false;
2069 if (layer_dst.
frames().is_empty()) {
2072 is_key_inserted =
true;
2073 has_active_key =
true;
2080 if (has_active_key && is_key_inserted) {
2084 const int frame_number_dst = is_key_inserted ? scene->
r.
cfra : info.frame_number;
2088 curves_src, selected_strokes, {});
2096 curves_src, selected_strokes, {});
2099 std::array<bke::GeometrySet, 2> geometry_sets{
2107 drawing_dst->tag_topology_changed();
2110 info.drawing.tag_topology_changed();
2128 if (add_new_layer) {
2132 const std::string unique_name =
grease_pencil.unique_layer_name(
"Layer");
2136 C, op, event,
IFACE_(
"Move to New Layer"),
IFACE_(
"Create"));
2154 ot->
name =
"Move to Layer";
2155 ot->
idname =
"GREASE_PENCIL_OT_move_to_layer";
2156 ot->
description =
"Move selected strokes to another layer";
2165 ot->
srna,
"target_layer_name",
nullptr,
INT16_MAX,
"Name",
"Target Grease Pencil Layer");
2168 "target_group_name",
2172 "Group to add the new layer to");
2175 ot->
srna,
"add_new_layer",
false,
"New Layer",
"Move selection to a new layer");
2198 {0,
nullptr, 0,
nullptr,
nullptr},
2214 object_dst->
data = id_cast<ID *>(grease_pencil_dst);
2220 const int layer_index,
2228 const Layer &layer_src = grease_pencil_src.layer(layer_index);
2229 if (
TreeNode *
node = grease_pencil_dst.find_node_by_name(layer_src.name())) {
2230 return node->as_layer();
2234 Layer &new_layer = grease_pencil_dst.add_layer(layer_src.name());
2236 src_to_dst_layer_indices.
append(layer_index);
2249 bool changed =
false;
2251 GreasePencil &grease_pencil_src = *id_cast<GreasePencil *>(object_src.
data);
2253 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2254 GreasePencil &grease_pencil_dst = *id_cast<GreasePencil *>(object_dst->
data);
2270 info.layer_index, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2272 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2277 curves_src, selected_points, {});
2280 info.drawing.tag_topology_changed();
2292 src_to_dst_layer_indices.
as_span(),
2293 grease_pencil_dst.attributes_for_write());
2296 if (grease_pencil_src.has_active_layer()) {
2297 const Layer &active_layer_src = *grease_pencil_src.get_active_layer();
2298 TreeNode *active_layer_dst = grease_pencil_dst.find_node_by_name(active_layer_src.name());
2299 if (active_layer_dst && active_layer_dst->
is_layer()) {
2300 grease_pencil_dst.set_active_layer(&active_layer_dst->
as_layer());
2326 bool changed =
false;
2328 GreasePencil &grease_pencil_src = *id_cast<GreasePencil *>(object_src.
data);
2331 for (
const int layer_i : grease_pencil_src.layers().index_range()) {
2332 Layer &layer_src = grease_pencil_src.layer(layer_i);
2333 if (layer_src.is_locked()) {
2338 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2339 GreasePencil &grease_pencil_dst = *id_cast<GreasePencil *>(object_dst->
data);
2342 layer_i, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2346 scene, grease_pencil_src, layer_src);
2351 object_src, info.drawing, info.layer_index, memory);
2364 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2370 info.drawing.strokes(), strokes, {});
2373 info.drawing.tag_topology_changed();
2384 src_to_dst_layer_indices.
as_span(),
2385 grease_pencil_dst.attributes_for_write());
2405 bool changed =
false;
2407 GreasePencil &grease_pencil_src = *id_cast<GreasePencil *>(object_src.
data);
2416 &bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
2417 GreasePencil &grease_pencil_dst = *id_cast<GreasePencil *>(object_dst->
data);
2434 object_src, info.drawing, mat_i, memory);
2441 info.layer_index, grease_pencil_src, grease_pencil_dst, src_to_dst_layer_indices);
2443 Drawing *drawing_dst = grease_pencil_dst.insert_frame(layer_dst, info.frame_number);
2451 info.drawing.tag_topology_changed();
2462 src_to_dst_layer_indices.
as_span(),
2463 grease_pencil_dst.attributes_for_write());
2486 GreasePencil &grease_pencil_src = *id_cast<GreasePencil *>(object_src->
data);
2489 bool changed =
false;
2498 const bool has_selection = std::any_of(
2500 return ed::curves::has_anything_selected(info.drawing.strokes());
2502 if (!has_selection) {
2509 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2514 if (object_src->
totcol == 1) {
2521 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2526 if (grease_pencil_src.layers().size() == 1) {
2532 *
C, *bmain, *scene, *view_layer, *base_prev, *object_src);
2549 ot->
name =
"Separate";
2550 ot->
idname =
"GREASE_PENCIL_OT_separate";
2551 ot->
description =
"Separate the selected geometry into a new Grease Pencil object";
2585} *grease_pencil_clipboard =
nullptr;
2617 scene_materials.
add(material.id.session_uid, &material);
2622 for (
const int i : clipboard.
materials.index_range()) {
2630 clipboard_material_remap[clipboard.
materials[i].second] = target_index;
2636 clipboard_material_remap[clipboard.
materials[i].second] = target_index;
2639 return clipboard_material_remap;
2647 auto instances = std::make_unique<bke::Instances>(geometries.
size());
2648 transforms.
materialize(instances->transforms_for_write());
2655 options.keep_original_ids =
true;
2656 options.realize_instance_attributes =
false;
2679 int num_elements_copied = 0;
2702 num_elements_copied += copied_curves.
curves_num();
2708 num_elements_copied += copied_curves.
points_num();
2716 if (copied_curves_per_layer.
is_empty()) {
2717 clipboard.
layers.reinitialize(0);
2721 clipboard.
layers.reinitialize(copied_curves_per_layer.
size());
2724 for (
auto const &[
layer, geometries] : copied_curves_per_layer.
items()) {
2725 const float4x4 layer_to_object =
layer->to_object_space(*
object);
2741 const auto is_material_index_used = [&](
const int material_index) ->
bool {
2746 if (material_indices.
contains(material_index)) {
2754 if (!is_material_index_used(material_index)) {
2758 clipboard.
materials.append({material ? material->id.session_uid : 0, material_index});
2776 ot->
name =
"Copy Strokes";
2777 ot->
idname =
"GREASE_PENCIL_OT_copy";
2778 ot->
description =
"Copy the selected Grease Pencil points or strokes to the internal clipboard";
2789 const float4x4 &object_to_paste_layer,
2790 const float4x4 &clipboard_to_world,
2791 const bool keep_world_transform,
2792 const bool paste_back,
2813 (keep_world_transform ?
2814 object.world_to_object() * clipboard_to_world :
2823 if (!clipboard_material_remap.
is_empty()) {
2828 if (material_indices) {
2829 for (
const int i : pasted_curves_range) {
2830 material_indices.
span[i] = clipboard_material_remap[material_indices.
span[i]];
2832 material_indices.
finish();
2838 return pasted_curves_range;
2862 if (clipboard.
layers.is_empty()) {
2868 bke::GSpanAttributeWriter selection = ed::curves::ensure_selection_attribute(
2869 layer.curves, selection_domain, bke::AttrType::Bool);
2875 if (!active_layer) {
2879 if (!active_layer->is_editable()) {
2891 selection_in_target.
finish();
2897 bool inserted_keyframe =
false;
2908 *bmain, *
object, object_to_layer, keep_world_transform, paste_on_back, info.
drawing);
2911 if (inserted_keyframe) {
2919 for (
const int clip_layer_i : clipboard.
layers.index_range()) {
2922 const bool found_layer =
node &&
node->is_layer() &&
node->as_layer().is_editable();
2924 layers_to_paste_into[clip_layer_i] = &
node->as_layer();
2927 if (active_layer && active_layer->is_editable()) {
2930 op->
reports,
RPT_WARNING,
"Couldn't find matching layer, pasting into active layer");
2931 layers_to_paste_into[clip_layer_i] = active_layer;
2935 if (!active_layer) {
2938 else if (!active_layer->is_editable()) {
2951 selection_in_target.
finish();
2954 for (
const int clip_layer_i : clipboard.
layers.index_range()) {
2958 BLI_assert(layers_to_paste_into[clip_layer_i] !=
nullptr);
2959 Layer &paste_layer = *layers_to_paste_into[clip_layer_i];
2963 bool inserted_keyframe =
false;
2976 object_to_paste_layer,
2978 keep_world_transform,
2983 if (inserted_keyframe) {
2992 if (!clipboard.
defnames.is_empty()) {
3001 clipboard.
defnames.free_no_destruct();
3028 {0,
nullptr, 0,
nullptr,
nullptr},
3031 ot->
name =
"Paste Strokes";
3032 ot->
idname =
"GREASE_PENCIL_OT_paste";
3034 "Paste Grease Pencil points or strokes from the internal clipboard to the active layer";
3044 ot->
srna,
"paste_back",
false,
"Paste on Back",
"Add pasted strokes behind all strokes");
3048 "keep_world_transform",
3050 "Keep World Transform",
3051 "Keep the world transform of strokes from the clipboard unchanged");
3059 const float4x4 &object_to_paste_layer,
3060 const bool keep_world_transform,
3061 const bool paste_back,
3065 if (clipboard.
layers.is_empty()) {
3077 joined_clipboard_set.
get_curves()->geometry.wrap();
3081 joined_clipboard_curves,
3082 object_to_paste_layer,
3084 keep_world_transform,
3101 std::atomic<bool> changed =
false;
3107 const IndexMask points = use_unselected ?
3116 drawing.
strokes(), threshold, points, {});
3118 changed.store(
true, std::memory_order_relaxed);
3131 ot->
name =
"Merge by Distance";
3132 ot->
idname =
"GREASE_PENCIL_OT_stroke_merge_by_distance";
3140 prop =
RNA_def_float(ot->
srna,
"threshold", 0.001f, 0.0f, 100.0f,
"Threshold",
"", 0.0f, 100.0f);
3148 "Use whole stroke, not only selected points");
3181 int point_offset = 0;
3183 const IndexRange curve_points = points_by_curve[curve_index];
3185 const bool curve_cyclic = src_cyclic[curve_index];
3187 curve_points_to_extrude.
foreach_index([&](
const int src_point_index) {
3188 if (!curve_cyclic && (src_point_index == curve_points.
first())) {
3191 dst_to_src_points.
insert(src_point_index + point_offset, src_point_index);
3192 dst_selected.
insert(src_point_index + point_offset,
true);
3193 ++dst_curve_counts[curve_index];
3197 if (!curve_cyclic && (src_point_index == curve_points.
last())) {
3200 dst_to_src_points.
insert(src_point_index + point_offset + 1, src_point_index);
3201 dst_selected.
insert(src_point_index + point_offset + 1,
true);
3202 ++dst_curve_counts[curve_index];
3210 dst_to_src_points.
append(src_point_index);
3211 dst_selected.
append(
false);
3212 dst_to_src_points.
append(src_point_index);
3213 dst_selected.
append(
true);
3214 dst_to_src_curves.
append(curve_index);
3215 dst_curve_counts.
append(2);
3219 const int new_points_num = dst_to_src_points.
size();
3220 const int new_curves_num = dst_to_src_curves.
size();
3240 for (
const StringRef selection_attribute_name :
3263 {
".selection",
".selection_handle_left",
".selection_handle_right"}),
3275 return curve_types[curve_index] == CURVE_TYPE_NURBS &&
3276 knot_modes[curve_index] == NURBS_KNOT_MODE_CUSTOM &&
3277 points_by_curve[curve_index].size() == dst_points_by_curve[curve_index].size();
3298 std::atomic<bool> changed =
false;
3305 if (points_to_extrude.
is_empty()) {
3313 changed.store(
true, std::memory_order_relaxed);
3326 ot->
name =
"Extrude Stroke Points";
3327 ot->
idname =
"GREASE_PENCIL_OT_extrude";
3386 if (keep_original) {
3410 std::atomic<bool> changed =
false;
3414 if (drawings.is_empty()) {
3417 const int current_frame_number = drawings.first().frame_number;
3420 scene.
r.
cfra = current_frame_number;
3439 curves, selection_name, bezier_points, memory);
3441 editable_points, selected_points, memory);
3443 if (points_to_reproject.
is_empty()) {
3448 if (selection_name ==
".selection_handle_left") {
3449 positions =
curves.handle_positions_left_for_write();
3451 else if (selection_name ==
".selection_handle_right") {
3452 positions =
curves.handle_positions_right_for_write();
3457 const float4x4 layer_space_to_world_space =
layer.to_world_space(*
object);
3460 [&](
const int point_i) {
3472 float3 ray_start, ray_direction;
3474 depsgraph, region, v3d, screen_co, ray_start, ray_direction,
true))
3479 float hit_depth = std::numeric_limits<float>::max();
3480 float3 hit_position(0.0f);
3498 world_space_to_layer_space,
3501 if (selection_name ==
".selection") {
3511 scene, *region, *v3d, *
object, &
layer, mode, offset,
nullptr);
3513 [&](
const int point_i) {
3514 const float3 new_pos = drawing_placement.
reproject(positions[point_i]);
3515 if (selection_name ==
".selection") {
3517 rv3d, positions[point_i], new_pos);
3519 positions[point_i] = new_pos;
3525 changed.store(
true, std::memory_order_relaxed);
3531 if (snap_context !=
nullptr) {
3537 scene.
r.
cfra = oldframe;
3573 "Reproject the strokes using the X-Z plane"},
3574 {int(
ReprojectMode::Side),
"SIDE", 0,
"Side",
"Reproject the strokes using the Y-Z plane"},
3575 {int(
ReprojectMode::Top),
"TOP", 0,
"Top",
"Reproject the strokes using the X-Y plane"},
3580 "Reproject the strokes to end up on the same plane, as if drawn from the current "
3582 "using 'Cursor' Stroke Placement"},
3587 "Reproject the strokes on to the scene geometry, as if drawn using 'Surface' placement"},
3592 "Reproject the strokes using the orientation of 3D cursor"},
3593 {0,
nullptr, 0,
nullptr,
nullptr},
3597 ot->
name =
"Reproject Strokes";
3598 ot->
idname =
"GREASE_PENCIL_OT_reproject";
3600 "Reproject the selected strokes from the current viewpoint as if they had been newly "
3602 "(e.g. to fix problems from accidental 3D cursor movement or accidental viewport changes, "
3603 "or for matching deforming geometry)";
3623 "Keep original strokes and create a copy before reprojecting");
3626 RNA_def_float(ot->
srna,
"offset", 0.0f, 0.0f, 10.0f,
"Surface Offset",
"", 0.0f, 10.0f);
3684 curves, selection_name, bezier_points, memory);
3687 const float4x4 layer_to_world =
layer.to_world_space(
object);
3691 if (selection_name ==
".selection_handle_left") {
3692 positions =
curves.handle_positions_left_for_write();
3694 else if (selection_name ==
".selection_handle_right") {
3695 positions =
curves.handle_positions_right_for_write();
3698 [&](
const int point_i) {
3700 const float3 pos_snapped = grid_size *
math::floor(pos_world / grid_size + 0.5f);
3706 drawing_info.drawing.tag_positions_changed();
3718 ot->
name =
"Snap Selection to Grid";
3719 ot->
idname =
"GREASE_PENCIL_OT_snap_to_grid";
3720 ot->
description =
"Snap selected points to the nearest grid points";
3756 selected_points_memory);
3759 const float4x4 layer_to_world =
layer.to_world_space(
object);
3768 curves, selected_curves_memory);
3771 [&](
const int curve_i) {
3772 const IndexRange points = points_by_curve[curve_i];
3775 const float3 offset = cursor_layer - positions[points.
first()];
3777 [&](
const int point_i) { positions[point_i] += offset; },
3787 curves.calculate_bezier_auto_handles();
3788 drawing_info.drawing.tag_positions_changed();
3801 ot->
name =
"Snap Selection to Cursor";
3802 ot->
idname =
"GREASE_PENCIL_OT_snap_to_cursor";
3803 ot->
description =
"Snap selected points/strokes to the cursor";
3817 "Offset the entire stroke instead of selected points only");
3835 int num_selected = 0;
3836 r_centroid =
float3(0.0f);
3837 r_min =
float3(std::numeric_limits<float>::max());
3838 r_max =
float3(std::numeric_limits<float>::lowest());
3841 for (
const DrawingInfo &drawing_info : drawings) {
3843 if (
layer.is_locked()) {
3856 selected_points_memory);
3857 const float4x4 layer_to_world =
layer.to_world_space(
object);
3861 [&](
const int point_i) {
3863 r_centroid += pos_world;
3867 num_selected += selected_points.
size();
3869 if (num_selected == 0) {
3870 r_min = r_max =
float3(0.0f);
3874 r_centroid /= num_selected;
3885 float3 centroid, points_min, points_max;
3887 scene,
object,
grease_pencil, centroid, points_min, points_max))
3915 ot->
name =
"Snap Cursor to Selected Points";
3916 ot->
idname =
"GREASE_PENCIL_OT_snap_cursor_to_selected";
3917 ot->
description =
"Snap cursor to center of selected points";
3941 strokemat4x3[2][2] = 0.0f;
3942 strokemat4x3[3][2] = 1.0f;
3944 return strokemat4x3;
3954 bool inserted_keyframe =
false;
3955 const bool use_duplicate_previous_key =
true;
3957 if (
layer->is_editable()) {
3963 std::atomic<bool> changed = inserted_keyframe;
3974 const float4x4 layer_space_to_world_space =
layer.to_world_space(*
object);
3979 const float2 screen_direction = screen_end - screen_start;
3980 const float2 screen_tangent = screen_start +
float2(-screen_direction[1], screen_direction[0]);
3991 strokes.
foreach_index([&](
const int curve_i,
const int pos) {
3992 const int material_index = materials[curve_i];
3995 material_index + 1);
4006 positions[points_by_curve[curve_i].first()]);
4019 const float3 origin = start;
4025 if (
math::dot(tangent - start, v_dir) < 0.0f) {
4037 offset_matrix *= 0.5f;
4038 offset_matrix[2] +=
float2(0.5f, 0.5f);
4042 offset_matrix[2] -=
float2(0.5f, 0.5f);
4045 offset_matrix = texture_rotation * offset_matrix;
4046 offset_matrix[2] -= texture_offset;
4048 texture_matrices[pos] = (offset_matrix *
expand_4x2_mat(base_texture_space)) *
4049 layer_space_to_world_space;
4054 changed.store(
true, std::memory_order_relaxed);
4105 ot->
name =
"Texture Gradient";
4106 ot->
idname =
"GREASE_PENCIL_OT_texture_gradient";
4107 ot->
description =
"Draw a line to set the fill material gradient for the selected strokes";
4137 bool changed =
false;
4149 options.convert_bezier_handles_to_poly_points = use_handles;
4150 options.convert_bezier_handles_to_catmull_rom_points = use_handles;
4151 options.keep_bezier_shape_as_nurbs = use_handles;
4152 options.keep_catmull_rom_shape_as_nurbs = use_handles;
4170 ot->
name =
"Set Curve Type";
4171 ot->
idname =
"GREASE_PENCIL_OT_set_curve_type";
4187 "Take handle information into account in the conversion");
4203 const SetHandleType dst_type = SetHandleType(
RNA_enum_get(op->
ptr,
"type"));
4205 auto new_handle_type = [&](
const int8_t handle_type) {
4207 case SetHandleType::Free:
4209 case SetHandleType::Auto:
4211 case SetHandleType::Vector:
4213 case SetHandleType::Align:
4215 case SetHandleType::Toggle:
4223 bool changed =
false;
4248 [&](
const int curve_i) {
4249 const IndexRange points = points_by_curve[curve_i];
4250 for (
const int point_i : points) {
4251 if (selection_left[point_i] || selection[point_i]) {
4252 handle_types_left[point_i] = new_handle_type(handle_types_left[point_i]);
4254 if (selection_right[point_i] || selection[point_i]) {
4255 handle_types_right[point_i] = new_handle_type(handle_types_right[point_i]);
4261 curves.calculate_bezier_auto_handles();
4262 curves.calculate_bezier_aligned_handles();
4263 curves.tag_topology_changed();
4279 ot->
name =
"Set Handle Type";
4280 ot->
idname =
"GREASE_PENCIL_OT_set_handle_type";
4281 ot->
description =
"Set the handle type for Bézier curves";
4311 bool changed =
false;
4341 ot->
name =
"Set Curve Resolution";
4342 ot->
idname =
"GREASE_PENCIL_OT_set_curve_resolution";
4343 ot->
description =
"Set resolution of selected curves";
4356 "The resolution to use for each curve segment",
4373 bool changed =
false;
4385 if (attributes.
contains(
"uv_rotation")) {
4386 if (editable_strokes.
size() ==
curves.curves_num()) {
4387 attributes.
remove(
"uv_rotation");
4397 if (attributes.
contains(
"uv_translation")) {
4398 if (editable_strokes.
size() ==
curves.curves_num()) {
4399 attributes.
remove(
"uv_translation");
4405 uv_translations.
finish();
4409 if (attributes.
contains(
"uv_scale")) {
4410 if (editable_strokes.
size() ==
curves.curves_num()) {
4411 attributes.
remove(
"uv_scale");
4421 if (attributes.
contains(
"uv_shear")) {
4422 if (editable_strokes.
size() ==
curves.curves_num()) {
4423 attributes.
remove(
"uv_shear");
4448 ot->
name =
"Reset UVs";
4449 ot->
idname =
"GREASE_PENCIL_OT_reset_uvs";
4450 ot->
description =
"Reset UV transformation to default values";
4464 std::atomic<bool> changed =
false;
4479 changed.store(
true, std::memory_order_relaxed);
4494 ot->
name =
"Split stroke";
4495 ot->
idname =
"GREASE_PENCIL_OT_stroke_split";
4496 ot->
description =
"Split selected points to a new stroke";
4522 std::atomic<bool> changed =
false;
4525 for (
const int layer_i :
grease_pencil.layers().index_range()) {
4528 drawings.
append({*drawing, layer_i, scene.
r.
cfra, 1.0f});
4533 for (
const int layer_i :
grease_pencil.layers().index_range()) {
4535 for (
const auto [frame_number, frame] :
layer.frames().items()) {
4537 drawings.
append({*drawing, layer_i, frame_number, 1.0f});
4545 changed.store(
true, std::memory_order_relaxed);
4563 {0,
nullptr, 0,
nullptr,
nullptr},
4567 ot->
name =
"Remove Fill Guides";
4568 ot->
idname =
"GREASE_PENCIL_OT_remove_fill_guides";
4569 ot->
description =
"Remove all the strokes that were created from the fill tool as guides";
4603 {0,
nullptr, 0,
nullptr,
nullptr},
4616 const int corner_subdivisions =
RNA_int_get(op->
ptr,
"corner_subdivisions");
4617 const float outline_offset = radius * offset_factor;
4618 const int mat_nr = -1;
4631 viewinv =
float4x4({1.0f, 0.0f, 0.0f, 0.0f},
4632 {0.0f, 0.0f, 1.0f, 0.0f},
4633 {0.0f, 1.0f, 0.0f, 0.0f},
4634 {0.0f, 0.0f, 0.0f, 1.0f});
4637 viewinv =
float4x4({0.0f, 0.0f, 1.0f, 0.0f},
4638 {0.0f, 1.0f, 0.0f, 0.0f},
4639 {1.0f, 0.0f, 0.0f, 0.0f},
4640 {0.0f, 0.0f, 0.0f, 1.0f});
4650 if (scene->
camera ==
nullptr) {
4654 viewinv = scene->
camera->world_to_object();
4661 bool changed =
false;
4672 const float4x4 viewmat = viewinv *
layer.to_world_space(*
object);
4677 corner_subdivisions,
4688 const std::array<bke::GeometrySet, 2> geometry_sets = {
4709 ot->
name =
"Outline";
4710 ot->
idname =
"GREASE_PENCIL_OT_outline";
4711 ot->
description =
"Convert selected strokes to perimeter";
4724 ot->
srna,
"offset_factor", -1.0f, -1.0f, 1.0f,
"Offset Factor",
"", -1.0f, 1.0f);
4725 RNA_def_int(ot->
srna,
"corner_subdivisions", 2, 0, 10,
"Corner Subdivisions",
"", 0, 5);
4736 const float threshold)
4747 const float threshold)
4753 const IndexMask non_catmull_rom_curves_selection =
4755 .complement(selection, memory);
4756 if (non_catmull_rom_curves_selection.
is_empty()) {
4767 non_catmull_rom_curves_selection,
4768 curves.points_by_curve(),
4773 curves.remove_points(points_to_remove, {});
4776 options.convert_bezier_handles_to_poly_points =
false;
4777 options.convert_bezier_handles_to_catmull_rom_points =
false;
4778 options.keep_bezier_shape_as_nurbs =
true;
4779 options.keep_catmull_rom_shape_as_nurbs =
true;
4791 .indices_for_curve_type(
4793 .complement(selection, memory);
4794 if (non_poly_curves_selection.
is_empty()) {
4803 const float threshold)
4809 const IndexMask poly_curves_selection =
curves.indices_for_curve_type(
4811 if (!poly_curves_selection.
is_empty()) {
4816 options.convert_bezier_handles_to_poly_points =
false;
4817 options.convert_bezier_handles_to_catmull_rom_points =
false;
4818 options.keep_bezier_shape_as_nurbs =
true;
4819 options.keep_catmull_rom_shape_as_nurbs =
true;
4825 const float threshold)
4832 const IndexMask poly_curves_selection =
curves.indices_for_curve_type(
4834 if (!poly_curves_selection.
is_empty()) {
4839 options.convert_bezier_handles_to_poly_points =
false;
4840 options.convert_bezier_handles_to_catmull_rom_points =
false;
4841 options.keep_bezier_shape_as_nurbs =
true;
4842 options.keep_catmull_rom_shape_as_nurbs =
true;
4855 std::atomic<bool> changed =
false;
4882 changed.store(
true, std::memory_order_relaxed);
4916 ot->
name =
"Convert Curve Type";
4917 ot->
idname =
"GREASE_PENCIL_OT_convert_curve_type";
4918 ot->
description =
"Convert type of selected curves";
4938 "The distance that the resulting points are allowed to be within",
4960 {0,
nullptr, 0,
nullptr,
nullptr},
4984 if (miter_angle == 0.0f) {
4989 std::atomic<bool> changed =
false;
5009 attributes.
remove(
"miter_angle");
5010 changed.store(
true, std::memory_order_relaxed);
5021 miter_angles.finish();
5022 changed.store(
true, std::memory_order_relaxed);
5058 ot->
name =
"Set Corner Type";
5059 ot->
idname =
"GREASE_PENCIL_OT_set_corner_type";
5060 ot->
description =
"Set the corner type of the selected points";
5078 "All corners sharper than the Miter angle will be cut flat",
5101 std::atomic<bool> changed =
false;
5120 case StrokeType::Stroke: {
5125 case StrokeType::Fill: {
5129 case StrokeType::Both: {
5135 if (
ELEM(type, StrokeType::Fill, StrokeType::Both)) {
5137 strokes, memory, [&](
const int64_t index) {
return fill_ids.span[
index] == 0; });
5139 fill_ids.span.varray(), selected_non_fill_strokes, fill_ids.span);
5151 if (type == StrokeType::Stroke) {
5152 if (std::all_of(fill_ids.span.begin(),
5153 fill_ids.span.end(),
5154 [&](
const int64_t fill_id) { return fill_id == 0; }))
5157 attributes.
remove(
"fill_id");
5161 if (
ELEM(type, StrokeType::Stroke, StrokeType::Both)) {
5163 hide_stroke.
span.varray());
5166 attributes.
remove(
"hide_stroke");
5176 changed.store(
true, std::memory_order_relaxed);
5190 {int(StrokeType::Stroke),
"STROKE", ICON_GP_DRAW_STROKE,
"Stroke",
""},
5191 {int(StrokeType::Fill),
"FILL", ICON_GP_DRAW_FILL,
"Fill",
""},
5192 {int(StrokeType::Both),
"BOTH", ICON_GP_DRAW_BOTH,
"Both",
""},
5193 {0,
nullptr, 0,
nullptr,
nullptr},
5197 ot->
name =
"Set Stroke Type";
5198 ot->
idname =
"GREASE_PENCIL_OT_set_stroke_type";
5199 ot->
description =
"Set the stroke type (stroke, fill, or both) of the selected strokes";
5208 ot->
srna,
"type", prop_stroke_type_types,
int(StrokeType::Stroke),
"Type",
"");
5220 const int first_curve = selected.
first();
5253 return indices_data;
5268 int num_drawings_selected = 0;
5269 int active_layer_index = 0;
5274 *
object, info.drawing, info.layer_index, memory);
5276 if (!base_selected_strokes.
is_empty()) {
5277 drawing_dst = &info.drawing;
5278 active_layer_index = info.layer_index;
5279 num_drawings_selected++;
5283 if (num_drawings_selected == 0) {
5289 if (num_drawings_selected > 1) {
5291 if (!active_layer) {
5295 if (!active_layer->is_editable()) {
5301 int active_layer_index = *
grease_pencil.get_layer_index(*active_layer);
5308 *
object, info.drawing, info.layer_index, memory);
5309 if (base_selected_strokes.
is_empty()) {
5314 if (info.layer_index == active_layer_index) {
5321 bool is_key_inserted =
false;
5322 bool has_active_key =
false;
5323 if (active_layer->
frames().is_empty()) {
5327 is_key_inserted =
true;
5328 has_active_key =
true;
5332 *scene,
grease_pencil, *active_layer,
false, is_key_inserted);
5335 if (has_active_key && is_key_inserted) {
5339 curves_src, selected_strokes, {});
5349 curves_src, selected_strokes, {});
5352 std::array<bke::GeometrySet, 2> geometry_sets{
5364 info.drawing.tag_topology_changed();
5370 *
object, *drawing_dst, active_layer_index, memory);
5371 if (base_selected_strokes.
is_empty()) {
5383 const int active_curve = selected_strokes.first();
5385 int fill_id_to_set = fill_ids.
span[active_curve];
5386 if (fill_id_to_set == 0) {
5426 ot->
name =
"Join Fills";
5427 ot->
idname =
"GREASE_PENCIL_OT_join_fills";
5428 ot->
description =
"Join selected strokes into one fill to create holes";
5450 std::atomic<bool> changed =
false;
5467 const int new_fill_id = std::max(
5468 *std::max_element(fill_ids.
span.begin(), fill_ids.
span.end()) + 1, 1);
5483 changed.store(
true, std::memory_order_relaxed);
5496 ot->
name =
"Separate Fills";
5497 ot->
idname =
"GREASE_PENCIL_OT_separate_fills";
5498 ot->
description =
"Separate the selected strokes from current fill";
5509 "Create a separate fill for each individual stroke");
5578 Layer &layer_dst = grease_pencil_dst.add_layer(group_dst, layer_src.name());
5601 switch (child.
type) {
5604 Layer &layer_dst =
copy_layer(grease_pencil_dst, group_dst, layer_src);
5605 layer_name_map.
add_new(layer_src.name(), layer_dst.name());
5635 for (
const int i : material_index_map.
index_range()) {
5637 if (material !=
nullptr) {
5641 material_index_map[i] = 0;
5644 return material_index_map;
5656 for (const int curve_i : range) {
5657 material_writer.span[curve_i] = material_index_map[material_writer.span[curve_i]];
5660 material_writer.
finish();
5673 return vertex_group_map;
5698 *value = bke::attribute_data_type_highest_complexity({*value, iter.data_type});
5702 add_or_upgrade_types(a);
5703 add_or_upgrade_types(
b);
5707 for (
const auto &[name, type] : new_types.items()) {
5741 const int orig_layers_num = grease_pencil_dst.layers().size();
5744 ob_dst, grease_pencil_dst, grease_pencil_src.vertex_group_names);
5749 const int new_drawing_array_num = grease_pencil_dst.drawing_array_num +
5750 grease_pencil_src.drawing_array_num;
5755 0, grease_pencil_dst.drawing_array_num);
5757 grease_pencil_dst.drawing_array_num, grease_pencil_src.drawing_array_num);
5763 grease_pencil_dst.resize_drawings(0);
5764 grease_pencil_dst.drawing_array = new_drawing_array;
5765 grease_pencil_dst.drawing_array_num = new_drawing_array_num;
5771 grease_pencil_dst.root_group(),
5772 grease_pencil_src.root_group(),
5775 grease_pencil_dst.attribute_storage.wrap() =
merge_attributes(grease_pencil_src.attributes(),
5776 grease_pencil_dst.attributes(),
5777 grease_pencil_dst.layers().size());
5780 for (
const int layer_index : grease_pencil_dst.layers().index_range()) {
5781 Layer &
layer = *grease_pencil_dst.layers_for_write()[layer_index];
5782 const bool is_orig_layer = (layer_index < orig_layers_num);
5783 const float4x4 old_layer_to_world = (is_orig_layer ?
layer.to_world_space(ob_dst) :
5784 layer.to_world_space(ob_src));
5787 if (!is_orig_layer) {
5791 if (new_mask_name) {
5797 for (
const int key :
layer.frames_for_write().keys()) {
5798 int &drawing_index =
layer.frames_for_write().lookup(key).drawing_index;
5799 drawing_index = new_drawings_src[drawing_index];
5806 if (
ELEM(
layer.parent, &ob_dst, &ob_src)) {
5807 layer.parent =
nullptr;
5813 const float4x4 new_layer_to_world =
layer.to_world_space(ob_dst);
5814 for (
const int key :
layer.frames_for_write().keys()) {
5815 const int drawing_index =
layer.frames_for_write().lookup(key).drawing_index;
5824 if (!is_orig_layer) {
5834 if (
id == &grease_pencil_src.id && strstr(
rna_path.c_str(),
"layers[")) {
5836 for (
auto [name_src, name_dst] : layer_name_map.
items()) {
5837 if (name_dst != name_src) {
5839 id,
rna_path.c_str(),
"layers", name_src, name_dst))
5841 fcu->rna_path_set_move(new_path);
5853 if (dtar->id != &grease_pencil_src.id) {
5856 dtar->id = &grease_pencil_dst.id;
5858 if (dtar->rna_path && strstr(dtar->rna_path,
"layers[")) {
5859 for (
auto [name_src, name_dst] : layer_name_map.
items()) {
5860 if (name_dst != name_src) {
5862 id, dtar->rna_path,
"layers", name_src, name_dst))
5864 MEM_delete(dtar->rna_path);
5865 dtar->rna_path = new_path;
5879 if (ob_dst.
adt ==
nullptr) {
5890 if (grease_pencil_src.adt) {
5891 if (grease_pencil_dst.adt ==
nullptr) {
5899 if (grease_pencil_dst.adt->action) {
5920 if (ob_iter == ob_active) {
5932 Object *ob_dst = ob_active;
#define CTX_DATA_BEGIN(C, Type, instance, member)
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.
General operations, lookup, etc. for materials.
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_ID_GPENCIL
#define BLT_I18NCONTEXT_ID_MOVIECLIP
#define GP_STROKE_MITER_ANGLE_BEVEL
#define GP_STROKE_MITER_ANGLE_ROUND
Object is a sort of wrapper for general info.
#define RNA_ENUM_ITEM_SEPR
#define BLI_assert_unreachable()
#define POINTER_OFFSET(v, ofs)
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
IndexRange index_range() const
void fill_assign_indices(const void *value, void *dst, const IndexMask &mask) const
void copy_from(GSpan values)
void materialize_to_uninitialized(void *dst) const
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
static IndexMask from_ranges(OffsetIndices< T > offsets, const IndexMask &mask, LinearAllocator<> &memory)
static IndexMask from_union(const IndexMask &mask_a, const IndexMask &mask_b, LinearAllocator<> &memory)
static IndexMask from_intersection(const IndexMask &mask_a, const IndexMask &mask_b, LinearAllocator<> &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
static constexpr IndexRange from_begin_size(const int64_t begin, const int64_t size)
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 take_back(const int64_t n) const
constexpr MutableSpan drop_back(const int64_t n) const
constexpr MutableSpan drop_front(const int64_t n) const
constexpr MutableSpan take_front(const int64_t n) const
bool contains(const Key &key) const
constexpr int64_t size() const
constexpr IndexRange index_range() 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_span(Span< T > values)
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 name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
bool contains(StringRef name) const
GAttributeReader lookup(const StringRef name) const
Attribute & add(std::string name, bke::AttrDomain domain, bke::AttrType data_type, Attribute::DataVariant data)
VArray< int8_t > curve_types() const
void update_curve_types()
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
VArray< bool > cyclic() const
AttributeAccessor attributes() const
bool nurbs_has_custom_knots() const
IndexRange curves_range() const
VArray< int8_t > nurbs_knots_modes() const
MutableSpan< int > offsets_for_write()
MutableSpan< bool > cyclic_for_write()
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
OffsetIndices< int > points_by_curve() const
MutableAttributeAccessor attributes_for_write()
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
bool remove(const StringRef name)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
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)
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
void tag_frames_map_changed()
float4x4 to_object_space(const Object &object) const
Map< FramesMapKeyT, GreasePencilFrame > & frames_for_write()
const LayerGroup & as_group() const
const Layer & as_layer() const
constexpr bool contains(const T &value) const
float3 reproject(float3 pos) const
void foreach_index_optimized(Fn &&fn, Mode mode=exec_mode::serial) const
IndexMask slice_content(IndexRange range) const
void to_indices(MutableSpan< T > r_indices) const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
IndexMask complement(const IndexMask &universe, LinearAllocator<> &memory) const
CCL_NAMESPACE_BEGIN struct Options options
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void invert_booleans(MutableSpan< bool > span)
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
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, LinearAllocator<> &memory)
void fill_points(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, GPointer value, GMutableSpan dst)
IndexMask selected_mask_to_fills(const IndexMask &selected_mask, const CurvesGeometry &curves, AttrDomain selection_domain, IndexMaskMemory &memory)
int get_next_available_fill_id(Span< int > fill_ids)
void gather_next_available_fill_ids(const VArray< int > &fill_ids, MutableSpan< int > r_new_fill_ids)
void separate_fill_ids(CurvesGeometry &curves, const IndexMask &strokes_to_keep)
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)
bool has_anything_selected(const VArray< bool > &varray, const IndexRange range_to_check)
const EnumPropertyItem rna_enum_set_handle_type_items[]
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, LinearAllocator<> &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)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, LinearAllocator<> &memory)
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)
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_delete_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)
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_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 void GREASE_PENCIL_OT_separate_fills(wmOperatorType *ot)
static wmOperatorStatus grease_pencil_set_curve_type_exec(bContext *C, wmOperator *op)
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_set_stroke_type_exec(bContext *C, wmOperator *op)
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 void GREASE_PENCIL_OT_set_stroke_type(wmOperatorType *ot)
static float calculate_radius_projection_factor(const RegionView3D *rv3d, const float3 &old_pos, const float3 &new_pos)
static wmOperatorStatus grease_pencil_separate_fills_exec(bContext *C, wmOperator *op)
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)
static bool remove_stroke_or_fill_based_on_mode(Object &object, bke::greasepencil::Drawing &drawing, const int layer_index, const DeleteMode mode, 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_join_fills_exec(bContext *C, wmOperator *op)
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)
Vector< MutableDrawingInfo > retrieve_editable_drawings_from_layer(const Scene &scene, GreasePencil &grease_pencil, const bke::greasepencil::Layer &layer)
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 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 Array< int > get_gapless_indices(const IndexRange &universe, const IndexMask &selected)
static bool grease_pencil_separate_layer(bContext &C, Main &bmain, Scene &scene, ViewLayer &view_layer, Base &base_prev, Object &object_src)
static bool remove_curves_based_on_mode(Object &object, bke::greasepencil::Drawing &drawing, const int layer_index, const DeleteMode mode, IndexMaskMemory &memory)
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 Map< StringRefNull, StringRefNull > add_vertex_groups(Object &object, GreasePencil &grease_pencil, const ListBaseT< bDeformGroup > &vertex_group_names)
static void GREASE_PENCIL_OT_snap_to_grid(wmOperatorType *ot)
IndexMask retrieve_editable_and_all_selected_points(Object &object, const bke::greasepencil::Drawing &drawing, const int layer_index, const eHandleDisplay handle_display, IndexMaskMemory &memory)
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)
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)
Mutex grease_pencil_clipboard_lock
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 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)
eHandleDisplay view3d_handle_type_or_default(const View3D *v3d)
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)
static bke::CurvesGeometry subdivide_last_segment(const bke::CurvesGeometry &curves, const IndexMask &strokes)
static void GREASE_PENCIL_OT_join_fills(wmOperatorType *ot)
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)
constexpr ParallelGrainSize grain_size(int grain_size)
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 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 grease_pencil_remove_points_and_split(const bke::CurvesGeometry &curves, const IndexMask &mask)
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={})
BLI_INLINE Texture * wrap(MTLTexture *texture)
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))
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void BKE_object_defgroup_unique_name(bDeformGroup *dg, Object *ob)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
ScrArea * CTX_wm_area(const bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
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()
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void GREASE_PENCIL_OT_stroke_carver(wmOperatorType *ot)
int BKE_object_material_remove_unused(Main *bmain, Object *ob)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
short * BKE_object_material_len_p(Object *ob)
Material *** BKE_object_material_array_p(Object *ob)
wmOperatorStatus WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Material * BKE_object_material_get(Object *ob, short act)
void BKE_grease_pencil_copy_layer_group_parameters(const bke::greasepencil::LayerGroup &src, bke::greasepencil::LayerGroup &dst)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
MatBase< float, 2, 2 > float2x2
wmOperatorStatus WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event)
const EnumPropertyItem rna_enum_curves_type_items[]
const ListBaseT< bDeformGroup > * BKE_id_defgroup_list_get(const ID *id)
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_LOCAL_ORIGINS
@ V3D_AROUND_CENTER_MEDIAN
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 GREASE_PENCIL_OT_stroke_trim(wmOperatorType *ot)
int RNA_int_get(PointerRNA *ptr, const char *name)
void BKE_object_material_active_index_sanitize(Object *ob)
void ED_operatortypes_grease_pencil_edit()
MatBase< float, 4, 4 > float4x4
MatBase< float, 2, 4 > float2x4
Base * CTX_data_active_base(const bContext *C)
int BKE_object_material_ensure(Main *bmain, Object *ob, Material *material)
void BKE_grease_pencil_copy_layer_parameters(const bke::greasepencil::Layer &src, bke::greasepencil::Layer &dst)
int BKE_defgroup_name_index(const ListBaseT< bDeformGroup > *defbase, StringRef name)
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
ViewLayer * CTX_data_view_layer(const bContext *C)
@ NURBS_KNOT_MODE_ENDPOINT
VecBase< float, 4 > float4
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
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)
Material * BKE_grease_pencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
VecBase< float, 2 > float2
bool BKE_object_material_slot_used(Object *object, short actcol)
wmOperatorStatus ED_grease_pencil_join_objects_exec(bContext *C, wmOperator *op)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
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])
wmWindowManager * CTX_wm_manager(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
MatBase< float, 4, 2 > float4x2
bke::AttrDomain ED_grease_pencil_edit_selection_domain_get(const ToolSettings *tool_settings)
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
bDeformGroup * BKE_defgroup_duplicate(const bDeformGroup *ingroup)
void WM_menu_name_call(bContext *C, const char *menu_name, wm::OpCallContext context)
float ED_view3d_grid_view_scale(const Scene *scene, const View3D *v3d, const ARegion *region, const char **r_grid_unit)
MatBase< float, 3, 2 > float3x2
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
int BKE_object_material_index_get(Object *ob, const Material *ma)
MatBase< float, 4, 3 > float4x3
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void BKE_object_material_array_assign(Main *bmain, Object *ob, Material ***matar, int totcol, bool to_object_only)
void BKE_fcurves_main_cb(struct Main *bmain, FunctionRef< void(ID *, FCurve *)> func)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
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)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
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)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
T * DEG_get_original(T *id)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
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)
@ ID_RECALC_ANIMATION_NO_FLUSH
AnimData * BKE_animdata_copy(Main *bmain, AnimData *adt, int flag)
void BKE_defgroup_copy_list(ListBaseT< bDeformGroup > *outbase, const ListBaseT< bDeformGroup > *inbase)
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)
void DEG_relations_tag_update(Main *bmain)
Scene * CTX_data_scene(const bContext *C)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
ListBaseT< bDeformGroup > * BKE_id_defgroup_list_get_mutable(ID *id)
VecBase< float, 3 > float3
@ GP_MATERIAL_GRADIENT_RADIAL
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
@ GP_STROKE_CAP_TYPE_FLAT
@ GP_STROKE_CAP_TYPE_ROUND
void WM_cursor_wait(bool val)
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)
Object * CTX_data_active_object(const bContext *C)
float DEG_get_ctime(const Depsgraph *graph)
ARegion * CTX_wm_region(const bContext *C)
char * BKE_animsys_fix_rna_path_rename(ID *owner_id, const char *old_path, StringRef prefix, StringRefNull old_name, StringRefNull newName)
void BKE_animdata_merge_copy(Main *bmain, ID *dst_id, ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
View3D * CTX_wm_view3d(const bContext *C)
void WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< DriverVar > variables
ListBaseT< struct bDeformGroup > vertex_group_names
GreasePencilDrawingType type
GreasePencilLayerTreeNode base
ListBaseT< GreasePencilLayerTreeNode > children
GreasePencilLayerTreeNodeType type
ListBaseT< Material > materials
static MatBase identity()
eMaterialGPencilStyle_GradientType gradient_type
struct ToolSettings * toolsettings
static ArrayData from_uninitialized(const CPPType &type, int64_t domain_size)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Curves * get_curves_for_write()
static GeometrySet from_instances(std::unique_ptr< Instances > instances)
const Curves * get_curves() const
MutableVArraySpan< T > span
bke::CurvesGeometry curves
ListBaseT< bDeformGroup > defnames
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_decorate)
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
void(*) ui(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type