Blender V5.3
grease_pencil.cc File Reference
#include <iostream>
#include <optional>
#include "BKE_action.hh"
#include "BKE_anim_data.hh"
#include "BKE_animsys.hh"
#include "BKE_asset_edit.hh"
#include "BKE_attribute_legacy_convert.hh"
#include "BKE_attribute_storage.hh"
#include "BKE_attribute_storage_blend_write.hh"
#include "BKE_bake_data_block_id.hh"
#include "BKE_brush.hh"
#include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_fcurve.hh"
#include "BKE_geometry_set.hh"
#include "BKE_grease_pencil.h"
#include "BKE_grease_pencil.hh"
#include "BKE_grease_pencil_fills.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_material.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_object_types.hh"
#include "BKE_paint.hh"
#include "BLI_array_utils.hh"
#include "BLI_bounds.hh"
#include "BLI_color_types.hh"
#include "BLI_delaunay_2d.hh"
#include "BLI_enumerable_thread_specific.hh"
#include "BLI_listbase.hh"
#include "BLI_map.hh"
#include "BLI_math_color_c.hh"
#include "BLI_math_euler_types.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_matrix.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_memarena.hh"
#include "BLI_memory_utils.hh"
#include "BLI_polyfill_2d.hh"
#include "BLI_resource_scope.hh"
#include "BLI_span.hh"
#include "BLI_stack.hh"
#include "BLI_string.hh"
#include "BLI_string_ref.hh"
#include "BLI_string_utf8.hh"
#include "BLI_string_utils.hh"
#include "BLI_task.hh"
#include "BLI_utildefines.hh"
#include "BLI_vector_set.hh"
#include "BLI_virtual_array.hh"
#include "BLO_read_write.hh"
#include "BLT_translation.hh"
#include "DNA_ID.h"
#include "DNA_ID_enums.h"
#include "DNA_brush_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "IMB_colormanagement.hh"
#include "RNA_access.hh"
#include "RNA_path.hh"
#include "RNA_prototypes.hh"
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#include "attribute_storage_access.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::bke
namespace  blender::bke::greasepencil

Functions

static void blender::grease_pencil_init_data (ID *id)
static void blender::grease_pencil_set_runtime_visibilities (ID &id_dst, GreasePencil &grease_pencil)
static void blender::grease_pencil_replace_end_frames_after_read (GreasePencil &grease_pencil)
static bool blender::grease_pencil_initialize_drawing_user_counts (GreasePencil &grease_pencil)
static void blender::grease_pencil_copy_data (Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
static void blender::grease_pencil_free_data (ID *id)
static void blender::grease_pencil_foreach_id (ID *id, LibraryForeachIDData *data)
static void blender::grease_pencil_foreach_working_space_color (ID *id, const IDTypeForeachColorFunctionCallback &fn)
static void blender::grease_pencil_blend_write (BlendWriter *writer, ID *id, const void *id_address)
static void blender::grease_pencil_blend_read_data (BlendDataReader *reader, ID *id)
static void blender::bke::greasepencil::ensure_fill_cache (const Drawing &drawing)
static void blender::bke::greasepencil::update_triangle_and_offsets_cache (const Span< float3 > positions, const Span< float3 > normals, const OffsetIndices< int > points_by_curve, const IndexMask &fill_mask, const GroupedSpan< int > fills, Vector< int3 > &r_triangles, MutableSpan< int > r_triangle_offsets, Vector< float3 > &r_intersection_points, MutableSpan< int > r_intersection_point_offsets)
static void blender::bke::greasepencil::ensure_triangle_cache (const Drawing &drawing)
static void blender::bke::greasepencil::update_curve_plane_normal_cache (const Span< float3 > positions, const OffsetIndices< int > points_by_curve, const IndexMask &curve_mask, MutableSpan< float3 > normals)
static float4x2 blender::bke::greasepencil::get_local_to_stroke_matrix (const Span< float3 > positions, const float3 normal)
static float3x2 blender::bke::greasepencil::get_stroke_to_texture_matrix (const float uv_rotation, const float2 uv_translation, const float2 uv_scale)
static float4x3 blender::bke::greasepencil::expand_4x2_mat (const float4x2 &strokemat)
static IndexMask blender::bke::greasepencil::curves_to_fills_mask (const IndexMask &curve_mask, const std::optional< GroupedSpan< int > > fills, const int num_curves, IndexMaskMemory &memory)
static void blender::bke::greasepencil::update_triangle_and_offsets_changed (const Span< float3 > positions, const Span< float3 > normals, const OffsetIndices< int > dst_points_by_curve, const IndexMask &changed_curves, const std::optional< GroupedSpan< int > > fills, const GroupedSpan< int3 > src_triangles, const GroupedSpan< float3 > src_intersection_points, Vector< int3 > &r_triangles, MutableSpan< int > r_triangle_offsets, Vector< float3 > &r_intersection_points, MutableSpan< int > r_intersection_point_offsets)
void blender::bke::greasepencil::copy_drawing_array (Span< const GreasePencilDrawingBase * > src_drawings, MutableSpan< GreasePencilDrawingBase * > dst_drawings)
void blender::bke::greasepencil::ensure_non_empty_layer_names (Main &bmain, GreasePencil &grease_pencil)
Drawing array read/write functions
static void blender::read_drawing_array (GreasePencil &grease_pencil, BlendDataReader *reader)
static void blender::write_drawing_array (GreasePencil &grease_pencil, ResourceScope &scope, BlendWriter *writer)
static void blender::free_drawing_array (GreasePencil &grease_pencil)
static size_t blender::drawing_struct_size (const GreasePencilDrawingType type)
Layer tree read/write functions
static void blender::read_layer_tree (GreasePencil &grease_pencil, BlendDataReader *reader)
static void blender::write_layer_tree (GreasePencil &grease_pencil, BlendWriter *writer)
static void blender::read_layer (BlendDataReader *reader, GreasePencilLayer *node, GreasePencilLayerTreeGroup *parent)
static size_t blender::layer_tree_node_struct_size (const GreasePencilLayerTreeNodeType type)
static void blender::read_layer_tree_group (BlendDataReader *reader, GreasePencilLayerTreeGroup *node, GreasePencilLayerTreeGroup *parent)
static void blender::write_layer (BlendWriter *writer, GreasePencilLayer *node)
static void blender::write_layer_tree_group (BlendWriter *writer, GreasePencilLayerTreeGroup *node)
Grease Pencil kernel functions
bool blender::BKE_grease_pencil_drawing_attribute_required (const GreasePencilDrawing *, StringRef name)
GreasePencil * blender::BKE_grease_pencil_add (Main *bmain, const char *name)
GreasePencil * blender::BKE_grease_pencil_new_nomain ()
GreasePencil * blender::BKE_grease_pencil_copy_for_eval (const GreasePencil *grease_pencil_src)
void blender::BKE_grease_pencil_copy_parameters (const GreasePencil &src, GreasePencil &dst)
void blender::BKE_grease_pencil_copy_layer_parameters (const bke::greasepencil::Layer &src, bke::greasepencil::Layer &dst)
void blender::BKE_grease_pencil_copy_layer_group_parameters (const bke::greasepencil::LayerGroup &src, bke::greasepencil::LayerGroup &dst)
void blender::BKE_grease_pencil_nomain_to_grease_pencil (GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
void blender::BKE_grease_pencil_vgroup_name_update (Object *ob, const char *old_name, const char *new_name)
static void blender::grease_pencil_evaluate_modifiers (Depsgraph *depsgraph, Scene *scene, Object *object, bke::GeometrySet &geometry_set)
static void blender::grease_pencil_do_layer_adjustments (GreasePencil &grease_pencil)
static void blender::grease_pencil_evaluate_layers (GreasePencil &grease_pencil)
void blender::BKE_grease_pencil_eval_geometry (Depsgraph *depsgraph, GreasePencil *grease_pencil)
void blender::BKE_object_eval_grease_pencil (Depsgraph *depsgraph, Scene *scene, Object *object)
void blender::BKE_grease_pencil_duplicate_drawing_array (const GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
Grease Pencil origin functions
Note
Used for "move only origins" in object_data_transform.cc.
bool blender::BKE_grease_pencil_has_curve_with_type (const GreasePencil &grease_pencil, CurveType type)
int blender::BKE_grease_pencil_stroke_point_count (const GreasePencil &grease_pencil)
void blender::BKE_grease_pencil_point_coords_get (const GreasePencil &grease_pencil, MutableSpan< float3 > all_positions, MutableSpan< float > all_radii)
void blender::BKE_grease_pencil_point_coords_apply (GreasePencil &grease_pencil, Span< float3 > all_positions, Span< float > all_radii)
void blender::BKE_grease_pencil_point_coords_apply_with_mat4 (GreasePencil &grease_pencil, Span< float3 > all_positions, Span< float > all_radii, const float4x4 &mat)
Grease Pencil material functions
int blender::BKE_grease_pencil_object_material_index_get_by_name (Object *ob, const char *name)
Material * blender::BKE_grease_pencil_object_material_new (Main *bmain, Object *ob, const char *name, int *r_index)
Material * blender::BKE_grease_pencil_object_material_from_brush_get (Object *ob, const Brush *brush)
Material * blender::BKE_grease_pencil_object_material_ensure_by_name (Main *bmain, Object *ob, const char *name, int *r_index)
static Material * blender::grease_pencil_object_material_ensure_from_brush_pinned (Main *bmain, Object *ob, Brush *brush)
Material * blender::BKE_grease_pencil_object_material_ensure_from_brush (Main *bmain, Object *ob, Brush *brush)
Material * blender::BKE_grease_pencil_object_material_alt_ensure_from_brush (Main *bmain, Object *ob, Brush *brush)
void blender::BKE_grease_pencil_material_remap (GreasePencil *grease_pencil, const uint *remap, int totcol)
void blender::BKE_grease_pencil_material_index_remove (GreasePencil *grease_pencil, int index)
bool blender::BKE_grease_pencil_material_index_used (GreasePencil *grease_pencil, int index)
void blender::BKE_grease_pencil_brush_material_set (struct Brush *brush, struct Material *material)
Grease Pencil palette functions
void blender::BKE_grease_pencil_palette_ensure (Main *bmain, Scene *scene)
Grease Pencil reference functions
static bool blender::grease_pencil_references_cyclic_check_internal (const GreasePencil *id_reference, const GreasePencil *grease_pencil)
bool blender::BKE_grease_pencil_references_cyclic_check (const GreasePencil *id_reference, const GreasePencil *grease_pencil)
Draw Cache
void blender::BKE_grease_pencil_batch_cache_dirty_tag (GreasePencil *grease_pencil, int mode)
void blender::BKE_grease_pencil_batch_cache_free (GreasePencil *grease_pencil)
Grease Pencil data-block API
template<typename T>
static void blender::grow_array (T **array, int *num, const int add_num)
template<typename T>
static void blender::shrink_array (T **array, int *num, const int shrink_num)
static void blender::delete_drawing (GreasePencilDrawingBase *drawing_base)
static VectorSet< StringRef > blender::get_node_names (const GreasePencil &grease_pencil)
static std::string blender::unique_node_name (const GreasePencil &grease_pencil, const StringRef name)
static std::string blender::unique_layer_group_name (const GreasePencil &grease_pencil, StringRef name)
static void blender::reorder_attribute_domain (bke::AttributeStorage &data, const bke::AttrDomain domain, const Span< int > new_by_old_map)
static void blender::reorder_layer_data (GreasePencil &grease_pencil, const FunctionRef< void()> do_layer_order_changes)
static GreasePencilModifierInfluenceData * blender::influence_data_from_modifier (ModifierData *md)
static void blender::shrink_attribute_storage (bke::AttributeStorage &storage, const int index_to_remove, const int size)
static void blender::update_active_node_from_node_to_remove (GreasePencil &grease_pencil, const bke::greasepencil::TreeNode &node)

Variables

static CLG_LogRef blender::LOG = {"geom.grease_pencil"}
static const char * blender::ATTR_POSITION = "position"
constexpr StringRef blender::bke::greasepencil::ATTR_RADIUS = "radius"
constexpr StringRef blender::bke::greasepencil::ATTR_OPACITY = "opacity"
constexpr StringRef blender::bke::greasepencil::ATTR_VERTEX_COLOR = "vertex_color"
constexpr StringRef blender::bke::greasepencil::ATTR_FILL_COLOR = "fill_color"