Files
test/source/blender/editors/space_graph/graph_query.cc
Christoph Lendenfeld 145af8d45b Refactor: Add function to query editable Graph Editor curves
No functional changes intended.

This patch extracts functionality to get all `bAnimListElem`
that are editable in the Graph Editor
into a separate function so it can be re-used by other operators.
This makes it easy to ensure the same data is retrieved and
filter flags can't go out of sync.

Extracted from #135913
Part of: #135794

Pull Request: https://projects.blender.org/blender/blender/pulls/137142
2025-04-22 10:28:39 +02:00

25 lines
716 B
C++

/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_listbase.h"
#include "ED_anim_api.hh"
#include "ED_space_graph.hh"
namespace blender::ed::graph {
ListBase get_editable_fcurves(bAnimContext &ac)
{
ListBase anim_data = {nullptr, nullptr};
eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE |
ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, eAnimCont_Types(ac.datatype));
return anim_data;
}
} // namespace blender::ed::graph