59 const float mtx[3][3],
60 const float smtx[3][3],
64 float *loc = bezt->
vec[bi];
65 const float *cent = bezt->
vec[1];
76 td2d->
loc[1] = (loc[1] + offset) * unit_scale;
82 td->
center[1] = (cent[1] + offset) * unit_scale;
88 td2d->
loc[0] = loc[0];
89 td2d->
loc[1] = (loc[1] + offset) * unit_scale;
100 td2d->
h1 = bezt->
vec[0];
101 td2d->
h2 = bezt->
vec[2];
183 const bool use_handle,
186 bool *r_right_handle)
189 bool key = (bezt->
f2 &
SELECT) != 0;
190 bool left = use_handle ? ((bezt->
f1 &
SELECT) != 0) : key;
191 bool right = use_handle ? ((bezt->
f3 &
SELECT) != 0) : key;
208 *r_left_handle = left;
209 *r_right_handle = right;
217 bool sel_key, sel_left, sel_right;
220 for (; j < fcu->
totvert; j++) {
225 if (sel_left || sel_key || sel_right) {
257 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
262 float mtx[3][3], smtx[3][3];
267 bool sel_key, sel_left, sel_right;
300 if (!visited_fcurves.
add(fcu)) {
303 unique_fcu_anim_list_elements.
append(&ale);
305 bool selected =
false;
308 if (fcu->
bezt ==
nullptr) {
316 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
324 if (sel_key || sel_left || sel_right) {
338 if (sel_key && !use_local_center) {
381 float xscale, yscale;
391 if (
IS_EQF(xscale, 0.0f) == 0) {
394 if (
IS_EQF(yscale, 0.0f) == 0) {
399 bool at_least_one_key_selected =
false;
405 float unit_scale, offset;
408 if (fcu->
bezt ==
nullptr || (is_prop_edit && ale->tag == 0)) {
417 ac.
scene, ale->
id,
static_cast<FCurve *
>(ale->key_data), anim_map_flag, &offset);
419 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
431 at_least_one_key_selected |= sel_key;
433 bool is_sel = (sel_key || sel_left || sel_right);
507 if (hdata ==
nullptr) {
527 if (sel_key && !use_local_center) {
539 if (!(sel_left) || !(sel_right)) {
540 if (hdata ==
nullptr) {
570 if (hdata && (sel_left) && (sel_right)) {
592 if (fcu->
bezt ==
nullptr || (ale->tag == 0)) {
601 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
615 if (sel_left || sel_key || sel_right) {
626 (td + 1)->dist = (td + 1)->rdist = dist;
627 (td + 2)->dist = (td + 2)->rdist = dist;
653 if (bezt ==
nullptr) {
657 for (i = 0; i < fcu->
totvert; i++, bezt++) {
696 a++, td++, td2d++, tdg++)
701 float inv_unit_scale = 1.0f / tdg->
unit_scale;
709 const float presnap_loc = td2d->
loc[0];
719 td2d->loc2d[0] = td2d->
loc[0];
728 key_snap_time_offset[a] = td2d->loc2d[0] - presnap_loc2d;
733 td2d->loc2d[1] =
floorf(td2d->
loc[1] * inv_unit_scale - tdg->
offset + 0.5f);
736 td2d->loc2d[1] = td2d->
loc[1] * inv_unit_scale - tdg->
offset;
748 for (a = 0, td = tc->
data, td2d = tc->
data_2d; a < tc->data_len; a++, td++, td2d++) {
749 const float offset = key_snap_time_offset[a];
750 if (offset == 0.0f) {
754 td2d->
h1[0] += offset;
757 td2d->
h2[0] += offset;
777 if (totvert == 0 || bezts ==
nullptr) {
801 bezm.swap_handles = (bezm.bezt->vec[0][0] > bezm.bezt->vec[1][0] &&
802 bezm.bezt->vec[2][0] < bezm.bezt->vec[1][0]);
806 const int bezms_size = bezms.
size();
807 if (bezms_size < 2) {
816 for (
const int i : bezm_range) {
819 if (bezm->
bezt->
vec[1][0] > (bezm + 1)->bezt->vec[1][0]) {
820 std::swap(*bezm, *(bezm + 1));
830 const bool swap_handles)
853 const BeztMap &bezm = bezms[new_index];
863 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[0])) {
864 td2d = &tc->
data_2d[*trans_data_index];
866 td2d->loc2d = fcu->
bezt[new_index].
vec[2];
869 td2d->loc2d = fcu->
bezt[new_index].
vec[0];
871 td = &tc->
data[*trans_data_index];
874 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[2])) {
875 td2d = &tc->
data_2d[*trans_data_index];
877 td2d->loc2d = fcu->
bezt[new_index].
vec[0];
880 td2d->loc2d = fcu->
bezt[new_index].
vec[2];
882 td = &tc->
data[*trans_data_index];
885 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[1])) {
886 td2d = &tc->
data_2d[*trans_data_index];
887 td2d->loc2d = fcu->
bezt[new_index].
vec[1];
896 td = &tc->
data[*trans_data_index];
916 for (
int i = 0; i < tc->
data_len; i++) {
924 for (const int i : range) {
925 FCurve *fcu = fcurves[i];
933 Vector<BeztMap> bezms = bezt_to_beztmaps(fcu->bezt, fcu->totvert);
934 sort_time_beztmaps(bezms);
935 update_transdata_bezt_pointers(tc, trans_data_map, fcu, bezms);
939 sort_time_fcurve(*fcu);
941 testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle);
951 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
992 unsorted_fcurves.
append(fcu);
1006 if (!unsorted_fcurves.
is_empty()) {
1035 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
#define BEZT_ISSEL_ANY(bezt)
Read Blender memory allocation and freeing.
constexpr IndexRange drop_back(int64_t n) const
const Value * lookup_ptr(const Key &key) const
bool add(const Key &key, const Value &value)
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr IndexRange index_range() const
void append(const T &value)
IndexRange index_range() const
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
void view2d_scale_get(const View2D *v2d, float *r_x, float *r_y)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, bool use_handle)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
@ V3D_AROUND_LOCAL_ORIGINS
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
void BKE_fcurve_handles_recalc_ex(FCurve &fcu, eBezTriple_Flag handle_sel_flag)
bool ANIM_nla_mapping_allowed(const bAnimListElem *ale)
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)
MINLINE void mul_v3_fl(float r[3], float f)
void BKE_fcurve_merge_duplicate_keys(FCurve *fcu, const int sel_flag, const bool use_handle)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
void ANIM_editkeyframes_refresh(bAnimContext *ac)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT
Main * CTX_data_main(const bContext *C)
void unit_m3(float m[3][3])
void ANIM_animdata_freelist(ListBaseT< bAnimListElem > *anim_data)
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
bool test_time_fcurve(FCurve &fcu)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
short ANIM_get_normalization_flags(SpaceLink *space_link)
ListBaseT< SpaceLink > spacedata
SpaceGraph_Runtime runtime