Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_anim.c
| Show All 27 Lines | |||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utf8.h" | #include "BLI_string_utf8.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_animsys.h" | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_fcurve_driver.h" | #include "BKE_fcurve_driver.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| Show All 16 Lines | static FCurve *ui_but_get_fcurve( | ||||
| /* for entire array buttons we check the first component, it's not perfect | /* for entire array buttons we check the first component, it's not perfect | ||||
| * but works well enough in typical cases */ | * but works well enough in typical cases */ | ||||
| int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; | int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; | ||||
| return BKE_fcurve_find_by_rna_context_ui( | return BKE_fcurve_find_by_rna_context_ui( | ||||
| but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven, r_special); | but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven, r_special); | ||||
| } | } | ||||
| void ui_but_anim_flag(uiBut *but, float cfra) | void ui_but_anim_flag(uiBut *but, const AnimationEvalContext *anim_eval_context) | ||||
| { | { | ||||
| AnimData *adt; | AnimData *adt; | ||||
| bAction *act; | bAction *act; | ||||
| FCurve *fcu; | FCurve *fcu; | ||||
| bool driven; | bool driven; | ||||
| bool special; | bool special; | ||||
| but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN); | but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN); | ||||
| Show All 13 Lines | if (!driven) { | ||||
| } | } | ||||
| but->flag |= UI_BUT_ANIMATED; | but->flag |= UI_BUT_ANIMATED; | ||||
| /* T41525 - When the active action is a NLA strip being edited, | /* T41525 - When the active action is a NLA strip being edited, | ||||
| * we need to correct the frame number to "look inside" the | * we need to correct the frame number to "look inside" the | ||||
| * remapped action | * remapped action | ||||
| */ | */ | ||||
| float cfra = anim_eval_context->eval_time; | |||||
| if (adt) { | if (adt) { | ||||
| cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); | cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); | ||||
| } | } | ||||
| if (fcurve_frame_has_keyframe(fcu, cfra, 0)) { | if (fcurve_frame_has_keyframe(fcu, cfra, 0)) { | ||||
| but->flag |= UI_BUT_ANIMATED_KEY; | but->flag |= UI_BUT_ANIMATED_KEY; | ||||
| } | } | ||||
| /* XXX: this feature is totally broken and useless with NLA */ | /* XXX: this feature is totally broken and useless with NLA */ | ||||
| if (adt == NULL || adt->nla_tracks.first == NULL) { | if (adt == NULL || adt->nla_tracks.first == NULL) { | ||||
| if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra)) { | const AnimationEvalContext remapped_context = BKE_animsys_eval_context_construct_at( | ||||
| anim_eval_context, cfra); | |||||
| if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, &remapped_context)) { | |||||
| but->drawflag |= UI_BUT_ANIMATED_CHANGED; | but->drawflag |= UI_BUT_ANIMATED_CHANGED; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| but->flag |= UI_BUT_DRIVEN; | but->flag |= UI_BUT_DRIVEN; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines | |||||