|
Blender V4.3
|
Low-level operations for grease pencil. More...
#include <atomic>#include "BLI_array_utils.hh"#include "BLI_color.hh"#include "BLI_function_ref.hh"#include "BLI_implicit_sharing_ptr.hh"#include "BLI_map.hh"#include "BLI_math_matrix_types.hh"#include "BLI_math_vector_types.hh"#include "BLI_shared_cache.hh"#include "BLI_utility_mixins.hh"#include "BLI_virtual_array.hh"#include "DNA_gpencil_legacy_types.h"#include "DNA_grease_pencil_types.h"Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::bake |
| namespace | blender::bke::greasepencil |
Macros | |
| #define | TREENODE_COMMON_METHODS |
| #define | TREENODE_COMMON_METHODS_FORWARD_IMPL(class_name) |
Typedefs | |
| using | blender::bke::greasepencil::FramesMapKeyT = int |
Variables | |
| constexpr float | blender::bke::greasepencil::LEGACY_RADIUS_CONVERSION_FACTOR = 1.0f / 2000.0f |
Low-level operations for grease pencil.
Definition in file BKE_grease_pencil.hh.
| #define TREENODE_COMMON_METHODS |
Definition at line 211 of file BKE_grease_pencil.hh.
| #define TREENODE_COMMON_METHODS_FORWARD_IMPL | ( | class_name | ) |
Definition at line 227 of file BKE_grease_pencil.hh.
| void * BKE_grease_pencil_add | ( | Main * | bmain, |
| const char * | name ) |
Definition at line 1901 of file grease_pencil.cc.
References BKE_id_new(), and ID_GP.
Referenced by BKE_object_obdata_add_from_type(), and blender::ed::greasepencil::duplicate_grease_pencil_object().
Definition at line 2415 of file grease_pencil.cc.
References Brush::gpencil_settings, and BrushGpencilSettings::material.
Referenced by BKE_grease_pencil_object_material_ensure_from_brush(), and BKE_grease_pencil_object_material_from_brush_get().
| GreasePencil * BKE_grease_pencil_copy_for_eval | ( | const GreasePencil * | grease_pencil_src | ) |
Definition at line 1915 of file grease_pencil.cc.
References BKE_id_copy_ex(), GreasePencil::id, LIB_ID_COPY_LOCALIZE, and GreasePencil::runtime.
Referenced by blender::bke::GreasePencilComponent::copy(), blender::bke::GreasePencilComponent::ensure_owns_direct_data(), blender::geometry::execute_realize_grease_pencil_tasks(), blender::bke::GreasePencilComponent::get_for_write(), and blender::ed::object::object_convert_exec().
| void BKE_grease_pencil_copy_layer_group_parameters | ( | const blender::bke::greasepencil::LayerGroup & | src, |
| blender::bke::greasepencil::LayerGroup & | dst ) |
Definition at line 1961 of file grease_pencil.cc.
References blender::bke::greasepencil::LayerGroup::as_node(), GreasePencilLayerTreeNode::color, GreasePencilLayerTreeGroup::color_tag, copy_v3_v3_uchar(), and GreasePencilLayerTreeNode::flag.
Referenced by blender::ed::greasepencil::copy_layer_group_recursive(), and blender::ed::greasepencil::copy_layer_groups_without_layers().
| void BKE_grease_pencil_copy_layer_parameters | ( | const blender::bke::greasepencil::Layer & | src, |
| blender::bke::greasepencil::Layer & | dst ) |
Definition at line 1934 of file grease_pencil.cc.
References GreasePencilLayer::active_mask_index, blender::bke::greasepencil::Layer::as_node(), GreasePencilLayer::blend_mode, BLI_addtail(), GreasePencilLayerTreeNode::color, copy_m4_m4(), copy_v3_v3(), copy_v3_v3_uchar(), GreasePencilLayerTreeNode::flag, LISTBASE_FOREACH, GreasePencilLayer::masks, GreasePencilLayer::opacity, GreasePencilLayer::parent, GreasePencilLayer::parentinv, GreasePencilLayer::parsubstr, GreasePencilLayer::rotation, GreasePencilLayer::scale, blender::bke::greasepencil::Layer::set_parent_bone_name(), blender::bke::greasepencil::Layer::set_view_layer_name(), GreasePencilLayer::translation, and GreasePencilLayer::viewlayername.
Referenced by blender::ed::greasepencil::copy_layer(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_layers(), blender::geometry::execute_realize_grease_pencil_task(), and blender::ed::greasepencil::merge_layers().
| void BKE_grease_pencil_copy_parameters | ( | const GreasePencil & | src, |
| GreasePencil & | dst ) |
Copy everything except the layer tree and the drawings.
Definition at line 1923 of file grease_pencil.cc.
References GreasePencil::attributes_active_index, BLI_duplicatelist(), GreasePencil::flag, GreasePencil::material_array, GreasePencil::material_array_num, MEM_dupallocN, GreasePencil::onion_skinning_settings, GreasePencil::vertex_group_active_index, and GreasePencil::vertex_group_names.
Referenced by blender::nodes::node_geo_duplicate_elements_cc::duplicate_layers(), blender::geometry::execute_realize_grease_pencil_tasks(), blender::ed::greasepencil::grease_pencil_merge_layer_exec(), blender::geometry::separate_grease_pencil_layer_selection(), blender::ed::greasepencil::tests::TEST(), blender::ed::greasepencil::tests::TEST(), and blender::ed::greasepencil::tests::TEST().
Definition at line 2165 of file grease_pencil.cc.
References BKE_grease_pencil_new_nomain(), BKE_object_eval_assign_data(), BKE_object_free_derived_caches(), blender::bke::AttributeAccessor::contains(), DEG_get_ctime(), DEG_get_original_object(), depsgraph, blender::bke::GeometrySet::get_component_for_write(), blender::bke::GeometrySet::get_grease_pencil(), blender::bke::GeometrySet::get_grease_pencil_for_write(), grease_pencil_do_layer_adjustments(), blender::bke::GeometryComponentEditData::grease_pencil_edit_hints_, grease_pencil_evaluate_modifiers(), blender::bke::GeometrySet::has_grease_pencil(), GreasePencil::id, int, OB_MODE_EDIT, blender::bke::GeometrySet::replace_grease_pencil(), and GreasePencil::runtime.
Referenced by BKE_object_handle_data_update().
| bool BKE_grease_pencil_drawing_attribute_required | ( | const GreasePencilDrawing * | , |
| const char * | name ) |
Definition at line 1895 of file grease_pencil.cc.
References ATTR_POSITION, and STREQ.
Referenced by BKE_attribute_required().
| void BKE_grease_pencil_duplicate_drawing_array | ( | const GreasePencil * | grease_pencil_src, |
| GreasePencil * | grease_pencil_dst ) |
Definition at line 2215 of file grease_pencil.cc.
References blender::bke::greasepencil::copy_drawing_array(), GreasePencil::drawing_array, and GreasePencil::drawing_array_num.
Referenced by grease_pencil_copy_data(), and blender::geometry::separate_grease_pencil_layer_selection().
| void BKE_grease_pencil_material_index_remove | ( | GreasePencil * | grease_pencil, |
| int | index ) |
Definition at line 2505 of file grease_pencil.cc.
References blender::bke::CurvesGeometry::attributes_for_write(), BLI_assert, blender::bke::SpanAttributeWriter< T >::domain, blender::bke::SpanAttributeWriter< T >::finish(), GP_DRAWING, blender::bke::SpanAttributeWriter< T >::span, blender::bke::greasepencil::Drawing::strokes_for_write(), and wrap().
Referenced by material_data_index_remove_id().
| bool BKE_grease_pencil_material_index_used | ( | GreasePencil * | grease_pencil, |
| int | index ) |
Definition at line 2531 of file grease_pencil.cc.
References blender::bke::CurvesGeometry::attributes(), blender::Span< T >::contains(), GP_DRAWING, blender::bke::greasepencil::Drawing::strokes(), and wrap().
Referenced by BKE_object_material_slot_used().
| void BKE_grease_pencil_material_remap | ( | GreasePencil * | grease_pencil, |
| const uint * | remap, | ||
| int | totcol ) |
Definition at line 2480 of file grease_pencil.cc.
References blender::bke::CurvesGeometry::attributes_for_write(), BLI_assert, blender::bke::SpanAttributeWriter< T >::domain, blender::bke::SpanAttributeWriter< T >::finish(), GP_DRAWING, blender::bke::SpanAttributeWriter< T >::span, blender::bke::greasepencil::Drawing::strokes_for_write(), UNUSED_VARS_NDEBUG, and wrap().
Referenced by BKE_object_material_remap().
| GreasePencil * BKE_grease_pencil_new_nomain | ( | ) |
Definition at line 1908 of file grease_pencil.cc.
References BKE_id_new_nomain(), and ID_GP.
Referenced by BKE_grease_pencil_data_update(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curves_to_grease_pencil_with_one_layer(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_layers(), blender::geometry::execute_realize_grease_pencil_tasks(), blender::geometry::extract_greasepencil_layer_curves(), blender::geometry::extract_greasepencil_layer_points(), blender::geometry::extract_greasepencil_layers(), blender::ed::greasepencil::grease_pencil_merge_layer_exec(), blender::geometry::merge_layers(), blender::ed::object::object_convert_exec(), blender::geometry::separate_grease_pencil_layer_selection(), blender::ed::greasepencil::tests::TEST(), blender::ed::greasepencil::tests::TEST(), blender::ed::greasepencil::tests::TEST(), blender::ed::greasepencil::tests::TEST(), blender::ed::greasepencil::tests::TEST(), and blender::bke::bake::try_load_grease_pencil().
| void BKE_grease_pencil_nomain_to_grease_pencil | ( | GreasePencil * | grease_pencil_src, |
| GreasePencil * | grease_pencil_dst ) |
Move data from a grease pencil outside of the main data-base into a grease pencil in the data-base. Takes ownership of the source grease pencil.
Definition at line 1970 of file grease_pencil.cc.
References GreasePencil::active_node, BKE_id_free(), BLI_assert, CD_MASK_ALL, CustomData_free(), CustomData_init_from(), DEG_id_tag_update(), GreasePencil::drawing_array, GreasePencil::drawing_array_num, free_drawing_array(), GP_DRAWING, GP_DRAWING_REFERENCE, GreasePencil::id, ID_RECALC_GEOMETRY, GreasePencil::layers_data, GreasePencil::root_group_ptr, GreasePencilDrawingBase::type, and wrap().
Referenced by blender::ed::greasepencil::grease_pencil_merge_layer_exec(), and blender::ed::object::object_convert_exec().
Definition at line 2471 of file grease_pencil.cc.
References BKE_gpencil_material_attr_init(), BKE_grease_pencil_object_material_ensure_from_active_input_material(), and Material::gp_style.
| Material * BKE_grease_pencil_object_material_ensure_by_name | ( | Main * | bmain, |
| Object * | ob, | ||
| const char * | name, | ||
| int * | r_index ) |
Definition at line 2402 of file grease_pencil.cc.
References BKE_grease_pencil_object_material_index_get_by_name(), BKE_grease_pencil_object_material_new(), and BKE_object_material_get().
Referenced by blender::ed::greasepencil::add_material_from_template().
| Material * BKE_grease_pencil_object_material_ensure_from_active_input_brush | ( | Main * | bmain, |
| Object * | ob, | ||
| Brush * | brush ) |
Definition at line 2446 of file grease_pencil.cc.
References BKE_grease_pencil_object_material_ensure_from_active_input_material(), BKE_grease_pencil_object_material_ensure_from_brush(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, and Brush::gpencil_settings.
Referenced by blender::ed::sculpt_paint::grease_pencil_fill_init(), blender::ed::greasepencil::grease_pencil_primitive_invoke(), blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_begin(), and blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_done().
Definition at line 2463 of file grease_pencil.cc.
References Object::actcol, BKE_material_default_gpencil(), and BKE_object_material_get().
Referenced by BKE_grease_pencil_object_material_ensure_active(), and BKE_grease_pencil_object_material_ensure_from_active_input_brush().
| Material * BKE_grease_pencil_object_material_ensure_from_brush | ( | Main * | bmain, |
| Object * | ob, | ||
| Brush * | brush ) |
Definition at line 2426 of file grease_pencil.cc.
References Object::actcol, BKE_grease_pencil_brush_material_get(), BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_get(), BKE_object_material_index_get(), BKE_object_material_slot_add(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, Brush::gpencil_settings, and Object::totcol.
Referenced by BKE_grease_pencil_object_material_ensure_from_active_input_brush().
Definition at line 2390 of file grease_pencil.cc.
References Object::actcol, BKE_grease_pencil_brush_material_get(), BKE_object_material_get(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, and Brush::gpencil_settings.
Referenced by blender::ed::sculpt_paint::grease_pencil_brush_cursor_draw().
Definition at line 2359 of file grease_pencil.cc.
References BKE_object_material_get(), BKE_object_material_len_p(), Material::id, ID::name, and STREQ.
Referenced by BKE_grease_pencil_object_material_ensure_by_name(), and blender::io::grease_pencil::GreasePencilImporter::create_material().
| Material * BKE_grease_pencil_object_material_new | ( | Main * | bmain, |
| Object * | ob, | ||
| const char * | name, | ||
| int * | r_index ) |
Definition at line 2373 of file grease_pencil.cc.
References Object::actcol, BKE_gpencil_material_add(), BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_slot_add(), Material::id, id_us_min(), and Object::totcol.
Referenced by BKE_grease_pencil_object_material_ensure_by_name(), blender::ed::greasepencil::clipboard_materials_remap(), blender::io::grease_pencil::GreasePencilImporter::create_material(), and blender::ui::greasepencil::eyedropper_add_material().
| void BKE_grease_pencil_point_coords_apply | ( | GreasePencil & | grease_pencil, |
| GreasePencilPointCoordinates * | elem_data ) |
Definition at line 2290 of file grease_pencil.cc.
References GreasePencilPointCoordinates::co, GreasePencilFrame::drawing_index, GP_DRAWING, blender::math::invert(), blender::bke::greasepencil::Drawing::radii_for_write(), GreasePencilPointCoordinates::radius, blender::bke::greasepencil::Drawing::strokes_for_write(), blender::math::transform_point(), GreasePencilDrawingBase::type, and wrap().
Referenced by blender::ed::object::data_xform_restore().
| void BKE_grease_pencil_point_coords_apply_with_mat4 | ( | GreasePencil & | grease_pencil, |
| GreasePencilPointCoordinates * | elem_data, | ||
| const blender::float4x4 & | mat ) |
Definition at line 2320 of file grease_pencil.cc.
References GreasePencilPointCoordinates::co, GreasePencilFrame::drawing_index, GP_DRAWING, blender::math::invert(), mat4_to_scale(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), blender::bke::greasepencil::Drawing::radii_for_write(), GreasePencilPointCoordinates::radius, blender::bke::greasepencil::Drawing::strokes_for_write(), blender::math::transform_point(), GreasePencilDrawingBase::type, and wrap().
Referenced by blender::ed::object::data_xform_by_mat4().
| void BKE_grease_pencil_point_coords_get | ( | const GreasePencil & | grease_pencil, |
| GreasePencilPointCoordinates * | elem_data ) |
Definition at line 2260 of file grease_pencil.cc.
References GreasePencilPointCoordinates::co, copy_v3_v3(), GreasePencilFrame::drawing_index, GP_DRAWING, blender::bke::greasepencil::Drawing::radii(), GreasePencilPointCoordinates::radius, blender::bke::greasepencil::Drawing::strokes(), blender::math::transform_point(), GreasePencilDrawingBase::type, and wrap().
Referenced by blender::ed::object::data_xform_create_ex().
| bool BKE_grease_pencil_references_cyclic_check | ( | const GreasePencil * | id_reference, |
| const GreasePencil * | grease_pencil ) |
Definition at line 2576 of file grease_pencil.cc.
References grease_pencil_references_cyclic_check_internal().
| int BKE_grease_pencil_stroke_point_count | ( | const GreasePencil & | grease_pencil | ) |
Definition at line 2235 of file grease_pencil.cc.
References GreasePencilFrame::drawing_index, GP_DRAWING, blender::bke::CurvesGeometry::points_num(), blender::bke::greasepencil::Drawing::strokes(), GreasePencilDrawingBase::type, and wrap().
Referenced by blender::ed::object::data_xform_create_ex().
| void BKE_grease_pencil_vgroup_name_update | ( | Object * | ob, |
| const char * | old_name, | ||
| const char * | new_name ) |
Definition at line 2021 of file grease_pencil.cc.
References Object::data, LISTBASE_FOREACH, STRNCPY, blender::bke::greasepencil::Drawing::strokes_for_write(), and wrap().
Referenced by BKE_object_defgroup_set_name(), and ED_armature_bone_rename().