50 return td2d->loc2d_i && td2d->
h1 ==
nullptr;
94 const bool use_duplicates)
115 for (
const int frame_number : frames_affected) {
116 const bool was_duplicated = use_duplicates &&
129 if (!was_duplicated) {
140 for (
const auto [frame_number, frame] :
layer.frames().items()) {
141 if (frame.is_end()) {
169 const int src_frame_number,
170 const int dst_frame_number)
185 layer.tag_frames_map_keys_changed();
198 const int src_duration = 0 ;
200 layer.remove_frame(dst_frame_number);
213 const bool duplicate)
229 layer.frames_for_write().add_overwrite(frame_number, frame);
231 layer.tag_frames_map_keys_changed();
240 if (canceled && duplicate) {
274 int i, count = 0, count_all = 0;
276 if (
ELEM(
nullptr, fcu, fcu->
bezt)) {
281 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
293 if (is_prop_edit && count > 0) {
304 int count = 0, count_all = 0;
306 if (gpl ==
nullptr) {
320 if (is_prop_edit && count > 0) {
329 const bool is_prop_edit,
330 const bool use_duplicated)
332 if (
layer ==
nullptr) {
336 int count_selected = 0;
339 if (use_duplicated) {
341 count_selected +=
layer->runtime->trans_data_.duplicated_frames_buffer.size();
342 count_all += count_selected;
346 for (
const auto &[frame_number, frame] :
layer->frames().items()) {
350 if (frame.is_selected()) {
357 if (is_prop_edit && count_selected > 0) {
360 return count_selected;
366 int count = 0, count_all = 0;
368 if (masklay ==
nullptr) {
382 if (is_prop_edit && count > 0) {
392 float *time = bezt->
vec[1];
395 td2d->
loc[0] = *time;
397 td2d->
h1 = bezt->
vec[0];
398 td2d->
h2 = bezt->
vec[2];
456 if (
ELEM(
nullptr, fcu, fcu->
bezt)) {
460 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
464 if (is_prop_edit || (bezt->
f2 &
SELECT)) {
501 if (is_prop_edit || is_selected) {
540 const bool is_prop_edit,
542 const bool duplicate)
546 int total_trans_frames = 0;
547 bool any_frame_affected =
false;
550 const auto grease_pencil_frame_to_trans_data = [&](
const int frame_number,
551 const bool frame_selected) {
555 if ((!is_prop_edit && !frame_selected) || !
FrameOnMouseSide(side, frame_number, cfra)) {
567 if (frame_selected) {
581 total_trans_frames++;
583 frames_affected.
append(frame_number);
584 any_frame_affected =
true;
588 duplicate ? (
layer->runtime->trans_data_.duplicated_frames_buffer) :
layer->frames();
590 for (
const auto [frame_number, frame] : frame_map.
items()) {
591 grease_pencil_frame_to_trans_data(frame_number, frame.is_selected());
594 if (total_trans_frames == 0) {
595 return total_trans_frames;
600 if (any_frame_affected) {
605 return total_trans_frames;
626 td2d->loc2d_i = &masklay_shape.
frame;
657 float xsize, ysize, xmask, ymask;
670 xsize = ysize = xmask = ymask = 1.0f;
671 view_center_y = 0.0f;
675 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
681 const float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * view_center_y;
722 static_cast<Layer *
>(ale.data), t->
frame_side, cfra, is_prop_edit, use_duplicated);
777 gpf_count += ale_count;
785 if (count == 0 && gpf_count == 0) {
804 if (is_prop_edit && !ale.tag) {
882 const auto grease_pencil_closest_selected_frame = [&](
const int frame_number,
883 const bool frame_selected) {
884 if (frame_selected) {
890 int closest_selected =
INT_MAX;
891 for (
const auto [neighbor_frame_number, neighbor_frame] :
layer->frames().items()) {
892 if (!neighbor_frame.is_selected() ||
897 const int distance =
abs(neighbor_frame_number - frame_number);
898 closest_selected = std::min(closest_selected,
distance);
905 for (
const auto [frame_number, frame] :
layer->frames().items()) {
906 grease_pencil_closest_selected_frame(frame_number, frame.is_selected());
909 if (use_duplicated) {
911 for (
const auto [frame_number, frame] :
912 layer->runtime->trans_data_.duplicated_frames_buffer.items())
914 grease_pencil_closest_selected_frame(frame_number, frame.is_selected());
947 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
956 for (j = 0, bezt_iter = fcu->
bezt; j < fcu->totvert; j++, bezt_iter++) {
959 float val =
fabs(bezt->
vec[1][0] - bezt_iter->
vec[1][0]);
1003 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1011 ac.scene = t->
scene;
1032 for (td = tc->
data, td2d = tc->
data_2d; i < tc->data_len; i++, td++, td2d++) {
1107 *(
static_cast<bool *
>(thunk)) =
true;
1119 bool is_double =
false;
1124 for (masklay_shape = masklay.
splines_shapes.first(); masklay_shape;
1125 masklay_shape = masklay_shape_next)
1127 masklay_shape_next = masklay_shape->
next;
1128 if (masklay_shape_next && masklay_shape->
frame == masklay_shape_next->
frame) {
1135 for (masklay_shape = masklay.
splines_shapes.first(); masklay_shape;
1136 masklay_shape = masklay_shape->
next)
1155 bool is_double =
false;
1160 for (gpf = gpl.
frames.first(); gpf; gpf = gpfn) {
1169 for (gpf = gpl.
frames.first(); gpf; gpf = gpf->
next) {
1187 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1199 &ale,
static_cast<FCurve *
>(ale.key_data),
false,
false);
1204 &ale,
static_cast<FCurve *
>(ale.key_data),
true,
false);
1232 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1240 switch (ale.datatype) {
1274 BLI_assert_msg(
false,
"Keys cannot be transformed into this animation type.");
1313 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1319 switch (ale.datatype) {
1355 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1370 if (!grease_pencils_to_update.
is_empty()) {
Low-level operations for grease pencil.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
bool add_overwrite(const Key &key, const Value &value)
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
ItemIterator items() const &
void append(const T &value)
Span< T > as_span() const
float distance(float, float) RET
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
BLI_INLINE Texture * wrap(MTLTexture *texture)
void WM_main_add_notifier(uint type, void *reference)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
MINLINE void copy_v3_v3(float r[3], const float a[3])
ListBaseT< TimeMarker > * ED_context_get_markers(const bContext *C)
MINLINE int round_fl_to_int(float a)
MINLINE void copy_v2_v2(float r[2], const float a[2])
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
bool ANIM_nla_mapping_allowed(const bAnimListElem *ale)
@ ANIMTYPE_GREASE_PENCIL_LAYER_GROUP
@ ANIMTYPE_GREASE_PENCIL_DATABLOCK
@ ANIMTYPE_GREASE_PENCIL_LAYER
@ ANIMTYPE_FILLACT_LAYERED
@ ANIMTYPE_SPECIALDATA__UNUSED
bool ANIM_animdata_context_getdata(bAnimContext *ac)
void ANIM_nla_mapping_apply_if_needed_fcurve(bAnimListElem *ale, FCurve *fcu, const bool restore, const bool only_keys)
void BKE_fcurve_merge_duplicate_keys(FCurve *fcu, const int sel_flag, const bool use_handle)
void ANIM_id_update(Main *bmain, ID *id)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
void void void BLI_listbase_sort_r(ListBase *listbase, int(*cmp)(void *, const void *, const void *), void *thunk) ATTR_NONNULL(1
@ ANIMFILTER_DATA_VISIBLE
void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape)
void DEG_id_tag_update(ID *id, unsigned int flags)
void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void ANIM_editkeyframes_refresh(bAnimContext *ac)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Main * CTX_data_main(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void ANIM_animdata_freelist(ListBaseT< bAnimListElem > *anim_data)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
bool BKE_annotations_layer_frame_delete(struct bGPDlayer *gpl, struct bGPDframe *gpf)
void BKE_annotations_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames)
@ SACTION_NOREALTIMEUPDATES
Key * BKE_key_from_object(Object *ob)
int ED_markers_post_apply_transform(ListBaseT< TimeMarker > *markers, Scene *scene, int mode, float value, char side)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
GreasePencilDrawingType type
bke::greasepencil::DrawingRuntime * runtime
struct MaskLayerShape * next
ListBaseT< MaskLayerShape > splines_shapes
ListBaseT< SpaceLink > spacedata
ListBaseT< bGPDframe > frames
ListBaseT< bGPDlayer > layers