TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_curve_types.h File Reference
#include <gui_core/gui_base_types.h>
#include <gui_core/gui_id.h>
#include <gui_core/input/gui_gesture.h>
#include <gui_controls/gui_widget_state_types.h>
#include <gui_controls/gui_view_ref.h>
#include <cstdint>
#include <functional>
#include <span>
#include <string>
#include <unordered_set>
#include <vector>

Go to the source code of this file.

Classes

struct  tachyon::CurveKey
 A key: a time where the curve has a value, its slopes on either side, and how the curve runs on to the next key. More...
struct  tachyon::Curve
 A curve: keys in time order, joined by segments as each key's interpolation says: a cubic (Hermite) one taking the keys' slopes, as an animation curve does, a straight line or a step. More...
struct  tachyon::CurveChannel
 One of a CurveView's curves, such as the red one of a color's. More...
struct  tachyon::CurveRange
 The span a CurveField shows, from timeMin to timeMax and valueMin to valueMax. More...
struct  tachyon::CurvePreset
 A named curve the editor offers to start from, as a thumbnail under the plot. More...
struct  tachyon::CurveEdit
 A change to a CurveView, for undo: what each changed channel's curve was before and after. More...
struct  tachyon::CurveEdit::Change
struct  tachyon::CurveData
 A CurveField's curves, kept by the app from frame to frame. More...
struct  tachyon::CurveViewState
 How one CurveField or CurveEditor shows a CurveData: the channel worked on, the selection, the part in view, and what the user is doing in it. More...
struct  tachyon::CurveViewState::HoverTarget
 What's under the pointer, for its hover look: a key, else a handle, else a curve. More...
struct  tachyon::CurveView
 Curves shown in one place: the curves and the one view of them together. More...

Namespaces

namespace  tachyon

Typedefs

using tachyon::CurveViewRef = BasicViewRef<CurveData, CurveViewState>
 Curves and one view of them, as CurveField, CurveEditor and the helpers take them.
using tachyon::ConstCurveViewRef = BasicViewRef<const CurveData, const CurveViewState>

Enumerations

enum class  tachyon::CurveTangentMode : uint8_t { tachyon::CurveTangentMode::Auto , tachyon::CurveTangentMode::Aligned , tachyon::CurveTangentMode::Free , tachyon::CurveTangentMode::Flat }
 How a key's slopes are set: worked out from its neighbors, or by the user. More...
enum class  tachyon::CurveInterpolation : uint8_t { tachyon::CurveInterpolation::Bezier , tachyon::CurveInterpolation::Linear , tachyon::CurveInterpolation::Constant }
 How a curve runs from a key to the next. More...
enum class  tachyon::CurveWrapMode : uint8_t { tachyon::CurveWrapMode::Clamp , tachyon::CurveWrapMode::Loop , tachyon::CurveWrapMode::PingPong }
 What a curve does before its first key or after its last. More...
enum class  tachyon::CurveChannelColor : uint8_t {
  tachyon::CurveChannelColor::Value , tachyon::CurveChannelColor::Red , tachyon::CurveChannelColor::Green , tachyon::CurveChannelColor::Blue ,
  tachyon::CurveChannelColor::Alpha
}
 The color a channel is drawn in. More...

Functions

float tachyon::EvaluateCurve (const Curve &curve, float time)
 The curve's value at time; 0 without keys.
void tachyon::UpdateCurveTangents (Curve &curve)
 Works out the slopes their mode sets: Auto from the neighbors, Flat level, Aligned the leaving slope on both sides.
Curve tachyon::MakeCurve (std::span< const float2 > points, CurveTangentMode mode=CurveTangentMode::Auto, CurveInterpolation interpolation=CurveInterpolation::Bezier)
 A curve, with its keys' tangents worked out: one key at each points (time, value).
std::span< const CurvePreset > tachyon::DefaultCurvePresets ()
 The built-in presets: constant, linear, ease in, ease out, ease in and out, and their mirror images.
void tachyon::ApplyCurveEdit (CurveData &data, const CurveEdit &edit, bool undo=false)
 Does (or with undo, undoes) edit on the curves, and raises their revision.
void tachyon::CommitCurveEdit (CurveViewRef view, const CurveEdit &edit)
 Applies edit, lets go of what it took from the view's selection, and hands it to view.data.onEdit; does nothing for an empty one.
void tachyon::ReleaseCurveEditIDs (IDManager &ids, const CurveEdit &edit, bool undone)
 Releases the static IDs of the keys only the side of edit not in effect holds: done, what its undo would bring back; undone, what its redo would add.
bool tachyon::PruneCurveSelection (CurveViewRef view)
 After an edit (through this view or another): lets go of the selected keys that are gone, and of what the view kept of them.
CurveEdit tachyon::AddCurveKeyEdit (const CurveData &data, int channel, float time, float value, ID keyID)
 A key on channel at time with value, kept in the curves' range; none on a hidden channel, or where the channel has a key at that time already.
float tachyon::SnapToFrame (const CurveData &data, float time)
 With fps set, time on the nearest frame; as it is without.
CurveEdit tachyon::DeleteSelectedCurveKeysEdit (ConstCurveViewRef view)
 The view's selected keys gone, from every channel.
CurveEdit tachyon::SetCurveTangentModeEdit (ConstCurveViewRef view, CurveTangentMode mode)
 The selected keys' tangent mode set; to Free or Aligned, each side keeps its slope.
CurveEdit tachyon::SetCurveInterpolationEdit (ConstCurveViewRef view, CurveInterpolation interpolation)
 The selected keys' interpolation to the next key set.
CurveEdit tachyon::ApplyCurvePresetEdit (const CurveData &data, int channel, const CurvePreset &preset, const std::function< ID()> &makeID)
 channel's curve made preset stretched over the curves' range, with new key IDs from makeID.
CurveEdit tachyon::SetCurveWrapEdit (const CurveData &data, int channel, CurveWrapMode pre, CurveWrapMode post)
 A channel's wrap modes set.