79#include "RNA_prototypes.hh"
111 grease_pencil->
root_group_ptr = MEM_new<greasepencil::LayerGroup>(__func__);
112 grease_pencil->set_active_node(
nullptr);
117 grease_pencil->
runtime = MEM_new<GreasePencilRuntime>(__func__);
132 "RNA struct GreasePencilLayer is expected to have a 'hide' property.");
136 "RNA struct GreasePencilLayerGroup is expected to have a 'hide' property.");
140 &id_dst, &RNA_GreasePencilLayerGroup, layer_group);
145 "It should be possible to construct the RNA path of a grease pencil layer group.");
148 grease_pencil.
adt, rna_path->c_str(), 0);
153 if (parent.runtime->is_visibility_animated_) {
158 return parent_group_visibility_animated(*parent_group);
164 if (parent_group_visibility_animated(layer->parent_group())) {
165 layer->runtime->is_visibility_animated_ =
true;
172 "It should be possible to construct the RNA path of a grease pencil layer.");
174 grease_pencil.
adt, rna_path.value(), 0);
182 const Array<int> user_counts = grease_pencil.count_frame_users_for_drawings();
183 BLI_assert(user_counts.
size() == grease_pencil.drawings().size());
184 for (
const int drawing_i : grease_pencil.drawings().index_range()) {
188 drawing.
runtime->user_count.store(user_counts[drawing_i]);
194 std::optional<Library *> ,
211 grease_pencil_dst->
root_group_ptr = MEM_new<bke::greasepencil::LayerGroup>(
212 __func__, grease_pencil_src->root_group());
215 if (grease_pencil_src->get_active_node()) {
217 grease_pencil_src->get_active_node()->name());
219 grease_pencil_dst->set_active_node(active_node);
229 grease_pencil_dst->
runtime = MEM_new<bke::GreasePencilRuntime>(__func__);
231 if (grease_pencil_src->
runtime->bake_materials) {
232 grease_pencil_dst->
runtime->bake_materials = std::make_unique<bke::bake::BakeMaterialsList>(
233 *grease_pencil_src->
runtime->bake_materials);
249 MEM_delete(&grease_pencil->root_group());
255 MEM_delete(grease_pencil->
runtime);
256 grease_pencil->
runtime =
nullptr;
288 fn.single(node->color);
351 grease_pencil->
runtime = MEM_new<blender::bke::GreasePencilRuntime>(__func__);
355 GreasePencil::id_type,
361 N_(
"grease_pencils"),
398 this->
runtime = MEM_new<bke::greasepencil::DrawingRuntime>(__func__);
408 this->
runtime = MEM_new<bke::greasepencil::DrawingRuntime>(__func__);
410 this->
runtime->triangle_offsets_cache = other.
runtime->triangle_offsets_cache;
412 this->
runtime->curve_plane_normals_cache = other.
runtime->curve_plane_normals_cache;
413 this->
runtime->curve_texture_matrices = other.
runtime->curve_texture_matrices;
420 this->
base.flag = other.base.flag;
426 other.runtime =
nullptr;
431 if (
this == &other) {
434 std::destroy_at(
this);
441 if (
this == &other) {
444 std::destroy_at(
this);
445 new (
this)
Drawing(std::move(other));
464 for (
const int curve_i : points_by_curve.
index_range()) {
465 const IndexRange points = points_by_curve[curve_i];
466 r_offsets[curve_i] = offset;
467 offset += std::max(
int(points.
size() - 2), 0);
469 r_offsets.
last() = offset;
471 return this->
runtime->triangle_offsets_cache.
data().as_span();
481 struct LocalMemArena {
487 if (pf_arena !=
nullptr) {
495 for (
const int curve_i : mask_segment) {
496 const IndexRange points = points_by_curve[curve_i];
497 if (points.
size() < 3) {
502 float (*projverts)[2] =
static_cast<float (*)[2]
>(
513 projverts, points.
size(), 0,
reinterpret_cast<uint32_t (*)[3]
>(r_tris.
data()), pf_arena);
524 const int total_triangles = triangle_offsets.total_size();
525 r_data.
resize(total_triangles);
528 this->curve_plane_normals(),
529 curves.evaluated_points_by_curve(),
535 return this->
runtime->triangles_cache.data().as_span();
544 const IndexRange points = points_by_curve[curve_i];
545 if (points.
size() < 2) {
553 for (
const int point_i : points) {
554 const float3 curr_point = positions[point_i];
556 prev_point = curr_point;
563 for (
const int point_i : points.
drop_back(1)) {
564 float3 segment_vec = positions[point_i] - positions[point_i + 1];
586 return this->
runtime->curve_plane_normals_cache.data().as_span();
597 if (positions.
size() <= 2) {
601 const float3 point_0 = positions[0];
602 const float3 point_1 = positions[1];
625 const float2 uv_translation,
631 const float s =
sin(uv_rotation);
632 const float c =
cos(uv_rotation);
652 texture_matrix =
rot * texture_matrix;
655 texture_matrix[2] += uv_translation;
657 return texture_matrix;
674 strokemat4x3[2][2] = 0.0f;
675 strokemat4x3[3][2] = 1.0f;
699 for (const int curve_i : range) {
700 const IndexRange points = points_by_curve[curve_i];
701 const float3 normal = normals[curve_i];
702 const float4x2 strokemat = get_local_to_stroke_matrix(positions.slice(points), normal);
703 const float3x2 texture_matrix = get_stroke_to_texture_matrix(
704 uv_rotations[curve_i], uv_translations[curve_i], uv_scales[curve_i]);
706 const float4x2 texspace = texture_matrix * expand_4x2_mat(strokemat);
708 r_data[curve_i] = texspace;
712 return this->runtime->curve_texture_matrices.data().as_span();
728 if (!uv_rotations || !uv_translations || !uv_scales) {
738 const IndexRange points = points_by_curve[curve_i];
765 const double3x4 right_inverse = transpose_strokemat *
771 const float2 uv_translation = texture_matrix[2];
774 const float uv_rotation =
math::atan2(texture_matrix[0][1], texture_matrix[0][0]);
784 uv_rotations.
span[curve_i] = uv_rotation;
785 uv_translations.span[curve_i] = uv_translation;
786 uv_scales.span[curve_i] = uv_scale;
789 uv_translations.finish();
807 return *this->
strokes().attributes().lookup_or_default<
float>(
817 this->strokes().points_num(),
823 return *this->
strokes().attributes().lookup_or_default<
float>(
833 this->strokes().points_num(),
849 this->strokes().points_num(),
865 this->strokes().curves_num(),
871 this->
runtime->curve_texture_matrices.tag_dirty();
877 this->
runtime->curve_plane_normals_cache.tag_dirty();
878 this->
runtime->triangles_cache.tag_dirty();
892 if (changed_curves.
size() > this->strokes().curves_num() / 2) {
896 if (!this->
runtime->triangles_cache.is_cached() ||
897 !this->runtime->curve_plane_normals_cache.is_cached())
913 this->curve_plane_normals(),
914 curves.evaluated_points_by_curve(),
915 this->triangle_offsets(),
924 this->
runtime->triangle_offsets_cache.tag_dirty();
939 if (changed_curves.
size() > this->strokes().curves_num() / 2) {
943 if (!this->
runtime->triangles_cache.is_cached() ||
944 !this->runtime->curve_plane_normals_cache.is_cached())
959 const Array<int> src_triangle_offset_data(this->triangle_offsets().
data());
963 this->
runtime->triangle_offsets_cache.tag_dirty();
975 dst_triangle_offsets,
981 this->curve_plane_normals(),
982 curves.evaluated_points_by_curve(),
983 dst_triangle_offsets,
1014 switch (src_drawing_base->
type) {
1019 MEM_new<bke::greasepencil::Drawing>(__func__, src_drawing->wrap()));
1026 MEM_new<bke::greasepencil::DrawingReference>(__func__, src_drawing_reference->wrap()));
1074 return *
reinterpret_cast<const LayerGroup *
>(
this);
1079 return *
reinterpret_cast<const Layer *
>(
this);
1084 return *
reinterpret_cast<LayerGroup *
>(
this);
1089 return *
reinterpret_cast<Layer *
>(
this);
1094 return (this->
parent) ? &this->
parent->wrap() :
nullptr;
1098 return (this->
parent) ? &this->
parent->wrap() :
nullptr;
1112 if (parent ==
nullptr) {
1116 return 1 +
parent->as_node().depth();
1147 masks_.clear_and_shrink();
1176 this->
runtime = MEM_new<LayerRuntime>(__func__);
1189 LayerMask *new_mask = MEM_new<LayerMask>(__func__, *
reinterpret_cast<LayerMask *
>(other_mask));
1209 this->
runtime->sorted_keys_cache_ = other.
runtime->sorted_keys_cache_;
1218 this->
base.wrap().~TreeNode();
1237 return this->
runtime->frames_;
1242 return this->
runtime->frames_;
1249 while (next_it != end && this->
frames().lookup(*next_it).is_end()) {
1252 next_it = std::next(next_it);
1259 if (!this->
frames().contains(frame_number)) {
1279 if (frame ==
nullptr) {
1287 if (next_key_it !=
sorted_keys.end() && *next_key_it == end_key) {
1290 next_key_it = this->remove_leading_end_frames_in_range(next_key_it,
sorted_keys.end());
1292 if (duration == 0) {
1298 if (next_key_it ==
sorted_keys.end() || *next_key_it > end_key) {
1308 if (!this->
frames().contains(key)) {
1320 if (std::next(remove_key_it) !=
sorted_keys.end()) {
1322 this->remove_leading_end_frames_in_range(next_key_it,
sorted_keys.end());
1330 if (!prev_frame.is_implicit_hold() && !prev_frame.is_end()) {
1352 std::sort(r_data.
begin(), r_data.
end());
1354 return this->
runtime->sorted_keys_cache_.data();
1377 return std::prev(it);
1380std::optional<FramesMapKeyT> Layer::frame_key_at(
const int frame_number)
const
1383 if (it ==
nullptr) {
1391 const std::optional<FramesMapKeyT> frame_key = this->frame_key_at(frame_number);
1393 if (frame_key && !this->
frames().lookup_ptr(*frame_key)->is_end()) {
1402 if (it ==
nullptr) {
1415 const std::optional<FramesMapKeyT> frame_key = this->frame_key_at(frame_number);
1421 if (frame_ptr ==
nullptr || frame_ptr->is_end()) {
1435 const std::optional<FramesMapKeyT> frame_key = this->frame_key_at(frame_number);
1441 if (frame_ptr ==
nullptr || frame_ptr->is_end()) {
1456 return frame_at(frame_number) !=
nullptr;
1462 if (it ==
nullptr) {
1468 if (frame->is_implicit_hold()) {
1472 if (frame->is_end()) {
1476 const int next_frame_number = *(std::next(it));
1488 this->
runtime->sorted_keys_cache_.tag_dirty();
1501 const size_t frames_num = size_t(
frames().
size());
1524 runtime = MEM_new<blender::bke::greasepencil::LayerRuntime>(__func__);
1534 if (this->
parent ==
nullptr) {
1543 if (this->
parent ==
nullptr) {
1569 const float4x4 &parent_object_to_world =
parent.object_to_world();
1572 this->parent_bone_name().c_str()))
1574 return parent_object_to_world *
float4x4_view(channel->pose_mat);
1577 return parent_object_to_world;
1622 this->
runtime = MEM_new<LayerGroupRuntime>(__func__);
1635 switch (child->type) {
1638 Layer *dup_layer = MEM_new<Layer>(__func__, layer->wrap());
1644 LayerGroup *dup_group = MEM_new<LayerGroup>(__func__, group->wrap());
1656 this->
base.wrap().~TreeNode();
1659 switch (child->type) {
1662 MEM_delete(&layer->wrap());
1667 MEM_delete(&group->wrap());
1679 if (
this == &other) {
1698 this->tag_nodes_cache_dirty();
1706 this->tag_nodes_cache_dirty();
1713 this->tag_nodes_cache_dirty();
1719 this->tag_nodes_cache_dirty();
1724 this->tag_nodes_cache_dirty();
1730 this->tag_nodes_cache_dirty();
1736 this->tag_nodes_cache_dirty();
1746 this->ensure_nodes_cache();
1747 return this->
runtime->nodes_cache_.size();
1761 link_children.
first);
1770 if (link.
next !=
nullptr) {
1774 if (link.
prev !=
nullptr) {
1780 if (this->
children.last == &link) {
1783 if (this->
children.first == &link) {
1791 this->tag_nodes_cache_dirty();
1796 this->tag_nodes_cache_dirty();
1804 this->ensure_nodes_cache();
1805 return this->
runtime->nodes_cache_.as_span();
1810 this->ensure_nodes_cache();
1811 return this->
runtime->nodes_cache_.as_span();
1816 this->ensure_nodes_cache();
1817 return this->
runtime->layer_cache_.as_span();
1822 this->ensure_nodes_cache();
1823 return this->
runtime->layer_cache_.as_span();
1828 this->ensure_nodes_cache();
1829 return this->
runtime->layer_group_cache_.as_span();
1834 this->ensure_nodes_cache();
1835 return this->
runtime->layer_group_cache_.as_span();
1841 if (node->name() ==
name) {
1851 if (node->name() ==
name) {
1870 std::cout << header << std::endl;
1874 next_node.
push(std::make_pair(1, child));
1877 auto [indent, node] = next_node.
pop();
1878 for (
int i = 0;
i < indent;
i++) {
1881 if (node->is_layer()) {
1882 std::cout << node->name();
1884 else if (node->is_group()) {
1885 std::cout << node->name() <<
": ";
1888 next_node.
push(std::make_pair(indent + 1, child));
1891 std::cout << std::endl;
1893 std::cout << std::endl;
1896void LayerGroup::ensure_nodes_cache()
const
1898 this->
runtime->nodes_cache_mutex_.ensure([&]() {
1899 this->
runtime->nodes_cache_.clear_and_shrink();
1900 this->
runtime->layer_cache_.clear_and_shrink();
1901 this->
runtime->layer_group_cache_.clear_and_shrink();
1905 this->
runtime->nodes_cache_.append(node);
1906 switch (node->
type) {
1914 this->
runtime->nodes_cache_.append(child);
1915 if (child->is_layer()) {
1916 this->
runtime->layer_cache_.append(&child->as_layer());
1918 else if (child->is_group()) {
1919 this->
runtime->layer_group_cache_.append(&child->as_group());
1929void LayerGroup::tag_nodes_cache_dirty()
const
1931 this->
runtime->nodes_cache_mutex_.tag_dirty();
1932 if (this->
base.parent) {
1933 this->
base.parent->wrap().tag_nodes_cache_dirty();
1940 switch (child->type) {
1942 child->as_layer().prepare_for_dna_write();
1946 child->as_group().prepare_for_dna_write();
1956 switch (child->type) {
1958 child->as_layer().update_from_dna_read();
1962 child->as_group().update_from_dna_read();
1972 if (layer->name().is_empty()) {
1973 grease_pencil.rename_node(bmain, layer->as_node(),
DATA_(
"Layer"));
1988 return std::nullopt;
1990 const int points_num = this->
drawing_orig->geometry.wrap().points_num();
1997 return std::nullopt;
2000 const int points_num = this->
drawing_orig->geometry.wrap().points_num();
2002 if (
data.sharing_info->is_mutable()) {
2004 data.sharing_info->tag_ensured_mutable();
2009 data.data = new_sharing_info->data.data();
2031 return grease_pencil;
2037 return grease_pencil;
2044 grease_pencil->
runtime->eval_frame = grease_pencil_src->
runtime->eval_frame;
2045 return grease_pencil;
2070 LayerMask *new_mask = MEM_new<LayerMask>(__func__, *
reinterpret_cast<LayerMask *
>(src_mask));
2110 grease_pencil_dst->
drawing_array[
i] = &MEM_new<Drawing>(__func__, src_drawing)->base;
2118 &MEM_new<DrawingReference>(__func__, src_drawing_ref)->base;
2125 MEM_delete(&grease_pencil_dst->root_group());
2128 grease_pencil_dst->
root_group_ptr = MEM_new<bke::greasepencil::LayerGroup>(
2130 BLI_assert(grease_pencil_src->layers().size() == grease_pencil_dst->layers().size());
2151 if (
STREQ(vgroup->name, old_name)) {
2184 for (; tmd; tmd = tmd->
next) {
2201 for (; md; md = md->
next) {
2225 struct LayerDrawingInfo {
2227 const int layer_index;
2232 for (
const int layer_i : grease_pencil.layers().index_range()) {
2233 const Layer &layer = grease_pencil.layer(layer_i);
2235 if (
Drawing *drawing = grease_pencil.get_eval_drawing(layer)) {
2236 if (all_drawings.
add(drawing)) {
2237 drawing_infos.
append({drawing, layer_i});
2242 if (layer_attributes.
contains(
"radius_offset")) {
2246 if (radius_offsets[info.layer_index] == 0.0f) {
2251 for (const int i : range) {
2252 radii[i] += radius_offsets[info.layer_index];
2258 if (layer_attributes.contains(
"tint_color")) {
2260 return base * (1.0 - tint.w) + tint * tint.
w;
2266 if (tint_colors[info.layer_index].a == 0.0f) {
2271 for (const int i : range) {
2272 vertex_colors[i] = ColorGeometry4f(
2273 mix_tint(float4(vertex_colors[i]), float4(tint_colors[info.layer_index])));
2278 for (const int i : range) {
2279 fill_colors[i] = ColorGeometry4f(
2280 mix_tint(float4(fill_colors[i]), float4(tint_colors[info.layer_index])));
2297 Layer *layer = layers[layer_i];
2299 layer->
runtime->orig_layer_index_ = layer_i;
2303 if (layer->is_visible() || layer->
runtime->is_visibility_animated_) {
2308 grease_pencil.remove_layer(*layer);
2335 if (layer_attributes.
contains(
"tint_color") || layer_attributes.
contains(
"radius_offset")) {
2370 object->runtime->geometry_set_eval =
new GeometrySet(std::move(geometry_set));
2382 grease_pencil_dst->drawings());
2404 if (
curves.has_curve_with_type(type)) {
2416 int total_points = 0;
2418 for (
const int layer_i : grease_pencil.layers().index_range()) {
2430 total_points +=
curves.points_num();
2434 return total_points;
2443 for (
const int layer_i : grease_pencil.layers().index_range()) {
2460 for (
const int i :
curves.points_range()) {
2462 all_radii[index] = radii[
i];
2467 const std::optional<Span<float3>> handle_positions_left =
curves.handle_positions_left();
2468 const std::optional<Span<float3>> handle_positions_right =
curves.handle_positions_right();
2469 for (
const int i :
curves.points_range()) {
2470 const int index_pos = index * 3;
2472 (*handle_positions_left)[
i]);
2475 (*handle_positions_right)[
i]);
2476 all_radii[index] = radii[
i];
2490 for (
const int layer_i : grease_pencil.layers().index_range()) {
2507 for (
const int i :
curves.points_range()) {
2509 radii[
i] = all_radii[index];
2516 for (
const int i :
curves.points_range()) {
2517 const int index_pos = index * 3;
2519 all_positions[index_pos]);
2522 all_positions[index_pos + 2]);
2523 radii[
i] = all_radii[index];
2528 curves.tag_radii_changed();
2542 for (
const int layer_i : grease_pencil.layers().index_range()) {
2559 for (
const int i :
curves.points_range()) {
2561 radii[
i] = all_radii[index] * scalef;
2568 for (
const int i :
curves.points_range()) {
2569 const int index_pos = index * 3;
2571 all_positions[index_pos]);
2573 all_positions[index_pos + 1]);
2575 all_positions[index_pos + 2]);
2576 radii[
i] = all_radii[index] * scalef;
2581 curves.tag_radii_changed();
2597 for (
short i = 0;
i < *totcol;
i++) {
2619 *r_index = ob->
actcol - 1;
2629 return brush->gpencil_settings->material;
2652 Material *ma = (
brush->gpencil_settings) ?
brush->gpencil_settings->material :
nullptr;
2663 const bool change_active_material =
false;
2703 Material *material_alt = (
brush->gpencil_settings) ?
brush->gpencil_settings->material_alt :
2706 material_alt =
reinterpret_cast<Material *
>(
2709 return material_alt;
2728 if (!material_indices) {
2732 for (
const int i : material_indices.
span.index_range()) {
2735 material_indices.
span[
i] = remap[material_indices.
span[
i]];
2737 material_indices.
finish();
2754 if (!material_indices) {
2758 for (
const int i : material_indices.
span.index_range()) {
2759 if (material_indices.
span[
i] > 0 && material_indices.
span[
i] >= index) {
2760 material_indices.
span[
i]--;
2763 material_indices.
finish();
2781 if (material_indices.
contains(index)) {
2800 if (id_reference == reference->id_reference) {
2825 int mode) =
nullptr;
2830 if (grease_pencil->
runtime && grease_pencil->
runtime->batch_cache) {
2837 if (grease_pencil->
runtime && grease_pencil->
runtime->batch_cache) {
2851 const int new_array_num = *
num + add_num;
2855 if (*
array !=
nullptr) {
2860 *
num = new_array_num;
2865 const int new_array_num = *
num - shrink_num;
2866 if (new_array_num == 0) {
2879 *
num = new_array_num;
2882blender::Span<const GreasePencilDrawingBase *> GreasePencil::drawings()
const
2884 return blender::Span<GreasePencilDrawingBase *>{this->drawing_array, this->drawing_array_num};
2887blender::MutableSpan<GreasePencilDrawingBase *> GreasePencil::drawings()
2889 return blender::MutableSpan<GreasePencilDrawingBase *>{this->drawing_array,
2890 this->drawing_array_num};
2898 MEM_delete(&drawing->wrap());
2904 MEM_delete(&drawing_reference->wrap());
2910void GreasePencil::resize_drawings(
const int new_num)
2912 using namespace blender;
2915 const int prev_num = int(this->drawings().
size());
2916 if (new_num == prev_num) {
2919 if (new_num > prev_num) {
2920 const int add_num = new_num - prev_num;
2924 const int shrink_num = prev_num - new_num;
2932 &this->drawing_array, &this->drawing_array_num, shrink_num);
2936void GreasePencil::add_empty_drawings(
const int add_num)
2938 using namespace blender;
2940 const int prev_num = this->drawings().size();
2945 MEM_new<blender::bke::greasepencil::Drawing>(__func__));
2949void GreasePencil::add_duplicate_drawings(
const int duplicate_num,
2950 const blender::bke::greasepencil::Drawing &drawing)
2952 using namespace blender;
2954 const int prev_num = this->drawings().size();
2956 &this->drawing_array, &this->drawing_array_num, duplicate_num);
2960 MEM_new<bke::greasepencil::Drawing>(__func__, drawing));
2964blender::bke::greasepencil::Drawing *GreasePencil::insert_frame(
2965 blender::bke::greasepencil::Layer &layer,
2966 const int frame_number,
2970 using namespace blender;
2972 if (frame ==
nullptr) {
2975 this->add_empty_drawings(1);
2976 frame->
drawing_index = this->drawings().index_range().last();
2982 return &drawing->wrap();
2986 const int frame_number,
2990 using namespace blender;
2999 if (frame !=
nullptr) {
3008 this->add_empty_drawings(frames.
size());
3017bool GreasePencil::insert_duplicate_frame(blender::bke::greasepencil::Layer &layer,
3018 const int src_frame_number,
3019 const int dst_frame_number,
3020 const bool do_instance)
3022 using namespace blender::bke::greasepencil;
3028 if (layer.is_locked()) {
3039 if (dst_frame ==
nullptr) {
3046 switch (src_drawing_base->
type) {
3059 this->add_duplicate_drawings(1, src_drawing);
3070 this->validate_drawing_user_counts();
3075bool GreasePencil::remove_frames(blender::bke::greasepencil::Layer &layer,
3076 blender::Span<int> frame_numbers)
3078 using namespace blender::bke::greasepencil;
3079 bool removed_any_drawing_user =
false;
3080 for (
const int frame_number : frame_numbers) {
3090 if (frame_to_remove.is_end()) {
3102 removed_any_drawing_user =
true;
3104 if (removed_any_drawing_user) {
3105 this->remove_drawings_with_no_users();
3110 this->validate_drawing_user_counts();
3116void GreasePencil::copy_frames_from_layer(blender::bke::greasepencil::Layer &dst_layer,
3118 const blender::bke::greasepencil::Layer &src_layer,
3119 const std::optional<int> frame_select)
3121 using namespace blender;
3126 for (
auto [frame_number, src_frame] : src_layer.
frames().
items()) {
3127 if (frame_select && *frame_select != frame_number) {
3132 int dst_drawing_index = drawing_index_map[src_drawing_index];
3133 if (dst_drawing_index < 0) {
3134 switch (src_drawings[src_drawing_index]->type) {
3139 this->add_duplicate_drawings(1, src_drawing);
3144 this->add_empty_drawings(1);
3147 dst_drawing_index = this->drawings().size() - 1;
3148 drawing_index_map[src_drawing_index] = dst_drawing_index;
3158void GreasePencil::add_layers_with_empty_drawings_for_eval(
const int num)
3160 using namespace blender;
3161 using namespace blender::bke::greasepencil;
3162 const int old_drawings_num = this->drawing_array_num;
3163 const int old_layers_num = this->layers().size();
3164 this->add_empty_drawings(
num);
3165 this->add_layers_for_eval(
num);
3167 for (
const int i : range) {
3168 const int new_drawing_i = old_drawings_num +
i;
3169 const int new_layer_i = old_layers_num +
i;
3170 Layer &layer = this->layer(new_layer_i);
3178void GreasePencil::remove_drawings_with_no_users()
3180 using namespace blender;
3181 using namespace blender::bke::greasepencil;
3196 auto is_drawing_used = [&](
const int drawing_index) {
3204 return drawing->wrap().has_users() || drawing->
runtime->fake_user;
3209 constexpr const int unchanged_index = -1;
3212 int first_unused_drawing = -1;
3213 int last_used_drawing = drawings.
size() - 1;
3216 auto find_next_swap_index = [&]() ->
bool {
3218 ++first_unused_drawing;
3219 }
while (first_unused_drawing <= last_used_drawing && is_drawing_used(first_unused_drawing));
3220 while (last_used_drawing >= 0 && !is_drawing_used(last_used_drawing)) {
3221 --last_used_drawing;
3224 return first_unused_drawing < last_used_drawing;
3227 while (find_next_swap_index()) {
3229 std::swap(drawings[first_unused_drawing], drawings[last_used_drawing]);
3230 drawing_index_map[last_used_drawing] = first_unused_drawing;
3236 BLI_assert(last_used_drawing == first_unused_drawing - 1);
3239 if (
i < first_unused_drawing) {
3249 const IndexRange drawings_to_remove = (first_unused_drawing > 0) ?
3251 first_unused_drawing) :
3253 if (drawings_to_remove.
is_empty()) {
3258 for (
const int i : drawings_to_remove) {
3260 switch (unused_drawing_base->
type) {
3263 MEM_delete(&unused_drawing->wrap());
3268 unused_drawing_base);
3269 MEM_delete(&unused_drawing_ref->wrap());
3275 &this->drawing_array, &this->drawing_array_num, drawings_to_remove.size());
3278 for (
Layer *layer : this->layers_for_write()) {
3280 const int new_drawing_index = drawing_index_map[value.drawing_index];
3281 if (new_drawing_index != unchanged_index) {
3282 value.drawing_index = new_drawing_index;
3289 this->validate_drawing_user_counts();
3293void GreasePencil::update_drawing_users_for_layer(
const blender::bke::greasepencil::Layer &layer)
3295 using namespace blender;
3296 for (
const auto &[key, value] : layer.
frames().
items()) {
3310 this->validate_drawing_user_counts();
3314void GreasePencil::move_frames(blender::bke::greasepencil::Layer &layer,
3315 const blender::Map<int, int> &frame_number_destinations)
3317 this->move_duplicate_frames(
3318 layer, frame_number_destinations, blender::Map<int, GreasePencilFrame>());
3321void GreasePencil::move_duplicate_frames(
3322 blender::bke::greasepencil::Layer &layer,
3323 const blender::Map<int, int> &frame_number_destinations,
3324 const blender::Map<int, GreasePencilFrame> &duplicate_frames)
3326 using namespace blender;
3331 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
3338 for (
const auto src_frame_number : frame_number_destinations.
keys()) {
3339 if (!duplicate_frames.
contains(src_frame_number)) {
3345 auto get_source_frame = [&](
const int frame_number) ->
const GreasePencilFrame * {
3349 return layer_frames_copy.
lookup_ptr(frame_number);
3352 for (
const auto [src_frame_number, dst_frame_number] : frame_number_destinations.
items()) {
3357 const int duration = src_layer_frames_durations.
lookup_default(src_frame_number, 0);
3369 *frame = *src_frame;
3373 this->remove_drawings_with_no_users();
3376const blender::bke::greasepencil::Drawing *GreasePencil::get_drawing_at(
3377 const blender::bke::greasepencil::Layer &layer,
const int frame_number)
const
3379 if (this->drawings().is_empty()) {
3383 if (drawing_index == -1) {
3393 return &drawing->wrap();
3396blender::bke::greasepencil::Drawing *GreasePencil::get_drawing_at(
3397 const blender::bke::greasepencil::Layer &layer,
const int frame_number)
3399 if (this->drawings().is_empty()) {
3403 if (drawing_index == -1) {
3413 return &drawing->wrap();
3416blender::bke::greasepencil::Drawing *GreasePencil::get_editable_drawing_at(
3417 const blender::bke::greasepencil::Layer &layer,
const int frame_number)
3419 if (!layer.is_editable()) {
3422 if (this->drawings().is_empty()) {
3426 if (drawing_index == -1) {
3436 return &drawing->wrap();
3439const blender::bke::greasepencil::Drawing *GreasePencil::get_eval_drawing(
3440 const blender::bke::greasepencil::Layer &layer)
const
3442 return this->get_drawing_at(layer, this->runtime->eval_frame);
3445blender::bke::greasepencil::Drawing *GreasePencil::get_eval_drawing(
3446 const blender::bke::greasepencil::Layer &layer)
3448 return this->get_drawing_at(layer, this->runtime->eval_frame);
3451std::optional<blender::Bounds<blender::float3>> GreasePencil::bounds_min_max(
3452 const int frame,
const bool use_radius)
const
3454 using namespace blender;
3455 std::optional<Bounds<float3>>
bounds;
3460 if (!layer.is_visible()) {
3483 if (
const std::optional radius_single = radius.
get_if_single()) {
3485 drawing_bounds.
pad(*radius_single);
3500 radii_eval.as_span());
3506std::optional<blender::Bounds<blender::float3>> GreasePencil::bounds_min_max_eval(
3507 const bool use_radius)
const
3509 return this->bounds_min_max(this->runtime->eval_frame, use_radius);
3512void GreasePencil::count_memory(blender::MemoryCounter &memory)
const
3514 using namespace blender::bke;
3519 const greasepencil::Drawing &drawing =
3525std::optional<int> GreasePencil::material_index_max_eval()
const
3527 using namespace blender;
3528 using namespace blender::bke;
3529 std::optional<int> max_index;
3530 for (
const greasepencil::Layer *layer : this->layers()) {
3531 if (
const greasepencil::Drawing *drawing = this->get_eval_drawing(*layer)) {
3535 if (max_index_on_layer) {
3536 max_index = std::max(*max_index, *max_index_on_layer);
3540 max_index = max_index_on_layer;
3547blender::Span<const blender::bke::greasepencil::Layer *> GreasePencil::layers()
const
3550 return this->root_group().layers();
3553blender::Span<blender::bke::greasepencil::Layer *> GreasePencil::layers_for_write()
3556 return this->root_group().layers_for_write();
3559blender::Span<const blender::bke::greasepencil::LayerGroup *> GreasePencil::layer_groups()
const
3562 return this->root_group().groups();
3565blender::Span<blender::bke::greasepencil::LayerGroup *> GreasePencil::layer_groups_for_write()
3568 return this->root_group().groups_for_write();
3571blender::Span<const blender::bke::greasepencil::TreeNode *> GreasePencil::nodes()
const
3574 return this->root_group().nodes();
3577blender::Span<blender::bke::greasepencil::TreeNode *> GreasePencil::nodes_for_write()
3580 return this->root_group().nodes_for_write();
3583std::optional<int> GreasePencil::get_layer_index(
3584 const blender::bke::greasepencil::Layer &layer)
const
3586 const int index = int(this->layers().first_index_try(&layer));
3593const blender::bke::greasepencil::Layer *GreasePencil::get_active_layer()
const
3595 if (this->active_node ==
nullptr) {
3598 const blender::bke::greasepencil::TreeNode &active_node = *this->get_active_node();
3605blender::bke::greasepencil::Layer *GreasePencil::get_active_layer()
3607 if (this->active_node ==
nullptr) {
3610 blender::bke::greasepencil::TreeNode &active_node = *this->get_active_node();
3617void GreasePencil::set_active_layer(blender::bke::greasepencil::Layer *layer)
3622 this->autolock_inactive_layers();
3626bool GreasePencil::is_layer_active(
const blender::bke::greasepencil::Layer *layer)
const
3628 if (layer ==
nullptr) {
3631 return this->get_active_layer() == layer;
3634void GreasePencil::autolock_inactive_layers()
3636 using namespace blender::bke::greasepencil;
3638 for (
Layer *layer : this->layers_for_write()) {
3639 if (this->is_layer_active(layer)) {
3640 layer->set_locked(
false);
3643 layer->set_locked(
true);
3647const blender::bke::greasepencil::LayerGroup *GreasePencil::get_active_group()
const
3649 if (this->active_node ==
nullptr) {
3652 const blender::bke::greasepencil::TreeNode &active_node = *this->get_active_node();
3659blender::bke::greasepencil::LayerGroup *GreasePencil::get_active_group()
3661 if (this->active_node ==
nullptr) {
3664 blender::bke::greasepencil::TreeNode &active_node = *this->get_active_node();
3671const blender::bke::greasepencil::TreeNode *GreasePencil::get_active_node()
const
3673 if (this->active_node ==
nullptr) {
3676 return &this->active_node->wrap();
3679blender::bke::greasepencil::TreeNode *GreasePencil::get_active_node()
3681 if (this->active_node ==
nullptr) {
3684 return &this->active_node->wrap();
3687void GreasePencil::set_active_node(blender::bke::greasepencil::TreeNode *node)
3712std::string GreasePencil::unique_layer_name(blender::StringRef
name)
3714 if (
name.is_empty()) {
3724 if (
name.is_empty()) {
3731blender::bke::greasepencil::Layer &GreasePencil::add_layer(
const blender::StringRef
name,
3732 const bool check_name_is_unique)
3734 using namespace blender;
3735 std::string
unique_name = check_name_is_unique ? unique_layer_name(
name) : std::string(
name);
3736 const int numLayers = layers().
size();
3755blender::bke::greasepencil::Layer &GreasePencil::add_layer(
3756 blender::bke::greasepencil::LayerGroup &parent_group,
3757 const blender::StringRef
name,
3758 const bool check_name_is_unique)
3760 using namespace blender;
3761 blender::bke::greasepencil::Layer &new_layer = this->add_layer(
name, check_name_is_unique);
3762 move_node_into(new_layer.
as_node(), parent_group);
3766void GreasePencil::add_layers_for_eval(
const int num_new_layers)
3768 using namespace blender;
3769 const int num_layers = this->layers().
size();
3771 for ([[maybe_unused]]
const int i :
IndexRange(num_new_layers)) {
3775 this->root_group().add_node(new_layer->
as_node());
3779blender::bke::greasepencil::Layer &GreasePencil::duplicate_layer(
3780 const blender::bke::greasepencil::Layer &duplicate_layer,
3781 const bool duplicate_frames,
3782 const bool duplicate_drawings)
3784 using namespace blender;
3785 std::string
unique_name = unique_layer_name(duplicate_layer.name());
3786 std::optional<int> duplicate_layer_idx = get_layer_index(duplicate_layer);
3788 const int numLayers = layers().
size();
3791 root_group().add_node(new_layer->
as_node());
3805 if (duplicate_frames) {
3806 for (
auto [frame_number, frame] : duplicate_layer.
frames().
items()) {
3810 if (duplicate_drawings) {
3816 *dst_drawing = src_drawing;
3821 this->update_drawing_users_for_layer(*new_layer);
3826blender::bke::greasepencil::Layer &GreasePencil::duplicate_layer(
3827 blender::bke::greasepencil::LayerGroup &parent_group,
3828 const blender::bke::greasepencil::Layer &duplicate_layer,
3829 const bool duplicate_frames,
3830 const bool duplicate_drawings)
3832 using namespace blender;
3834 duplicate_layer, duplicate_frames, duplicate_drawings);
3835 move_node_into(new_layer.
as_node(), parent_group);
3839blender::bke::greasepencil::LayerGroup &GreasePencil::add_layer_group(
3840 const blender::StringRef
name,
const bool check_name_is_unique)
3842 using namespace blender;
3847 return root_group().add_node(new_group->
as_node()).as_group();
3850blender::bke::greasepencil::LayerGroup &GreasePencil::add_layer_group(
3851 blender::bke::greasepencil::LayerGroup &parent_group,
3852 const blender::StringRef
name,
3853 const bool check_name_is_unique)
3855 using namespace blender;
3857 move_node_into(new_group.
as_node(), parent_group);
3867 if (attr.
domain() != domain) {
3873 const auto &
data = std::get<bke::Attribute::ArrayData>(attr.
data());
3897 old_layer_index_by_layer.
add_new(layers[
i],
i);
3901 do_layer_order_changes();
3902 layers = grease_pencil.layers();
3907 for (
const int layer_i_new : layers.
index_range()) {
3910 const int layer_i_old = old_layer_index_by_layer.
pop(layer);
3911 new_by_old_map[layer_i_new] = layer_i_old;
3920void GreasePencil::move_node_up(blender::bke::greasepencil::TreeNode &node,
const int step)
3922 using namespace blender;
3928void GreasePencil::move_node_down(blender::bke::greasepencil::TreeNode &node,
const int step)
3930 using namespace blender;
3936void GreasePencil::move_node_top(blender::bke::greasepencil::TreeNode &node)
3938 using namespace blender;
3944void GreasePencil::move_node_bottom(blender::bke::greasepencil::TreeNode &node)
3946 using namespace blender;
3953void GreasePencil::move_node_after(blender::bke::greasepencil::TreeNode &node,
3954 blender::bke::greasepencil::TreeNode &target_node)
3956 using namespace blender;
3966void GreasePencil::move_node_before(blender::bke::greasepencil::TreeNode &node,
3967 blender::bke::greasepencil::TreeNode &target_node)
3969 using namespace blender;
3979void GreasePencil::move_node_into(blender::bke::greasepencil::TreeNode &node,
3980 blender::bke::greasepencil::LayerGroup &parent_group)
3982 using namespace blender;
3992const blender::bke::greasepencil::TreeNode *GreasePencil::find_node_by_name(
3993 const blender::StringRef
name)
const
3995 return this->root_group().find_node_by_name(
name);
3998blender::bke::greasepencil::TreeNode *GreasePencil::find_node_by_name(
3999 const blender::StringRef
name)
4001 return this->root_group().find_node_by_name(
name);
4004blender::IndexMask GreasePencil::layer_selection_by_name(
const blender::StringRef
name,
4005 blender::IndexMaskMemory &memory)
const
4007 using namespace blender::bke::greasepencil;
4008 const TreeNode *node = this->find_node_by_name(
name);
4014 const int index = *this->get_layer_index(node->
as_layer());
4018 blender::Vector<int64_t> layer_indices;
4019 for (
const int64_t layer_index : this->layers().index_range()) {
4020 const Layer &layer = *this->layers()[layer_index];
4021 if (layer.is_child_of(node->
as_group())) {
4022 layer_indices.
append(layer_index);
4141void GreasePencil::rename_node(Main &bmain,
4142 blender::bke::greasepencil::TreeNode &node,
4143 const blender::StringRef new_name)
4145 using namespace blender;
4146 if (node.
name() == new_name) {
4151 std::string old_name = node.
name();
4153 node.set_name(unique_layer_name(new_name));
4165 if (
STREQ(
mask->layer_name, old_name.c_str())) {
4174 if (object->data !=
this) {
4180 char *dst_layer_name =
nullptr;
4181 size_t dst_layer_name_maxncpy = 0;
4186 dst_layer_name_maxncpy =
sizeof(lmd->target_layer);
4191 dst_layer_name = influence_data->layer_name;
4192 dst_layer_name_maxncpy =
sizeof(influence_data->layer_name);
4194 if (dst_layer_name &&
STREQ(dst_layer_name, old_name.c_str())) {
4195 BLI_strncpy(dst_layer_name, node.
name().c_str(), dst_layer_name_maxncpy);
4202 const int index_to_remove,
4206 const IndexRange range_before(index_to_remove);
4207 const IndexRange range_after(index_to_remove + 1,
size - index_to_remove - 1);
4213 const auto &
data = std::get<bke::Attribute::ArrayData>(attr.
data());
4219 range_after.
size());
4235 if (node.
prev !=
nullptr) {
4236 grease_pencil.set_active_node(
reinterpret_cast<TreeNode *
>(node.
prev));
4240 else if (node.
next !=
nullptr) {
4241 grease_pencil.set_active_node(
reinterpret_cast<TreeNode *
>(node.
next));
4246 grease_pencil.set_active_node(&node.
parent->wrap().as_node());
4250 grease_pencil.set_active_node(
nullptr);
4254void GreasePencil::remove_layer(blender::bke::greasepencil::Layer &layer)
4256 using namespace blender::bke::greasepencil;
4258 if (&layer.
as_node() == this->get_active_node()) {
4263 const int layer_index = *this->get_layer_index(layer);
4277 drawing->wrap().remove_user();
4279 this->remove_drawings_with_no_users();
4285void GreasePencil::remove_group(blender::bke::greasepencil::LayerGroup &group,
4286 const bool keep_children)
4288 using namespace blender::bke::greasepencil;
4290 if (&group.
as_node() == this->get_active_node()) {
4292 if (keep_children && !group.
is_empty()) {
4293 this->set_active_node(
reinterpret_cast<TreeNode *
>(group.
children.
last));
4300 if (!keep_children) {
4303 switch (child->type) {
4324void GreasePencil::print_layer_tree()
4326 using namespace blender::bke::greasepencil;
4327 this->root_group().print_nodes(
"Layer Tree:");
4330blender::Array<int> GreasePencil::count_frame_users_for_drawings()
const
4332 using namespace blender;
4333 using namespace blender::bke::greasepencil;
4335 for (
const Layer *layer : this->layers()) {
4336 for (
const auto &[frame, value] : layer->
frames().
items()) {
4338 user_counts[value.drawing_index]++;
4344void GreasePencil::validate_drawing_user_counts()
4347 using namespace blender::bke::greasepencil;
4348 blender::Array<int> actual_user_counts = this->count_frame_users_for_drawings();
4349 for (
const int drawing_i : this->drawings().index_range()) {
4360blender::bke::AttributeAccessor GreasePencil::attributes()
const
4362 return blender::bke::AttributeAccessor(
4366blender::bke::MutableAttributeAccessor GreasePencil::attributes_for_write()
4368 return blender::bke::MutableAttributeAccessor(
4389 drawing->wrap().strokes_for_write().blend_read(*reader);
4391 drawing->
runtime = MEM_new<blender::bke::greasepencil::DrawingRuntime>(__func__);
4415 bke::CurvesGeometry::BlendWriteData write_data(scope);
4416 curves.blend_write_prepare(write_data);
4417 drawing_copy.
runtime =
nullptr;
4423 curves.blend_write(*writer, grease_pencil.
id, write_data);
4438 grease_pencil.resize_drawings(0);
4471 node->wrap().update_from_dna_read();
4483 switch (child->type) {
4497 node->wrap().
runtime = MEM_new<blender::bke::greasepencil::LayerGroupRuntime>(__func__);
4508 grease_pencil.
root_group_ptr = MEM_new<blender::bke::greasepencil::LayerGroup>(__func__);
4509 grease_pencil.set_active_node(
nullptr);
4541 switch (child->type) {
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void BKE_animdata_free(ID *id, bool do_id_user)
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
void CustomData_reset(CustomData *data)
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
Low-level operations for grease pencil that cannot be defined in the C++ header yet.
void(* BKE_grease_pencil_batch_cache_dirty_tag_cb)(GreasePencil *grease_pencil, int mode)
void BKE_grease_pencil_batch_cache_dirty_tag(GreasePencil *grease_pencil, int mode)
void BKE_grease_pencil_batch_cache_free(GreasePencil *grease_pencil)
void(* BKE_grease_pencil_batch_cache_free_cb)(GreasePencil *grease_pencil)
Low-level operations for grease pencil.
void BKE_grease_pencil_point_coords_apply(GreasePencil &grease_pencil, blender::Span< blender::float3 > all_positions, blender::Span< float > all_radii)
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *remap, int totcol)
void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int index)
void BKE_grease_pencil_vgroup_name_update(Object *ob, const char *old_name, const char *new_name)
Material * BKE_grease_pencil_object_material_alt_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
void BKE_grease_pencil_point_coords_apply_with_mat4(GreasePencil &grease_pencil, blender::Span< blender::float3 > all_positions, blender::Span< float > all_radii, const blender::float4x4 &mat)
void BKE_grease_pencil_point_coords_get(const GreasePencil &grease_pencil, blender::MutableSpan< blender::float3 > all_positions, blender::MutableSpan< float > all_radii)
void BKE_object_eval_grease_pencil(Depsgraph *depsgraph, Scene *scene, Object *object)
bool BKE_grease_pencil_references_cyclic_check(const GreasePencil *id_reference, const GreasePencil *grease_pencil)
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)
Material * BKE_grease_pencil_object_material_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
void BKE_grease_pencil_nomain_to_grease_pencil(GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
void BKE_grease_pencil_eval_geometry(Depsgraph *depsgraph, GreasePencil *grease_pencil)
void BKE_grease_pencil_duplicate_drawing_array(const GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
bool BKE_grease_pencil_has_curve_with_type(const GreasePencil &grease_pencil, CurveType type)
Material * BKE_grease_pencil_object_material_from_brush_get(Object *ob, Brush *brush)
int BKE_grease_pencil_stroke_point_count(const GreasePencil &grease_pencil)
GreasePencil * BKE_grease_pencil_new_nomain()
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)
bool BKE_grease_pencil_drawing_attribute_required(const GreasePencilDrawing *, blender::StringRef name)
GreasePencil * BKE_grease_pencil_copy_for_eval(const GreasePencil *grease_pencil_src)
bool BKE_grease_pencil_material_index_used(GreasePencil *grease_pencil, int index)
int BKE_grease_pencil_object_material_index_get_by_name(Object *ob, const char *name)
Material * BKE_grease_pencil_object_material_ensure_by_name(Main *bmain, Object *ob, const char *name, int *r_index)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void BKE_id_free(Main *bmain, void *idv)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
void * BKE_id_new(Main *bmain, short type, const char *name)
void * BKE_id_new_nomain(short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
General operations, lookup, etc. for materials.
short * BKE_object_material_len_p(Object *ob)
@ BKE_MAT_ASSIGN_USERPREF
short BKE_object_material_slot_find_index(Object *ob, Material *ma)
Material * BKE_gpencil_material_add(Main *bmain, const char *name)
bool BKE_object_material_slot_add(Main *bmain, Object *ob, bool set_active=true)
Material * BKE_material_default_gpencil()
Material * BKE_object_material_get(Object *ob, short act)
void BKE_object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type)
int BKE_object_material_index_get(Object *ob, const Material *ma)
void BKE_modifiers_clear_errors(Object *ob)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const Object *ob)
void BKE_object_eval_assign_data(Object *object, ID *data, bool is_owned)
void BKE_object_free_derived_caches(Object *ob)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
float mat4_to_scale(const float mat[4][4])
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void unit_m4(float m[4][4])
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
#define BLI_MEMARENA_STD_BUFSIZE
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
ATTR_WARN_UNUSED_RESULT const size_t num
void BLI_polyfill_calc_arena(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3], struct MemArena *arena)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup_null(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
size_t void BLI_uniquename_cb(blender::FunctionRef< bool(blender::StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
#define UNUSED_VARS_NDEBUG(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define POINTER_OFFSET(v, ofs)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
void BLO_write_int32_array(BlendWriter *writer, int64_t num, const int32_t *data_ptr)
void BLO_read_int32_array(BlendDataReader *reader, int64_t array_size, int32_t **ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
void BLO_write_shared_tag(BlendWriter *writer, const void *data)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define BLO_write_struct_list(writer, struct_name, list_ptr)
#define BLO_read_struct(reader, struct_name, ptr_p)
void BLO_write_pointer_array(BlendWriter *writer, int64_t num, const void *data_ptr)
void BLO_read_pointer_array(BlendDataReader *reader, int64_t array_size, void **ptr_p)
#define BLO_write_struct_at_address(writer, struct_name, address, data_ptr)
#define BLT_I18NCONTEXT_ID_GPENCIL
void DEG_id_tag_update(ID *id, unsigned int flags)
float DEG_get_ctime(const Depsgraph *graph)
bool DEG_is_evaluated(const T *id)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
T * DEG_get_original(T *id)
ID and Library types, which are fundamental for SDNA.
Enumerations for DNA_ID.h.
@ GP_BRUSH_MATERIAL_PINNED
#define DNA_struct_default_get(struct_name)
struct GreasePencilDrawingBase GreasePencilDrawingBase
struct GreasePencilLayerTreeGroup GreasePencilLayerTreeGroup
struct GreasePencilDrawingReference GreasePencilDrawingReference
struct GreasePencilFrame GreasePencilFrame
@ GP_LAYER_FRAMES_STORAGE_DIRTY
struct GreasePencil GreasePencil
GreasePencilLayerTreeNodeType
@ GP_LAYER_TREE_NODE_EXPANDED
@ GP_LAYER_TREE_NODE_USE_LIGHTS
@ GP_LAYER_TREE_NODE_HIDE_MASKS
struct GreasePencilDrawing GreasePencilDrawing
struct GreasePencilLayerTreeNode GreasePencilLayerTreeNode
@ GREASE_PENCIL_AUTOLOCK_LAYERS
struct GreasePencilLayerMask GreasePencilLayerMask
struct GreasePencilLayer GreasePencilLayer
struct GreasePencilModifierInfluenceData GreasePencilModifierInfluenceData
struct ModifierData ModifierData
struct GreasePencilLineartModifierData GreasePencilLineartModifierData
@ eModifierType_GreasePencilSmooth
@ eModifierType_GreasePencilWeightProximity
@ eModifierType_GreasePencilMirror
@ eModifierType_GreasePencilOffset
@ eModifierType_GreasePencilThickness
@ eModifierType_GreasePencilEnvelope
@ eModifierType_GreasePencilArmature
@ eModifierType_GreasePencilSubdiv
@ eModifierType_GreasePencilTint
@ eModifierType_GreasePencilNoise
@ eModifierType_GreasePencilMultiply
@ eModifierType_GreasePencilBuild
@ eModifierType_GreasePencilTime
@ eModifierType_GreasePencilTexture
@ eModifierType_GreasePencilSimplify
@ eModifierType_GreasePencilColor
@ eModifierType_GreasePencilDash
@ eModifierType_GreasePencilLineart
@ eModifierType_GreasePencilOutline
@ eModifierType_GreasePencilWeightAngle
@ eModifierType_GreasePencilOpacity
@ eModifierType_GreasePencilLength
@ eModifierType_GreasePencilShrinkwrap
@ eModifierType_GreasePencilLattice
@ eModifierType_GreasePencilHook
@ eModifierType_GreasePencilArray
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_WEIGHT_GREASE_PENCIL
Read Guarded memory(de)allocation.
static const char * ATTR_POSITION
BMesh const char void * data
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
IndexRange index_range() const
void copy_construct_n(const void *src, void *dst, int64_t n) const
bke::CurvesGeometry & strokes_for_write()
const CPPType & type() const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr int64_t start() const
GreasePencilFrame * add_frame(FramesMapKeyT key, int duration=0)
const Value * lookup_ptr(const Key &key) const
Value pop(const Key &key)
bool add_overwrite(const Key &key, const Value &value)
ValueIterator values() const &
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 foreach_item(const FuncT &func) const
void remove_contained(const Key &key)
void add_new(const Key &key, const Value &value)
bool contains(const Key &key) const
ItemIterator items() const &
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr MutableSpan drop_front(const int64_t n) const
constexpr IndexRange index_range() const
const LayerGroup & as_group() const
const Layer & as_layer() const
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
Span< T > as_span() const
void copy_assign(const void *src, void *dst) const
VArray< ColorGeometry4f > vertex_colors() const
MutableSpan< float > opacities_for_write()
MutableSpan< float > radii_for_write()
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
VArray< float > radii() const
void tag_positions_changed()
void tag_texture_matrices_changed()
void tag_topology_changed()
VArray< ColorGeometry4f > fill_colors() const
VArray< float > opacities() const
MutableSpan< ColorGeometry4f > fill_colors_for_write()
MutableSpan< ColorGeometry4f > vertex_colors_for_write()
void set_texture_matrices(Span< float4x2 > matrices, const IndexMask &selection)
ImplicitSharingPtr sharing_info
static IndexMask from_indices(Span< T > indices, IndexMaskMemory &memory)
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr IndexRange take_back(int64_t n) const
static constexpr IndexRange from_single(const int64_t index)
constexpr IndexRange drop_front(int64_t n) const
const Value * lookup_ptr(const Key &key) const
KeyIterator keys() const &
bool contains(const Key &key) const
ItemIterator items() const &
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr T * data() const
constexpr MutableSpan drop_front(const int64_t n) const
T & construct(Args &&...args)
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
constexpr bool contains(const T &value) const
void push(const T &value)
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr const char * data() const
std::optional< T > get_if_single() const
Span< T > get_internal_span() const
static VArray from_single(T value, const int64_t size)
bool contains(const Key &key) const
void append(const T &value)
const T & last(const int64_t n=0) const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
Span< T > as_span() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
bool contains(StringRef attribute_id) const
void foreach(FunctionRef< void(Attribute &)> fn)
AttrStorageType storage_type() const
const DataVariant & data() const
AttrDomain domain() const
void assign_data(DataVariant &&data)
AttrType data_type() const
std::optional< int > material_index_max() const
void ensure_can_interpolate_to_evaluated() const
MutableAttributeAccessor attributes_for_write()
VArray< float > radius() const
int evaluated_points_num() const
void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const
AttributeAccessor attributes() const
void count_memory(MemoryCounter &memory) const
bool is_single_type(CurveType type) const
std::optional< Bounds< float3 > > bounds_min_max(bool use_radius=true) const
Span< float3 > evaluated_positions() const
std::unique_ptr< GreasePencilEditHints > grease_pencil_edit_hints_
std::optional< MutableSpan< float3 > > positions_for_write()
const greasepencil::Drawing * drawing_orig
std::optional< Span< float3 > > positions() const
ImplicitSharingPtrAndData positions_data
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GSpanAttributeWriter lookup_for_write_span(StringRef attribute_id)
Drawing & operator=(const Drawing &other)
Span< float3 > curve_plane_normals() const
Span< float4x2 > texture_matrices() const
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_texture_matrices_changed()
Span< int3 > triangles() const
void tag_topology_changed()
void move_node_top(TreeNode &node)
void prepare_for_dna_write()
void set_expanded(bool expanded)
TreeNode & add_node(TreeNode &node)
void move_node_down(TreeNode &node, int step=1)
void move_node_bottom(TreeNode &node)
bool unlink_node(TreeNode &link, bool keep_children=false)
const TreeNode & as_node() const
int64_t num_direct_nodes() const
int64_t num_nodes_total() const
Span< TreeNode * > nodes_for_write()
const TreeNode * find_node_by_name(StringRef name) const
Span< const Layer * > layers() const
void update_from_dna_read()
Span< Layer * > layers_for_write()
void add_node_before(TreeNode &node, TreeNode &link)
void add_node_after(TreeNode &node, TreeNode &link)
void move_node_up(TreeNode &node, int step=1)
void print_nodes(StringRef header) const
LayerGroup & operator=(const LayerGroup &other)
Span< const LayerGroup * > groups() const
Span< LayerGroup * > groups_for_write()
Span< const TreeNode * > nodes() const
SharedCache< Vector< FramesMapKeyT > > sorted_keys_cache_
Map< FramesMapKeyT, GreasePencilFrame > frames_
LayerTransformData trans_data_
Vector< LayerMask > masks_
SortedKeysIterator sorted_keys_iterator_at(int frame_number) const
StringRefNull parent_bone_name() const
int sorted_keys_index_at(int frame_number) const
float4x4 to_world_space(const Object &object) const
StringRefNull view_layer_name() const
void set_local_transform(const float4x4 &transform)
void set_view_layer_name(StringRef new_name)
void tag_frames_map_keys_changed()
bool remove_frame(FramesMapKeyT key)
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
float4x4 local_transform() const
GreasePencilFrame * add_frame(FramesMapKeyT key, int duration=0)
const TreeNode & as_node() const
const GreasePencilFrame * frame_at(const int frame_number) const
void tag_frames_map_changed()
bool has_drawing_at(const int frame_number) const
const int * SortedKeysIterator
int drawing_index_at(const int frame_number) const
int get_frame_duration_at(const int frame_number) const
std::optional< int > start_frame_at(int frame_number) const
float4x4 to_object_space(const Object &object) const
void update_from_dna_read()
Span< FramesMapKeyT > sorted_keys() const
float4x4 parent_inverse() const
void prepare_for_dna_write()
const LayerGroup & parent_group() const
Map< FramesMapKeyT, GreasePencilFrame > & frames_for_write()
void set_parent_bone_name(StringRef new_name)
const TreeNode * parent_node() const
const LayerGroup & as_group() const
const Layer & as_layer() const
const LayerGroup * parent_group() const
IndexMask complement(const IndexMask &universe, IndexMaskMemory &memory) const
void foreach_index(Fn &&fn) const
void foreach_segment(Fn &&fn) const
IndexRange index_range() const
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
static float normals[][3]
VecBase< float, D > normalize(VecOp< float, D >) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
MatBase< R, C > transpose(MatBase< C, R >) RET
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
float length(VecOp< float, D >) RET
static void shrink_array(T **array, int *num, const int shrink_num)
static void read_layer_tree_group(BlendDataReader *reader, GreasePencilLayerTreeGroup *node, GreasePencilLayerTreeGroup *parent)
static void read_drawing_array(GreasePencil &grease_pencil, BlendDataReader *reader)
static void grease_pencil_evaluate_layers(GreasePencil &grease_pencil)
static GreasePencilModifierInfluenceData * influence_data_from_modifier(ModifierData *md)
static void grow_array(T **array, int *num, const int add_num)
static void grease_pencil_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
static bool grease_pencil_references_cyclic_check_internal(const GreasePencil *id_reference, const GreasePencil *grease_pencil)
static void grease_pencil_free_data(ID *id)
static std::string unique_node_name(const GreasePencil &grease_pencil, const blender::StringRef name)
static void shrink_attribute_storage(blender::bke::AttributeStorage &storage, const int index_to_remove, const int size)
static void reorder_layer_data(GreasePencil &grease_pencil, const blender::FunctionRef< void()> do_layer_order_changes)
static void free_drawing_array(GreasePencil &grease_pencil)
static void write_layer_tree_group(BlendWriter *writer, GreasePencilLayerTreeGroup *node)
static void update_active_node_from_node_to_remove(GreasePencil &grease_pencil, const blender::bke::greasepencil::TreeNode &node)
static void grease_pencil_initialize_drawing_user_counts_after_read(GreasePencil &grease_pencil)
static void grease_pencil_do_layer_adjustments(GreasePencil &grease_pencil)
static void grease_pencil_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void BKE_grease_pencil_batch_cache_free(GreasePencil *grease_pencil)
static void read_layer_tree(GreasePencil &grease_pencil, BlendDataReader *reader)
static void write_layer(BlendWriter *writer, GreasePencilLayer *node)
static Material * grease_pencil_object_material_ensure_from_brush_pinned(Main *bmain, Object *ob, Brush *brush)
static std::string unique_layer_group_name(const GreasePencil &grease_pencil, blender::StringRef name)
static void write_layer_tree(GreasePencil &grease_pencil, BlendWriter *writer)
static void grease_pencil_set_runtime_visibilities(ID &id_dst, GreasePencil &grease_pencil)
static void delete_drawing(GreasePencilDrawingBase *drawing_base)
static void grease_pencil_blend_read_data(BlendDataReader *reader, ID *id)
static void write_drawing_array(GreasePencil &grease_pencil, blender::ResourceScope &scope, BlendWriter *writer)
static blender::VectorSet< blender::StringRef > get_node_names(const GreasePencil &grease_pencil)
void BKE_grease_pencil_duplicate_drawing_array(const GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
static void grease_pencil_foreach_id(ID *id, LibraryForeachIDData *data)
static void reorder_attribute_domain(blender::bke::AttributeStorage &data, const blender::bke::AttrDomain domain, const Span< int > new_by_old_map)
static void grease_pencil_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static void grease_pencil_init_data(ID *id)
static void read_layer(BlendDataReader *reader, GreasePencilLayer *node, GreasePencilLayerTreeGroup *parent)
static void grease_pencil_evaluate_modifiers(Depsgraph *depsgraph, Scene *scene, Object *object, blender::bke::GeometrySet &geometry_set)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void copy_group_to_group(OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
bool contains(const VArray< bool > &varray, const IndexMask &indices_to_check, bool value)
bool prop_is_animated(const AnimData *adt, StringRefNull rna_path, int array_index)
GAttributeReader lookup(const void *owner, const StringRef name)
void gather(GSpan src, Span< int > map, GMutableSpan dst)
void ensure_non_empty_layer_names(Main &bmain, GreasePencil &grease_pencil)
static void update_curve_plane_normal_cache(const Span< float3 > positions, const OffsetIndices< int > points_by_curve, const IndexMask &curve_mask, MutableSpan< float3 > normals)
constexpr StringRef ATTR_RADIUS
static void update_triangle_cache(const Span< float3 > positions, const Span< float3 > normals, const OffsetIndices< int > points_by_curve, const OffsetIndices< int > triangle_offsets, const IndexMask &curve_mask, MutableSpan< int3 > triangles)
static float4x2 get_local_to_stroke_matrix(const Span< float3 > positions, const float3 normal)
constexpr StringRef ATTR_VERTEX_COLOR
static float3x2 get_stroke_to_texture_matrix(const float uv_rotation, const float2 uv_translation, const float2 uv_scale)
const AttributeAccessorFunctions & get_attribute_accessor_functions()
constexpr StringRef ATTR_OPACITY
constexpr StringRef ATTR_FILL_COLOR
static float4x3 expand_4x2_mat(const float4x2 &strokemat)
void copy_drawing_array(Span< const GreasePencilDrawingBase * > src_drawings, MutableSpan< GreasePencilDrawingBase * > dst_drawings)
GMutableSpan get_mutable_attribute(AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size, const void *custom_default_value)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void attribute_storage_blend_write_prepare(AttributeStorage &data, AttributeStorage::BlendWriteData &write_data)
void fill_attribute_range_default(MutableAttributeAccessor dst_attributes, AttrDomain domain, const AttributeFilter &attribute_filter, IndexRange range)
ID * asset_edit_id_find_local(Main &global_main, ID &id)
ID * asset_edit_id_ensure_local(Main &global_main, ID &id)
const CPPType & attribute_type_to_cpp_type(AttrType type)
Bounds< T > merge(const Bounds< T > &a, const Bounds< T > &b)
std::optional< Bounds< T > > min_max_with_radii(const Span< T > values, const Span< RadiusT > radii)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
T length_squared(const VecBase< T, Size > &a)
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
T distance(const T &a, const T &b)
T length(const VecBase< T, Size > &a)
QuaternionBase< T > normalize_and_get_length(const QuaternionBase< T > &q, T &out_length)
EulerXYZBase< float > EulerXYZ
CartesianBasis invert(const CartesianBasis &basis)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T atan2(const T &y, const T &x)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
void to_loc_rot_scale_safe(const MatBase< T, 4, 4 > &mat, VecBase< T, 3 > &r_location, RotationT &r_rotation, VecBase< T, 3 > &r_scale)
T determinant(const MatBase< T, Size, Size > &mat)
void transform_points(const float4x4 &transform, MutableSpan< float3 > points, bool use_threading=true)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
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< double, 4, 2 > double4x2
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4
MatBase< float, 2, 4 > float2x4
VecBase< float, 4 > float4
MatBase< double, 3, 4 > double3x4
MatView< float, 4, 4, 4, 4, 0, 0, alignof(float)> float4x4_view
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
MatBase< float, 4, 2 > float4x2
MatBase< float, 3, 2 > float3x2
MatBase< float, 4, 3 > float4x3
MatBase< float, 3, 3 > float3x3
void uninitialized_relocate_n(T *src, int64_t n, T *dst)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
MatBase< double, 4, 3 > double4x3
void uninitialized_move_n(T *src, int64_t n, T *dst)
float wrap(float value, float max, float min)
static void unique_name(bNode *node)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
struct Attribute * dna_attributes
void pad(const PaddingT &padding)
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
static GeometrySet from_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const GreasePencil * get_grease_pencil() const
bool has_grease_pencil() const
GreasePencil * get_grease_pencil_for_write()
void replace_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
struct GreasePencil * id_reference
GreasePencilDrawingBase base
GreasePencilDrawingBase base
GreasePencilDrawingRuntimeHandle * runtime
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilFrame * values
GreasePencilLayerTreeNode base
GreasePencilLayerGroupRuntimeHandle * runtime
struct GreasePencilLayerTreeNode * next
struct GreasePencilLayerTreeNode * prev
struct GreasePencilLayerTreeGroup * parent
GreasePencilLayerRuntimeHandle * runtime
GreasePencilLayerTreeNode base
GreasePencilLayerFramesMapStorage frames_storage
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
GreasePencilModifierInfluenceData influence
int attributes_active_index
GreasePencilLayerTreeNode * active_node
struct Material ** material_array
int vertex_group_active_index
CustomData layers_data_legacy
ListBase vertex_group_names
GreasePencilLayerTreeGroup * root_group_ptr
GreasePencilRuntimeHandle * runtime
GreasePencilDrawingBase ** drawing_array
GreasePencilOnionSkinningSettings onion_skinning_settings
struct AttributeStorage attribute_storage
struct ModifierData * next
void(* modify_geometry_set)(ModifierData *md, const ModifierEvalContext *ctx, blender::bke::GeometrySet *geometry_set)
const c_style_mat & ptr() const
static MatBase identity()
Vector<::Attribute, 16 > & attributes
static ArrayData from_uninitialized(const CPPType &type, int64_t domain_size)
static ArrayData from_constructed(const CPPType &type, int64_t domain_size)
MutableVArraySpan< T > span