Refactor: Anim, use blender::listbase_to_vector
Add a `const` version of `blender::listbase_to_vector`, and use it in `animrig::fcurves_for_action_slot()`. No functional changes.
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include "ANIM_action.hh"
|
||||
#include "ANIM_action_legacy.hh"
|
||||
|
||||
#include "BLI_listbase_wrapper.hh"
|
||||
|
||||
#include "BKE_fcurve.hh"
|
||||
|
||||
namespace blender::animrig::legacy {
|
||||
@@ -140,11 +142,7 @@ static Vector<FCurveType *> fcurves_for_action_slot_templated(ActionType &action
|
||||
/* Legacy Action. */
|
||||
if (action.is_action_legacy()) {
|
||||
#endif /* WITH_ANIM_BAKLAVA */
|
||||
Vector<FCurveType *> legacy_fcurves;
|
||||
LISTBASE_FOREACH (FCurveType *, fcurve, &action.curves) {
|
||||
legacy_fcurves.append(fcurve);
|
||||
}
|
||||
return legacy_fcurves;
|
||||
return listbase_to_vector<FCurveType>(action.curves);
|
||||
#ifdef WITH_ANIM_BAKLAVA
|
||||
}
|
||||
|
||||
|
||||
@@ -112,4 +112,17 @@ template<typename T> Vector<T *> listbase_to_vector(ListBase &list)
|
||||
return vector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a ListBase to a Vector.
|
||||
*/
|
||||
template<typename T> Vector<T *> listbase_to_vector(const ListBase &list)
|
||||
{
|
||||
Vector<T *> vector;
|
||||
|
||||
for (T *item : ConstListBaseWrapper<T>(list)) {
|
||||
vector.append(item);
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
} /* namespace blender */
|
||||
|
||||
Reference in New Issue
Block a user