Browse Source

Animation,Trade: add various TODOs.

The relatively older APIs don't have the usability as good as the recent
MeshData/MaterialData/SkinData. Gotta fix that.
pull/580/head
Vladimír Vondruš 4 years ago
parent
commit
983a99d540
  1. 14
      src/Magnum/Animation/Track.h
  2. 2
      src/Magnum/Trade/AbstractImporter.cpp
  3. 3
      src/Magnum/Trade/AnimationData.h
  4. 1
      src/Magnum/Trade/LightData.h
  5. 2
      src/Magnum/Trade/SkinData.h

14
src/Magnum/Animation/Track.h

@ -549,6 +549,8 @@ template<class K, class V, class R
* and to @cpp const std::pair<K_, V_> @ce (where @p K_ / @p V_ are
* with @cpp const @ce removed) when they are @cpp const @ce.
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
typedef typename std::conditional<std::is_const<K>::value, const std::pair<typename std::remove_const<K>::type, typename std::remove_const<V>::type>, std::pair<K, V>>::type KeyValueType;
/** @brief Animation result type */
@ -599,12 +601,16 @@ template<class K, class V, class R
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView1D<K>&, const Containers::StridedArrayView1D<V>&, Interpolator, Extrapolation, Extrapolation).
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
/*implicit*/ TrackView(Containers::ArrayView<KeyValueType> data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView1D<K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<KeyValueType>, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
explicit TrackView(Containers::ArrayView<KeyValueType> data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{data, interpolator, extrapolation, extrapolation} {}
/**
@ -641,12 +647,16 @@ template<class K, class V, class R
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView1D<K>&, const Containers::StridedArrayView1D<V>&, Interpolator, Extrapolation, Extrapolation).
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
/*implicit*/ TrackView(Containers::ArrayView<KeyValueType> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{Containers::StridedArrayView1D<K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<KeyValueType>, Interpolation, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
/*implicit*/ TrackView(Containers::ArrayView<KeyValueType> data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{data, interpolation, interpolator, extrapolation, extrapolation} {}
/**
@ -681,12 +691,16 @@ template<class K, class V, class R
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView1D<K>&, const Containers::StridedArrayView1D<V>&, Interpolator, Extrapolation, Extrapolation).
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
/*implicit*/ TrackView(Containers::ArrayView<KeyValueType> data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView1D<K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<KeyValueType>, Interpolation, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/** @todo drop this, supplying strided array views is the usual
workflow at this point */
/*implicit*/ TrackView(Containers::ArrayView<KeyValueType> data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{data, interpolation, extrapolation, extrapolation} {}
/** @brief Convert a mutable view to a const one */

2
src/Magnum/Trade/AbstractImporter.cpp

@ -429,6 +429,8 @@ Containers::Optional<AnimationData> AbstractImporter::animation(const UnsignedIn
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::animation(): no file opened", {});
CORRADE_ASSERT(id < doAnimationCount(), "Trade::AbstractImporter::animation(): index" << id << "out of range for" << doAnimationCount() << "entries", {});
Containers::Optional<AnimationData> animation = doAnimation(id);
/** @todo maybe this should also disallow custom interpolators? since thise
would be dangling on plugin unload */
CORRADE_ASSERT(!animation ||
((!animation->_data.deleter() || animation->_data.deleter() == static_cast<void(*)(char*, std::size_t)>(Implementation::nonOwnedArrayDeleter) || animation->_data.deleter() == ArrayAllocator<char>::deleter) &&
(!animation->_tracks.deleter() || animation->_tracks.deleter() == static_cast<void(*)(AnimationTrackData*, std::size_t)>(Implementation::nonOwnedArrayDeleter))),

3
src/Magnum/Trade/AnimationData.h

@ -280,6 +280,9 @@ class AnimationTrackData {
* @param target Track target
* @param view Type-erased @ref Animation::TrackView instance
*/
/** @todo stop taking TrackViewStorage and instead directly take the
key/value views, interpolator/interpolation and extrapolation --
it's just 6 overloads and makes usage much better */
explicit AnimationTrackData(AnimationTrackType type, AnimationTrackType resultType, AnimationTrackTargetType targetType, UnsignedLong target, Animation::TrackViewStorage<const Float> view) noexcept: _type{type}, _resultType{resultType}, _targetType{targetType}, _target{target}, _view{view} {}
/** @overload

1
src/Magnum/Trade/LightData.h

@ -121,6 +121,7 @@ class MAGNUM_TRADE_EXPORT LightData {
* @brief Light type
*
* @see @ref type()
* @todo move this to LightType outside of the class for consistency
*/
enum class Type: UnsignedByte {
/* Zero reserved for an invalid value */

2
src/Magnum/Trade/SkinData.h

@ -90,6 +90,8 @@ template<UnsignedInt dimensions> class SkinData {
/** @brief Move assignment */
SkinData<dimensions>& operator=(SkinData<dimensions>&& other) noexcept;
/** @todo expose DataFlags (so users can know if the data are externally owned, at least) */
/**
* @brief Joint IDs
*

Loading…
Cancel
Save