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];
184 const bool use_handle,
187 bool *r_right_handle)
190 bool key = (bezt->
f2 &
SELECT) != 0;
191 bool left = use_handle ? ((bezt->
f1 &
SELECT) != 0) : key;
192 bool right = use_handle ? ((bezt->
f3 &
SELECT) != 0) : key;
209 *r_left_handle =
left;
210 *r_right_handle = right;
218 bool sel_key, sel_left, sel_right;
221 for (; j < fcu->
totvert; j++) {
226 if (sel_left || sel_key || sel_right) {
258 ListBase anim_data = {
nullptr,
nullptr};
263 float mtx[3][3], smtx[3][3];
268 bool sel_key, sel_left, sel_right;
301 if (!visited_fcurves.
add(fcu)) {
304 unique_fcu_anim_list_elements.
append(ale);
306 bool selected =
false;
309 if (fcu->
bezt ==
nullptr) {
325 if (sel_key || sel_left || sel_right) {
339 if (sel_key && !use_local_center) {
382 float xscale, yscale;
392 if (
IS_EQF(xscale, 0.0f) == 0) {
395 if (
IS_EQF(yscale, 0.0f) == 0) {
400 bool at_least_one_key_selected =
false;
406 float unit_scale, offset;
409 if (fcu->
bezt ==
nullptr || (is_prop_edit && ale->tag == 0)) {
418 ac.
scene, ale->
id,
static_cast<FCurve *
>(ale->key_data), anim_map_flag, &offset);
432 at_least_one_key_selected |= sel_key;
434 bool is_sel = (sel_key || sel_left || sel_right);
508 if (hdata ==
nullptr) {
528 if (sel_key && !use_local_center) {
540 if (!(sel_left) || !(sel_right)) {
541 if (hdata ==
nullptr) {
571 if (hdata && (sel_left) && (sel_right)) {
593 if (fcu->
bezt ==
nullptr || (ale->tag == 0)) {
616 if (sel_left || sel_key || sel_right) {
627 (td + 1)->dist = (td + 1)->rdist = dist;
628 (td + 2)->dist = (td + 2)->rdist = dist;
654 if (bezt ==
nullptr) {
687 a++, td++, td2d++, tdg++)
692 float inv_unit_scale = 1.0f / tdg->
unit_scale;
737 if (totvert == 0 || bezts ==
nullptr) {
761 bezm.swap_handles = (bezm.bezt->vec[0][0] > bezm.bezt->vec[1][0] &&
762 bezm.bezt->vec[2][0] < bezm.bezt->vec[1][0]);
766 const int bezms_size = bezms.
size();
767 if (bezms_size < 2) {
776 for (
const int i : bezm_range) {
779 if (bezm->
bezt->
vec[1][0] > (bezm + 1)->bezt->vec[1][0]) {
780 std::swap(*bezm, *(bezm + 1));
790 const bool swap_handles)
813 const BeztMap &bezm = bezms[new_index];
823 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[0])) {
824 td2d = &tc->
data_2d[*trans_data_index];
831 td = &tc->
data[*trans_data_index];
834 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[2])) {
835 td2d = &tc->
data_2d[*trans_data_index];
842 td = &tc->
data[*trans_data_index];
845 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[1])) {
846 td2d = &tc->
data_2d[*trans_data_index];
856 td = &tc->
data[*trans_data_index];
884 for (const int i : range) {
885 FCurve *fcu = fcurves[i];
893 Vector<BeztMap> bezms = bezt_to_beztmaps(fcu->bezt, fcu->totvert);
894 sort_time_beztmaps(bezms);
895 update_transdata_bezt_pointers(tc, trans_data_map, fcu, bezms);
899 sort_time_fcurve(fcu);
901 testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle);
911 ListBase anim_data = {
nullptr,
nullptr};
952 unsorted_fcurves.
append(fcu);
995 ListBase anim_data = {
nullptr,
nullptr};
Main * CTX_data_main(const bContext *C)
void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, bool use_handle)
bool test_time_fcurve(FCurve *fcu)
void BKE_fcurve_handles_recalc_ex(FCurve *fcu, eBezTriple_Flag handle_sel_flag)
void BKE_fcurve_merge_duplicate_keys(FCurve *fcu, const int sel_flag, const bool use_handle)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
#define LISTBASE_FOREACH(type, var, list)
MINLINE float min_fff(float a, float b, float c)
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void unit_m3(float m[3][3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define BEZT_ISSEL_ANY(bezt)
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT
@ V3D_AROUND_LOCAL_ORIGINS
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
Read Guarded memory(de)allocation.
void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y)
void ANIM_animdata_freelist(ListBase *anim_data)
void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
short ANIM_get_normalization_flags(SpaceLink *space_link)
void ANIM_nla_mapping_apply_if_needed_fcurve(bAnimListElem *ale, FCurve *fcu, const bool restore, const bool only_keys)
bool ANIM_nla_mapping_allowed(const bAnimListElem *ale)
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
bool ANIM_animdata_context_getdata(bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
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
void ANIM_editkeyframes_refresh(bAnimContext *ac)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
ccl_device_inline float2 fabs(const float2 a)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
SpaceGraph_Runtime runtime