static int actkeys_clean_exec(bContext *C, wmOperator *op) { bAnimContext ac; float thresh; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) return OPERATOR_PASS_THROUGH; /* get cleaning threshold */ thresh = RNA_float_get(op->ptr, "threshold"); /* clean keyframes */ clean_action_keys(&ac, thresh); /* validate keyframes after editing */ ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; }
static int actkeys_clean_exec(bContext *C, wmOperator *op) { bAnimContext ac; float thresh; bool clean_chan; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { BKE_report(op->reports, RPT_ERROR, "Not implemented"); return OPERATOR_PASS_THROUGH; } /* get cleaning threshold */ thresh = RNA_float_get(op->ptr, "threshold"); clean_chan = RNA_boolean_get(op->ptr, "channels"); /* clean keyframes */ clean_action_keys(&ac, thresh, clean_chan); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; }