Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_action.c
| Show All 10 Lines | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_rect.h" | #include "BLI_rect.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_fcurve.h" | |||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_mask.h" | #include "BKE_mask.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "ED_anim_api.h" | #include "ED_anim_api.h" | ||||
| #include "ED_keyframes_edit.h" | #include "ED_keyframes_edit.h" | ||||
| ▲ Show 20 Lines • Show All 718 Lines • ▼ Show 20 Lines | static void posttrans_action_clean(bAnimContext *ac, bAction *act) | ||||
| /* loop through relevant data, removing keyframes as appropriate | /* loop through relevant data, removing keyframes as appropriate | ||||
| * - all keyframes are converted in/out of global time | * - all keyframes are converted in/out of global time | ||||
| */ | */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| AnimData *adt = ANIM_nla_mapping_get(ac, ale); | AnimData *adt = ANIM_nla_mapping_get(ac, ale); | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); | ||||
| posttrans_fcurve_clean(ale->key_data, SELECT, false); /* only use handles in graph editor */ | BKE_fcurve_merge_duplicate_keys( | ||||
| ale->key_data, SELECT, false); /* only use handles in graph editor */ | |||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| posttrans_fcurve_clean(ale->key_data, SELECT, false); /* only use handles in graph editor */ | BKE_fcurve_merge_duplicate_keys( | ||||
| ale->key_data, SELECT, false); /* only use handles in graph editor */ | |||||
| } | } | ||||
| } | } | ||||
| /* free temp data */ | /* free temp data */ | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| static void special_aftertrans_update__actedit(bContext *C, TransInfo *t) | static void special_aftertrans_update__actedit(bContext *C, TransInfo *t) | ||||
| Show All 35 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| * 2) canceled == 0 -> user confirmed the transform, | * 2) canceled == 0 -> user confirmed the transform, | ||||
| * so duplicates should be removed | * so duplicates should be removed | ||||
| * 3) canceled + duplicate -> user canceled the transform, | * 3) canceled + duplicate -> user canceled the transform, | ||||
| * but we made duplicates, so get rid of these | * but we made duplicates, so get rid of these | ||||
| */ | */ | ||||
| if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && ((canceled == 0) || (duplicate))) { | if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && ((canceled == 0) || (duplicate))) { | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0); | ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0); | ||||
| posttrans_fcurve_clean(fcu, SELECT, false); /* only use handles in graph editor */ | BKE_fcurve_merge_duplicate_keys( | ||||
| fcu, SELECT, false); /* only use handles in graph editor */ | |||||
| ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0); | ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| posttrans_fcurve_clean(fcu, SELECT, false); /* only use handles in graph editor */ | BKE_fcurve_merge_duplicate_keys( | ||||
| fcu, SELECT, false); /* only use handles in graph editor */ | |||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| BLI_assert_msg(false, "Keys cannot be transformed into this animation type."); | BLI_assert_msg(false, "Keys cannot be transformed into this animation type."); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines | |||||