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 ListBase 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) {
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);
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)) {
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) {
686 a++, td++, td2d++, tdg++)
691 float inv_unit_scale = 1.0f / tdg->
unit_scale;
736 if (totvert == 0 || bezts ==
nullptr) {
760 bezm.swap_handles = (bezm.bezt->vec[0][0] > bezm.bezt->vec[1][0] &&
761 bezm.bezt->vec[2][0] < bezm.bezt->vec[1][0]);
765 const int bezms_size = bezms.
size();
766 if (bezms_size < 2) {
775 for (
const int i : bezm_range) {
778 if (bezm->
bezt->
vec[1][0] > (bezm + 1)->bezt->vec[1][0]) {
779 std::swap(*bezm, *(bezm + 1));
789 const bool swap_handles)
812 const BeztMap &bezm = bezms[new_index];
822 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[0])) {
823 td2d = &tc->
data_2d[*trans_data_index];
830 td = &tc->
data[*trans_data_index];
833 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[2])) {
834 td2d = &tc->
data_2d[*trans_data_index];
841 td = &tc->
data[*trans_data_index];
844 if (
const int *trans_data_index = trans_data_map.
lookup_ptr(bezm.
bezt->
vec[1])) {
845 td2d = &tc->
data_2d[*trans_data_index];
855 td = &tc->
data[*trans_data_index];
883 for (const int i : range) {
884 FCurve *fcu = fcurves[i];
892 Vector<BeztMap> bezms = bezt_to_beztmaps(fcu->bezt, fcu->totvert);
893 sort_time_beztmaps(bezms);
894 update_transdata_bezt_pointers(tc, trans_data_map, fcu, bezms);
898 sort_time_fcurve(fcu);
900 testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle);
910 ListBase anim_data = {
nullptr,
nullptr};
951 unsorted_fcurves.
append(fcu);
994 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