Blender V5.3
blender::bke::greasepencil Namespace Reference

Namespaces

namespace  convert
namespace  tests

Classes

class  Drawing
class  DrawingReference
class  DrawingRuntime
struct  FillCache
class  Layer
class  LayerGroup
class  LayerGroupRuntime
class  LayerMask
class  LayerRuntime
struct  LayerTransformData
struct  ShapeData
class  TreeNode
struct  TriangleCache

Typedefs

using FramesMapKeyT = int

Functions

void copy_drawing_array (Span< const GreasePencilDrawingBase * > src_drawings, MutableSpan< GreasePencilDrawingBase * > dst_drawings)
 TREENODE_COMMON_METHODS_FORWARD_IMPL (Layer)
 TREENODE_COMMON_METHODS_FORWARD_IMPL (LayerGroup)
const AttributeAccessorFunctions & get_attribute_accessor_functions ()
void ensure_non_empty_layer_names (Main &bmain, GreasePencil &grease_pencil)
std::optional< FillCache > fill_cache_from_fill_ids (const VArray< int > &fill_ids)
ShapeData shapes_from_fill_ids (const VArray< int > &fill_ids, int curves_num)
int get_next_available_fill_id (Span< int > fill_ids)
int get_next_available_fill_id (const VArray< int > &fill_ids)
void gather_next_available_fill_ids (const VArray< int > &fill_ids, MutableSpan< int > r_new_fill_ids)
void gather_next_available_fill_ids (const VArray< int > &fill_ids, const IndexMask &curve_mask, MutableSpan< int > r_new_fill_ids)
IndexMask selected_mask_to_fills (const IndexMask &selected_mask, const CurvesGeometry &curves, AttrDomain selection_domain, IndexMaskMemory &memory)
IndexMask curves_mask_to_shapes (const IndexMask &curve_mask, const GroupedSpan< int > shapes, IndexMaskMemory &memory)
void separate_fill_ids (CurvesGeometry &curves, const IndexMask &strokes_to_keep)
static void ensure_fill_cache (const Drawing &drawing)
static void 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 ensure_triangle_cache (const Drawing &drawing)
static void update_curve_plane_normal_cache (const Span< float3 > positions, const OffsetIndices< int > points_by_curve, const IndexMask &curve_mask, MutableSpan< float3 > normals)
static float4x2 get_local_to_stroke_matrix (const Span< float3 > positions, const float3 normal)
static float3x2 get_stroke_to_texture_matrix (const float uv_rotation, const float2 uv_translation, const float2 uv_scale)
static float4x3 expand_4x2_mat (const float4x2 &strokemat)
static IndexMask curves_to_fills_mask (const IndexMask &curve_mask, const std::optional< GroupedSpan< int > > fills, const int num_curves, IndexMaskMemory &memory)
static void 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)
static const auto & changed_tags ()
static const auto & builtin_attributes ()
static const auto & array_storage_required ()
static int get_domain_size (const void *owner, const AttrDomain domain)
static AttributeAccessorFunctions get_grease_pencil_accessor_functions ()
static int get_next_available_fill_id_from_max (const int max_fill_id)
Vertex groups in drawings
void validate_drawing_vertex_groups (GreasePencil &grease_pencil)
int ensure_vertex_group (StringRef name, ListBaseT< bDeformGroup > &vertex_group_names)
void assign_to_vertex_group (Drawing &drawing, StringRef name, float weight)
void assign_to_vertex_group_from_mask (CurvesGeometry &curves, const IndexMask &mask, StringRef name, float weight)
bool remove_from_vertex_group (Drawing &drawing, StringRef name, bool use_selection)
void clear_vertex_groups (GreasePencil &grease_pencil)

Variables

constexpr float LEGACY_RADIUS_CONVERSION_FACTOR = 1.0f / 2000.0f
constexpr StringRef ATTR_RADIUS = "radius"
constexpr StringRef ATTR_OPACITY = "opacity"
constexpr StringRef ATTR_VERTEX_COLOR = "vertex_color"
constexpr StringRef ATTR_FILL_COLOR = "fill_color"

Typedef Documentation

◆ FramesMapKeyT

Function Documentation

◆ array_storage_required()

const auto & blender::bke::greasepencil::array_storage_required ( )
static

◆ assign_to_vertex_group()

◆ assign_to_vertex_group_from_mask()

◆ builtin_attributes()

const auto & blender::bke::greasepencil::builtin_attributes ( )
static

◆ changed_tags()

const auto & blender::bke::greasepencil::changed_tags ( )
static

Definition at line 18 of file grease_pencil_attributes.cc.

References changed_tags().

Referenced by changed_tags(), and get_grease_pencil_accessor_functions().

◆ clear_vertex_groups()

◆ copy_drawing_array()

void blender::bke::greasepencil::copy_drawing_array ( Span< const GreasePencilDrawingBase * > src_drawings,
MutableSpan< GreasePencilDrawingBase * > dst_drawings )

◆ curves_mask_to_shapes()

◆ curves_to_fills_mask()

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

◆ ensure_fill_cache()

◆ ensure_non_empty_layer_names()

void blender::bke::greasepencil::ensure_non_empty_layer_names ( Main & bmain,
GreasePencil & grease_pencil )

Renames layers with empty names to "Layer".

Note
While original data should not have layers with empty names, we allow layer names to be empty in evaluated geometry.
Examples
/usr/src/RPM/BUILD/blender5.3-5.3.0/source/blender/blenkernel/BKE_grease_pencil.hh.

Definition at line 2442 of file grease_pencil.cc.

References DATA_, ensure_non_empty_layer_names(), and layer.

Referenced by blender::ed::object::apply_grease_pencil_for_modifier(), blender::ed::object::apply_grease_pencil_for_modifier_all_keyframes(), ensure_non_empty_layer_names(), blender::ed::geometry::store_result_geometry(), and TREENODE_COMMON_METHODS_FORWARD_IMPL().

◆ ensure_triangle_cache()

◆ ensure_vertex_group()

int blender::bke::greasepencil::ensure_vertex_group ( StringRef name,
ListBaseT< bDeformGroup > & vertex_group_names )

◆ expand_4x2_mat()

float4x3 blender::bke::greasepencil::expand_4x2_mat ( const float4x2 & strokemat)
static

◆ fill_cache_from_fill_ids()

◆ gather_next_available_fill_ids() [1/2]

void blender::bke::greasepencil::gather_next_available_fill_ids ( const VArray< int > & fill_ids,
const IndexMask & curve_mask,
MutableSpan< int > r_new_fill_ids )

◆ gather_next_available_fill_ids() [2/2]

◆ get_attribute_accessor_functions()

◆ get_domain_size()

int blender::bke::greasepencil::get_domain_size ( const void * owner,
const AttrDomain domain )
static

◆ get_grease_pencil_accessor_functions()

◆ get_local_to_stroke_matrix()

float4x2 blender::bke::greasepencil::get_local_to_stroke_matrix ( const Span< float3 > positions,
const float3 normal )
static

◆ get_next_available_fill_id() [1/2]

int blender::bke::greasepencil::get_next_available_fill_id ( const VArray< int > & fill_ids)

◆ get_next_available_fill_id() [2/2]

◆ get_next_available_fill_id_from_max()

int blender::bke::greasepencil::get_next_available_fill_id_from_max ( const int max_fill_id)
static

◆ get_stroke_to_texture_matrix()

float3x2 blender::bke::greasepencil::get_stroke_to_texture_matrix ( const float uv_rotation,
const float2 uv_translation,
const float2 uv_scale )
static

◆ remove_from_vertex_group()

bool blender::bke::greasepencil::remove_from_vertex_group ( Drawing & drawing,
StringRef name,
bool use_selection )

◆ selected_mask_to_fills()

◆ separate_fill_ids()

◆ shapes_from_fill_ids()

ShapeData blender::bke::greasepencil::shapes_from_fill_ids ( const VArray< int > & fill_ids,
int curves_num )

Calculate all of the shapes from the "fill_id" attribute. Each shape is either a group of multiple curves that share the same "fill_id", or a single curve when the "fill_id" is zero.

For example:

curve index: 0 1 2 3 4 5 6 7 8 fill_id: 0 0 a 0 a c a b b (a, b, c are some integers != 0)

shape_map: 0 1 2 4 6 3 5 7 8 shape_offsets: 0 1 2 5 6 7 9 shapes: _ _ _____ _ _ ___ a c b (ordered by the first occurrence in fill_id)

Returns a ShapeData struct with the #shape_map and #shape_offsets.

Definition at line 78 of file grease_pencil_fills.cc.

References blender::offset_indices::accumulate_counts_to_offsets(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::BLI_assert(), blender::array_utils::fill_index_range(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::VArrayCommon< T >::is_empty(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::threading::parallel_for(), blender::bke::greasepencil::ShapeData::shape_map, blender::bke::greasepencil::ShapeData::shape_offsets, shapes_from_fill_ids(), blender::VArrayCommon< T >::size(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

Referenced by blender::ed::greasepencil::tests::draw_results(), shapes_from_fill_ids(), and blender::ed::greasepencil::tests::test_curve_boolean().

◆ TREENODE_COMMON_METHODS_FORWARD_IMPL() [1/2]

blender::bke::greasepencil::TREENODE_COMMON_METHODS_FORWARD_IMPL ( Layer )

◆ TREENODE_COMMON_METHODS_FORWARD_IMPL() [2/2]

blender::bke::greasepencil::TREENODE_COMMON_METHODS_FORWARD_IMPL ( LayerGroup )

◆ update_curve_plane_normal_cache()

◆ update_triangle_and_offsets_cache()

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

Definition at line 547 of file grease_pencil.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), blender::axis_dominant_v3_to_m3(), blender::BLI_assert(), blender::BLI_memarena_alloc(), blender::BLI_memarena_clear(), blender::BLI_memarena_free(), blender::BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, blender::BLI_polyfill_calc_arena(), blender::CDT_INSIDE_WITH_HOLES, blender::CDT_ONLY_ONE_ORIG, blender::CDT_ORIG_VERTS, blender::MutableSpan< T >::data(), blender::meshintersect::CDT_input< T >::face_offsets, blender::meshintersect::CDT_input< T >::face_vert_indices, float, blender::index_mask::IndexMask::foreach_segment(), blender::IndexMask::from_indices(), blender::IndexMask::from_predicate(), blender::offset_indices::gather_selected_offsets(), blender::exec_mode::grain_size(), blender::IndexRange::index_range(), blender::OffsetSpan< T, BaseT >::index_range(), blender::IndexRange::IndexRange(), blender::math::invert(), blender::threading::isolate_task(), blender::threading::EnumerableThreadSpecific< T >::local(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::mul_v2_m3v3(), blender::MutableSpan< T >::MutableSpan(), blender::meshintersect::CDT_input< T >::needed_ids, blender::threading::parallel_for(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), blender::result, blender::index_mask::IndexMask::size(), blender::IndexRange::size(), blender::Span< T >::Span(), blender::offset_indices::sum_group_sizes(), blender::offset_indices::OffsetIndices< T >::total_size(), update_triangle_and_offsets_cache(), and blender::meshintersect::CDT_input< T >::vert.

Referenced by ensure_triangle_cache(), update_triangle_and_offsets_cache(), and update_triangle_and_offsets_changed().

◆ update_triangle_and_offsets_changed()

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 )
static

◆ validate_drawing_vertex_groups()

Variable Documentation

◆ ATTR_FILL_COLOR

StringRef blender::bke::greasepencil::ATTR_FILL_COLOR = "fill_color"
constexpr

◆ ATTR_OPACITY

StringRef blender::bke::greasepencil::ATTR_OPACITY = "opacity"
constexpr

◆ ATTR_RADIUS

StringRef blender::bke::greasepencil::ATTR_RADIUS = "radius"
constexpr

◆ ATTR_VERTEX_COLOR

StringRef blender::bke::greasepencil::ATTR_VERTEX_COLOR = "vertex_color"
constexpr

◆ LEGACY_RADIUS_CONVERSION_FACTOR