30#include "RNA_prototypes.hh"
43 : region_(®ion), view3d_(&
view3d)
45 layer_space_to_world_space_ = (layer !=
nullptr) ? layer->
to_world_space(eval_object) :
46 eval_object.object_to_world();
47 world_space_to_layer_space_ =
math::invert(layer_space_to_world_space_);
50 case GP_LOCKAXIS_VIEW:
51 plane_ = DrawingPlacementPlane::View;
54 plane_ = DrawingPlacementPlane::Front;
55 placement_normal_ = float3(0, 1, 0);
58 plane_ = DrawingPlacementPlane::Side;
59 placement_normal_ = float3(1, 0, 0);
62 plane_ = DrawingPlacementPlane::Top;
63 placement_normal_ = float3(0, 0, 1);
65 case GP_LOCKAXIS_CURSOR: {
66 plane_ = DrawingPlacementPlane::Cursor;
67 placement_normal_ = scene.cursor.matrix<float3x3>() * float3(0, 0, 1);
75 placement_normal_ = math::transform_direction(math::transpose(world_space_to_layer_space_),
80 const char align_flag = scene.toolsettings->gpencil_v3d_align;
84 surface_offset_ = 0.0f;
85 placement_loc_ =
float3(scene.cursor.location);
90 use_project_only_selected_ =
true;
92 surface_offset_ = scene.toolsettings->gpencil_surface_offset;
94 placement_loc_ = layer_space_to_world_space_.location();
98 surface_offset_ = 0.0f;
100 placement_loc_ = layer_space_to_world_space_.location();
104 surface_offset_ = 0.0f;
105 placement_loc_ = layer_space_to_world_space_.location();
110 surface_offset_ = 0.0f;
111 placement_loc_ =
float3(0.0f);
122 const Object &eval_object,
125 const float surface_offset,
129 depth_cache_(view_depths),
130 surface_offset_(surface_offset)
132 layer_space_to_world_space_ = (layer !=
nullptr) ? layer->
to_world_space(eval_object) :
133 eval_object.object_to_world();
134 world_space_to_layer_space_ =
math::invert(layer_space_to_world_space_);
136 switch (reproject_mode) {
142 placement_normal_ =
float3(0, 1, 0);
146 placement_normal_ =
float3(1, 0, 0);
150 placement_normal_ =
float3(0, 0, 1);
169 switch (reproject_mode) {
172 surface_offset_ = 0.0f;
177 surface_offset_ = 0.0f;
178 placement_loc_ = layer_space_to_world_space_.location();
182 placement_loc_ = layer_space_to_world_space_.location();
186 surface_offset_ = 0.0f;
187 placement_loc_ = layer_space_to_world_space_.location();
198 region_ = other.region_;
199 view3d_ = other.view3d_;
201 depth_ = other.depth_;
202 plane_ = other.plane_;
204 if (other.depth_cache_ !=
nullptr) {
208 use_project_only_selected_ = other.use_project_only_selected_;
210 surface_offset_ = other.surface_offset_;
212 placement_loc_ = other.placement_loc_;
213 placement_normal_ = other.placement_normal_;
214 placement_plane_ = other.placement_plane_;
216 layer_space_to_world_space_ = other.layer_space_to_world_space_;
217 world_space_to_layer_space_ = other.world_space_to_layer_space_;
222 region_ = other.region_;
223 view3d_ = other.view3d_;
225 depth_ = other.depth_;
226 plane_ = other.plane_;
228 std::swap(depth_cache_, other.depth_cache_);
229 use_project_only_selected_ = other.use_project_only_selected_;
231 surface_offset_ = other.surface_offset_;
233 placement_loc_ = other.placement_loc_;
234 placement_normal_ = other.placement_normal_;
235 placement_plane_ = other.placement_plane_;
237 layer_space_to_world_space_ = other.layer_space_to_world_space_;
238 world_space_to_layer_space_ = other.world_space_to_layer_space_;
243 if (
this == &other) {
246 std::destroy_at(
this);
253 if (
this == &other) {
256 std::destroy_at(
this);
263 if (depth_cache_ !=
nullptr) {
283 if (use_project_only_selected_) {
301 placement_loc_ = origin;
305 placement_loc_ = layer_space_to_world_space_.location();
310float3 DrawingPlacement::project_depth(
const float2 co)
const
318 proj_point -= view_normal * surface_offset_;
332 proj_point = this->project_depth(co);
350 proj_point = this->project_depth(co);
366 for (const int i : range) {
367 dst[i] = this->project(src[i]);
384 proj_point = this->project_depth(co);
402 plane = placement_plane_;
407 proj_point = world_pos + ray_no * lambda;
419 for (const int i : range) {
420 dst[i] = this->reproject(src[i]);
427 return layer_space_to_world_space_;
431 const int center_frame,
436 if (falloff_curve ==
nullptr) {
441 if (frame_number > center_frame) {
442 const float frame_factor = 0.5f *
float(center_frame - min_frame) / (frame_number - min_frame);
446 if (frame_number < center_frame) {
447 const float frame_factor = 0.5f *
float(center_frame - frame_number) /
448 (max_frame - frame_number);
456 const int current_frame)
459 int frame_min = current_frame;
460 int frame_max = current_frame;
463 const Layer &layer = *layers[layer_i];
464 if (!layer.is_editable()) {
467 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
468 if (frame_number != current_frame && frame.is_selected()) {
469 frame_min =
math::min(frame_min, frame_number);
470 frame_max =
math::max(frame_max, frame_number);
474 return std::pair<int, int>(frame_min, frame_max);
479 const int frame_number,
480 const int frame_index,
481 const int current_frame,
482 const int current_frame_index,
483 const int last_frame,
484 const int last_frame_index,
485 const bool use_multi_frame_editing,
486 const bool do_onion_skinning,
487 const bool is_before_first,
490 if (use_multi_frame_editing) {
491 if (frame.is_selected()) {
492 if (do_onion_skinning) {
493 return (frame_number < current_frame) ? -1 : 1;
499 if (do_onion_skinning && layer.use_onion_skinning()) {
501 if (onion_settings.
filter != 0 && (onion_settings.
filter & (1 << frame.
type)) == 0) {
511 delta = frame_number - current_frame;
514 delta = frame_index - current_frame_index;
517 if (is_before_first) {
530 shift = last_frame_index;
532 delta += (delta < 0) ? (shift + 1) : -(shift + 1);
551 const int current_frame,
552 const bool use_multi_frame_editing,
553 const bool do_onion_skinning)
562 const int last_frame = sorted_keys.
last();
564 const bool is_before_first = (current_frame < sorted_keys.
first());
565 const std::optional<int> current_start_frame = layer.
start_frame_at(current_frame);
566 for (
const int frame_i : sorted_keys.
index_range()) {
567 const int frame_number = sorted_keys[frame_i];
568 if (current_start_frame && *current_start_frame == frame_number) {
580 use_multi_frame_editing,
584 if (!frame_id.has_value()) {
589 frame_numbers.
append({frame_number, *frame_id});
592 frame_numbers.
append({current_frame, 0});
594 return frame_numbers.
as_span();
599 const int current_frame,
600 const bool use_multi_frame_editing)
605 if (use_multi_frame_editing) {
606 const Drawing *current_drawing = grease_pencil.get_drawing_at(layer, current_frame);
607 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
608 if (!frame.is_selected()) {
611 frame_numbers.
append(frame_number);
612 added_drawings.
add(grease_pencil.get_drawing_at(layer, frame_number));
614 if (added_drawings.
contains(current_drawing)) {
615 return frame_numbers.
as_span();
619 frame_numbers.
append(current_frame);
620 return frame_numbers.
as_span();
627 const int current_frame = scene.
r.
cfra;
629 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
635 const Layer &layer = *layers[layer_i];
636 if (!layer.is_editable()) {
640 grease_pencil, layer, current_frame, use_multi_frame_editing);
641 for (
const int frame_number : frame_numbers) {
642 if (
Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number)) {
643 editable_drawings.
append({*drawing, layer_i, frame_number, 1.0f});
648 return editable_drawings;
655 const int current_frame = scene.
r.
cfra;
657 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
659 const bool use_multi_frame_falloff = use_multi_frame_editing &&
663 std::pair<int, int> minmax_frame;
664 if (use_multi_frame_falloff) {
667 center_frame =
math::clamp(current_frame, minmax_frame.first, minmax_frame.second);
673 const Layer &layer = *layers[layer_i];
674 if (!layer.is_editable()) {
678 grease_pencil, layer, current_frame, use_multi_frame_editing);
679 for (
const int frame_number : frame_numbers) {
680 if (
Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number)) {
681 const float falloff = use_multi_frame_falloff ?
688 editable_drawings.
append({*drawing, layer_i, frame_number, falloff});
693 return editable_drawings;
700 int current_frame = scene.
r.
cfra;
702 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
704 const bool use_multi_frame_falloff = use_multi_frame_editing &&
707 if (use_multi_frame_falloff) {
713 int frame_min = current_frame, frame_max = current_frame;
715 if (use_multi_frame_editing) {
717 const Layer &layer = *layers[layer_i];
718 if (!layer.is_editable()) {
721 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
722 if (frame_number != current_frame && frame.is_selected()) {
723 selected_frames.
add(frame_number);
724 frame_min =
math::min(frame_min, frame_number);
725 frame_max =
math::max(frame_max, frame_number);
730 selected_frames.
add(current_frame);
734 if (use_multi_frame_falloff) {
736 for (
const int frame_number : selected_frames) {
747 const Layer &layer = *layers[layer_i];
748 if (!layer.is_editable()) {
752 if (use_multi_frame_editing) {
753 for (
const auto [frame_number, frame] : layer.
frames().
items()) {
754 Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number);
755 if (!frame.is_selected() || drawing ==
nullptr || added_drawings.
contains(drawing)) {
758 const int frame_group = selected_frames.
index_of(frame_number);
759 drawings_grouped_per_frame[frame_group].append(
760 {*drawing, layer_i, frame_number, falloff_per_selected_frame[frame_group]});
761 added_drawings.
add_new(drawing);
766 Drawing *current_drawing = grease_pencil.get_drawing_at(layer, current_frame);
767 if (current_drawing !=
nullptr && !added_drawings.
contains(current_drawing)) {
768 const int frame_group = selected_frames.
index_of(current_frame);
769 drawings_grouped_per_frame[frame_group].append(
770 {*current_drawing, layer_i, current_frame, falloff_per_selected_frame[frame_group]});
771 added_drawings.
add_new(current_drawing);
775 return drawings_grouped_per_frame;
784 const int current_frame = scene.
r.
cfra;
786 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
788 const int layer_index = *grease_pencil.get_layer_index(layer);
792 grease_pencil, layer, current_frame, use_multi_frame_editing);
793 for (
const int frame_number : frame_numbers) {
794 if (
Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number)) {
795 editable_drawings.
append({*drawing, layer_index, frame_number, 1.0f});
799 return editable_drawings;
808 const int current_frame = scene.
r.
cfra;
810 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
812 const bool use_multi_frame_falloff = use_multi_frame_editing &&
815 const int layer_index = *grease_pencil.get_layer_index(layer);
817 std::pair<int, int> minmax_frame;
818 if (use_multi_frame_falloff) {
821 center_frame =
math::clamp(current_frame, minmax_frame.first, minmax_frame.second);
826 grease_pencil, layer, current_frame, use_multi_frame_editing);
827 for (
const int frame_number : frame_numbers) {
828 if (
Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number)) {
829 const float falloff = use_multi_frame_falloff ?
836 editable_drawings.
append({*drawing, layer_index, frame_number, falloff});
840 return editable_drawings;
845 const bool do_onion_skinning)
848 const int current_frame = scene.
r.
cfra;
850 const bool use_multi_frame_editing = (toolsettings->
gpencil_flags &
856 const Layer &layer = *layers[layer_i];
857 if (!layer.is_visible()) {
861 grease_pencil, layer, current_frame, use_multi_frame_editing, do_onion_skinning);
862 for (
const auto &[frame_number, onion_id] : frames) {
863 if (
const Drawing *drawing = grease_pencil.get_drawing_at(layer, frame_number)) {
864 visible_drawings.
append({*drawing, layer_i, frame_number, onion_id});
869 return visible_drawings;
876 for (
const int mat_i :
IndexRange(
object.totcol)) {
879 if (material !=
nullptr && material->
gp_style !=
nullptr &&
883 editable_material_indices.
add_new(mat_i);
886 return editable_material_indices;
893 for (
const int mat_i :
IndexRange(
object.totcol)) {
895 if (material !=
nullptr && material->
gp_style !=
nullptr &&
898 hidden_material_indices.
add_new(mat_i);
901 return hidden_material_indices;
908 for (
const int mat_i :
IndexRange(
object.totcol)) {
910 if (material !=
nullptr && material->
gp_style !=
nullptr &&
913 fill_material_indices.
add_new(mat_i);
916 return fill_material_indices;
928 if (
object.totcol == 0) {
936 if (layer.ignore_locked_materials()) {
942 if (editable_material_indices.
is_empty()) {
950 if (editable_material_indices.
contains(0)) {
958 return editable_material_indices.
contains(materials[curve_i]);
969 object, drawing, layer_index, memory);
982 if (editable_strokes.
contains(0) && fill_material_indices.contains(0)) {
989 const int material_index = materials[curve_i];
990 return fill_material_indices.contains(material_index);
1004 if (editable_material_indices.
is_empty()) {
1015 if (editable_material_indices.
contains(0)) {
1016 return curves_range;
1023 const int material_index = materials[curve_i];
1024 if (material_index == mat_i) {
1025 return editable_material_indices.
contains(material_index);
1039 if (
object.totcol == 0) {
1047 if (layer.ignore_locked_materials()) {
1053 if (editable_material_indices.
is_empty()) {
1062 if (editable_material_indices.
contains(0)) {
1063 return points_range;
1070 return editable_material_indices.
contains(materials[point_i]);
1099 if (hidden_material_indices.
is_empty()) {
1112 const int material_index = materials[curve_i];
1113 return !hidden_material_indices.
contains(material_index);
1124 if (hidden_material_indices.
is_empty()) {
1135 if (
const std::optional<int> single_material = materials.
get_if_single()) {
1136 if (!hidden_material_indices.
contains(*single_material)) {
1137 return points_range;
1145 const int material_index = materials[point_i];
1146 return !hidden_material_indices.
contains(material_index);
1152 const int layer_index,
1172 object, drawing, layer_index, memory);
1176 const bool is_selected = selected_point[point_i] || selected_left[point_i] ||
1177 selected_right[point_i];
1179 return is_selected && is_bezier;
1187 const int layer_index,
1193 object, drawing, layer_index, memory);
1197 object, drawing, layer_index, memory);
1211 object, drawing, layer_index, memory);
1226 object, drawing, layer_index, memory);
1253 object, drawing, layer_index, memory);
1257 object, drawing, layer_index, memory);
1266 const bool keep_caps)
1272 int dst_points_num = 0;
1274 dst_points_num += src_transfer_data.size();
1276 if (dst_points_num == 0) {
1288 Array<int> src_pivot_point(src_curves_num, -1);
1289 Array<int> dst_interm_curves_offsets(src_curves_num + 1, 0);
1292 const IndexRange src_points = src_points_by_curve[src_curve];
1294 for (
const int src_point : src_points) {
1295 for (
const PointTransferData &dst_point_transfer : src_to_dst_points[src_point]) {
1296 if (dst_point_transfer.is_src_point) {
1297 dst_transfer_data[++dst_point] = dst_point_transfer;
1302 dst_transfer_data[++dst_point] = dst_point_transfer;
1307 if (src_cyclic[src_curve] && dst_point_transfer.is_cut) {
1308 src_pivot_point[src_curve] = dst_point;
1316 dst_interm_curves_offsets[src_curve + 1] = dst_point + 1;
1322 for (const int src_curve : src_curves) {
1323 const int pivot_point = src_pivot_point[src_curve];
1325 if (pivot_point == -1) {
1327 src_now_cyclic[src_curve] = src_cyclic[src_curve];
1335 src_now_cyclic[src_curve] = false;
1337 const int dst_interm_first = dst_interm_curves_offsets[src_curve];
1338 const int dst_interm_last = dst_interm_curves_offsets[src_curve + 1];
1339 std::rotate(dst_transfer_data.begin() + dst_interm_first,
1340 dst_transfer_data.begin() + pivot_point,
1341 dst_transfer_data.begin() + dst_interm_last);
1348 dst_curves_offset.
append(0);
1349 for (
int src_curve : src.curves_range()) {
1350 const IndexRange dst_points(dst_interm_curves_offsets[src_curve],
1351 dst_interm_curves_offsets[src_curve + 1] -
1352 dst_interm_curves_offsets[src_curve]);
1353 int length_of_current = 0;
1355 for (
int dst_point : dst_points) {
1357 if ((length_of_current > 0) && dst_transfer_data[dst_point].is_cut) {
1359 dst_curves_offset.
append(dst_point);
1360 dst_to_src_curve.
append(src_curve);
1361 length_of_current = 0;
1363 ++length_of_current;
1366 if (length_of_current != 0) {
1368 dst_curves_offset.
append(dst_points.one_after_last());
1369 dst_to_src_curve.
append(src_curve);
1372 const int dst_curves_num = dst_curves_offset.
size() - 1;
1373 if (dst_curves_num == 0) {
1375 return dst_transfer_data;
1379 dst.resize(dst_points_num, dst_curves_num);
1381 const OffsetIndices<int> dst_points_by_curve = dst.points_by_curve();
1384 const bke::AttributeAccessor src_attributes = src.attributes();
1385 bke::MutableAttributeAccessor dst_attributes = dst.attributes_for_write();
1394 if (src_cyclic.get_if_single().value_or(
true)) {
1396 src_now_cyclic.as_span(), dst_to_src_curve.as_span(), dst.cyclic_for_write());
1399 dst.update_curve_types();
1403 bke::SpanAttributeWriter<int8_t> dst_start_caps =
1405 bke::SpanAttributeWriter<int8_t> dst_end_caps =
1409 for (const int dst_curve : dst_curves) {
1410 const IndexRange dst_curve_points = dst_points_by_curve[dst_curve];
1411 const PointTransferData &start_point_transfer =
1412 dst_transfer_data[dst_curve_points.first()];
1413 const PointTransferData &end_point_transfer = dst_transfer_data[dst_curve_points.last()];
1415 if (start_point_transfer.is_cut) {
1416 dst_start_caps.span[dst_curve] = GP_STROKE_CAP_TYPE_FLAT;
1420 if (!end_point_transfer.is_src_end_point()) {
1421 dst_end_caps.span[dst_curve] = GP_STROKE_CAP_TYPE_FLAT;
1427 dst_end_caps.finish();
1435 using T = decltype(dummy);
1436 auto src_attr = attribute.src.typed<T>();
1437 auto dst_attr = attribute.dst.span.typed<T>();
1439 threading::parallel_for(dst.points_range(), 4096, [&](const IndexRange dst_points) {
1440 for (const int dst_point : dst_points) {
1441 const PointTransferData &point_transfer = dst_transfer_data[dst_point];
1442 if (point_transfer.is_src_point) {
1443 dst_attr[dst_point] = src_attr[point_transfer.src_point];
1446 dst_attr[dst_point] = bke::attribute_math::mix2<T>(
1447 point_transfer.factor,
1448 src_attr[point_transfer.src_point],
1449 src_attr[point_transfer.src_next_point]);
1458 return dst_transfer_data;
1465 const float pixel_radius)
1495 const float pressure,
1511 float opacity = brush->
alpha;
1520 const bool use_duplicate_previous_key)
1529 if (!grease_pencil.has_active_layer()) {
1536 if (brush ==
nullptr) {
1542 if (!active_layer.is_editable()) {
1548 bool inserted_keyframe =
false;
1550 *scene, grease_pencil, active_layer, use_duplicate_previous_key, inserted_keyframe))
1555 if (inserted_keyframe) {
1577 u_dir =
float3(1.0f, 0.0f, 0.0f);
1578 v_dir =
float3(0.0f, 0.0f, 1.0f);
1581 u_dir =
float3(0.0f, 1.0f, 0.0f);
1582 v_dir =
float3(0.0f, 0.0f, 1.0f);
1585 u_dir =
float3(1.0f, 0.0f, 0.0f);
1586 v_dir =
float3(0.0f, 1.0f, 0.0f);
1590 u_dir = mat *
float3(1.0f, 0.0f, 0.0f);
1591 v_dir = mat *
float3(0.0f, 1.0f, 0.0f);
1606 if (grease_pencil ==
nullptr) {
1609 grease_pencil =
static_cast<GreasePencil *
>(
object->data);
1612 return grease_pencil;
bool BKE_brush_use_alpha_pressure(const Brush *brush)
bool BKE_brush_use_size_pressure(const Brush *brush)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
Paint * BKE_paint_get_active_from_context(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, bool clip)
@ GP_ONION_SKINNING_MODE_ABSOLUTE
@ GP_ONION_SKINNING_MODE_SELECTED
@ GP_ONION_SKINNING_MODE_RELATIVE
@ GP_ONION_SKINNING_SHOW_LOOP
Object is a sort of wrapper for general info.
@ GP_SCULPT_SETT_FLAG_FRAME_FALLOFF
@ GP_PROJECT_DEPTH_STROKE
@ GP_PROJECT_DEPTH_ONLY_SELECTED
@ GP_USE_MULTI_FRAME_EDITING
bool ED_view3d_depth_read_cached(const ViewDepths *vd, const int mval[2], int margin, float *r_depth)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
void ED_view3d_win_to_3d(const View3D *v3d, const ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
void ED_view3d_win_to_3d_with_shift(const View3D *v3d, const ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
void ED_view3d_depths_free(ViewDepths *depths)
@ V3D_DEPTH_SELECTED_ONLY
bool ED_view3d_win_to_3d_on_plane(const ARegion *region, const float plane[4], const float mval[2], bool do_clip, float r_out[3])
void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float r_out[3])
bool ED_view3d_depth_unproject_v3(const ARegion *region, const int mval[2], double depth, float r_location_world[3])
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
BPy_StructRNA * depsgraph
const Value & lookup(const Key &key) const
ItemIterator items() const
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_intersection(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
constexpr int64_t last(const int64_t n=0) const
bool contains(const Key &key) const
void add_new(const Key &key)
constexpr const T & first() const
constexpr const T & last(const int64_t n=0) const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
std::optional< T > get_if_single() const
int64_t index_of(const Key &key) const
void add_new(const Key &key)
bool contains(const Key &key) const
void append(const T &value)
Span< T > as_span() const
GAttributeReader lookup(const StringRef attribute_id) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
OffsetIndices< int > points_by_curve() const
IndexRange curves_range() const
IndexRange points_range() const
void resize(int points_num, int curves_num)
VArray< bool > cyclic() const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
const bke::CurvesGeometry & strokes() const
int sorted_keys_index_at(int frame_number) const
float4x4 to_world_space(const Object &object) const
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
std::optional< int > start_frame_at(int frame_number) const
Span< FramesMapKeyT > sorted_keys() const
DrawingPlacement & operator=(const DrawingPlacement &other)
bool use_project_to_surface() const
void set_origin_to_nearest_stroke(float2 co)
void cache_viewport_depths(Depsgraph *depsgraph, ARegion *region, View3D *view3d)
float3 project(float2 co) const
bool use_project_to_nearest_stroke() const
float4x4 to_world_space() const
float3 project_with_shift(float2 co) const
DrawingPlacement()=default
float3 reproject(float3 pos) const
bool contains(int64_t query_index) const
draw_view in_light_buf[] float
void *(* MEM_dupallocN)(const void *vmemh)
void copy(const GVArray &src, GMutableSpan dst, int64_t grain_size=4096)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
Vector< AttributeTransferData > retrieve_attributes_for_transfer(const AttributeAccessor src_attributes, MutableAttributeAccessor dst_attributes, AttrDomainMask domain_mask, const AttributeFilter &attribute_filter={})
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
IndexMask retrieve_editable_and_selected_elements(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, const bke::AttrDomain selection_domain, IndexMaskMemory &memory)
IndexMask retrieve_editable_and_selected_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
int grease_pencil_draw_operator_invoke(bContext *C, wmOperator *op, const bool use_duplicate_previous_key)
static Array< int > get_editable_frames_for_layer(const GreasePencil &grease_pencil, const bke::greasepencil::Layer &layer, const int current_frame, const bool use_multi_frame_editing)
static std::optional< int > get_frame_id(const bke::greasepencil::Layer &layer, const GreasePencilFrame &frame, const int frame_number, const int frame_index, const int current_frame, const int current_frame_index, const int last_frame, const int last_frame_index, const bool use_multi_frame_editing, const bool do_onion_skinning, const bool is_before_first, const GreasePencilOnionSkinningSettings onion_settings)
IndexMask retrieve_editable_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
bool ensure_active_keyframe(const Scene &scene, GreasePencil &grease_pencil, bke::greasepencil::Layer &layer, const bool duplicate_previous_key, bool &r_inserted_keyframe)
GreasePencil * from_context(bContext &C)
IndexMask retrieve_editable_fill_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
float opacity_from_input_sample(const float pressure, const Brush *brush, const BrushGpencilSettings *settings)
IndexMask retrieve_editable_elements(Object &object, const MutableDrawingInfo &info, const bke::AttrDomain selection_domain, IndexMaskMemory &memory)
IndexMask retrieve_visible_bezier_handle_points(Object &object, const bke::greasepencil::Drawing &drawing, const int layer_index, IndexMaskMemory &memory)
static float get_multi_frame_falloff(const int frame_number, const int center_frame, const int min_frame, const int max_frame, const CurveMapping *falloff_curve)
bke::CurvesGeometry fill_strokes(const ViewContext &view_context, const Brush &brush, const Scene &scene, const bke::greasepencil::Layer &layer, const VArray< bool > &boundary_layers, Span< DrawingInfo > src_drawings, bool invert, const std::optional< float > alpha_threshold, const float2 &fill_point, const ExtensionData &extensions, FillToolFitMethod fit_method, int stroke_material_index, bool keep_images)
IndexMask retrieve_visible_points(Object &object, const bke::greasepencil::Drawing &drawing, IndexMaskMemory &memory)
Vector< DrawingInfo > retrieve_visible_drawings(const Scene &scene, const GreasePencil &grease_pencil, const bool do_onion_skinning)
float radius_from_input_sample(const RegionView3D *rv3d, const ARegion *region, const Brush *brush, const float pressure, const float3 location, const float4x4 to_world, const BrushGpencilSettings *settings)
IndexMask retrieve_editable_strokes_by_material(Object &object, const bke::greasepencil::Drawing &drawing, const int mat_i, IndexMaskMemory &memory)
IndexMask retrieve_editable_and_selected_fill_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static std::pair< int, int > get_minmax_selected_frame_numbers(const GreasePencil &grease_pencil, const int current_frame)
static float pixel_radius_to_world_space_radius(const RegionView3D *rv3d, const ARegion *region, const float3 center, const float4x4 to_world, const float pixel_radius)
static float brush_radius_at_location(const RegionView3D *rv3d, const ARegion *region, const Brush *brush, const float3 location, const float4x4 to_world)
static Array< std::pair< int, int > > get_visible_frames_for_layer(const GreasePencil &grease_pencil, const bke::greasepencil::Layer &layer, const int current_frame, const bool use_multi_frame_editing, const bool do_onion_skinning)
Array< PointTransferData > compute_topology_change(const bke::CurvesGeometry &src, bke::CurvesGeometry &dst, const Span< Vector< PointTransferData > > src_to_dst_points, const bool keep_caps)
IndexMask retrieve_editable_and_selected_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static VectorSet< int > get_editable_material_indices(Object &object)
static VectorSet< int > get_fill_material_indices(Object &object)
static VectorSet< int > get_hidden_material_indices(Object &object)
Vector< MutableDrawingInfo > retrieve_editable_drawings_from_layer(const Scene &scene, GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &layer)
IndexMask retrieve_visible_strokes(Object &object, const bke::greasepencil::Drawing &drawing, IndexMaskMemory &memory)
Vector< MutableDrawingInfo > retrieve_editable_drawings_from_layer_with_falloff(const Scene &scene, GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &layer)
IndexMask retrieve_visible_bezier_handle_elements(Object &object, const bke::greasepencil::Drawing &drawing, const int layer_index, const bke::AttrDomain selection_domain, IndexMaskMemory &memory)
Vector< MutableDrawingInfo > retrieve_editable_drawings_with_falloff(const Scene &scene, GreasePencil &grease_pencil)
IndexMask retrieve_editable_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
Vector< MutableDrawingInfo > retrieve_editable_drawings(const Scene &scene, GreasePencil &grease_pencil)
float4x2 calculate_texture_space(const Scene *scene, const ARegion *region, const float2 &mouse, const DrawingPlacement &placement)
Array< Vector< MutableDrawingInfo > > retrieve_editable_drawings_grouped_per_frame(const Scene &scene, GreasePencil &grease_pencil)
constexpr double inv_sqrt3
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
T clamp(const T &a, const T &min, const T &max)
T safe_divide(const T &a, const T &b)
T length(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T min(const T &a, const T &b)
CartesianBasis invert(const CartesianBasis &basis)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T max(const T &a, const T &b)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
MatBase< float, 4, 4 > float4x4
MatBase< float, 2, 4 > float2x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
MatBase< float, 4, 2 > float4x2
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
struct CurveMapping * curve_sensitivity
struct CurveMapping * curve_strength
struct CurveMapping * cur_falloff
int16_t num_frames_before
GreasePencilOnionSkinningSettings onion_skinning_settings
struct MaterialGPencilStyle * gp_style
struct ToolSettings * toolsettings
bke::greasepencil::Drawing & drawing
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)