Blender V5.3
BKE_grease_pencil.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11
12#include <atomic>
13
14#include "BLI_color_types.hh"
16#include "BLI_map.hh"
19#include "BLI_offset_indices.hh"
20#include "BLI_shared_cache.hh"
22
24
25namespace blender {
26
27struct Brush;
28struct Depsgraph;
29struct Main;
30struct Scene;
31struct Object;
32struct Material;
33
34namespace draw {
36};
37
38namespace bke::bake {
39struct BakeMaterialsList;
40}
41
42namespace bke {
43struct AttributeAccessorFunctions;
44
45namespace greasepencil {
46
47/* Prior to Blender 4.3, Grease Pencil used a radius convention where 1 `px` = 0.001 units. This
48 * `px` was the brush size which would be stored in the stroke thickness and then scaled by the
49 * point pressure factor. Finally, the render engine would divide this thickness value by
50 * 2000 (we're going from a thickness to a radius, hence the factor of two) to convert back
51 * into blender units. With Grease Pencil 3, the radius is no longer stored in `px` space,
52 * but in blender units (world space) directly. Also note that there is no longer a stroke
53 * "thickness" attribute, the radii are directly stored on the points.
54 * For compatibility, legacy thickness values have to be multiplied by this factor. */
55constexpr float LEGACY_RADIUS_CONVERSION_FACTOR = 1.0f / 2000.0f;
56
82
97
99 public:
104
110
115
116 /*
117 * Matrices that transform from a 3D point in layer-space to a 2D point in texture-space. This is
118 * stored per curve.
119 */
121
127 mutable std::atomic<int> user_count = 1;
128
133 mutable bool fake_user = false;
134};
135
137 public:
138 Drawing();
139 Drawing(const Drawing &other);
140 Drawing(Drawing &&other);
141 Drawing &operator=(const Drawing &other);
142 Drawing &operator=(Drawing &&other);
143 ~Drawing();
144
145 const bke::CurvesGeometry &strokes() const;
147
151 std::optional<GroupedSpan<int>> fills() const;
156 std::optional<GroupedSpan<int3>> triangles() const;
166
171
176 void tag_fills_changed();
184 void tag_positions_changed(const IndexMask &changed_curves);
185
191 void tag_topology_changed(const IndexMask &changed_curves);
192
202 void set_texture_matrices(Span<float4x2> matrices, const IndexMask &selection);
203
207 VArray<float> radii() const;
209
215 VArray<float> opacities() const;
217
224
231
236 void add_user() const;
241 void remove_user() const;
245 bool is_instanced() const;
249 bool has_users() const;
253 int user_count() const;
254};
255static_assert(sizeof(Drawing) == sizeof(blender::GreasePencilDrawing));
256
263static_assert(sizeof(DrawingReference) == sizeof(blender::GreasePencilDrawingReference));
264
271
272class LayerGroup;
273class Layer;
274
275/* Defines the common functions used by #TreeNode, #Layer, and #LayerGroup.
276 * NOTE: Because we cannot mix C-style and C++ inheritance (all of these three classes wrap a
277 * C-struct that already uses "inheritance"), we define and implement these methods on all these
278 * classes individually. This just means that we can call `layer->name()` directly instead of
279 * having to write `layer->as_node().name()`. For #Layer and #LayerGroup the calls are just
280 * forwarded to #TreeNode. */
281#define TREENODE_COMMON_METHODS \
282 StringRefNull name() const; \
283 void set_name(StringRef new_name); \
284 bool is_visible() const; \
285 void set_visible(bool visible); \
286 bool is_locked() const; \
287 void set_locked(bool locked); \
288 bool is_editable() const; \
289 bool is_selected() const; \
290 void set_selected(bool selected); \
291 bool use_onion_skinning() const; \
292 bool use_masks() const; \
293 bool ignore_locked_materials() const; \
294 bool is_child_of(const LayerGroup &group) const;
295
296/* Implements the forwarding of the methods defined by #TREENODE_COMMON_METHODS. */
297#define TREENODE_COMMON_METHODS_FORWARD_IMPL(class_name) \
298 inline StringRefNull class_name::name() const \
299 { \
300 return this->as_node().name(); \
301 } \
302 inline void class_name::set_name(const StringRef new_name) \
303 { \
304 return this->as_node().set_name(new_name); \
305 } \
306 inline bool class_name::is_visible() const \
307 { \
308 return this->as_node().is_visible(); \
309 } \
310 inline void class_name::set_visible(const bool visible) \
311 { \
312 this->as_node().set_visible(visible); \
313 } \
314 inline bool class_name::is_locked() const \
315 { \
316 return this->as_node().is_locked(); \
317 } \
318 inline void class_name::set_locked(const bool locked) \
319 { \
320 this->as_node().set_locked(locked); \
321 } \
322 inline bool class_name::is_editable() const \
323 { \
324 return this->as_node().is_editable(); \
325 } \
326 inline bool class_name::is_selected() const \
327 { \
328 return this->as_node().is_selected(); \
329 } \
330 inline void class_name::set_selected(const bool selected) \
331 { \
332 this->as_node().set_selected(selected); \
333 } \
334 inline bool class_name::use_onion_skinning() const \
335 { \
336 return this->as_node().use_onion_skinning(); \
337 } \
338 inline bool class_name::use_masks() const \
339 { \
340 return this->as_node().use_masks(); \
341 } \
342 inline bool class_name::ignore_locked_materials() const \
343 { \
344 return this->as_node().ignore_locked_materials(); \
345 } \
346 inline bool class_name::is_child_of(const LayerGroup &group) const \
347 { \
348 return this->as_node().is_child_of(group); \
349 }
350
357 public:
358 TreeNode();
361 TreeNode(const TreeNode &other);
362 ~TreeNode();
363
364 public:
365 /* Define the common functions for #TreeNode. */
370 bool is_group() const;
374 bool is_layer() const;
375
379 const Layer &as_layer() const;
380 Layer &as_layer();
381
385 const LayerGroup &as_group() const;
387
391 const LayerGroup *parent_group() const;
393
394 const TreeNode *parent_node() const;
396
400 int64_t depth() const;
401};
402static_assert(sizeof(TreeNode) == sizeof(blender::GreasePencilLayerTreeNode));
403
408 public:
409 LayerMask();
410 explicit LayerMask(StringRef name);
411 LayerMask(const LayerMask &other);
412 ~LayerMask();
413};
414static_assert(sizeof(LayerMask) == sizeof(blender::GreasePencilLayerMask));
415
421
422 /* Map of frame keys describing the transformation of the frames. Keys of the map are the source
423 * frame indices, and the values of the map are the destination frame indices. */
425
426 /* Copy of the layer frames, stored in two separate maps :
427 * - frames_static contains the frames not affected by the transformation,
428 * - frames_transformed contains the frames affected by the transformation.
429 * This allows to display the transformation while running, without removing any drawing.
430 */
433
434 /* Map containing the duration (in frames) for each frame in the layer that has a fixed duration,
435 * i.e. each frame that is not an implicit hold. */
437
438 /* Temporary copy of duplicated frames before we decide on a place to insert them.
439 * Used in the move+duplicate operator. */
441
443};
444
445/*
446 * The key type for a `GreasePencilFrame` in the frames map.
447 *
448 * This is either the start or end frame (scene time) of a `GreasePencilFrame`.
449 *
450 * If the key refers to a end frame, the value in the map for this key is
451 * `GreasePencilFrame::end()`.
452 * Note that end frame is exclusive with regards to the frame duration. E.g. if a frame starts at
453 * 10 and the end frame is at 15, then the duration is 4.
454 */
455using FramesMapKeyT = int;
456
516
522 public:
523 using SortedKeysIterator = const int *;
524
525 Layer();
526 explicit Layer(StringRef name);
527 Layer(const Layer &other);
528 ~Layer();
529
530 /* Define the common functions for #TreeNode. */
535 const TreeNode &as_node() const;
536 TreeNode &as_node();
537
541 const LayerGroup &parent_group() const;
543
549
553 bool is_empty() const;
554
566 GreasePencilFrame *add_frame(FramesMapKeyT key, int duration = 0);
577 bool remove_frame(FramesMapKeyT key);
578
584
590 int drawing_index_at(const int frame_number) const;
591
595 bool has_drawing_at(const int frame_number) const;
596
601 std::optional<int> start_frame_at(int frame_number) const;
602
607 int sorted_keys_index_at(int frame_number) const;
612 SortedKeysIterator sorted_keys_iterator_at(int frame_number) const;
613
617 const GreasePencilFrame *frame_at(const int frame_number) const;
618 GreasePencilFrame *frame_at(const int frame_number);
619
625 int get_frame_duration_at(const int frame_number) const;
626
628
634
639
644
645 float4x4 parent_inverse() const;
646
651
658
662 float4x4 to_object_space(const Object &object) const;
663
667 float4x4 to_world_space(const Object &object) const;
668
674 void set_parent_bone_name(StringRef new_name);
675
681 void set_view_layer_name(StringRef new_name);
682
683 private:
688 std::optional<FramesMapKeyT> frame_key_at(int frame_number) const;
689
690 GreasePencilFrame *add_frame_internal(int frame_number);
691
698 SortedKeysIterator remove_leading_end_frames_in_range(SortedKeysIterator begin,
700
704 float4x4 parent_to_world(const Object &parent) const;
705};
706static_assert(sizeof(Layer) == sizeof(blender::GreasePencilLayer));
707
733
739
740 public:
741 LayerGroup();
742 explicit LayerGroup(StringRef name);
743 LayerGroup(const LayerGroup &other);
744 ~LayerGroup();
745
746 LayerGroup &operator=(const LayerGroup &other);
747
748 public:
749 /* Define the common functions for #TreeNode. */
754 const TreeNode &as_node() const;
755 TreeNode &as_node();
756
760 bool is_empty() const;
761
766
770 int64_t num_nodes_total() const;
771
777
783
789
793 const TreeNode *find_node_by_name(StringRef name) const;
795
799 bool is_expanded() const;
803 void set_expanded(bool expanded);
804
808 void print_nodes(StringRef header) const;
809
814
819
820 protected:
825
833 void add_node_after(TreeNode &node, TreeNode &link);
834
838 void move_node_up(TreeNode &node, int step = 1);
839 void move_node_down(TreeNode &node, int step = 1);
845
850 bool unlink_node(TreeNode &link, bool keep_children = false);
851
852 private:
853 void ensure_nodes_cache() const;
854 void tag_nodes_cache_dirty() const;
855};
856static_assert(sizeof(LayerGroup) == sizeof(blender::GreasePencilLayerTreeGroup));
857
858inline void Drawing::add_user() const
859{
860 this->runtime->user_count.fetch_add(1, std::memory_order_relaxed);
861}
862inline void Drawing::remove_user() const
863{
864 this->runtime->user_count.fetch_sub(1, std::memory_order_relaxed);
865}
866inline bool Drawing::is_instanced() const
867{
868 return this->runtime->user_count.load(std::memory_order_relaxed) > 1;
869}
870inline bool Drawing::has_users() const
871{
872 return this->runtime->user_count.load(std::memory_order_relaxed) > 0;
873}
874inline int Drawing::user_count() const
875{
876 return this->runtime->user_count.load(std::memory_order_relaxed);
877}
878
879inline bool TreeNode::is_group() const
880{
881 return this->type == GP_LAYER_TREE_GROUP;
882}
883inline bool TreeNode::is_layer() const
884{
885 return this->type == GP_LAYER_TREE_LEAF;
886}
887inline bool TreeNode::is_visible() const
888{
889 return ((this->flag & GP_LAYER_TREE_NODE_HIDE) == 0) &&
890 (!this->parent_group() || this->parent_group()->as_node().is_visible());
891}
892inline void TreeNode::set_visible(const bool visible)
893{
895}
896inline bool TreeNode::is_locked() const
897{
898 return ((this->flag & GP_LAYER_TREE_NODE_LOCKED) != 0) ||
899 (this->parent_group() && this->parent_group()->as_node().is_locked());
900}
901inline void TreeNode::set_locked(const bool locked)
902{
904}
905inline bool TreeNode::is_editable() const
906{
907 return this->is_visible() && !this->is_locked();
908}
909inline bool TreeNode::is_selected() const
910{
911 return (this->flag & GP_LAYER_TREE_NODE_SELECT) != 0;
912}
913inline void TreeNode::set_selected(const bool selected)
914{
916}
917inline bool TreeNode::use_onion_skinning() const
918{
919 return ((this->flag & GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING) == 0) &&
920 (!this->parent_group() || this->parent_group()->as_node().use_onion_skinning());
921}
922inline bool TreeNode::use_masks() const
923{
924 return ((this->flag & GP_LAYER_TREE_NODE_HIDE_MASKS) == 0) &&
925 (!this->parent_group() || this->parent_group()->as_node().use_masks());
926}
927inline bool TreeNode::ignore_locked_materials() const
928{
930}
931inline bool TreeNode::is_child_of(const LayerGroup &group) const
932{
933 if (const LayerGroup *parent = this->parent_group()) {
934 if (parent == &group) {
935 return true;
936 }
937 return parent->is_child_of(group);
938 }
939 return false;
940}
941inline StringRefNull TreeNode::name() const
942{
943 return (this->GreasePencilLayerTreeNode::name != nullptr) ?
946}
947inline const TreeNode &LayerGroup::as_node() const
948{
949 return *reinterpret_cast<const TreeNode *>(this);
950}
952{
953 return *reinterpret_cast<TreeNode *>(this);
954}
955inline const TreeNode &Layer::as_node() const
956{
957 return *reinterpret_cast<const TreeNode *>(this);
958}
960{
961 return *reinterpret_cast<TreeNode *>(this);
962}
963
965inline bool Layer::is_empty() const
966{
967 return (this->frames().is_empty());
968}
969inline const LayerGroup &Layer::parent_group() const
970{
971 return *this->as_node().parent_group();
972}
974{
975 return *this->as_node().parent_group();
976}
977
979
981
988
989} // namespace greasepencil
990
992 public:
1000 int eval_frame = 0;
1005 bool is_drawing_stroke = false;
1009 bool temp_use_eraser = false;
1011
1012 std::unique_ptr<bake::BakeMaterialsList> bake_materials;
1013
1014 public:
1017};
1018
1020 public:
1022 /* Deformed positions for original points. Data has the same topology as the original curves. */
1024
1029 std::optional<Array<float3x3>> deform_mats;
1030
1031 std::optional<Span<float3>> positions() const;
1032 std::optional<MutableSpan<float3>> positions_for_write();
1033};
1034
1039 public:
1044
1049
1054 std::optional<Array<GreasePencilDrawingEditHints>> drawing_hints;
1055};
1056
1057} // namespace bke
1058
1059inline bke::greasepencil::Drawing &GreasePencilDrawing::wrap()
1060{
1061 return *reinterpret_cast<bke::greasepencil::Drawing *>(this);
1062}
1063inline const bke::greasepencil::Drawing &GreasePencilDrawing::wrap() const
1064{
1065 return *reinterpret_cast<const bke::greasepencil::Drawing *>(this);
1066}
1067
1068inline bke::greasepencil::DrawingReference &GreasePencilDrawingReference::wrap()
1069{
1070 return *reinterpret_cast<bke::greasepencil::DrawingReference *>(this);
1071}
1072inline const bke::greasepencil::DrawingReference &GreasePencilDrawingReference::wrap() const
1073{
1074 return *reinterpret_cast<const bke::greasepencil::DrawingReference *>(this);
1075}
1076
1077inline GreasePencilFrame GreasePencilFrame::end()
1078{
1079 return GreasePencilFrame{-1, {}, 0};
1080}
1081
1082inline bool GreasePencilFrame::is_end() const
1083{
1084 return this->drawing_index == -1;
1085}
1086
1087inline bool GreasePencilFrame::is_implicit_hold() const
1088{
1089 return (this->flag & GP_FRAME_IMPLICIT_HOLD) != 0;
1090}
1091
1092inline bool GreasePencilFrame::is_selected() const
1093{
1094 return (this->flag & GP_FRAME_SELECTED) != 0;
1095}
1096
1097inline bke::greasepencil::TreeNode &GreasePencilLayerTreeNode::wrap()
1098{
1099 return *reinterpret_cast<bke::greasepencil::TreeNode *>(this);
1100}
1101inline const bke::greasepencil::TreeNode &GreasePencilLayerTreeNode::wrap() const
1102{
1103 return *reinterpret_cast<const bke::greasepencil::TreeNode *>(this);
1104}
1105
1106inline bke::greasepencil::Layer &GreasePencilLayer::wrap()
1107{
1108 return *reinterpret_cast<bke::greasepencil::Layer *>(this);
1109}
1110inline const bke::greasepencil::Layer &GreasePencilLayer::wrap() const
1111{
1112 return *reinterpret_cast<const bke::greasepencil::Layer *>(this);
1113}
1114
1115inline bke::greasepencil::LayerMask &GreasePencilLayerMask::wrap()
1116{
1117 return *reinterpret_cast<bke::greasepencil::LayerMask *>(this);
1118}
1119inline const bke::greasepencil::LayerMask &GreasePencilLayerMask::wrap() const
1120{
1121 return *reinterpret_cast<const bke::greasepencil::LayerMask *>(this);
1122}
1123
1124inline bke::greasepencil::LayerGroup &GreasePencilLayerTreeGroup::wrap()
1125{
1126 return *reinterpret_cast<bke::greasepencil::LayerGroup *>(this);
1127}
1128inline const bke::greasepencil::LayerGroup &GreasePencilLayerTreeGroup::wrap() const
1129{
1130 return *reinterpret_cast<const bke::greasepencil::LayerGroup *>(this);
1131}
1132
1133inline const GreasePencilDrawingBase *GreasePencil::drawing(const int64_t index) const
1134{
1135 BLI_assert(index >= 0 && index < this->drawings().size());
1136 return this->drawings()[index];
1137}
1138inline GreasePencilDrawingBase *GreasePencil::drawing(const int64_t index)
1139{
1140 BLI_assert(index >= 0 && index < this->drawings().size());
1141 return this->drawings()[index];
1142}
1143
1144inline const bke::greasepencil::Layer &GreasePencil::layer(const int64_t index) const
1145{
1146 return *this->layers()[index];
1147}
1148inline bke::greasepencil::Layer &GreasePencil::layer(const int64_t index)
1149{
1150 return *this->layers_for_write()[index];
1151}
1152
1153inline const bke::greasepencil::LayerGroup &GreasePencil::root_group() const
1154{
1155 return this->root_group_ptr->wrap();
1156}
1157inline bke::greasepencil::LayerGroup &GreasePencil::root_group()
1158{
1159 return this->root_group_ptr->wrap();
1160}
1161
1162inline bool GreasePencil::has_active_layer() const
1163{
1164 return (this->active_node != nullptr) && (this->active_node->wrap().is_layer());
1165}
1166
1167inline bool GreasePencil::has_active_group() const
1168{
1169 return (this->active_node != nullptr) && (this->active_node->wrap().is_group());
1170}
1171
1172bool BKE_grease_pencil_drawing_attribute_required(const GreasePencilDrawing *, StringRef name);
1173
1174GreasePencil *BKE_grease_pencil_add(Main *bmain, const char *name);
1179void BKE_grease_pencil_copy_layer_parameters(const bke::greasepencil::Layer &src,
1180 bke::greasepencil::Layer &dst);
1181void BKE_grease_pencil_copy_layer_group_parameters(const bke::greasepencil::LayerGroup &src,
1182 bke::greasepencil::LayerGroup &dst);
1183
1189 GreasePencil *grease_pencil_dst);
1190
1191void BKE_grease_pencil_vgroup_name_update(Object *ob, const char *old_name, const char *new_name);
1192
1193void BKE_grease_pencil_eval_geometry(Depsgraph *depsgraph, GreasePencil *grease_pencil);
1194void BKE_object_eval_grease_pencil(Depsgraph *depsgraph, Scene *scene, Object *object);
1195void BKE_grease_pencil_duplicate_drawing_array(const GreasePencil *grease_pencil_src,
1196 GreasePencil *grease_pencil_dst);
1197
1201int BKE_grease_pencil_stroke_point_count(const GreasePencil &grease_pencil);
1205bool BKE_grease_pencil_has_curve_with_type(const GreasePencil &grease_pencil, CurveType type);
1209void BKE_grease_pencil_point_coords_get(const GreasePencil &grease_pencil,
1210 MutableSpan<float3> all_positions,
1211 MutableSpan<float> all_radii);
1216 Span<float3> all_positions,
1217 Span<float> all_radii);
1222 Span<float3> all_positions,
1223 Span<float> all_radii,
1224 const float4x4 &mat);
1225
1226int BKE_grease_pencil_object_material_index_get_by_name(Object *ob, const char *name);
1228 Object *ob,
1229 const char *name,
1230 int *r_index);
1231Material *BKE_grease_pencil_object_material_from_brush_get(Object *ob, const Brush *brush);
1233 Object *ob,
1234 const char *name,
1235 int *r_index);
1237 Object *ob,
1238 Brush *brush);
1240 Object *ob,
1241 Brush *brush);
1242void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *remap, int totcol);
1243void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int index);
1244bool BKE_grease_pencil_material_index_used(GreasePencil *grease_pencil, int index);
1245
1246void BKE_grease_pencil_brush_material_set(struct Brush *brush, struct Material *material);
1247
1248void BKE_grease_pencil_palette_ensure(Main *bmain, Scene *scene);
1249
1251 const GreasePencil *grease_pencil);
1252
1253} // namespace blender
#define SET_FLAG_FROM_TEST(value, test, flag)
#define BLI_assert(a)
constexpr StringRefNull()
std::optional< MutableSpan< float3 > > positions_for_write()
std::optional< Span< float3 > > positions() const
std::optional< Array< float3x3 > > deform_mats
GreasePencilEditHints(const GreasePencil &grease_pencil_id_orig)
std::optional< Array< GreasePencilDrawingEditHints > > drawing_hints
draw::GreasePencilBatchCache * batch_cache
std::unique_ptr< bake::BakeMaterialsList > bake_materials
SharedCache< std::optional< FillCache > > fill_cache
SharedCache< Vector< float3 > > curve_plane_normals_cache
SharedCache< Vector< float4x2 > > curve_texture_matrices
SharedCache< std::optional< TriangleCache > > triangle_cache
VArray< ColorGeometry4f > vertex_colors() const
Drawing & operator=(const Drawing &other)
Span< float3 > curve_plane_normals() const
std::optional< GroupedSpan< int > > fills() const
MutableSpan< float > opacities_for_write()
Span< float4x2 > texture_matrices() const
MutableSpan< float > radii_for_write()
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
std::optional< GroupedSpan< int3 > > triangles() const
VArray< ColorGeometry4f > fill_colors() const
MutableSpan< ColorGeometry4f > fill_colors_for_write()
MutableSpan< ColorGeometry4f > vertex_colors_for_write()
void set_texture_matrices(Span< float4x2 > matrices, const IndexMask &selection)
GroupedSpan< float3 > intersection_points() const
TreeNode & add_node(TreeNode &node)
void move_node_down(TreeNode &node, int step=1)
bool unlink_node(TreeNode &link, bool keep_children=false)
const TreeNode * find_node_by_name(StringRef name) const
Span< const Layer * > layers() const
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< const TreeNode * > nodes() const
SharedCache< Vector< FramesMapKeyT > > sorted_keys_cache_
Map< FramesMapKeyT, GreasePencilFrame > frames_
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)
bool remove_frame(FramesMapKeyT key)
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
GreasePencilFrame * add_frame(FramesMapKeyT key, int duration=0)
const GreasePencilFrame * frame_at(const int frame_number) const
bool has_drawing_at(const int frame_number) const
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
Span< FramesMapKeyT > sorted_keys() const
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 LayerGroup * parent_group() const
#define index(i)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void ensure_non_empty_layer_names(Main &bmain, GreasePencil &grease_pencil)
constexpr float LEGACY_RADIUS_CONVERSION_FACTOR
const AttributeAccessorFunctions & get_attribute_accessor_functions()
TREENODE_COMMON_METHODS_FORWARD_IMPL(Layer)
void copy_drawing_array(Span< const GreasePencilDrawingBase * > src_drawings, MutableSpan< GreasePencilDrawingBase * > dst_drawings)
int size(const AssetLibraryReference *library_reference)
BMesh Iterators.
@ GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING
@ GP_LAYER_TREE_NODE_IGNORE_LOCKED_MATERIALS
__int64 int64_t
Definition BKE_text.h:90
bool BKE_grease_pencil_has_curve_with_type(const GreasePencil &grease_pencil, CurveType type)
void BKE_object_eval_grease_pencil(Depsgraph *depsgraph, Scene *scene, Object *object)
unsigned int uint
Definition BKE_text.h:55
GreasePencil * BKE_grease_pencil_copy_for_eval(const GreasePencil *grease_pencil_src)
void BKE_grease_pencil_copy_layer_group_parameters(const bke::greasepencil::LayerGroup &src, bke::greasepencil::LayerGroup &dst)
bool BKE_grease_pencil_drawing_attribute_required(const GreasePencilDrawing *, StringRef name)
void BKE_grease_pencil_point_coords_get(const GreasePencil &grease_pencil, MutableSpan< float3 > all_positions, MutableSpan< float > all_radii)
MatBase< float, 4, 4 > float4x4
void BKE_grease_pencil_copy_layer_parameters(const bke::greasepencil::Layer &src, bke::greasepencil::Layer &dst)
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
bool BKE_grease_pencil_material_index_used(GreasePencil *grease_pencil, int index)
void BKE_grease_pencil_point_coords_apply_with_mat4(GreasePencil &grease_pencil, Span< float3 > all_positions, Span< float > all_radii, const float4x4 &mat)
Material * BKE_grease_pencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
void BKE_grease_pencil_eval_geometry(Depsgraph *depsgraph, GreasePencil *grease_pencil)
void BKE_grease_pencil_nomain_to_grease_pencil(GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
void BKE_grease_pencil_duplicate_drawing_array(const GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
int BKE_grease_pencil_object_material_index_get_by_name(Object *ob, const char *name)
void BKE_grease_pencil_brush_material_set(struct Brush *brush, struct Material *material)
void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int index)
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
Material * BKE_grease_pencil_object_material_ensure_by_name(Main *bmain, Object *ob, const char *name, int *r_index)
void BKE_grease_pencil_vgroup_name_update(Object *ob, const char *old_name, const char *new_name)
bool BKE_grease_pencil_references_cyclic_check(const GreasePencil *id_reference, const GreasePencil *grease_pencil)
void BKE_grease_pencil_point_coords_apply(GreasePencil &grease_pencil, Span< float3 > all_positions, Span< float > all_radii)
iter begin(iter)
Material * BKE_grease_pencil_object_material_from_brush_get(Object *ob, const Brush *brush)
Material * BKE_grease_pencil_object_material_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *remap, int totcol)
GreasePencil * BKE_grease_pencil_new_nomain()
int BKE_grease_pencil_stroke_point_count(const GreasePencil &grease_pencil)
Material * BKE_grease_pencil_object_material_alt_ensure_from_brush(Main *bmain, Object *ob, Brush *brush)
void BKE_grease_pencil_palette_ensure(Main *bmain, Scene *scene)
bke::greasepencil::DrawingRuntime * runtime
struct GreasePencilLayerTreeGroup * parent
Map< int, GreasePencilFrame > duplicated_frames_buffer